Sections in flash memory

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

Sections in flash memory

297 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fred117 on Wed Feb 17 04:48:07 MST 2010
Hi!
I want to use 1 of  sectors in flash memory to store my data. I know default value of those data and I want to program it with rest of code, but also I want to edit it by IAP so it must be on constant address.
Every thing is ok but when I just add another section in ld file (taken from CRP example) it's going to Hard Fault Routine any time I try to enable IRQ. 

So how can I create section on flash that will be programmed by my data and did not crash my program ??
0 Kudos
2 Replies

240 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fred117 on Mon Jul 19 09:04:53 MST 2010
Hi!
I copied code from crp example and change it like this:


Quote:

#ifdef __GNUC__
__attribute__ ((section(".settings"))) const uint32_t S1_WORD = 0xAAAAAAAA;
#endif
#ifdef __IAR_SYSTEMS_ICC__
const __root uint32_t S1_WORD @ ".settings" = 0xAAAAAAAA;
#endif

Additional I put declaration of new section into ld file:


Quote:
SECTIONS
{
    .text :
    {
        KEEP(*(.isr_vector))
        . = 0x000002FC;
        KEEP(*(.crp))   
        *(.text*)
        *(.rodata*)
[B]        . = 0x00007E00;
        KEEP(*(.settings))[/B]
    } > MFlash32

and this is part of my map file.


Quote:
.text.SystemInit
                0x00004308       0xb0 C:\Documents and Settings\Marcin\My Documents\lpcxpresso_3.2\workspace\CMSISv1p30_LPC13xx\Debug\libCMSISv1p30_LPC13xx.a(system_LPC13xx.o)
                0x00004308                SystemInit
*(.rodata*)
.rodata        0x000043b8       0x10 ./src/iap.o
.rodata        0x000043c8      0xc00 ./src/main.o
                0x000043c8                eye_log
                0x00004bc8                corG
                0x000047c8                corR
                0x00007e00                . = 0x7e00
[B]*fill*         0x00004fc8     0x2e38 00
*(.settings)
.settings      0x00007e00        0x4 ./src/main.o
                0x00007e00                S1_WORD[/B]

.glue_7         0x00007e04        0x0
.glue_7        0x00000000        0x0 linker stubs

.glue_7t        0x00007e04        0x0

I don't know why it wont work.
0 Kudos

240 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Tue Feb 23 01:18:45 MST 2010

Quote: fred117
Hi!
...
when I just add another section in ld file (taken from CRP example) it's going to Hard Fault Routine any time I try to enable IRQ.



Would you post your LPCXpresso .map file? It should show what sections have been allocated in your program. Also please post your linker scripts (*.ld files).

Thank you,
-NXP
0 Kudos