79318709

Date: 2024-12-30 22:00:36
Score: 3
Natty:
Report link

(1) Modify the linker script 'STM32G030C8Tx_FLASH.ld' and add the EE emulation area

    MEMORY
    {
    RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 8K
    FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 62K
    EMULATED_EEPROM    (xrw)   : ORIGIN = 0x0800F800,   LENGTH = 2K
    }

    /* Define output sections */
    SECTIONS
    {
        /* The startup code into "FLASH" Rom type memory */
      .ourData :
      {
        . = ALIGN(4);
        *(.ourData)
        . = ALIGN(4);
      } >EMULATED_EEPROM
.
.
.

(2) Change linker script name (to e.g. STM32G030C8Tx_EE_FLASH.ld) for MXCube not to erase it when updating code
(3) Modify linker script path in 'CMakeLists.txt' like this

# Set linker script
set(linker_script_SRC   ${PROJ_PATH}/STM32G030C8Tx_EE_FLASH.ld)
set(EXECUTABLE          ${CMAKE_PROJECT_NAME})

I've been reading out the memory areas and it seems to work fine.
If there is anything wrong or to improve, please give some feedback.

Reasons:
  • RegEx Blacklisted phrase (2.5): please give some
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: BEsmart