AnsweredAssumed Answered

Update of Flash lookup table - where to put in linker script

Question asked by Johnlondon on Aug 18, 2014
Latest reply on Aug 19, 2014 by Clive One
I'm editing this as I see that my first post - from an iPad - wasn't accepted as it was from a mobile device.

I'm writing for a STM32F4 device that involves getting information from a number of lookup tables.  These tables are perhaps 1K in total size.  The user will update these occasionally.  The main code will, apart from bug fixes, be seldom updated.  All updates will be via the inbuilt bootloader.  In order not to unnecessarily expose our main code from being downloaded (by providing an update image for the boot loader), we wish to update the lookup tables separately from the main code.

My question is on strategies for where to store the lookup data in flash.

If the data is stored in flash, the section needs to be deleted before the update, and the smallest section is 16K.  It therefore seems very wasteful to put the lookup tables in a separate section as they're only going to be 1K max, and probably very much smaller.

Should I do this, however?  

Or should I just put the data in the .data section along with all other initialised variables and just update all of these when I update the tables?

How do I know the address of the start of the .data section when updating the tables so that I can access this when copying the data from ROM to RAM? 

If I need to align the data on a section page (16K), how do I do this and align the elements on a 4 byte boundary?  Do I do this in the linker script or when defining the variable using the "aligned" attribute?

Sorry for the numpty questions, but this is my first experience of working with linker scripts.