如何在程序中判断编译类型(RAM或FLASH)?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
在TI的例程中有用FLASH来判断的,代码如下:
// Only used if running from FLASH
// Note that the variable FLASH is defined by the compiler
#ifdef FLASH
// Copy time critical code and Flash setup code to RAM
// The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
// symbols are created by the linker. Refer to the linker files.
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
// Call Flash Initialization to setup flash waitstates
// This function must reside in RAM
InitFlash(); // Call the flash wrapper init function
#endif //(FLASH)
我用这种方式尝试的时候,这部分代码在编译的时候完全被忽略掉了。TI说明FLASH是由编译器定义的,那么编译器在编译时都定义了哪些变量,如何查看?或者说CMD文件中的段名就是编译器编译产生的变量?