define section directive
Syntax
define [ root ] [ space ] sectionname[ with alignment =sec-align] {section-content-item...};
where each section-content-item can be one of:
udata8 {data|string}; sdata8data[ ,data] ...; udata16data[ ,data] ...; sdata16data[ ,data] ...; udata24data[ ,data] ...; sdata24data[ ,data] ...; udata32data[ ,data] ...; sdata32data[ ,data] ...; udata64data[ ,data] ...; sdata64data[ ,data] ...; spacedata; pad_todata-align; [ public ]label:if-item
where if-item is:
if (condition) {section-content-item... [} else if (condition] {section-content-item... ]... [} else {section-content-item...] }
Parameters
| The name of the section. |
| An expression that specifies a minimum alignment for the section. This can be increased silently by the linker if needed. |
| Optional. If |
| If |
| If the parameter is an expression ( If the parameter is a quoted string, it generates one one-byte member in the section for each character in the string. |
| As The possible range of values is – |
| As |
| As |
| As |
| As |
| As |
| As The possible range of values is – |
| As |
| As |
| Defines |
| Generates pad bytes to make the current offset from the start of the section to be aligned to the expression |
[ | Defines a label at the current offset from the start of the section. If
Generally, the type of a symbol does not matter. |
| Configuration-time selection of items. |
| An expression. |
| An expression that is only evaluated during relocation and only if the value is needed. |
Description
Use the define section directive to create sections with content that is not available from assembler language or C/C++. Examples of this are the results of stack usage analysis, the size of blocks, and arithmetic operations that do not exist as relocations.
Unknown identifiers in data expressions are assumed to be labels.
Note
Only data expressions can use labels, stack usage analysis results, etc. All the other expressions are evaluated immediately when the configuration file is read.
These extra operators are available:
| The stack depth of the deepest call chain for any call graph root function in the category. |
| The sum of the stack depths of the deepest call chains for each call graph root function in the category. |
| The size of the block. |
Example
define section data {
/* The application entry in a 16-bit word, provided it is less
than 256K and 4-byte aligned. */
udata16 __iar_program_start >> 2;
/* The maximum stack usage in the program entry category. */
udata16 maxstack("Application entry");
/* The size of the DATA block */
udata32 size(block DATA);
};
/* This defines the space section ExtraStack with a size of 0x2000 bytes.
The label ExtraStackStart is defined at the start of the section. The
label ExtraStackEnd is defined at the end of the section.
*/
define root space section ExtraStack
{
public ExtraStackStart:
space 0x2000;
public ExtraStackEnd:
};