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 Uninitialized Space
symbol .usect "section name", size in bytes[, alignment[, bank offset] ]
The .usect directive reserves space for variables in an uninitialized, named section. This directive is similar to the .bss directive (see .bss 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.
Initialized sections directives (.text, .data, and .sect) tell the assembler to pause assembling into the current section and begin assembling into another section. A .usect or .bss directive encountered in the current section is simply assembled, and assembly continues in the current section.
Variables that can be located contiguously in memory can be defined in the same specified section; to do so, repeat the .usect directive with the same section name and the subsequent symbol (variable name).
For more information about sections, see Chapter 12.
This example uses the .usect directive to define two uninitialized, named sections, var1 and var2. The symbol ptr points to the first byte reserved in the var1 section. The symbol array points to the first byte in a block of 100 bytes reserved in var1, and dflag points to the first byte in a block of 50 bytes in var1. The symbol vec points to the first byte reserved in the var2 section.
Figure 5-8 shows how this example reserves space in two uninitialized sections, var1 and var2.
1 ******************************************************
2 ** Assemble into the .text section. **
3 ******************************************************
4 00000000 .text
5 00000000 E3A01003 MOV R1, #03h
6
7 ******************************************************
8 ** Reserve 1 byte in the var1 section. **
9 ******************************************************
10 00000000 ptr .usect "var1", 1
11
12 ******************************************************
13 ** Reserve 100 bytes in the var1 section. **
14 ******************************************************
15 00000001 array .usect "var1", 100
16
17 00000004 E281001F ADD R0, R1, #037 ; Still in .text
18
19 ******************************************************
20 ** Reserve 50 bytes in the var1 section. **
21 ******************************************************
22 00000065 dflag .usect "var1", 50
23
24 00000008 E2812064 ADD R2, R1, #dflag - array ; Still in .text
25
26 ******************************************************
27 ** Reserve 100 bytes in the var2 section. **
28 ******************************************************
29 00000000 vec .usect "var2", 100
30
31 0000000c E0824000 ADD R4, R2, R0 ; Still in .text
32 ******************************************************
33 ** Declare a .usect symbol to be external. **
34 ******************************************************
35 .global array