SLAU131V October 2004 – February 2020
Uninitialized sections reserve space in MSP430 memory; they are usually placed in RAM. These sections have no actual contents in the object file; they simply reserve memory. A program can use this space at run time for creating and storing variables.
Uninitialized data areas are built by using the following assembler directives.
Each time you invoke the .bss or .usect directive, the assembler reserves additional space in the .bss or the user-named section. The syntax is:
.bss symbol,size in bytes[, alignment ] | |
symbol | .usect "section name",size in bytes[, alignment ] |
symbol | points to the first byte reserved by this invocation of the .bss or .usect directive. The symbol corresponds to the name of the variable for which you are reserving space. It can be referenced by any other section and can also be declared as a global symbol (with the .global directive). |
size in bytes | is an absolute expression (see Section 4.9).
|
alignment | is an optional parameter. It specifies the minimum alignment in bytes required by the space allocated. The default value is byte aligned; this option is represented by the value 1. The value must be a power of 2. The maximum alignment is 32K. |
section name | specifies the user-named section in which to reserve space. See Section 2.4.3. |
Initialized section directives (.text, .data, .intvec, and .sect) change which section is considered the current section (see Section 2.4.4). However, the .bss and .usect directives do not change the current section; they simply escape from the current section temporarily. Immediately after a .bss or .usect directive, the assembler resumes assembling into whatever the current section was before the directive. The .bss and .usect directives can appear anywhere in an initialized section without affecting its contents. For an example, see Section 2.4.7.
The .usect directive can also be used to create uninitialized subsections. See Section 2.4.6 for more information on creating subsections.
The .common directive is similar to directives that create uninitialized data sections, except that common symbols are created by the linker instead.