STM32F4 linker script for use battery RAM

Sysprogs forums Forums VisualGDB STM32F4 linker script for use battery RAM

This topic contains 1 reply, has 2 voices, and was last updated by  support 11 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #11232


    I am trying to make a linker section for battery RAM. I have modyfied oryginal script added:

    FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 1M
    SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K
    CCMRAM (RWX) : ORIGIN = 0x10000000, LENGTH = 64K
    BKPRAM (RWX) : ORIGIN = 0x40024000, LENGTH = 4K

    and in sections part:

    .backup (NOLOAD) :
    . = ALIGN(4);
    . = ALIGN(4);
    } > BKPRAM

    In main.cpp it looks like that:

    struct config_t
    uint8_t a;
    uint16_t b;
    uint32_t c;

    __attribute__((section(“.backup”))) config_t config;

    and init for battery ram looks like that:

    void initBackupRam(void)

    It does not work, probably I missed something in linker script. I need some adivice what is wrong.

    • This topic was modified 11 months, 1 week ago by  kucza.



    Please try referencing the “config” variable from your code so that the linker does not discard it as unused. Alternatively you can try using the KEEP() statement in the linker script file and attribute__((used)) in your code.

    If it does not help, try enabling the map file generation via Linker Settings and check the map file to see where exactly the linker placed your variable.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.