Programming STM32L4 MCU's internal flash memory with sensor coefficients while keeping the firmware memory section intact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-14 7:03 PM
Hello,
This is the first time I am using the STM32 MCU.
I would like to know how can I re-flash a certain section of the internal flash memory (eg 1000h ~ 1200h) with NEW sensor coefficients while keeping the already flashed MCU firmware intact.
Can I use STVP-STM32 software to accomplish this? If yes, any tutorial documentation or code example for this?
Any other software (with GUI) recommendation to accomplish this request?
Many thanks in advance!
Best Regards,
Darren
- Labels:
-
Flash
-
STM32L4 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-14 7:11 PM
Don't put this stuff in the midst of your firmware.
Shrink the size of the memory presented to the linker (via linker script, scatter file, GUI, etc), by 4KB or whatever amount of space your data consumes.
The put your data into page(s) at the END of the flash space, ie 0x0801F000
Access the data via a pointer, to an array or structure depending on the nature of the data.
Recognize when this data is blank so you can substitute defaults.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-14 8:29 PM
Thank you for the response!
And yes, these data (coefficients) will be in a separate memory area.
For example, the firmware memory will be located in 0x00000000 ~ 0x00100000 (fixed)
Then the data (coefficient) will be located in 0x0800 0100 ~ 0x0800 0200 (just as you suggested)
Occasionally, due to sensor replacement or other factors, we might need to replace these coefficient data.
So, I need a way to re-flash this memory area ( 0x0800 0100 ~ 0x0800 0200 only) without re-flashing the whole Flash memory area which would eventually replace the whole firmware.
Thank you!
Best Regards,
Darren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-15 12:58 AM
Watch out. I don't know which stm32l4 you're using but on stm32l4x5 and stm32l4x6, memory from 0x00000000 to 0x000fffff might simply be an alias of the internal FLASH starting at 0x08000000.
It depends on your Boot/remap settings if you have external FLASH either connected over FSMC or QuadSPI.
And if your system does have external FLASH, it begs the question why not also have external EEPROM to store the coefficients?
Hope this helps,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-16 3:40 AM
That is not a "might be", but "it is".
Every reference manual has a memory map, where it's shown and written clearly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-16 3:48 AM
It "might be", as it might be also RAM or the "ROM" ;)
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-16 4:47 AM
True, but for me it seems that OP is misunderstanding that area as another memory. Therefore in that context - "it is" only an alias, not a real memory. :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-25 2:06 AM
Hello All,
Sorry for the late reply.
Yup. You guys are right... that area of memory is an alias of the internal flash memory.
For my case, I had not decided on the exact memory location to store the data yet. The information given above by me is just an assumption.
My main concern here is not really "where" to store the data, but "how" to reprogram/re-flash only a certain sector of internal flash memory location (where the data is located).
Can the software St Visual Programmer-STM32 achieve this?
(https://www.st.com/en/development-tools/stvp-stm32.html)
Many thanks again to all!!! :)
Best Regards,
Darren
