cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 placing data (images) to external NOR Flash

Darski.Piotr
Associate II

Hello,

I'm looking for example about how set linker and which declaration put to sources to enable External NOR Flash for program data and images.

regards

Piotr

9 REPLIES 9
Pavel A.
Evangelist III

For declarations, please see stm32f4xx_hal_nor.h in the ST HAL libraries

( STM32F4xx_HAL_Driver\Inc )

According to this file, NOR memory is located at fixed addresses NOR_MEMORY_ADRESS1-4. So you do not need to tweak any linker settings, just access the data thru a pointer.

-- pa

Darski.Piotr
Associate II

Hi Pavel,

ok, I already did it. I see data from 0x60000000 but I do not know set linker to get this data from 0x60000000 as separate Hex flash.

I have declared section refering to 0x60000000.

Is it enough to run objcopy by elf file with name of this section?

regards,

Piotr

Look at the dozens of examples under the cube trees for the "applications" and "demos", where data is pushed into QSPI

The linker scripts are used to describe the memory areas to be used, by section name and object. And the code can use #pragma or attribute to direct specific data / functions into those sections.

Review the documentation for the tools you've selected.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Darski.Piotr
Associate II

Ok, I got it.

Do you know how set linker to get separate hex file?

regards,

PD

Pavel A.
Evangelist III

No manipulations with linker or pragmas are needed. Try something simple as this:

struct my_data { ..... } *ptr = (struct my_data*)0x60000000;

Do you need to program the data in runtime, or one-time during production?

--pa

Darski.Piotr
Associate II

I need to program images as a separated hex once during production.

PD

Keil's FromELF tool can create multiple .HEX files in a directory where the regions in the AXF/ELF are sparse.

Other tools may require options and multiple invocations to achieve the same.

.HEX files are ASCII, and not exactly difficult to edit or manipulate mechanically. Basic C STDIO function level competence should suffice.

Look perhaps at tools like SRecord.

I posted an ELFARM tool I created many years ago, the forum transitions seem to have make a bit of a dog's breakfast of the threads.

https://community.st.com/s/question/0D50X00009XkZn1SAF/converting-axf-to-hax-to-flash-on-to-stm3240geval-board

https://community.st.com/s/question/0D50X00009XkbK6SAJ/exporting-flash-files-from-atollic

I can create something custom, pitch me a reasonable offer. The stuff I code commercially tends to package and checksum/crc

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Darski.Piotr
Associate II

Ok, thank you. I see that I can use objcopy with parameters.

regards,

PD

Darski.Piotr
Associate II

I put this modification to make file:

post-build:

   -@echo 'Generating binary and Printing size information:'

   arm-none-eabi-objcopy -O binary "STM32469I_EVAL.elf" "STM32469I_EVAL.bin"

   arm-none-eabi-size "STM32469I_EVAL.elf"

   arm-none-eabi-objcopy -O binary --only-section=ExternalFlash "STM32469I_EVAL.elf" "ext_flash.bin"

   -@echo ' '

and I have additional ext_flash.bin file but it is empty file.

Here I have declaratyion w main.c:

#define EXT_MEM __attribute__((section(".ExternalFlash")))

const EXT_MEM __IO uint16_t EXTFLASH_strinfo[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};

and w LD:

/* Specify the memory areas */

MEMORY

{

FLASH (rx)     : ORIGIN = 0x8000000, LENGTH = 2048K

RAM (xrw)     : ORIGIN = 0x20000000, LENGTH = 320K

CCMRAM (rw)     : ORIGIN = 0x10000000, LENGTH = 64K

EXT_FLASH (rx) : ORIGIN = 0x60000000, LENGTH = 16M

}

 _ExternalFlash_init_base = LOADADDR(.ExternalFlash);

 _ExternalFlash_init_length = SIZEOF(.ExternalFlash);

   .ExternalFlash :

   {

   . = ALIGN(4);

   _ExternalFlash_start = .;        /*create a global symbol at NOR Flash start*/

   *(.ExternalFlash)

   *(.ExternalFlash*)

   . = ALIGN(4);   

   _ExternalFlash_end = .;          /*define a global symbol at end of NOR Flash*/

   *(.gnu.linkonce.r.*)

   } >EXT_FLASH   

I can get data from 0x60000000 from program but I cannot put const table to external bin file.

br

Piotr