LPC1277 link at flash offset 0x2000 to hex file

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC1277 link at flash offset 0x2000 to hex file

1,903 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kiryat8 on Thu Jan 01 07:43:24 MST 2015
I am trying to link my code to at absolute position that my secondary bootloader expects - 0x2000 in the flash.
I have done this many times with the LPC1768 by just changing the xxx_mem.ld file's flash origin as shown below.
I then take the bin file and use it for OTAP and direct USB loading.
In my LPC1277 project I wanted to use Flash Magic to flash the secondary bootloader with the erase all flash option and then flash my program hex code without any erase options.
Flash Magic complains that I am overwriting code with the program hex file.
From what I can see the hex file does not start at 0x2000 as I would expect.
What am I doing wrong?

xx_mem.id file:
MEMORY
{
  /* Define each memory region */
  MFlash128 (rx) : ORIGIN = 0x02000, LENGTH = 0x1E000 /* 128K bytes */
  RamLoc8 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x2000 /* 8K bytes */


}
  /* Define a symbol for the top of each memory region */
  __top_MFlash128 = 0x0 + 0x20000;
  __top_RamLoc8 = 0x10000000 + 0x2000;

Post build steps:
arm-none-eabi-size ${BuildArtifactFileName}
arm-none-eabi-objcopy -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin
checksum -p ${TargetChip} -d ${BuildArtifactFileBaseName}.bin
arm-none-eabi-objcopy -I binary -O ihex ${BuildArtifactFileBaseName}.bin ${BuildArtifactFileBaseName}.hex

Start of hex file:
:1000000000200010FF200000D1200000D3200000BD
:100010000000000000000000000000005D7DFFEF18
:10002000000000000000000000000000D5200000DB
:100030000000000000000000D7200000A1360000F2
:10004000DB200000DB200000DB200000DB200000C4
:10005000DB200000DB200000DB200000DB200000B4
:10006000DB200000DB200000DB200000DB200000A4
:100070009D2E0000DB200000DB200000DB200000C4
:10008000DB200000DB200000894700004D48000015
:10009000DB20000071210000DB200000DB200000DD
:1000A00000000000814D0000DB200000DB2000008C
:1000B00000000000DB200000DB200000A86300003F
:1000C000000000100C0000000C0000104C040000A8
:1000D000FEE7FEE7FEE7FEE7FEE7FEE710B50023DA

The linker map file is attached.

Any help would be appreciated.
Thank you

Original Attachment has been moved to: map.txt.zip

0 项奖励
回复
4 回复数

1,588 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kiryat8 on Sun Jan 04 03:48:14 MST 2015
My secondary bootloader checks the checksum so I need it.
0 项奖励
回复

1,588 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Sun Jan 04 03:02:32 MST 2015
You don't need all of these post-build steps
arm-none-eabi-size ${BuildArtifactFileName}
arm-none-eabi-objcopy -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin
checksum -p ${TargetChip} -d ${BuildArtifactFileBaseName}.bin
arm-none-eabi-objcopy -I binary -O ihex ${BuildArtifactFileBaseName}.bin ${BuildArtifactFileBaseName}.hex

The checksum is ONLY required if you are linking your application to Flash address zero. This means that you can skip several step.

i.e. just
arm-none-eabi-size ${BuildArtifactFileName}
arm-none-eabi-objcopy -O ihex ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.hex

Should do what you require.
0 项奖励
回复

1,588 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kiryat8 on Sun Jan 04 00:20:16 MST 2015
I finally found the problem as reported in
http://www.lpcware.com/content/forum/replace-application-at-runtime-with-iap-and-boot-switch

I also could not get the --set-start or the --adjust-start to work.

arm-none-eabi-objcopy -I binary --set-start=0x02000 -O  ihex ${BuildArtifactFileBaseName}.bin ${BuildArtifactFileBaseName}.hex

arm-none-eabi-objcopy --adjust-start=0x02000 -I binary -O ihex ${BuildArtifactFileBaseName}.bin ${BuildArtifactFileBaseName}.hex

I finally just took the binary file offset at 0x0000 and used the external program
bin2hex.exe 1.bin 1.hex -o 2000

Thanks
0 项奖励
回复

1,588 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Thu Jan 01 09:53:05 MST 2015
By definition, Converting to binary strips all address information and just leaves the data.
0 项奖励
回复