STM32 huge BIN/Hex file

Sysprogs forums Forums VisualGDB STM32 huge BIN/Hex file

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #22503
    Johanan
    Participant

    The Bin and hex files generated are huge , while the code itself is about 600K

    My system has an external 8Mb flush that holds data , but not code, and it is not part of the program.

    There is also an external 8Mb sram.

    The hex file (or bin) file is full with records outside the STM32F4 internal flush memory, and it can’t be used in programmer without manually editing the file and remove the zero records.

    How can I fix this?

    The hex file starting to fill with zeros:

    :10295C00FFFFFF0080808000FFFFFF0FFFFFFF0FD6
    :10296C00FFFFFF0F00000000F1D70408000000007B
    :10297C0079DB040800000000FFFFFFFF350A0508A3
    :10298C00ED080508F10905080D0A0508000100000D
    :08299C001F0D05084B0D050895                  ;; END of code
    :020000044002B8                              ;; Full of megabytes of zeros from here on...
    :1040000000000000000000000000000000000000B0
    :1040100000000000000000000000000000000000A0
    
    Thanks

     

    #22535
    support
    Keymaster

    Hi,

    Please either the sections that go into the external memory with the NOLOAD attribute (so that they will be excluded from the .bin file), or use the AT syntax in the linker script (see how DATA is handled) in order to place them in the regular FLASH memory and move them to the external memory manually.

    Also if you are using the Custom edition, please consider using the Additional Memories page of VisualGDB Project Properties to let VisualGDB do the necessary edits automatically.

    #22555
    Johanan
    Participant

    Indeed using NOLODAD solved the problem.

    it took me some time to figure out how to use it so here is the linker script on external rams, if someone needs it and don’t like to read the linker tutorial…

    <hr />

    MEMORY
    {
    FLASH (RX) : ORIGIN = 0x08040000, LENGTH = 1792K
    SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 192K
    CCMRAM (RWX) : ORIGIN = 0x10000000, LENGTH = 64K
    NVRAM (RWX) : ORIGIN = 0x40024000, LENGTH = 4K
    SDRAM (RW) : ORIGIN = 0xC0000000, LENGTH = 8M
    }

    _estack = 0x20030000;

    SECTIONS
    {
    .sdram (NOLOAD):
    {
    *(SD_ram*);
    *(SD_ram);
    } > SDRAM

    .nvram (NOLOAD) :
    {
    *(NV_ram*);
    *(NV_ram);
    } > NVRAM

    .ccram (NOLOAD) :
    {
    *(CCM_ram);
    } > CCMRAM

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.