Download C Cross Compiler User's Guide for CORTEX-M

Transcript
Assembler Directives - section
section
Description
Define a new section
Syntax
<section_name>: section [<attributes>]
Function
The section directive defines a new section, and indicates that the following program is to be assembled into a section named
<section_name>. The section directive cannot be used to redefine an
already existing section. If no name and no attributes are specified to
the section, the default is to defined the section as a text section with its
same attributes. It is possible to associate <attributes> to the new section. An attribute is either the name of an existing section or an attribute
keyword. Attributes may be added if prefixed by a ‘+’ character or not
prefixed, or deleted if prefixed by a ‘-’ character. Several attributes may
be specified separated by commas. Attribute keywords are:
abs
absolute section
bss
bss style section (no data)
hilo
values are stored in descending order of significance
even
enforce even starting address and size
long
enforce 32 bit relocation
Example
CODE:
lab1:
DATA:
lab2:
lab3:
lab4:
section
ds.b
section
ds.b
switch
ds.b
switch
ds.b
© 2012 COSMIC Software
.text
5
.data
6
CODE
7
DATA
8
; section of text
; section of data
Using The Assembler 249