LPC4357 Flash Driver Error

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

LPC4357 Flash Driver Error

835 Views
px_seven
Contributor I

Hello,


I am having problems flashing the LPC4357 using an LPCLink-2 debugger. The flash driver is downloaded to RAM but the driver complains about what I assume is code corruption. This is the output from the GUI flash tool console:

-----------------------------------------------------------------------------------------------

Executing flash operation 'Program' (Program file into flash: Debug\lpc_4357_multicore_xxx.axf) - Sun Sep 23 22:03:57 CEST 2018
Checking MCU info...
Scanning for targets...
Executing flash action...
MCUXpresso IDE RedlinkMulti Driver v10.2 (Jul 25 2018 11:25:37 - crt_emu_cm_redlink.exe build 555)
(  0) Reading remote configuration
Wc(03). No cache support.
Found chip XML file in C:/FM/xxx/C/FM/lpcopen_projs/ws7/lpc_4357_multicore_xxx/Debug\LPC4357.xml
(  5) Remote configuration complete
Reconnected to existing link server
Connecting to probe 1 core 0:0 (using server started externally) gave 'OK'
Probe Firmware: LPC-LINK2 CMSIS-DAP V5.183 (NXP Semiconductors)
Serial Number:  CWGWC1CT
VID:PID:  1FC9:0090
USB Path: \\?\hid#vid_1fc9&pid_0090&mi_00#7&14e9832b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Using memory from core 0:0 after searching for a good core
( 30) Emulator Connected
( 40) Debug Halt
( 50) CPU ID
debug interface type      = Cortex-M3/4 (DAP DP ID 4BA00477) over JTAG TAP 0
processor type            = Cortex-M4 (CPU ID 00000C24) on DAP AP 0
number of h/w breakpoints = 6
number of flash patches   = 2
number of h/w watchpoints = 4
Probe(0): Connected&Reset. DpID: 4BA00477. CpuID: 00000C24. Info: <None>
Debug protocol: JTAG. RTCK: Disabled. Vector catch: Disabled.
Content of CoreSight Debug ROM(s):
RBASE E00FF000: CID B105100D PID 04000BB4C4 ROM dev (type 0x1)
ROM 1 E000E000: CID B105E00D PID 04000BB00C ChipIP dev SCS (type 0x0)
ROM 1 E0001000: CID B105E00D PID 04003BB002 ChipIP dev DWT (type 0x0)
ROM 1 E0002000: CID B105E00D PID 04002BB003 ChipIP dev FPB (type 0x0)
ROM 1 E0000000: CID B105E00D PID 04003BB001 ChipIP dev ITM (type 0x0)
ROM 1 E0040000: CID B105900D PID 04000BB9A1 CoreSight dev TPIU type 0x11 Trace Sink - TPIU
ROM 1 E0041000: CID B105900D PID 04000BB925 CoreSight dev ETM type 0x13 Trace Source - core
Inspected v.2 On-chip Flash Memory LPC18x7_43x7_2x512_BootA.cfx
Image 'LPC18x7/LPC43x7 2x512KB (Boot Bank A) Jul 25 2018 11:21:30'
NXP: LPC4357
( 65) Chip Setup Complete
Connected: was_reset=false. was_stopped=false
( 70) License Check Complete
Loading 'lpc_4357_multicore_xxx.axf' ELF 0x1A000000 len 0xC9F0
Opening flash driver LPC18x7_43x7_2x512_BootA.cfx
Sending VECTRESET to run flash driver
There was a problem after we succesfully downloaded flash driver code to the target, so we are going to compare the flash driver code with the memory where it was loaded.
Note that, after driver initialization, some difference is normal in 'generic' drivers.

