SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By Gorlash
#135761
We are using STR912 on a project here, building with Yagarto package. All has been working well. Now, however, I would like to create a second code segment in our code, which would be relocated to Flash Bank 1 and used for firmware updates. I've seen some hints on how to set up the linker configuration file for a second text segment, but I *don't* see anything which suggests how I would force C functions into that alternate section.

Are there any example projects available which would teach me how to accomplish this?
By exuvo
#136069
I use Code Sourcerys arm-none-eabi-gcc and a LPC1768 and I have this in my linker script :
Code: Select all
MEMORY
{
  rom (rx)  : ORIGIN = 0x00002000, LENGTH = 504K
  ram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
  
  ram1(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K
  ram2(rwx) : ORIGIN = 0x20080000, LENGTH = 16K
} 
and
Code: Select all
.ram1 (NOLOAD):
  {
 	__ram1_start__ = .;
  	*(.ram1)
  	__ram1_end__ = .;
  } >ram1
then in the code i write "__attribute__((section(".ram2"))) uint8_t thingy;" to place a variable in .ram2. This also works on functions.
You can have a look at my eclipse project at svn://exuvo.se/kartobot/Blueboard if you wish to see exactly how it is set up.