AnsweredAssumed Answered

Problem adding DTCM section to GNU linker script

Question asked by David Harrison on Nov 20, 2017

Hi, I am running a custom microSD Card bootloader on an STM ARM Cortex-M7 STM32F746NG device. The bootloader itself works well. The bootloader occupies the first 32KByte sector starting at 0x08000000 and an area of USER flash for application use occupies the second 32KByte FLASH sector starting at 0x08008000. The main application itself loads at FLASH  SECTOR # 2 (Address 0x08010000).

 

When I use a standard VisualGDB STM32F746NG_flash.lds GNU linker script, attached here, my application correctly generates a valid hex file for it loading at FLASH  SECTOR # 2 (Address 0x08010000).

 

However, I want to identify a section of the DTCM RAM (Data Tightly Coupled Memory) Starting at RAM Address 0x20000000 in order to place particular variables in that DTCM RAM region.

 

I have therefore a modified linker script called STM32F746NG_flash-WITH-DTCMSection.lds, also attached here. But when I build using that linker script it generates an invalid hex file, also attached here, that tries to start putting flash memory at address 0x20000000 starting at the hex record 8413 in the hex file.

 

Therefore the bootloader fails since it traps the invalid FLASH Address and does not proceed any further.

 

Can anyone tell me what is wrong with my STM32F746NG_flash-WITH-DTCMSection.lds linker script that is causing this problem? Have I added the RAM section DTCM1 incorrectly?

 

Thanks.

 

As a workaround, in my boot loader, I simply ignore any addresses such as mentioned here that do not fall within the valid application FLASH range, and move on to the next hex record. But I’d really like to know why those bogus addresses appear in the hex file in the first place.

Outcomes