My end goal is to create an Open Flash Loader that will successfully program NXP LPC2214 external flash. The debug version of the code works fine when executing the various required functions via the debug test driver main() function.
However, when I try to use the Release version of the Open Flash Loader, I see "Error: Failed to initialize RAMCode".
In an attempt to make it easier for others to provide support/help, I created an Open Flash Loader that has the same failure but is designed to work for the NXP LPC2214 internal flash. The NXP LPC2214 internal flash version has the same failure when executed via the debug test driver main() function but fails (with "Error: Failed to initialize RAMCode") when attempting to use it to write programs to internal flash.
Below are relevant portions of the J-Link logs when using the Segger built in programming code and the attached Open Flash Loader. The working scenario jlink log is provided first.
TB1B49700 005:818 JLINK_RTTERMINAL_Control(Cmd = JLINKARM_RTTERMINAL_CMD_STOP) returns 0x01 (0000ms, 0422ms total)
TB1B49700 005:818 JLINK_BeginDownload(Flags = 0x00) (0000ms, 0422ms total)
TB1B49700 005:818 JLINK_WriteMemEx(0x00000000, 0x04B8 Bytes, ..., Flags = 0x00000000) - Data: 18 F0 9F E5 18 F0 9F E5 18 F0 9F E5 18 F0 9F E5 ... -- Need to split memory access -- #0: 0x00000000, 0x00000040 bytes - Writing 0x40 bytes @ 0x7FFFE000 -- WriteRemote(64 bytes @ 0x7FFFE000) -- #1: 0x00000040, 0x00000478 bytes -- ReadRemote(64 bytes @ 0x7FFFE000) -- Updating C cache (64 bytes @ 0x7FFFE000) -- Read from C cache (64 bytes @ 0x7FFFE000) -- Read from flash cache (1144 bytes @ 0x00000040)
returns 0x4B8 (0002ms, 0424ms total)
TB1B49700 005:820 JLINK_EndDownload() -- -------------------------------------- -- Start of determining dirty areas in flash cache -- End of determining dirty areas -- Start of preparing flash programming -- Calculating RAM usage -- RAM usage = 4568 Bytes -- Preserving CPU registers -- Preparing memory -- Determining CPU clock frequency -- CPU frequency = 14760 kHz -- Preparing target -- Downloading RAMCode -- Checking target RAM & preparing RAMCode -- End of preparing flash programming
-- CPU is running at 14760 kHz. -- Start of comparing flash -- CRC check was estimated as fastest method -- Comparing range 0x0000 - 0x1FFF (1 Sector, 8 KB), using multi-block CRC calculation -- CRC does not match for sector 0 -- End of comparing flash -- Start of erasing sectors -- Erasing range 0x00000000 - 0x00001FFF ( 1 Sector, 8 KB) -- End of erasing sectors -- Start of flash programming -- Programming range 0x00000000 - 0x00001FFF ( 1 Sector, 8 KB) -- End of flash programming
-- 0x0000 - 0x1FFF ( 1 Sector, 8 KB) -- Start of verifying flash -- Checksum calculation was estimated as fastest method -- Checksum is not supported by this flash bank. Switched to read back method. -- End of verifying flash -- Start of restoring -- Restoring RAMCode -- Restore target -- Restore memory -- Restoring CPU registers -- End of restoring -- Bank 0 @ 0x00000000: 1 range affected (8192 bytes)
-- Total time needed: 0.565s (Prepare: 0.026s, Compare: 0.014s, Erase: 0.443s, Program: 0.062s, Verify: 0.014s, Restore: 0.002s) returns -1 (0566ms, 0990ms total)
TB1B49700 006:386 JLINK_IsHalted() -- ReadRemote(4 bytes @ 0xE01FC040) returns TRUE (0000ms, 0990ms total)
Now the "not working" jlink.log.
TD3A2B700 005:094 JLINK_RTTERMINAL_Control(Cmd = JLINKARM_RTTERMINAL_CMD_STOP) returns 0x01 (0000ms, 0423ms total)
TD3A2B700 005:095 JLINK_BeginDownload(Flags = 0x00) (0000ms, 0423ms total)
TD3A2B700 005:095 JLINK_WriteMemEx(0x00000000, 0x04B8 Bytes, ..., Flags = 0x00000000) - Data: 18 F0 9F E5 18 F0 9F E5 18 F0 9F E5 18 F0 9F E5 ... -- Need to split memory access -- #0: 0x00000000, 0x00000040 bytes - Writing 0x40 bytes @ 0x7FFFE000 -- WriteRemote(64 bytes @ 0x7FFFE000) -- #1: 0x00000040, 0x00000478 bytes -- ReadRemote(64 bytes @ 0x7FFFE000) -- Updating C cache (64 bytes @ 0x7FFFE000) -- Read from C cache (64 bytes @ 0x7FFFE000) -- Read from flash cache (1144 bytes @ 0x00000040)
returns 0x4B8 (0002ms, 0425ms total)
TD3A2B700 005:097 JLINK_EndDownload() -- -------------------------------------- -- Start of determining flash info (Bank @ 0x00000000) -- Preparing RAMCode -- Calculating RAM usage -- RAM usage = 2976 Bytes -- Preserving CPU registers -- Preparing memory -- Preparing target -- Preserving target RAM temporarily used for programming -- Preserving additional used target memory -- Downloading RAMCode -- Restoring RAMCode -- Restoring target memory -- Restore target -- Restore memory
-- Restoring CPU registers -- End of determining flash info -- Start of determining dirty areas in flash cache -- End of determining dirty areas -- Start of preparing flash programming -- Preparing RAMCode -- Calculating RAM usage -- RAM usage = 2976 Bytes -- Preserving CPU registers -- Preparing memory -- Preparing target -- Downloading RAMCode -- End of preparing flash programming -- CPU speed could not be measured. -- Start of comparing flash -- CRC check was estimated as fastest method
-- CRC check is not supported by this flash bank. Switched to read back method. -- Comparing range 0x0000 - 0x1FFF (1 Sector, 8 KB), using single-block CRC calculation -- CRC check is not supported by this flash bank. Switched to read back method. -- Recalculating RAMUsage for optimal performance during programming -- Initializing RAMCode -- Executing Init()
***** Error: Failed to initialize RAMCode -- CRC does not match for sector 0 -- End of comparing flash -- Start of erasing sectors
-- Erasing range 0x00000000 - 0x00001FFF ( 1 Sector, 8 KB) -- Recalculating RAMUsage for optimal performance during programming -- Initializing RAMCode -- Executing UnInit() -- Executing Init()
***** Error: Failed to initialize RAMCode -- End of erasing sectors -- Start of restoring -- Restoring RAMCode -- Executing UnInit() -- End of restoring
***** Error: Failed to initialize RAMCodeFailed to initialize RAMCode returns -5 (0119ms, 0544ms total)
TD3A2B700 005:216 JLINK_IsHalted() -- ReadRemote(4 bytes @ 0xE01FC040) returns TRUE (0000ms, 0544ms total)
However, when I try to use the Release version of the Open Flash Loader, I see "Error: Failed to initialize RAMCode".
In an attempt to make it easier for others to provide support/help, I created an Open Flash Loader that has the same failure but is designed to work for the NXP LPC2214 internal flash. The NXP LPC2214 internal flash version has the same failure when executed via the debug test driver main() function but fails (with "Error: Failed to initialize RAMCode") when attempting to use it to write programs to internal flash.
Below are relevant portions of the J-Link logs when using the Segger built in programming code and the attached Open Flash Loader. The working scenario jlink log is provided first.
TB1B49700 005:818 JLINK_RTTERMINAL_Control(Cmd = JLINKARM_RTTERMINAL_CMD_STOP) returns 0x01 (0000ms, 0422ms total)
TB1B49700 005:818 JLINK_BeginDownload(Flags = 0x00) (0000ms, 0422ms total)
TB1B49700 005:818 JLINK_WriteMemEx(0x00000000, 0x04B8 Bytes, ..., Flags = 0x00000000) - Data: 18 F0 9F E5 18 F0 9F E5 18 F0 9F E5 18 F0 9F E5 ... -- Need to split memory access -- #0: 0x00000000, 0x00000040 bytes - Writing 0x40 bytes @ 0x7FFFE000 -- WriteRemote(64 bytes @ 0x7FFFE000) -- #1: 0x00000040, 0x00000478 bytes -- ReadRemote(64 bytes @ 0x7FFFE000) -- Updating C cache (64 bytes @ 0x7FFFE000) -- Read from C cache (64 bytes @ 0x7FFFE000) -- Read from flash cache (1144 bytes @ 0x00000040)
returns 0x4B8 (0002ms, 0424ms total)
TB1B49700 005:820 JLINK_EndDownload() -- -------------------------------------- -- Start of determining dirty areas in flash cache -- End of determining dirty areas -- Start of preparing flash programming -- Calculating RAM usage -- RAM usage = 4568 Bytes -- Preserving CPU registers -- Preparing memory -- Determining CPU clock frequency -- CPU frequency = 14760 kHz -- Preparing target -- Downloading RAMCode -- Checking target RAM & preparing RAMCode -- End of preparing flash programming
-- CPU is running at 14760 kHz. -- Start of comparing flash -- CRC check was estimated as fastest method -- Comparing range 0x0000 - 0x1FFF (1 Sector, 8 KB), using multi-block CRC calculation -- CRC does not match for sector 0 -- End of comparing flash -- Start of erasing sectors -- Erasing range 0x00000000 - 0x00001FFF ( 1 Sector, 8 KB) -- End of erasing sectors -- Start of flash programming -- Programming range 0x00000000 - 0x00001FFF ( 1 Sector, 8 KB) -- End of flash programming
-- 0x0000 - 0x1FFF ( 1 Sector, 8 KB) -- Start of verifying flash -- Checksum calculation was estimated as fastest method -- Checksum is not supported by this flash bank. Switched to read back method. -- End of verifying flash -- Start of restoring -- Restoring RAMCode -- Restore target -- Restore memory -- Restoring CPU registers -- End of restoring -- Bank 0 @ 0x00000000: 1 range affected (8192 bytes)
-- Total time needed: 0.565s (Prepare: 0.026s, Compare: 0.014s, Erase: 0.443s, Program: 0.062s, Verify: 0.014s, Restore: 0.002s) returns -1 (0566ms, 0990ms total)
TB1B49700 006:386 JLINK_IsHalted() -- ReadRemote(4 bytes @ 0xE01FC040) returns TRUE (0000ms, 0990ms total)
Now the "not working" jlink.log.
TD3A2B700 005:094 JLINK_RTTERMINAL_Control(Cmd = JLINKARM_RTTERMINAL_CMD_STOP) returns 0x01 (0000ms, 0423ms total)
TD3A2B700 005:095 JLINK_BeginDownload(Flags = 0x00) (0000ms, 0423ms total)
TD3A2B700 005:095 JLINK_WriteMemEx(0x00000000, 0x04B8 Bytes, ..., Flags = 0x00000000) - Data: 18 F0 9F E5 18 F0 9F E5 18 F0 9F E5 18 F0 9F E5 ... -- Need to split memory access -- #0: 0x00000000, 0x00000040 bytes - Writing 0x40 bytes @ 0x7FFFE000 -- WriteRemote(64 bytes @ 0x7FFFE000) -- #1: 0x00000040, 0x00000478 bytes -- ReadRemote(64 bytes @ 0x7FFFE000) -- Updating C cache (64 bytes @ 0x7FFFE000) -- Read from C cache (64 bytes @ 0x7FFFE000) -- Read from flash cache (1144 bytes @ 0x00000040)
returns 0x4B8 (0002ms, 0425ms total)
TD3A2B700 005:097 JLINK_EndDownload() -- -------------------------------------- -- Start of determining flash info (Bank @ 0x00000000) -- Preparing RAMCode -- Calculating RAM usage -- RAM usage = 2976 Bytes -- Preserving CPU registers -- Preparing memory -- Preparing target -- Preserving target RAM temporarily used for programming -- Preserving additional used target memory -- Downloading RAMCode -- Restoring RAMCode -- Restoring target memory -- Restore target -- Restore memory
-- Restoring CPU registers -- End of determining flash info -- Start of determining dirty areas in flash cache -- End of determining dirty areas -- Start of preparing flash programming -- Preparing RAMCode -- Calculating RAM usage -- RAM usage = 2976 Bytes -- Preserving CPU registers -- Preparing memory -- Preparing target -- Downloading RAMCode -- End of preparing flash programming -- CPU speed could not be measured. -- Start of comparing flash -- CRC check was estimated as fastest method
-- CRC check is not supported by this flash bank. Switched to read back method. -- Comparing range 0x0000 - 0x1FFF (1 Sector, 8 KB), using single-block CRC calculation -- CRC check is not supported by this flash bank. Switched to read back method. -- Recalculating RAMUsage for optimal performance during programming -- Initializing RAMCode -- Executing Init()
***** Error: Failed to initialize RAMCode -- CRC does not match for sector 0 -- End of comparing flash -- Start of erasing sectors
-- Erasing range 0x00000000 - 0x00001FFF ( 1 Sector, 8 KB) -- Recalculating RAMUsage for optimal performance during programming -- Initializing RAMCode -- Executing UnInit() -- Executing Init()
***** Error: Failed to initialize RAMCode -- End of erasing sectors -- Start of restoring -- Restoring RAMCode -- Executing UnInit() -- End of restoring
***** Error: Failed to initialize RAMCodeFailed to initialize RAMCode returns -5 (0119ms, 0544ms total)
TD3A2B700 005:216 JLINK_IsHalted() -- ReadRemote(4 bytes @ 0xE01FC040) returns TRUE (0000ms, 0544ms total)
The post was edited 1 time, last by kec ().