|
发表于 2016-8-27 13:51:21
|
显示全部楼层
__root
The __root attribute can be used on either a function or a variable to ensure that, when the module containing the function or variable is linked, the function or variable is also included, whether or not it is referenced by the rest of the program.
By default only the part of the runtime library calling main and any interrupt vectors are root. All other functions and variables are included in the linked output only if they are referenced by the rest of the program.
The __root keyword is placed in front of the type, for example to place settings in non-volatile memory:
__root int settings[10];
The #pragma object_attribute directive can also be used. The following declaration is equivalent to the previous one:
#pragma object_attribute=__root
int settings[10];
Note: The __root keyword cannot be used in typedefs.
__root 关键字保证没有使用的函数或者变量也能够包含在目标代码中.
定义存放在__flash 空间的数据在程序编译时会自动生成代码嵌入到flash代码中,
对于程序没有使用也要求编译的数据(比如可以在代码中嵌入你的版本号,时间等)必须加关键字__root 限制。
Syntax --keep symbol
Parameters
symbol The name of the symbol to be treated as a root symbol
Description
Normally, the linker keeps a symbol only if it is needed by your application. Use this option to make a symbol always be included in the final application.
Project>Options>Linker>Input>Keep symbols
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|