Creating a segment for IAP data storage

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating a segment for IAP data storage

573 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Kartman on Fri Apr 08 05:46:11 MST 2011
I'm sorry if this has been asked many times before. I did try to do a search and came across the CodeRed faqs on modifying linker scripts and various issues regarding IAP problems.

I got this far:

In my C code:

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#define
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]FLASHFILE [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]__attribute__[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ((section([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]".[U]Flashfile[/U]"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])))[/SIZE]

[LEFT][SIZE=2]FLASHFILE [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]unsigned[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] temp[256];[/SIZE][/LEFT]

[LEFT][SIZE=2]In the _mem.ld script[/SIZE]
[SIZE=2]/*[/SIZE]
[SIZE=2]* GENERATED FILE - DO NOT EDIT[/SIZE]
[SIZE=2]* (C) Code Red Technologies Ltd, 2008-9[/SIZE]
[SIZE=2]* Generated linker script include file for [/SIZE]
[SIZE=2]* (created from LinkMemoryTemplate (LPCXpresso v3.6.2 [Build 279] [29/01/2011] ) on Fri Apr 08 21:56:18 EST 2011)[/SIZE]
[SIZE=2]*/[/SIZE][/LEFT]

[LEFT][SIZE=2]MEMORY[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]/* Define each memory region */[/SIZE]
[SIZE=2]MFlash128 (rx) : ORIGIN = 0x0, LENGTH = 0x1f000 /* 128k - 4k */[/SIZE]
[SIZE=2]Flashfile (rx) : ORIGIN = 0x1f000, LENGTH = 0x1000 /* 4k */[/SIZE]
[SIZE=2]RamLoc8 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x2000 /* 8k */[/SIZE][/LEFT]

[LEFT][SIZE=2]}[/SIZE]
[SIZE=2]/* Define a symbol for the top of each memory region */[/SIZE]
[SIZE=2]__top_MFlash128 = 0x0 + 0x20000;[/SIZE]
[SIZE=2]__top_Flashfile = 0x1f000 + 0x1000;[/SIZE]
[SIZE=2]__top_RamLoc8 = 0x10000000 + 0x2000;[/SIZE][/LEFT]


[LEFT][SIZE=2]Where I fall down is the linker commands to actually place the data in this section.[/SIZE][/LEFT]

[LEFT][SIZE=2]What I'm trying to do is map certain variables into a specific place in flash so I can have them non-volatile. [/SIZE][/LEFT]

[LEFT][SIZE=2]I'm using a LPX1227 by the way (not that it makes much difference).[/SIZE][/LEFT]

[LEFT][SIZE=2]I'm sure this has all been done before, so please point me in the right direction.[/SIZE][/LEFT]

[/LEFT]
0 Kudos
Reply
1 Reply

557 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Kartman on Fri Apr 08 06:18:40 MST 2011
I got it to work by placing the linker command

-section-start=.Flashfile=0x1f000

under properties|C/C++ Build|Settings|MCU Linker|Miscellaneous|Other options

If there are other ways, please tell me.
0 Kudos
Reply