platformio / platform-ststm8

ST STM8: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/ststm8
Apache License 2.0
40 stars 26 forks source link

Add CONST area to the program size estimation #54

Closed fabalthazar closed 2 years ago

fabalthazar commented 2 years ago

As can be seen in the following memory map example, the CONST area is also part of the flash program memory. It contains read-only data. In many cases, its size is non negligible. In my example below, the error is 1775 bytes / 32768 (5.4%). The CONST area is mentionned in the SDCC manual.

Area                                    Addr        Size        Decimal Bytes (Attributes)
--------------------------------        ----        ----        ------- ----- ------------
GSFINAL                             000080CB    00000003 =           3. bytes (REL,CON)

      Value  Global                              Global Defined In Module
      -----  --------------------------------   ------------------------
ASxxxx Linker V03.00 + NoICE + sdld,  page 19.
Hexadecimal  [32-Bits]

Area                                    Addr        Size        Decimal Bytes (Attributes)
--------------------------------        ----        ----        ------- ----- ------------
CONST                               000080CE    000006EF =        1775. bytes (REL,CON)

      Value  Global                              Global Defined In Module
      -----  --------------------------------   ------------------------
     000080CE  _long_bit                          common
     0000812E  _CRC16_tablo                       common
     0000822E  _CRC16_tabhi                       common
     0000832E  _seuil_adc_ctn                     ctn_param
     0000833E  _alpha_ctn                         ctn_param
     00008350  _beta_ctn                          ctn_param
     0000853F  _default_prog_P                    prog
     00008656  _param_variables                   variables

ASxxxx Linker V03.00 + NoICE + sdld,  page 20.
Hexadecimal  [32-Bits]

Area                                    Addr        Size        Decimal Bytes (Attributes)
--------------------------------        ----        ----        ------- ----- ------------
INITIALIZER                         000087BD    00000027 =          39. bytes (REL,CON)
ivankravets commented 2 years ago

Thanks for the PR!