using the latest freedom sdk from sifive
FLASHING (this looks like my test0.hex (which has the correct bytes) was properly flashed to 0x20000000)
nlivic@null:~/rv2/freedom-e-sdk$ make upload
scripts/upload --hex /home/nlivic/rv2/freedom-e-sdk/software/test0/debug/test0.hex --jlink JLinkExe
SEGGER J-Link Commander V6.70 (Compiled Mar 27 2020 14:37:00)
DLL version V6.70, compiled Mar 27 2020 14:36:47
Connecting to J-Link via USB...O.K.
Firmware: J-Link V11 compiled Mar 19 2020 11:11:08
Hardware version: V11.00
S/N: 601001907
License(s): RDI, FlashBP, FlashDL, JFlash, GDB
VTref=3.309V
Device "FE310" selected.
Connecting to target via JTAG
ConfigTargetSettings() start
ConfigTargetSettings() end
TotalIRLen = 5, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x20000913, IRLen: 05, Unknown device
Debug architecture:
RISC-V debug: 0.13
AddrBits: 7
DataBits: 32
IdleClks: 5
Memory access:
Via system bus: No
Via ProgBuf: Yes (16 ProgBuf entries)
DataBuf: 1 entries
autoexec[0] implemented: Yes
Detected: RV32 core
CSR access via abs. commands: No
Temp. halted CPU for NumHWBP detection
HW instruction/data BPs: 8
Support set/clr BPs while running: No
HW data BPs trigger before execution of inst
RISC-V identified.
J-Link>Downloading file [/home/nlivic/rv2/freedom-e-sdk/software/test0/debug/test0.hex]...
Comparing flash [100%] Done.
Erasing flash [100%] Done.
Programming flash [100%] Done.
Verifying flash [100%] Done.
J-Link: Flash download: Bank 0 @ 0x20000000: 1 range affected (65536 bytes)
J-Link: Flash download: Total time needed: 2.873s (Prepare: 0.067s, Compare: 0.768s, Erase: 0.157s, Program: 1.101s, Verify: 0.769s, Restore: 0.009s)
O.K.
J-Link>ConfigTargetSettings() start
ConfigTargetSettings() end
TotalIRLen = 5, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x20000913, IRLen: 05, Unknown device
Debug architecture:
RISC-V debug: 0.13
AddrBits: 7
DataBits: 32
IdleClks: 5
Memory access:
Via system bus: No
Via ProgBuf: Yes (16 ProgBuf entries)
DataBuf: 1 entries
autoexec[0] implemented: Yes
Detected: RV32 core
CSR access via abs. commands: No
HW instruction/data BPs: 8
Support set/clr BPs while running: No
HW data BPs trigger before execution of inst
RISC-V: Performing reset via <ndmreset>
test0.hex
:020000042001D9
:100000009711FF5F938181289702000093828205F8
:100010007390523093020000638402007350107C8E
:100020001701FFDF130101FE9700FFDF938080FDC2
:10003000638300008290732540F181450146812051
:100040009700FFDF938000FC63830000829097029B
[truncated]
GDB
(gdb) monitor long 0x20000004
Reading from address 0x20000004 (Data = 0x0B018193)
(gdb) monitor long 0x20000008
Reading from address 0x20000008 (Data = 0x00004297)
(gdb) monitor long 0x2000000c
Reading from address 0x2000000C (Data = 0x60428293)
(gdb) monitor long 0x2000000b
Reading from address 0x2000000B (Data = 0x42829300)
(gdb) monitor long 0x2000000c
Reading from address 0x2000000C (Data = 0x60428293)
(gdb) monitor long 0x20000010
Reading from address 0x20000010 (Data = 0x30529073)
(gdb) monitor long 0x20000014
Reading from address 0x20000014 (Data = 0x00000293)
(gdb) monitor long 0x20000018
Reading from address 0x20000018 (Data = 0x00028463)
(gdb) monitor long 0x2000001c
Reading from address 0x2000001C (Data = 0x7C105073)
(gdb) monitor long 0x20000020
Reading from address 0x20000020 (Data = 0xE0000117)
(gdb) monitor long 0x20000024
Reading from address 0x20000024 (Data = 0xFE010113)
(gdb) monitor long 0x20000028
Reading from address 0x20000028 (Data = 0xE0000097)
(gdb) monitor long 0x2000002c
Reading from address 0x2000002C (Data = 0xFD808093)
(gdb) monitor long 0x20000030
Reading from address 0x20000030 (Data = 0x00008363)
(gdb) monitor long 0x20000034
Reading from address 0x20000034 (Data = 0x25739082)
Question
So at address 0x20000004 we should have the value: 93818128 (0x28818193) BUT actually have 0x0B018193. So even though J-Link outputs J-Link: Flash download: Bank 0 @ 0x20000000: 1 range affected (65536 bytes), any idea why, starting at 0x20000000, these locations are not actually overwritten with new code? thanks!!
FLASHING (this looks like my test0.hex (which has the correct bytes) was properly flashed to 0x20000000)
nlivic@null:~/rv2/freedom-e-sdk$ make upload
scripts/upload --hex /home/nlivic/rv2/freedom-e-sdk/software/test0/debug/test0.hex --jlink JLinkExe
SEGGER J-Link Commander V6.70 (Compiled Mar 27 2020 14:37:00)
DLL version V6.70, compiled Mar 27 2020 14:36:47
Connecting to J-Link via USB...O.K.
Firmware: J-Link V11 compiled Mar 19 2020 11:11:08
Hardware version: V11.00
S/N: 601001907
License(s): RDI, FlashBP, FlashDL, JFlash, GDB
VTref=3.309V
Device "FE310" selected.
Connecting to target via JTAG
ConfigTargetSettings() start
ConfigTargetSettings() end
TotalIRLen = 5, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x20000913, IRLen: 05, Unknown device
Debug architecture:
RISC-V debug: 0.13
AddrBits: 7
DataBits: 32
IdleClks: 5
Memory access:
Via system bus: No
Via ProgBuf: Yes (16 ProgBuf entries)
DataBuf: 1 entries
autoexec[0] implemented: Yes
Detected: RV32 core
CSR access via abs. commands: No
Temp. halted CPU for NumHWBP detection
HW instruction/data BPs: 8
Support set/clr BPs while running: No
HW data BPs trigger before execution of inst
RISC-V identified.
J-Link>Downloading file [/home/nlivic/rv2/freedom-e-sdk/software/test0/debug/test0.hex]...
Comparing flash [100%] Done.
Erasing flash [100%] Done.
Programming flash [100%] Done.
Verifying flash [100%] Done.
J-Link: Flash download: Bank 0 @ 0x20000000: 1 range affected (65536 bytes)
J-Link: Flash download: Total time needed: 2.873s (Prepare: 0.067s, Compare: 0.768s, Erase: 0.157s, Program: 1.101s, Verify: 0.769s, Restore: 0.009s)
O.K.
J-Link>ConfigTargetSettings() start
ConfigTargetSettings() end
TotalIRLen = 5, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x20000913, IRLen: 05, Unknown device
Debug architecture:
RISC-V debug: 0.13
AddrBits: 7
DataBits: 32
IdleClks: 5
Memory access:
Via system bus: No
Via ProgBuf: Yes (16 ProgBuf entries)
DataBuf: 1 entries
autoexec[0] implemented: Yes
Detected: RV32 core
CSR access via abs. commands: No
HW instruction/data BPs: 8
Support set/clr BPs while running: No
HW data BPs trigger before execution of inst
RISC-V: Performing reset via <ndmreset>
test0.hex
:020000042001D9
:100000009711FF5F938181289702000093828205F8
:100010007390523093020000638402007350107C8E
:100020001701FFDF130101FE9700FFDF938080FDC2
:10003000638300008290732540F181450146812051
:100040009700FFDF938000FC63830000829097029B
[truncated]
GDB
(gdb) monitor long 0x20000004
Reading from address 0x20000004 (Data = 0x0B018193)
(gdb) monitor long 0x20000008
Reading from address 0x20000008 (Data = 0x00004297)
(gdb) monitor long 0x2000000c
Reading from address 0x2000000C (Data = 0x60428293)
(gdb) monitor long 0x2000000b
Reading from address 0x2000000B (Data = 0x42829300)
(gdb) monitor long 0x2000000c
Reading from address 0x2000000C (Data = 0x60428293)
(gdb) monitor long 0x20000010
Reading from address 0x20000010 (Data = 0x30529073)
(gdb) monitor long 0x20000014
Reading from address 0x20000014 (Data = 0x00000293)
(gdb) monitor long 0x20000018
Reading from address 0x20000018 (Data = 0x00028463)
(gdb) monitor long 0x2000001c
Reading from address 0x2000001C (Data = 0x7C105073)
(gdb) monitor long 0x20000020
Reading from address 0x20000020 (Data = 0xE0000117)
(gdb) monitor long 0x20000024
Reading from address 0x20000024 (Data = 0xFE010113)
(gdb) monitor long 0x20000028
Reading from address 0x20000028 (Data = 0xE0000097)
(gdb) monitor long 0x2000002c
Reading from address 0x2000002C (Data = 0xFD808093)
(gdb) monitor long 0x20000030
Reading from address 0x20000030 (Data = 0x00008363)
(gdb) monitor long 0x20000034
Reading from address 0x20000034 (Data = 0x25739082)
Question
So at address 0x20000004 we should have the value: 93818128 (0x28818193) BUT actually have 0x0B018193. So even though J-Link outputs J-Link: Flash download: Bank 0 @ 0x20000000: 1 range affected (65536 bytes), any idea why, starting at 0x20000000, these locations are not actually overwritten with new code? thanks!!