Reset and flashing etc. broken since v0.44.0 for ATSAM4L
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 560
- Avg merge
- 1h 41m
- Merged PRs (30d)
- 3
Description
I have a board with Atmel/Microchip ATSAM4LS8C (Cortex-M4). I have been using pyocd for flashing, debugging etc. without issues (utilizing an external CMSIS-Pack, since this chip is not available via pyocd pack find).
Starting with the v0.44.0 release of pyocd, flashing and even just resetting the chip wouldn't work anymore:
$ pyocd reset --target atsam4ls8c --pack ./Keil.SAM4_DFP.1.6.2.pack --verbose
0000307 I Target type is atsam4ls8c [board]
0000421 I DP IDR = 0x2ba01477 (v1 rev2) [dap]
0000446 I AHB-AP#0 IDR = 0x24770011 (AHB-AP var1 rev2) [discovery]
0000457 I AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=43b:Arm part=4c4) [rom_table]
0000467 I [0]<e000e000:SCS v7-M class=14 designer=43b:Arm part=000> [rom_table]
0000472 I [1]<e0001000:DWT v7-M class=14 designer=43b:Arm part=002> [rom_table]
0000477 I [2]<e0002000:FPB v7-M class=14 designer=43b:Arm part=003> [rom_table]
0000483 I [3]<e0000000:ITM v7-M class=14 designer=43b:Arm part=001> [rom_table]
0000491 I [4]<e0040000:TPIU M4 class=9 designer=43b:Arm part=9a1 devtype=11 archid=0000 devid=ca0:0:0> [rom_table]
0000503 I CPU core #0: Cortex-M4 r0p1, v7.0-M architecture [cortex_m]
0000503 I Extensions: [DSP, MPU] [cortex_m]
0000510 I 4 hardware watchpoints [dwt]
0000517 I 6 hardware breakpoints, 4 literal comparators [fpb]
0000533 I Performing DEFAULT reset... [reset_cmd]
0000537 E Error while running debug sequence 'ResetSystem' (core Cortex-M4): Memory transfer fault (SWD/JTAG communication failure (FAULT ACK)) [pack_target]
0000554 C Memory transfer fault (SWD/JTAG communication failure (FAULT ACK)) [__main__]
Resetting the chip without the pack file, i.e. running the generic reset, would work.
After bisecting it turns out that the breaking commit is 7e53e5ac ("Add support for default debug sequences"), part of #1939.
Steps to reproduce:
wget https://www.keil.com/pack/Keil.SAM4_DFP.1.6.2.pack
git checkout a922ee62 && pip3 install .
pyocd reset --target atsam4ls8c --pack ./Keil.SAM4_DFP.1.6.2.pack --verbose # works
git checkout 7e53e5ac && pip3 install .
pyocd reset --target atsam4ls8c --pack ./Keil.SAM4_DFP.1.6.2.pack --verbose # doesn't work anymore
Here is a LLM summary of the apparent cause of the regression (SAM4L_RESET_REGRESSION.md). Apparently pyocd performs a default reset sequence when none is defined in the pack file, and if I understand correctly that default has been changed in that commit.
Let me know if I can help in any way.
Thanks,
Patrick
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read SAM4L_RESET_REGRESSION.md and inspect commit 7e53e5ac, especially the default debug-sequence handling used by pack_target during reset. Reproduce with the listed pyocd reset commands at a922ee62 and 7e53e5ac using the Keil.SAM4_DFP.1.6.2.pack file. Done means packed ATSAM4LS8C reset and flashing work again without regressing generic reset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools, embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100