Placing data at an fixed flash address

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

Placing data at an fixed flash address

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Mon Feb 07 02:02:03 MST 2011
LPC1758 with LCPXPresso.
I need to place a array in a fixed flash address.

like this
__attribute__ ((section(".??????????"))) const char Driver[20] ;

I think I need to change the .ld linker file, but how can I do this ?
Ther'is a simple way to force only 20 byte ?

The solution in this link (http://support.code-red-tech.com/CodeRedWiki/PlacingData) don't function because i need to use thw flash and must overlap !!

Thanks
0 Kudos
Reply
2 Replies

810 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Mon Feb 07 06:32:52 MST 2011
OK, thanks !
0 Kudos
Reply

810 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Feb 07 04:34:04 MST 2011
You can do this in a similar way to the CRP mechanism that is provided as part of the enhanced managed linker script mechanism provided in LPCXpresso 3.6.x, which is described in:

http://support.code-red-tech.com/CodeRedWiki/EnhancedManagedLinkScripts

What you need to do here is:

[LIST]
[*] Create a subdirectory called "linkscripts" within your project
[/LIST]

[LIST]
[*] Copy the file "link_template.ld" from Wizards directory into the "linkscripts" subdirectory  (as per above FAQ).
[/LIST]

[LIST]
[*] Assuming that the address you want to place the array into is at, say, 0x2E8 (immediately before the CRP word), then modify the link_template.ld in your linkscripts subdirectory such that you change the portion from the .text section from:
[/LIST]

        *(.after_vectors*)
        
        /* INSERT CRP */
to
 
       *(.after_vectors*)

        . = 0x000002E8 ;
        KEEP(*(.rodata.mydriver*))

      /* INSERT CRP */
where your array is declared as:

__attribute__ ((section(".rodata.mydriver"))) const char Driver[20] = "My_driver_ABCDEFGH";
Note that after doing the above, you will need to do a clean before building, otherwise the link script template will not get picked up.

Alternatively, you could just produce the linker script yourself from scratch, as per:

http://support.code-red-tech.com/CodeRedWiki/OwnLinkScripts

Regards,
CodeRedSupport
0 Kudos
Reply