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.

C2000 (v6.2.11): macro not expanding properly

Guru 20075 points

Hello,

The macros below 

The macro shown below is not working properly.  For example, if I place PLACE_CODE_IN_SECTION(main,TestCodeSection)in the code, CCS shows that it is expanding to Pragma("CODE_SECTION(\"SectionName\")").  

My code uses this macro to place a quite a few functions in the section named TestCode Section.  However, the compiler only issued the following warning for one of the function: creating output section "SectionName" without a SECTIONS  Also, the linker decided "SectionName" should start at 0x00004000, which is the starting location of another memory range named ZONE0.

Why isn't the macro expanding properly?

Thanks,

Stephen

#define EMIT_PRAGMA(x)  _Pragma(#x)

#ifdef __cplusplus
#define PLACE_CODE_IN_SECTION(function,SectionName) \
EMIT_PRAGMA(CODE_SECTION("SectionName"))
#else
#define PLACE_CODE_IN_SECTION(function,SectionName) \
EMIT_PRAGMA(CODE_SECTION(function ,SectionName))
#endif