Skip to main content
April 9, 2021
Question

Disable external flash programming

  • April 9, 2021
  • 8 replies
  • 2895 views

Hello dear engineers,

How can I instruct the STM32cubeIDE to neglect programming of the exteranl flash parts?

This parts have been placed in an external ram memory which is to be read and programmed in runtime.

In Keil ide, it simply says since no flashing algorithm for the specified parts is available, I will not take these sections into account for programming.

The _flash.ld file has been changed as follows.

/* Memories definition */
MEMORY
{
 CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
 ExtFlashSection (xrw) : ORIGIN = 0xC00F0000, LENGTH = 0x1f10000 
}

Any help would be appreciated.

This topic has been closed for replies.

8 replies

Radosław
Associate II
April 9, 2021

Mark sections located in extflash as noload.

   .section (NOLOAD) :

   {

       .....

   } > ExtFlashSection AT > ExtFlashSection

April 9, 2021

Which file should I add that, to the RAM or the Flash?

And then, I have this post build script, they have conflict

arm-none-eabi-objcopy.exe --dump-section ExtFlashSection=images.bin tester.elf

Radosław
Associate II
April 9, 2021

i answered to your question, but now you need to specify much more, when you wanna have something loaded from flash to ram on start up, then

   .section (NOLOAD) :

   {

       .....

   } > RAM AT > FLASH, and in *.ld but also this requires modify startup file.

April 9, 2021

I sincerly appreciate your help. I have some image code from Touchgfx, I have supposed to load them from sd card to external RAM since the image size is larger than microcontroller built in flash memory. I want to have the data to be in one single file and the order of files has been managed by the IDE. The above post build script export the mentioned data from the specified sectoin. Now I have to tell the programmer (Jlink or stlink) to skip these parts. So they are neither implemented in internal ram nor internal flash.

Radosław
Associate II
April 9, 2021

--set-section-flags for this section, noload flag is what you wanna. in objcopy tool.

but you also can try if dum will work correcly for noload sections.

April 9, 2021

Dear @Rados?aw​ 

Thank you for your participation.

Now I have changed *.ld linker file as follows.

MEMORY
{
 CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
 ExtRAM (xrw) : ORIGIN = 0xC00F0000, LENGTH = 0x1f10000 
 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
}

And next part,

 ExtFlashSection (NOLOAD):
 {
 *(ExtFlashSection ExtFlashSection.*)
 . = ALIGN(0x4); 
 } >ExtRAM AT> ExtRAM

And the post build script as

arm-none-eabi-objcopy.exe --set-section-flags sectionpattern=noload --dump-section ExtFlashSection=images.bin tester.elf

But the massage I get is:

arm-none-eabi-objcopy.exe --set-section-flags sectionpattern=noload --dump-section ExtFlashSection=images.bin tester.elf
arm-none-eabi-objcopy.exe: tester.elf[ExtFlashSection]: can't dump section - it has no contents: file format not recognized

Radosław
Associate II
April 9, 2021

1few options to try:

  1. remove : (NOLOAD) from ld file,
  2. split obj operation first create flash image next set flag
  3. remove set flag but leave (NOLOAD).

I never do this, but maybe you remove some important flag for this sections.

April 9, 2021

@Rados?aw​ There should exist an automated method. Otherwise all these efforts for building compilers and linker script and ... for large embeded systems are useless. I said there is no problem with Keil.

Radosław
Associate II
April 9, 2021

I understand you, but still you want to do something unusual. Did you try this options? Later maybe i will find some time to test this.

About keil a can't say anything, i hate it.

April 9, 2021

@Rados?aw​ It is not unusual, Systems either have QSPI, NAND flash, SDCARD or other storage media for saving large data. Then as image data are really large for embeded systems, I choosed to use NAND flash as my storage. For not making runtime app to be slow, image data are going to be loaded into external ram at startup time. Usual or unusual?

Radosław
Associate II
April 9, 2021

This is usual i agree, but unusual is to creating 2 programing files splited this way that you describe with preserwing degug informations. Or i miss something.

This is tricky, and also for my personal knowlage i will find some solution. Give me some time please. If you can mail to me directly.

Radosław
Associate II
April 9, 2021

Still i can't understand why external flash must be programmed differently... This will be SD card or another removable memory?

April 9, 2021

Image file is copied to SD card directly so no need to be programmed via UC, NAND Flash is programed via UC with the information stored in the SD CARD.

Radosław
Associate II
April 9, 2021

It seems to be much more problematic ;).

messing with section flags is very risky, i get strange effects, Remove this section after creating bin file can be solution, but debuging probably will be difficult.