Project Options->Linker->Input->Raw binary image
选择文件,填变量名,段名,对齐,如 symbol_0, .text, 4
还要在Keep symbols中填上对应的变量名
symbol_0
然后就可以在 源文件 中使用此变量
extern unsigned int symbol_0;
extern unsigned char symbol_0[128];
如果需要包含多个文件, 需要使用命令行实现
其中filename_0.bin也可以用相对地址来指定:$PROJ_DIR$\filename_0.bin
在 extra options 中也可以将函数名重定向,如将系统的malloc重定向到操作系统的malloc中就可以这样做:
--redirect malloc=pvPortMalloc
--redirect calloc=pvPortCalloc
--redirect realloc=pvPortRealloc
--redirect free=vPortFree
这样在程序中调用malloc就相当于调用pvPortMalloc