Interacting with the linker scripts in the STM32F4 BSP

Mr. Andrei Chichak groups at chichak.ca
Mon Jul 14 22:53:03 UTC 2014


I have a block of parameters that I want to place in FLASH memory at a known location, say the last block of FLASH so that I can read and write it later. (these processors don’t have EEPROM but you can use a page of FLASH as an adequate replacement for internal configuration parameter storage at the cost of halting the bus until the writes complete)

It needs to be on a page boundary, because the FLASH is erased in 2K pages. 

Since gcc doesn’t allow syntax like:

static volatile const PARAM_T fu @ 0x000FF800;
static volatile const PARAM_T fu __attribute__((at(0x000FF800)))
or
static volatile const PARAM_T fu __at__ 0x000FF800

I have to use the linker script to push the structure to the target location. The STM32F4 BSP has a set of scripts but there is a lot of existing thought that I don’t want to violate.


Is it possible to add a project specific linker script so that I can place a struct at a particular FLASH location without triggering the  .unexpected_sections portion of linkcmds.base? I’ve tried a few things, but the trick escapes me.

Thanks,
Andrei



Typical lame attempt:



typedef struct {
		uint8_t filler[2048];
} PARAM_PAGE_T;

static volatile PARAM_PAGE_T flashParamsPage __attribute__((section(".params"))) ;



MEMORY {
	PARAM_INT : ORIGIN = 0x000FF800, LENGTH = 2k
}

SECTIONS {
	.params : {
		*(.params)
	} > PARAM_INT
}






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20140714/d1982bab/attachment.html>


More information about the users mailing list