Hi,
I had an earlier thread: [SOLVED] JFlash overwrites incorrect pages where Segger provided a solution using GDB to prevent the J-Link erasing data in the flash that we need to protect. I have the same problem with J-Flash: we use a 2-step programming process, where the 2nd step writes data into a sector that already contains code (but the data doesn't overlap). In our case the code is at 0x0 - 0x7fdff, and some data is placed at 0x7fe00 - 0x7ffff. The flash sector size is 32kB, so sector 15 has range 0x78000-0x7ffff. When writing the data, J-Flash erases sector 15, and part of the code is lost.
We solved that for GDB by using the J-Link command "SetFlashDLNoRMWThreshold = 0xffffffff", and I want to do the same for J-Flash. I tried to put that command in a J-Link script file (see attached), but get errors from J-Flash during the load operation:
- Connected successfully
Checking if selected data fits into selected flash sectors.
Programming and verifying target (580548 bytes, 3 ranges) ...
- Start of preparing flash programming
- ERROR: Can not read register 20 (CFBP) while CPU is running
- ERROR: CPU is not halted
- ERROR: Timeout while checking target RAM, RAMCode did not respond in time
- ERROR: Failed to prepare for programming.
Failed to execute RAMCode for RAM check!
- End of preparing flash programming
- ERROR: Failed to program and verify target
Disconnecting ...
- Disconnected
I'm not sure if this command should be placed in the InitTarget() function, or if there are other commands needed before it.
Can you provide an example of this command in a Jlink script file, or point out the issue?
Thanks,
Henry
I had an earlier thread: [SOLVED] JFlash overwrites incorrect pages where Segger provided a solution using GDB to prevent the J-Link erasing data in the flash that we need to protect. I have the same problem with J-Flash: we use a 2-step programming process, where the 2nd step writes data into a sector that already contains code (but the data doesn't overlap). In our case the code is at 0x0 - 0x7fdff, and some data is placed at 0x7fe00 - 0x7ffff. The flash sector size is 32kB, so sector 15 has range 0x78000-0x7ffff. When writing the data, J-Flash erases sector 15, and part of the code is lost.
We solved that for GDB by using the J-Link command "SetFlashDLNoRMWThreshold = 0xffffffff", and I want to do the same for J-Flash. I tried to put that command in a J-Link script file (see attached), but get errors from J-Flash during the load operation:
- Connected successfully
Checking if selected data fits into selected flash sectors.
Programming and verifying target (580548 bytes, 3 ranges) ...
- Start of preparing flash programming
- ERROR: Can not read register 20 (CFBP) while CPU is running
- ERROR: CPU is not halted
- ERROR: Timeout while checking target RAM, RAMCode did not respond in time
- ERROR: Failed to prepare for programming.
Failed to execute RAMCode for RAM check!
- End of preparing flash programming
- ERROR: Failed to program and verify target
Disconnecting ...
- Disconnected
I'm not sure if this command should be placed in the InitTarget() function, or if there are other commands needed before it.
Can you provide an example of this command in a Jlink script file, or point out the issue?
Thanks,
Henry