How to program a code of the size of 512KB into LPC1853 using LPCScrypt

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

How to program a code of the size of 512KB into LPC1853 using LPCScrypt

958 Views
yasushihasegawa
Contributor III

I will use LPCScrypt version 1.8.0 or later to program in LPC1853. I think that the program size exceeds 300KB.

Please tell me the method to make two consecutive .bin files from .axf file. The .axf file is built by LPCXpresso.

Two .bin files divided from all codes is necessary for LPCScrypt. LPCScrypt programs these two files in "BankA", "BankB".

I'd like to program more than 300KB code into LPC1853 using LPCScrypt. 

Present status:

Because I am still inspecting it, I made the .axf file which placed main function in BankB using "__TEXT(Flash2) macro ", but one .bin file is output by the following command practice.

------

arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin"
checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"

------

By the way, programing one .bin file not to divide using LPCScrypt, but was the following error.

------

C:\NXP\LPCScrypt\bin>lpcscrypt program ..\images\20160901\periph_blinky.bin BankA
Error: <Command line>:1: Binary image ..\images\20160901\periph_blinky.bin (size16777316) is too large for memory BankA (0x1a000000, size 524288)
Script cmd: program ..\images\20160901\periph_blinky.bin BankA
Last target cmd: =queryFlash
Terminated with errors

Labels (2)
0 Kudos
2 Replies

617 Views
yasushihasegawa
Contributor III

Thanks for your advice. This problem was closed.

It is a memo as follows.

-------

[1.Source code change point]

systick.c 
#include <cr_section_macros.h> /* added */
__TEXT(Flash2) void SysTick_Handler(void) /* __TEXT(Flash2) added */
__TEXT(Flash2) int main(void) /* __TEXT(Flash2) added */

[2. Post-build => Command => Edit.. modify]

arm-none-eabi-size "${BuildArtifactFileName}"
cp "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}_ORIGINAL.axf"
arm-none-eabi-objcopy --remove-section .text_Flash2 --only-section .text -O elf32-littlearm "${BuildArtifactFileName}"  "${BuildArtifactFileBaseName}_BANKA.axf"
arm-none-eabi-objcopy -O binary --pad-to 0x1A03FFFF "${BuildArtifactFileBaseName}_BANKA.axf"
"${BuildArtifactFileBaseName}_BANKA.bin"
arm-none-eabi-objcopy --only-section .text_Flash2 --rename-section .text_Flash2=.text -O elf32-littlearm "${BuildArtifactFileName}"
"${BuildArtifactFileBaseName}_BANKB.axf"
arm-none-eabi-objcopy -O binary --pad-to 0x1B03FFFF "${BuildArtifactFileBaseName}_BANKB.axf"
"${BuildArtifactFileBaseName}_BANKB.bin"
arm-none-eabi-objcopy --remove-section .text_Flash2 -O elf32-littlearm "${BuildArtifactFileName}"
"${BuildArtifactFileBaseName}_except_text_Flash2.axf"
arm-none-eabi-size "${BuildArtifactFileBaseName}_except_text_Flash2.axf"
arm-none-eabi-size "${BuildArtifactFileBaseName}_BANKA.axf"
arm-none-eabi-size "${BuildArtifactFileBaseName}_BANKB.axf"
checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}_BANKA.bin"

[3. Writing to two Banks of flash memory by LPCScrypt]

Copy two following files to imaging folder.

  periph_blinky_BANKA.bin
  periph_blinky_BANKB.bin 

Execute LPCScrypt following commands.

----
C:¥NXP¥LPCScrypt¥bin>..¥scripts¥boot_lpcscrypt.cmd
Booting LPCScrypt target with "LPCScrypt_140.bin.hdr"
LPCScrypt target booted

C:¥NXP¥LPCScrypt¥bin>lpcscrypt erase BankA
Erasing BankA ... completed in 0.218s

C:¥NXP¥LPCScrypt¥bin>lpcscrypt erase BankB
Erasing BankB ... completed in 0.109s

C:¥NXP¥LPCScrypt¥bin>lpcscrypt program ..¥images¥20160901¥periph_blinky_BANKA.bi
n BankA
........
Programmed 262143 bytes to 0x1a000000 in 0.937s (273.211KB/sec)

C:¥NXP¥LPCScrypt¥bin>lpcscrypt program ..¥images¥20160901¥periph_blinky_BANKB.bi
n BankB
........
Programmed 262143 bytes to 0x1b000000 in 0.938s (272.920KB/sec)
----

0 Kudos

617 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Fundamentally an .axf file contains address information and when this is combined with knowledge of the underlying flash memories, tools such as LPCXpreso IDE can automatically program the required data in one operation.

Once binary data is extracted, all address information is lost.  Objcopy will create a binary starting at the lowest address and ending at the highest i.e. it cannot contain holes, for this reason you are seeing a 16MB bin file i.e the binary is size between 0x1A000000 and 0x1Bxxxxxx.

A solution is to create an image in such a way that appropriate sections can be used to identify the data from the separate flash devices. The following link discusses a very similar situation https://community.nxp.com/message/759232  locate the entry that begins:  'Content originally posted in LPCWare by lpcxpresso-support on Wed Sep 17 03:28:37 MST 2014'.

Depending on your requirements, an alternative scheme might be to extract the data from the device memories after the programming operation. 

Yours,

LPCXpresso-support

0 Kudos