SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
Reserve Space in the .bss Section
.bss symbol, size in bytes[, alignment]
The .bss directive reserves space for variables in the .bss section. This directive is usually used to allocate space in RAM.
This directive is similar to the .usect directive (see .usect topic); both simply reserve space for data and that space has no contents. However, .usect defines additional sections that can be placed anywhere in memory, independently of the .bss section.
For more information about sections, see Chapter 12.
In this example, the .bss directive allocates space for two variables, TEMP and ARRAY. The symbol TEMP points to four bytes of uninitialized space (at .bss SPC = 0). The symbol ARRAY points to 100 bytes of uninitialized space (at .bss SPC = 04h). Symbols declared with the .bss directive can be referenced in the same manner as other symbols and can also be declared external.
1 ***********************************************
2 ** Start assembling into the .text section. **
3 ***********************************************
4 00000000 .text
5 00000000 E3A00000 MOV R0, #0
6
7 ***********************************************
8 ** Allocate 4 bytes in .bss for TEMP. **
9 ***********************************************
10 00000000 Var_1: .bss TEMP, 4
11
12 ***********************************************
13 ** Still in .text. **
14 ***********************************************
15 00000004 E2801056 ADD R1, R0, #56h
16 00000008 E0020091 MUL R2, R1, R0
17
18 ***********************************************
19 ** Allocate 100 bytes in .bss for the symbol **
20 ** named ARRAY. **
21 ***********************************************
22 00000004 .bss ARRAY, 100, 4
23
24 ***********************************************
25 ** Assemble more code into .text. **
26 ***********************************************
27 0000000c E1A0F00E MOV PC, LR
28
29 ***********************************************
30 ** Declare external .bss symbols. **
31 ***********************************************
32 .global ARRAY, TEMP
33 .end