When Jlink performs flash updates, it looks that its cache is not up-to-date if the memory content has been modified by code execution. It results in having wrong memory content at the end.
My use is case is the following : My application is initializing 16 bytes at defined address of the Flash memory at startup, assuming the first byte is FFh.
- 1. Flash code -> memory is virgin -> All bytes are FFh
- 2. Using memory viewer, I modified some bytes (lets say 8th and 12th to CCh) into the buffer. The flasher runs and modifies the memory. Memory viewer shows the right data.
- 3. I run code and stop it just after my code performs memory initialization. Memory viewer shows the expected data : All the bytes are written with new value including 8th and 12th bytes
- 4. I use the memory viewer to modify first byte to 33h. The flasher runs but the result is not the good one. First byte is ok but 8th and 12th get the value written in dot 2 !!!!
@0x5000 (Flash Memory)
1. -> FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
2. -> FF FF FF FF FF FF FF CC FF FF FF CC FF FF FF FF FF FF
3. -> 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
4. -> 33 FF FF FF FF FF FF CC FF FF FF CC FF FF FF FF FF FF (expected value with Read-Modify-Feature: 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 )
If I perform exactly the same but replacing the code operation with direct modification in Memory viewer , everything is ok
Looking at jlinklog, the CPU mem read and cache update are ok. See log attached (line 1383). But it looks the Flasher has its own cache that it is not up-to-date as it restores the former data.
Context :
- Embedded Studio 8.16
- Jlink software 7.98d
- Jlink base compact with last firmware.
Note: All the Flash memory has been excluded from Flash caching in jlink script file using JLINK_ExecCommand("ExcludeFlashCacheRange 0x00000000-0x0007FFFF"); as required.
My use is case is the following : My application is initializing 16 bytes at defined address of the Flash memory at startup, assuming the first byte is FFh.
- 1. Flash code -> memory is virgin -> All bytes are FFh
- 2. Using memory viewer, I modified some bytes (lets say 8th and 12th to CCh) into the buffer. The flasher runs and modifies the memory. Memory viewer shows the right data.
- 3. I run code and stop it just after my code performs memory initialization. Memory viewer shows the expected data : All the bytes are written with new value including 8th and 12th bytes
- 4. I use the memory viewer to modify first byte to 33h. The flasher runs but the result is not the good one. First byte is ok but 8th and 12th get the value written in dot 2 !!!!
@0x5000 (Flash Memory)
1. -> FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
2. -> FF FF FF FF FF FF FF CC FF FF FF CC FF FF FF FF FF FF
3. -> 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
4. -> 33 FF FF FF FF FF FF CC FF FF FF CC FF FF FF FF FF FF (expected value with Read-Modify-Feature: 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 )
If I perform exactly the same but replacing the code operation with direct modification in Memory viewer , everything is ok
Looking at jlinklog, the CPU mem read and cache update are ok. See log attached (line 1383). But it looks the Flasher has its own cache that it is not up-to-date as it restores the former data.
Context :
- Embedded Studio 8.16
- Jlink software 7.98d
- Jlink base compact with last firmware.
Note: All the Flash memory has been excluded from Flash caching in jlink script file using JLINK_ExecCommand("ExcludeFlashCacheRange 0x00000000-0x0007FFFF"); as required.
The post was edited 2 times, last by fjouen ().