This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why variables wtth prefix of code are put in CONST area by Keil

Hi ,

I have one question for keil compiler.

Originally, in the compile result for my project, CONST size is 0 and all of variables with prefix of code are put in CODE area by compiler.

But now, I did some changes in my project and found some of variables with prefix of code are put in CONST area.

Could you pls explain it. thanks a lot.

Parents
  • Actually I changed DEBUG Macro definition as below

    Old:
    #define DBG_LOG1(DBG_LEVEL, DBG_STR_IDX, P0) SiiDbgLogSend(DBG_LEVEL, DBG_STR_IDX, P0)

    New:
    #define DBG_LOG1(DBG_LEVEL, DBG_STR_IDX, STR_FORMAT, P0) SiiDbgLogSend(DBG_LEVEL, DBG_STR_IDX, 1, P0)

    at the beginning, I only changed such in 2 c files and no constant size allocated. but after all of c files(~30) applied, constant size become several hundred bytes.

    so far, I suspect, in keil complier, when hardcode(numbers) size increased to MAX number, the left code data would be allocated to constant area.

    what relation between code and constant in keil? thanks

Reply
  • Actually I changed DEBUG Macro definition as below

    Old:
    #define DBG_LOG1(DBG_LEVEL, DBG_STR_IDX, P0) SiiDbgLogSend(DBG_LEVEL, DBG_STR_IDX, P0)

    New:
    #define DBG_LOG1(DBG_LEVEL, DBG_STR_IDX, STR_FORMAT, P0) SiiDbgLogSend(DBG_LEVEL, DBG_STR_IDX, 1, P0)

    at the beginning, I only changed such in 2 c files and no constant size allocated. but after all of c files(~30) applied, constant size become several hundred bytes.

    so far, I suspect, in keil complier, when hardcode(numbers) size increased to MAX number, the left code data would be allocated to constant area.

    what relation between code and constant in keil? thanks

Children
No data