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

Total ROM Size in -map file doesn't include last byte of ROM, why?

Hello,

for crc calculation, I'm using the total ROM size out of the .map file.

To check, all code is included, I've added the total ROM size to my start address.

Then I saw, that I only get the address of the first byte of my last word, half word ....

I would expect to get the address of the last byte or the last byte plus some stuffing bytes to get an alignment of 4.

Do you know, why I get the address of the first byte (of my last word/half word....) if I'm adding the total ROM size to my start address?

Best regards,
klaus

Parents Reply Children
  • This is a question of ROM size vs RAM size (or Load region vs Execution region in scatterloading terminology).

    The compressed data is stored in 'ROM', taking up as little space (in Flash in a real device), and the init code (__main, which itself calls __scatterload) copies and decompresses to your (S)RAM, taking its full size there.

    So in your example that region will take up 0x23ddc bytes of "ROM", and 0x24e44 bytes of "RAM".

    Apologies, I should have mentioned data-compression previously.

  • And what about the "total ROM size" at the End of the .map file, why is it different to the compressed size?

  • Hi again Klaus,

    I have been discussing this internally.

    Can you confirm which version of the compiler you are using? I wonder if this is an issue with an older toolchain.

    It would also be good to use "fromelf -z" on the generated executable. What does that report, and does it match the linker output?

    > fromelf -z Blinky.axf
    
    ========================================================================
    
    ** Object/Image Component Sizes
    
          Code (inc. data)   RO Data    RW Data    ZI Data      Debug   Object Name
    
         14712        202       6608         12       3652      87147   Blinky.axf
         14712        202       6608         12          0          0   ROM Totals for Blinky.axf

  • Hello Ronan,

    here are our compiler and linker versions:

    MDK Essential 5.37
    C Compiler: ArmClang.exe V6.18
    Assembler: Armasm.exe V6.18
    Linker/Locator: ArmLink.exe V6.18
    Library Manager: ArmAr.exe V6.18

  • Now I'm totally confused.... 

    here is my map. file output:

    ==============================================================================
    
    
          Code (inc. data)   RO Data    RW Data    ZI Data      Debug   
    
        120140       2874      26472       4496      16316    1308369   Grand Totals
        120140       2874      26472        296      16316    1308369   ELF Image Totals (compressed)
        120140       2874      26472        296          0          0   ROM Totals
        
        ==============================================================================
    
        Total RO  Size (Code + RO Data)               146612 ( 143.18kB)
        Total RW  Size (RW Data + ZI Data)             20812 (  20.32kB)
        Total ROM Size (Code + RO Data + RW Data)     146908 ( 143.46kB)
    
    ==============================================================================

    and fromelf-z tells me:

    ========================================================================
    
    ** Object/Image Component Sizes
    
          Code (inc. data)   RO Data    RW Data    ZI Data      Debug   Object Name
    
        120140       2874      28504       4496      16316    1308369   C:... (uncompressed)
        120140       2874      28504        296      16316    1308369   C:... (compressed)
             0          0       2032          0          0          0   (incl. padding)
        120140       2874      28504        296          0          0   ROM Totals for C:...

    There are the same size for code, rw and zi data, but different size for ro data....

  • Hmm... the difference is the 2032 bytes of padding (26472+2032=28504).

    Is the "ROM Totals" from fromelf correct?

  • Yes, if I add the ROM totals from fromelf (Code + ro data + rw data) I'll get the expected result.

  • Thanks for confirming. I'll flag this up internally.

  • Hello Ronan,

    thank you very much.

    It seems like the output of the fromelf is the same as the compressed size, we've talked about several days ago...