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 Reply Children
  • I think it's NOT the case you said.

    for const in keil, seems a lot confusing. let me explain more.

    by Keil manual, if variables are declared by "const", they would be assigned to xdata.

    Besides, "const" also exists in memory class, shown as below. here "const", the same as "code", also put in ROM.

    Program Size: data=143.1 xdata=3694 const=26 code=61164

    My question is how Lx51 decide to put variables declared with "code" in const or code memory class? thanks

  • By keil manual again, if variables declared with code, then they would be assigned to code memory class.

    But I found, under some conditions, those code variables are put in const memory class instead of code class, though they both are put in ROM. who can help explain deeds of lx51? thanks