Skip to main content
Associate III
September 19, 2024
Question

ST Cube Ide bad ELF programming from debugger.

  • September 19, 2024
  • 1 reply
  • 632 views

Good morning,

we have a problem with ELF file loading. We are using an STM32U575 MCU on a Nucleo board.

In particular:

the location 0x0802A61B in the ELF file is set at 0x00 (we see it by open the ELF file with Cube Programmer).

1) If we load the ELF file with Cube Programmer and read the memory again then we see that the location 0x0802A61B is correctly set to 0x00.

2) But: If we load the ELF file with Cube Ide debugger and read the memory again with Cube Programmer then we see that the location 0x0802A61B is set to 0xFF.

Issue is systematic: we found same problem on 3 different NUCLEO boards.

Couly you explain this behaviour?

Thank you in advance

 

    1 reply

    SafeDevAuthor
    Associate III
    September 20, 2024

    We found a solution. We put . = ALIGN(4); in every flash section of the LD script.

    Now we obtain the same flash read both when download ELF image from Cube Ide and when download from CubeProgrammer.

     

     

    .text :
    
    {
    
    . = ALIGN(4);
    
    *(.text) /* .text sections (code) */
    
    *(.text*) /* .text* sections (code) */
    
    *(.glue_7) /* glue arm to thumb code */
    
    *(.glue_7t) /* glue thumb to arm code */
    
    *(.eh_frame)
    
    KEEP (*(.init))
    
    KEEP (*(.fini))
    
    . = ALIGN(4);
    
    _etext = .; /* define a global symbols at end of code */
    
    } >FLASH

     

     

    In the end we cannot understand why the old LD script without . = ALIGN(4) works only with the CUBE Programmer.