Open Thomas-Lawrence opened 2 years ago
Any suggestions to fix the issue?
(Apologies for taking a long time to reply! 🙇🏽)
Thanks for providing a detailed report.
The exceptions suggest that the XML from the CMSIS-Pack is malformed. I'll have to take a look and verify this—will get back to you on this.
Because the Pack wasn't successfully read, the memory map probably isn't complete and is missing the flash information. So pyocd might have tried to write to flash as if it were RAM, which clearly isn't going to end well… 😄
If the Pack XML is really malformed, the best option is to extract a copy locally and fix the XML. Then you can use the expanded pack with pyocd's --pack
argument. (And try to report the issue to GigaDevice.)
Hi Flit, I have also tried to add a built-in target for the same as per the documentation, but there also am getting the same memory transfer fault. I have verified the memory mapping and the flash algorithm generated and seems to be correct. When tried with the 'basic_test.py' script, and can perform the basic operations but when trying to access anything above 0x8000000 would give memory transfer fault. see below log,
# Probe Unique ID
-------------------------------------------------------------------------------------
0 ARM CMSIS-DAP v1 0000000300190051044ab7bd00000c120000000097969921
1 Segger 3rd party CMSIS-DAP 1045103829
Enter the number of the debug probe or 'q' to quit> 0
INFO:pyocd.core.session:Using config options for probe 0000000300190051044ab7bd00000c120000000097969921
INFO:pyocd.board.board:Target type is gd32f3x0
INFO:pyocd.coresight.dap:DP IDR = 0x2ba01477 (v1 rev2)
INFO:pyocd.coresight.ap:AHB-AP#0 IDR = 0x24770011 (AHB-AP var1 rev2)
INFO:pyocd.coresight.rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=751 part=61e)
INFO:pyocd.coresight.rom_table:[0]<e000e000:SCS v7-M class=14 designer=43b part=00c>
INFO:pyocd.coresight.rom_table:[1]<e0001000:DWT v7-M class=14 designer=43b part=002>
INFO:pyocd.coresight.rom_table:[2]<e0002000:FPB v7-M class=14 designer=43b part=003>
INFO:pyocd.coresight.rom_table:[3]<e0000000:ITM v7-M class=14 designer=43b part=001>
INFO:pyocd.coresight.rom_table:[4]<e0040000:TPIU M4 class=9 designer=43b part=9a1 devtype=11 archid=0000 devid=ca0:0:0>
INFO:pyocd.coresight.cortex_m:CPU core #0 is Cortex-M4 r0p1
INFO:pyocd.coresight.cortex_m:FPU present: FPv4-SP-D16-M
INFO:pyocd.coresight.dwt:4 hardware watchpoints
INFO:pyocd.coresight.fpb:6 hardware breakpoints, 4 literal comparators
binary file: c:\pyOCD\test\data\binaries\test.bin
------ GET Unique ID ------
Unique ID: 0000000300190051044ab7bd00000c120000000097969921
------ TEST READ / WRITE CORE REGISTER ------
initial pc: 0x20000000
now pc: 0x3D82
initial pc value rewritten: 0x20000000
MSP = 0x20000340; PSP = 0xb3dae710
CONTROL = 0x00; FAULTMASK = 0x01; BASEPRI = 0x00; PRIMASK = 0x00
New PRIMASK = 0x01
Restored PRIMASK = 0x00
S0 = 9.27586e+23 (0x67446c84)
New S0 = 3.14159 (0x40490fdb)
Restored S0 = 9.27586e+23 (0x67446c84)
------ TEST HALT / RESUME ------
resume
halt
HALT: pc: 0x20000000
------ TEST STEP ------
reset and halt
HALT: pc: 0xFFFFFFFE
step
STEP: pc: 0xFFFFFFFE
step
STEP: pc: 0xFFFFFFFE
step
STEP: pc: 0xFFFFFFFE
step
STEP: pc: 0xFFFFFFFE
------ TEST RANGE STEP ------
range start = 0x20001fb8; range_end = 0x20001fca
wrote range test step code to RAM successfully
start PC: 0x20001FB8
end PC: 0x20001FCA
start PC: 0x20001FB8
end PC: 0x20001FCA
halt reason: DEBUG (should be BREAKPOINT)
------ TEST READ / WRITE MEMORY ------
READ32/WRITE32
write32 0x2C0AE577 at 0x20000000
read32 at 0x20000000: 0x2C0AE577
READ16/WRITE16
write16 0xB2A1 at 0x20000002
read16 at 0x20000002: 0xB2A1
READ8/WRITE8
write8 0xC9 at 0x20000001
read8 at 0x20000001: 0xC9
------ TEST READ / WRITE MEMORY BLOCK ------
TEST PASSED
------ TEST RESET ------
pc: 0xFFFFFFFE
pc: 0xFFFFFFFE
pc: 0xFFFFFFFE
pc: 0xFFFFFFFE
pc: 0xFFFFFFFE
------ TEST PROGRAM/ERASE PAGE ------
Erasing sector @ 0x800f400 (1024 bytes)
<Memory transfer fault here.....>
Hi Flit, Any suggestions to fix the issue?
GigaDevice.GD32F30x_DFP.2.2.0.pack had all their SVDs malformed - whitespace at the start of 1st line. Not sure why this is not an issue with Keil, but pyocd behaves correctly as in 'it is indeed a malformed xml'. So fix unpack the pack, rename svds to xml and try to open in a browser. If that fails, need to fix svd and repack back to the pack. This is how I fixed mine, your issue could be similar. Hope this helps
OS
Windows
Pyocd Version
0.33.1
DFP info
Debug probe
CMSIS-DAP v1
Command
ERROR
Note
I was able to erase the device using erase command but when I try to flash its throwing the above error.