1

I make the program for STM8L151G6 on IAR Embedded Workbench for STM8 (version 3.11.1) I need to place the instruction JPF 0xf000 at 0x008426 address. I do this. In C code:

__root static const uint8_t jpfat0x8426 [] @ "ENTRY_POINT" = {0xac, 0x00, 0xf0, 0x00}; // jpf 0xf000

In .icf file:

define region EntryPoint = [from 0x8426 to 0x842A];

define region VectorsRegion = [from 0x8000 size 0x80];

define region NearFuncCode = [from 0x8080 to 0xEF7F] - EntryPoint;

define region FarFuncCode = [from 0x8080 to 0xEF7F] - EntryPoint;

define region HugeFuncCode = [from 0x8080 to 0xEF7F] - EntryPoint;

place at start of EntryPoint    { ro section ENTRY_POINT };
place in EntryPoint             { };

Linker builds the code in next way:

...
"A2":                                     0x80
  INTVEC                      0x008000    0x80  <Block>
    .intvec          const    0x008000    0x80  interrupt.o [4]
                            - 0x008080    0x80

"A3":                                      0x4
  ENTRY_POINT        const    0x008426     0x4  project51.o [1]
                            - 0x00842a     0x4

"P3-P5":                                0x20cb
  .near_func.text    ro code  0x00842b   0x3a6  float.o [4]
  .near_func.text    ro code  0x0087d1   0x2a1  data_exchange.o [1]
  .near_func.text    ro code  0x008a72   0x1fa  fuel_gauge.o [1]
...

It is right. But the range [from 0x008080 to 0x00842b] is empty, so code is not compact. I loose close 1K bytes, it is too many for stm8 MCU. For example object float.o (size 0x3a6) can be placed to this range, but linker doesn't do this. Is there some way to tell the linker to do denser code and fill empty chunks of sections with objects. Thank you.

Ivan167
  • 11
  • 2

0 Answers0