set a fixed flash address initialized to a fixed value when Code is being compiled

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

set a fixed flash address initialized to a fixed value when Code is being compiled

1,193 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mile on Fri Sep 19 01:59:16 MST 2014
I have to set a fixed flash address  initialized to a fixed value.
This process must be done when Code is being compiled.

I set flash as follows:
MEMORY
{
  /* Define each memory region */
  MFlash128 (rx) : ORIGIN = 0x0, LENGTH = 0x1dff0 /* 119k */
  BootLoaderFlag (rx) : ORIGIN = 0x1fff0, LENGTH = 0x20000 /* 128k */
  RamLoc16 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x4000 /* 16k */
  RamAHB16 (rwx) : ORIGIN = 0x2007c000, LENGTH = 0x4000 /* 16k */

}

and my code is :

#pragma DATA_SECTION(FlashKeyword, "BootLoaderFlag");
const uint16_t FlashKeyword[1] = {0x6DA};

int main(void)
{
fp32 f32Value       = 0;
f32Value = 0;
uint16_t u16Value = 0 ;
uint16_t *pTest = 0x1fff0;
u16Value = *pTest;
}

u16Value is  65535 not 0x6DA.

I have to set a fixed flash address  initialized to a fixed value when Code is being compiled.
what should I do? How to accomplish this function in LPCXpresso?

My LPCXpresso Version is : LPCXpresso v5.2.4 [Build 2122] [2013-04-29]
0 Kudos
Reply
4 Replies

1,147 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Sep 19 03:35:13 MST 2014
Is is fully explained in the FAQ. For example, it says

Quote:
Modify your project to provide your own linker script, as detailed in the FAQ "Using your own linker scripts".

0 Kudos
Reply

1,147 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mile on Fri Sep 19 03:13:55 MST 2014
I change my code ,but it not working. is I have to  have a linker script?Or chang the default linker script?

My new code is as follows:

__attribute__ ((section(".BootLoaderFlag"))) uint16_t FlashKeyword[1] = {0x6DA};
0 Kudos
Reply

1,147 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mile on Fri Sep 19 03:13:33 MST 2014
I change my code ,but it not working.  is I have to  have a linker script?Or chang the default linker script?

My new code is as follows:

__attribute__ ((section(".BootLoaderFlag"))) uint16_t FlashKeyword[1] = {0x6DA};
0 Kudos
Reply

1,147 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Sep 19 02:18:46 MST 2014
Please read this FAQ.
http://www.lpcware.com/content/faq/lpcxpresso/placing-data-address

Note that you are using a very old version of LPCXpresso and would strongly recommend that you upgrade to the latest release.
0 Kudos
Reply