lpcware

Locating a constant at a fixed Flash Location

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by kcarolan on Tue Apr 01 06:43:56 MST 2014
I have found several post on Locating a constant at a fixed memory location.  The link below looked very promising.  Everything compiled great but my constant was not placed in the flash segment that I specified.  I must be missing something simple.

http://www.lpcware.com/content/faq/lpcxpresso/coderodata-different-flash-blocks

For an example I am trying to put 0x1234 at 0xFFFC
I have defined the Segment ChecksumSeq at 0xFFFE  ( See Map File output below)

__RODATA(ChecksumSeg) const int kevin= 0x1234;  This line is located in my File Called ManufacturingTest.c

Snipets from my Map File

Name             Origin             Length             Attributes
MFlash128        0x00000000         0x0000fffc         xr
ChecksumSeg      0x0000fffc         0x00000004         xr[/b]
MFlash128_64     0x00010000         0x00010000         xr
RamLoc8          0x10000000         0x00002000         xrw
RamPeriph2       0x20000000         0x00000800         xrw
SRAM1_2          0x20004000         0x00000800         xrw
*default*        0x00000000         0xffffffff

START GROUP
LOAD c:/nxp/lpcxpresso_6.1.2_177/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/armv6-m\libcr_c.a
LOAD c:/nxp/lpcxpresso_6.1.2_177/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/armv6-m\libcr_eabihelpers.a
END GROUP
                0x0000fffc                __top_MFlash128 = 0xfffc
                0x00010000                __top_ChecksumSeg = 0x10000
                0x00020000                __top_MFlash128_64 = 0x20000
                0x10002000                __top_RamLoc8 = 0x10002000
                0x20000800                __top_RamPeriph2 = 0x20000800
                0x20004800                __top_SRAM1_2 = 0x20004800

.text_Flash2    0x0000fffc        0x0
FILL mask 0xff
*(.text_Flash2*)
*(.text_ChecksumSeg*)
*(.text.$Flash2*)
*(.text.$ChecksumSeg*)
*(.rodata.$Flash2*)
*(.rodata.$ChecksumSeg*)


.rodata.$text_Flash2
                0x00008e90        0x4 ./src/ManufacturingTest.o
                0x00008e90                kevin

The constant 0x1234 end up at 0x8E90

Any ideas on what I am doing wrong?

Thanks, Kevin


Outcomes