cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to store a file in STM32F446's internal flash?

Daniel Almeida
Associate II
Posted on September 16, 2017 at 17:11

Greetings,

I need to upload an audio file containing an ECG signal to my stm32f446 nucleo-64 board, this file will be a .wav file or a simplified version of the .wav file containing interleaved audio samples from two channels. Since the .wav file or the samples file is too large, it is possible to upload it to the internal fash memory, using mbed? Or I need another software tool?

Note: this post was migrated and contained many threaded conversations, some content may be missing.
8 REPLIES 8
Posted on September 16, 2017 at 17:19

Tell the ST-LINK Utilities it is a binary file and write it directly into memory at the address you want to store it.

Too large for what?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 16, 2017 at 18:50

The file is too large to store in RAM. It has about 256 kB.

I don't know how to use the ST-Link utilities, I can do that using mbed? How? 

Sorry, I don't know much about this platform.

Posted on September 17, 2017 at 13:43

you could try converting it to a .h header file and just ♯ include it.  declare it const and let the linker do what linkers do.

Posted on September 19, 2017 at 23:01

I could do that, but I want to be able to change the file or files stored without changing the code.

Posted on September 19, 2017 at 23:17

I could provide a link the the ST-LINK Utilities Manual if that would help. It is a fairly trivial task to load binary data and push it to a specific address within the processors' flash memory space.

mbed allows you to drop a binary, but I don't think it allows you to control the address at which it is placed, and I don't think it takes .HEX files. Review the documentation for your chosen tools.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 19, 2017 at 23:28

Yes I think the ST-Link Utilities Manual link would help.

It's possible to convert a hexadecimal file to binary? If it's not possible, what I can use instead of mbed?

Posted on September 20, 2017 at 00:46

http://www.st.com/content/ccc/resource/technical/document/user_manual/e6/10/d8/80/d6/1d/4a/f2/CD00262073.pdf/files/CD00262073.pdf/jcr:content/translations/en.CD00262073.pdf

 

Your data is already in a binary form.

A .HEX file can be translated with tools like S-Records, or HEX2BIN, or frankly loaded into a programming tool and saved back out in a different format.

If you have an .AXF or .ELF file Keil's FromELF tool can generate .BIN or .HEX files.

In the context of mbed creating a binary file from a .HEX loses the inferred address of the data, and mbed will presumably blow away your application code at 0x08000000, which is not what you want. You want to put your data deeper into flash from where you application can access it. For a 512K device, and 256K of data, perhaps 0x08040000 should be the base for the data.

Don't let 'STM32' specifics limit you understanding here, micro-processors/controllers all have similar construction and compilers, assemblers and linkers have common functionality. Techniques and specifics may vary slightly, but a basic understanding is transferable.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 21, 2017 at 19:46

Thank you very much for your help,

Do you know which library and functions (can you give me an example) can be used to store arrays/variables in STM32 flash memory?