Driver from AXF file:
100000E0: 3046f3c0 bf842807 300708c0 00004770    ..F0.(.....0pG..
100000F0: 4a0a4b09 601ab510 62e0f642 4b094c08    .K.J...`B..b.L.K
10000100: 601a4621 f8412331 4b073b18 681b4620    !F.`1#A..;.K F.h
10000110: 69a04798 bf00bd10 4005006c 01000800    .G.i....l..@....
10000120: 100003b8 100003b4 10400100 47702000    ..........@.. pG
10000130: 43f8e92d 27322300 4c1d260e e9c44d1d    -..C.#2'.&.L.M..
10000140: e9c47300 46206302 f104682b 47980118    .s...c F+h.....G
10000150: bb5069a0 0934f04f 805cf8df 9000e9c4    .iP.O.4...\.....
10000160: 3000f8d8 e9c460a6 f1043003 46200118    ...0.`...0.... F
10000170: 4798682b b9c069a0 7000e9c4 60a62701    +h.G.i.....p.'.`
10000180: 462060e7 f104682b 47980118 b96069a0    .` F+h.....G.i`.
10000190: 3000f8d8 9000e9c4 3703e9c4 462060a6    ...0.......7.` F
100001A0: f104682b 47980118 e8bd69a0 bf0083f8    +h.....G.i......
100001B0: 100003b8 10400100 100003b4 41f0e92d    ......@.....-..A
100001C0: f7ff4607 280eff8d d8424680 4c222335    .F.....(.FB.5#"L
100001D0: 5fd8f1b7 3000e9c4 2300bf34 39012301    ..._...04..#.#.9
100001E0: 60e3180d 4b1e4e1d f1a660a5 681b0018    ...`.N.K.`.....h
100001F0: 47984631 280869a0 2332d129 5fd8f1b7    1F.G.i.().2#..._
10000200: 3c18f846 2300bf34 e9c42301 60e38501    F..<4..#.#.....`
10000210: 4b134912 0018f1a1 4798681b b9b069a0    .I.K.....h.G.i..
10000220: f8462334 4b0f3c18 5fd8f1b7 e9c4681b    4#F..<.K..._.h..
10000230: 60e38501 2301bf28 bf284908 4b086123    ...`(..#.I(.#a.K
10000240: 6120bf38 f1a1681b 47980018 e8bd69a0    8. a.h.....G.i..
10000250: 200181f0 bf00e7fb 100003b8 100003d0    ... ............
10000260: 10400100 100003b4 47f0e92d 460e4605    ..@.....-..G.F.F
10000270: 46074690 f8df4c2b 463890b8 ff30f7ff    .F.F+L....8F..0.
10000280: d84d280e f1b52332 e9c45fd8 bf343000    .(M.2#..._...04.
10000290: 23012300 60a04924 f1a160e3 f8d90018    .#.#$I.`.`......
100002A0: 47983000 280069a0 2333d136 3700e9c4    .0.G.i.(6.3#...7
100002B0: 0305eba8 60a3443b 5380f44f 60e34a1b    ....;D.`O..S.J.`
100002C0: f1b56813 61235fd8 2301bf28 bf344916    .h..._#a(..#.I4.
100002D0: 61636160 0018f1a1 3000f8d9 47984692    `aca.......0.F.G
100002E0: b9c869a0 5f80f5b6 f44fbf38 f5b65680    .i....._8.O..V..
100002F0: f5075080 d1115780 5fd0f1b5 233cd10c    .P...W....._..<#
10000300: 3000e9c4 3000f8da 60a34907 0018f1a1    ...0...0.I.`....
10000310: 3000f8d9 69a04798 87f0e8bd e7ac4606    ...0.G.i.....F..
10000320: e7f92001 100003b8 100003d0 100003b4    . ..............
10000330: 10400100 7380f020 5fd0f1b3 4606b570    ..@. ..s..._p..F
10000340: 4614460d 221cd111 f0004621 b108f811    .F.F..."!F......
10000350: bd70200a 0220f1a5 0120f104 0020f106    . p... ... ... .
10000360: f806f000 d0f42800 460ae7f2 e7f74621    .....(.....F!F..
10000370: 0301ea40 b570079b 4604d10c 2a03460b    @.....p....F.F.*
10000380: 46204619 6806d906 3404680d f10342ae    .F F...h.h.4.B..
10000390: d0040304 4291440a 2000d103 3a04e008    .....D.B... ...:
100003A0: f810e7ed f8113b01 42a34b01 1b18d0f3    .....;...K.B....
100003B0: 0000bd70 00000000 00000000 00000000    p...............
100003C0: 00000000 00000000 00000000 00000000    ................
100003D0: 00000000 00000000 00000000             ............
Driver code in memory:
100000E0: 3046f39e bf842807 300708c0 00004770    ..F0.(.....0pG..
100000F0: 4a0a4b09 601ab510 62e0f642 4b094c08    .K.J...`B..b.L.K
10000100: 601a4621 f8412331 4b073b18 681b4620    !F.`1#A..;.K F.h
10000110: 69a04798 bf00bd10 4005006c 01000800    .G.i....l..@....
10000120: 100003b8 100003b4 10400100 47702000    ..........@.. pG
10000130: 43f8e92d 27322300 4c1d260e e9c44d1d    -..C.#2'.&.L.M..
10000140: e9c47300 46206302 f104682b 47980118    .s...c F+h.....G
10000150: bb5069a0 0934f04f 805cf8df 9000e9c4    .iP.O.4...\.....
10000160: 3000f8d8 e9c460a6 f1043003 46200118    ...0.`...0.... F
10000170: 4798682b b9c069a0 7000e9c4 60a62701    +h.G.i.....p.'.`
10000180: 462060e7 f104682b 47980118 b96069a0    .` F+h.....G.i`.
10000190: 3000f8d8 9000e9c4 3703e9c4 462060a6    ...0.......7.` F
100001A0: f104682b 47980118 e8bd69a0 bf0083f8    +h.....G.i......
100001B0: 100003b8 10400100 100003b4 41f0e92d    ......@.....-..A
100001C0: f7ff4607 280eff8d d8424680 4c222335    .F.....(.FB.5#"L
100001D0: 5fd8f1b7 3000e9c4 2300bf34 39012301    ..._...04..#.#.9
100001E0: 60e3180d 4b1e4e1d f1a660a5 681b0018    ...`.N.K.`.....h
100001F0: 47984631 280869a0 2332d129 5fd8f1b7    1F.G.i.().2#..._
10000200: 3c18f846 2300bf34 e9c42301 60e38501    F..<4..#.#.....`
10000210: 4b134912 0018f1a1 4798681b b9b069a0    .I.K.....h.G.i..
10000220: f8462334 4b0f3c18 5fd8f1b7 e9c4681b    4#F..<.K..._.h..
10000230: 60e38501 2301bf28 bf284908 4b086123    ...`(..#.I(.#a.K
10000240: 6120bf38 f1a1681b 47980018 e8bd69a0    8. a.h.....G.i..
10000250: 200181f0 bf00e7fb 100003b8 100003d0    ... ............
10000260: 10400100 100003b4 47f0e92d 460e4605    ..@.....-..G.F.F
10000270: 46074690 f8df4c2b 463890b8 ff30f7ff    .F.F+L....8F..0.
10000280: d84d280e f1b52332 e9c45fd8 bf343000    .(M.2#..._...04.
10000290: 23012300 60a04924 f1a160e3 f8d90018    .#.#$I.`.`......
100002A0: 47983000 280069a0 2333d136 3700e9c4    .0.G.i.(6.3#...7
100002B0: 0305eba8 60a3443b 5380f44f 60e34a1b    ....;D.`O..S.J.`
100002C0: f1b56813 61235fd8 2301bf28 bf344916    .h..._#a(..#.I4.
100002D0: 61636160 0018f1a1 3000f8d9 47984692    `aca.......0.F.G
100002E0: b9c869a0 5f80f5b6 f44fbf38 f5b65680    .i....._8.O..V..
100002F0: f5075080 d1115780 5fd0f1b5 233cd10c    .P...W....._..<#
10000300: 3000e9c4 3000f8da 60a34907 0018f1a1    ...0...0.I.`....
10000310: 3000f8d9 69a04798 87f0e8bd e7ac4606    ...0.G.i.....F..
10000320: e7f92001 100003b8 100003d0 100003b4    . ..............
10000330: 10400100 7380f020 5fd0f1b3 4606b570    ..@. ..s..._p..F
10000340: 4614460d 221cd111 f0004621 b108f811    .F.F..."!F......
10000350: bd70200a 0220f1a5 0120f104 0020f106    . p... ... ... .
10000360: f806f000 d0f42800 460ae7f2 e7f74621    .....(.....F!F..
10000370: 0301ea40 b570079b 4604d10c 2a03460b    @.....p....F.F.*
10000380: 46204619 6806d906 3404680d f10342ae    .F F...h.h.4.B..
10000390: d0040304 4291440a 2000d103 3a04e008    .....D.B... ...:
100003A0: f810e7ed f8113b01 42a34b01 1b18d0f3    .....;...K.B....
100003B0: 0000bd70 00000000 00000000 00000000    p...............
100003C0: 00000000 00000000 00000000 00000000    ................
100003D0: 00000000 00000000 00000000             ............
(100) Writing Flash ended with an error.
File 'lpc_4357_multicore_xxx.axf' load failure: Ef(50): Flash driver failed to initialize
Loading 'lpc_4357_multicore_xxx.axf' ELF 0x1B000000 len 0x4DFC
Opening flash driver LPC18x7_43x7_2x512_BootA.cfx
VECTRESET reset omitted - already reset
Writing 19964 bytes to address 0x1B000000 in Flash
1 of 1 (  0) Writing pages 15-17 at 0x1B000000 with 19964 bytes
(  0) at 1B000000: 0 bytes - 0/19964
( 41) at 1B000000: 8192 bytes - 8192/19964
( 82) at 1B002000: 8192 bytes - 16384/19964
(100) at 1B004000: 8192 bytes - 24576/19964
Erased/Wrote page  15-17 with 19964 bytes in 1125msec
Closing flash driver LPC18x7_43x7_2x512_BootA.cfx
(100) Finished writing Flash successfully.
Flash Write Done
Loaded 0x4DFC bytes in 1627ms (about 12kB/s)
Reset target (system)
Starting execution using system reset

-----------------------------------------------------------------------------------------------

Note that flash bank B is flashed OK and works, despite the reported flash driver error.

I have tried using both JTAG and SWD, two different but identical 4357 boards using 20-pin trace/JTAG/SWD connector and one other 4357 board with 10-pin JTAG/SWD connector. I have also tried old scripts from LPCExpresso 7.1.1 and 6.1.2, but they gave the same error.

I should say that I have used these exact boards and the same LPCLink-2 a number of years ago (2013-2014), and then they did not have these problems. Could it be that the LPCLink-2 is damaged?

Do you have any ideas what the problem might be?

BR Fredric

Labels (1)
0 Kudos
2 Replies

634 Views
px_seven
Contributor I

I have located the problem, and it was due to a dual core application where the Cortex-M0 was linked to use the same RAM as the flash driver was uploaded to. The M0 then corrupted the flash driver image in RAM as it was executing while flashing process was ongoing.

I solved it by a single line of debugger code which halts the M0 on debugger connect:

10 CMHALT 1 1

I put this in a .scp script file which executes on flash and debug init.

NXP, maybe you should consider to halt the M0 in your connect procedure, as it is of no use having it execute during the flash or debug session init. I saw other people have had the same problem years ago:

https://community.nxp.com/thread/420213 

BR Fredric

0 Kudos

634 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Fredric,

   Thanks a lot for your solutions sharing and the suggestions!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos