#82 Controlling location of CONST area


I’d like to force all constant program data like:

__code Byte TCvrt[15] = {77,23,30,39,52,65,80, 94,103,104, 96,82,62,45,30};

to lower half of the flash. The reason is to allow playing with MCU upper code pages (MOVC access) without worrying about access to this constant data declared in the program.

Currently the linker places it after the CSEG which is way above 0x7FFF. I tried linker option: "-Wl -b CONST = 0x1000" but linker still places it after CSEG. If I force CSEG to start higher example: "-Wl -b CSEG= 0x1800" then it works. But I will always have to check and set it manually in case CONST grows larger, not to mention wasted space.

Anyone know a better way to do this?

Many thanks.


  • Maarten Brock

    Maarten Brock - 2011-11-05

    Sorry for this late response.

    I don't quite understand why CONST should be in the lower part but CSEG would be allowed to grow into the upper pages? Shouldn't they both be in the lower part?

    Have a look at --codeseg, --constseg and bank switching in the manual. It might help.


  • Maarten Brock

    Maarten Brock - 2011-11-05
    • status: open --> pending
  • Maarten Brock

    Maarten Brock - 2013-09-21
    • status: pending --> closed
    • assigned_to: Maarten Brock
    • Group: -->

Log in to post a comment.