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

LX51, ?STACK Segment Placement Oddities

I want to fix two variables at the top of IDATA using the _at_ keyword, a 1 byte variable at 0xFD and a 2 byte variable at 0xFE (both variables are in two separate C modules, so two segments are created by C51). With the default linker configuration I got two warnings related to LX51 not being able to allocate the ?STACK segment.

So I investigated and I learnt that LX51 allocates the ?STACK segment after all others, and that it is placed after the last IDATA segment. Consequently with my last IDATA segment ending at 0xFF the ?STACK segment cannot be allocated.

So playing with the LX51 I managed to concoct the following:

SEGMENTS (?STACK (LAST),?ID?CAN_DRIVER?0 (LAST),?ID?CAR_DB?0 (LAST))

Where ?ID?CAN_DRIVER?0 is the 1 byte segment and ?ID?CAR_DB?0 is the 2 byte segment. This works but I get an oddity in the listing file:

000057H   000057H   000001H   BYTE   UNIT     IDATA          ?STACK
000058H   0000FDH   0000A6H   ---    ---      **GAP**
0000FEH   0000FFH   000002H   BYTE   OFFS..   IDATA          ?ID?CAR_DB?0

Notice the ?ID?CAN_DRIVER?0 segment is missing from the MAP file and the **GAP** includes the address 0xFD where the segment should be, but because the symbol table does contain:

000000FDH   SYMBOL    IDATA    BYTE     baudrate_selected

The program does work as expected.

Am I defining the segment layout correctly, and/ or is there a bug with LX51?

Parents Reply Children
No data