7
31
Fork
You've already forked blackmagic
23

Reversions, cleanup, and fixes to the scanchain systems #978

Merged
esden merged 12 commits from scanchain-cleanup into master 2022年03月15日 05:37:44 +01:00

This set of commits seeks to address issues in the current JTAG scanchain detection and setup code.

The first problem this addresses is the way in which the post-scanchain-detection handler init is done as the table of ID Codes to handlers is needed for a future PR to provide support for JTAG-PDI, and passing the entire jtag_devs slot structure to the handler is horridly wasteful for information that can be gleaned a different way without this layering violation.

The second problem is in how chain scanning is being performed - the old code works a very particular way and this is necessary for correctly detecting things like ATXMega devices.

The third is the conflation of SWD and JTAG scan that is occurring, which is only partially addressed by this PR as SWD being able to defer on failure to JTAG at all is a violation of the boundy set by having specific jtag_scan and swd_scan monitor commands - a future PR will be submitted that entirely removes this deferral and introduces an auto_scan command that allows the BlackMagic Probe Firmware to slew through a pile of scan chain possibilities and try and auto-detect what is present.

This set of commits seeks to address issues in the current JTAG scanchain detection and setup code. The first problem this addresses is the way in which the post-scanchain-detection handler init is done as the table of ID Codes to handlers is needed for a future PR to provide support for JTAG-PDI, and passing the entire jtag_devs slot structure to the handler is horridly wasteful for information that can be gleaned a different way without this layering violation. The second problem is in how chain scanning is being performed - the old code works a very particular way and this is necessary for correctly detecting things like ATXMega devices. The third is the conflation of SWD and JTAG scan that is occurring, which is only partially addressed by this PR as SWD being able to defer on failure to JTAG at all is a violation of the boundy set by having specific `jtag_scan` and `swd_scan` monitor commands - a future PR will be submitted that entirely removes this deferral and introduces an `auto_scan` command that allows the BlackMagic Probe Firmware to slew through a pile of scan chain possibilities and try and auto-detect what is present.
UweBonnes commented 2022年01月22日 14:05:53 +01:00 (Migrated from github.com)
Copy link

Please break up in several PRs. b502a43, 1b677c5, d693647 are mostly syntactical fixes. Removal of the "auto-scan" is user interface change . For reverting the JTAG detection scheme, I think an issue to discuss is worth the effort. I have to access the impact on the RiscV and AVR8 branch. If jtag_scan again needs the irlens argument to scan through unknown chains, I think this would be a regression.

Please break up in several PRs. b502a43, 1b677c5, d693647 are mostly syntactical fixes. Removal of the "auto-scan" is user interface change . For reverting the JTAG detection scheme, I think an issue to discuss is worth the effort. I have to access the impact on the RiscV and AVR8 branch. If jtag_scan again needs the irlens argument to scan through unknown chains, I think this would be a regression.
esden (Migrated from github.com) reviewed 2022年03月14日 04:09:57 +01:00
esden (Migrated from github.com) left a comment
Copy link

Overall it looks good to me. I am happy to merge this after the other questions are answered or amended.

Overall it looks good to me. I am happy to merge this after the other questions are answered or amended.
@ -104,4 +101,4 @@
#define AP_DESIGNER_ARM 0x43b
/*LPC845 with designer 501. Strange!? */
#define AP_DESIGNER_SPECULAR 0x501
#define AP_DESIGNER_CS 0x555
esden (Migrated from github.com) commented 2022年03月14日 04:01:33 +01:00
Copy link

Why are we loosing these defines? (It is missing the AP_ prefix but it might be useful in the future. Unless it is wrong.

Why are we loosing these defines? (It is missing the `AP_` prefix but it might be useful in the future. Unless it is wrong.
esden (Migrated from github.com) commented 2022年03月14日 04:02:00 +01:00
Copy link

Same here as for the removed XILINX designer.

Same here as for the removed XILINX designer.
@ -25,37 +26,47 @@
esden (Migrated from github.com) commented 2022年03月14日 04:05:47 +01:00
Copy link

If we are removing the manufacturer description above for the ST parts then we probably should remove Atmel here? (and on the line below)

If we are removing the manufacturer description above for the ST parts then we probably should remove Atmel here? (and on the line below)
@ -104,4 +101,4 @@
#define AP_DESIGNER_ARM 0x43b
/*LPC845 with designer 501. Strange!? */
#define AP_DESIGNER_SPECULAR 0x501
#define AP_DESIGNER_CS 0x555
Author
Owner
Copy link

It didn't look to be for any ARM processors, so it didn't belong in this header - if this is actually the MFR code for something like the Zynq, then we'll reinstate it.

It didn't look to be for any ARM processors, so it didn't belong in this header - if this is actually the MFR code for something like the Zynq, then we'll reinstate it.
Author
Owner
Copy link

Same reasoning as with the Xilinx code. We don't have any of their processors to test with though unlike Xilinx Zynq.

Same reasoning as with the Xilinx code. We don't have any of their processors to test with though unlike Xilinx Zynq.
@ -25,37 +26,47 @@
Author
Owner
Copy link

Sure, we can do that

Sure, we can do that
UweBonnes commented 2022年03月14日 13:33:37 +01:00 (Migrated from github.com)
Copy link

I still urge to break up this PR in smaller, unrelated ones. This mixes up changes to the scan system with other things like syntactical changes and user interface changes.
The scan system targeted to revert is used in the present way in the riscv branch #924 and https://github.com/UweBonnes/blackmagic/tree/avr (able to flash JTAG-AVRs and some Xilinx parts). Does the present way really not find the XMega? The present way tries more auto-detection on unknown chains, while the ability to provide scan length number is still given.

Of course auto/swd/jtag scan is a good idea, but still worth it's own PR.

I still urge to break up this PR in smaller, unrelated ones. This mixes up changes to the scan system with other things like syntactical changes and user interface changes. The scan system targeted to revert is used in the present way in the riscv branch #924 and <https://github.com/UweBonnes/blackmagic/tree/avr> (able to flash JTAG-AVRs and some Xilinx parts). Does the present way really not find the XMega? The present way tries more auto-detection on unknown chains, while the ability to provide scan length number is still given. Of course auto/swd/jtag scan is a good idea, but still worth it's own PR.
esden (Migrated from github.com) reviewed 2022年03月15日 05:34:33 +01:00
@ -104,4 +101,4 @@
#define AP_DESIGNER_ARM 0x43b
/*LPC845 with designer 501. Strange!? */
#define AP_DESIGNER_SPECULAR 0x501
#define AP_DESIGNER_CS 0x555
esden (Migrated from github.com) commented 2022年03月15日 05:34:33 +01:00
Copy link

As discussed, this is being added back in through the upcoming scanchain-xilinx branch.

As discussed, this is being added back in through the upcoming scanchain-xilinx branch.
esden commented 2022年03月15日 05:37:38 +01:00 (Migrated from github.com)
Copy link

There is a bunch of patches in the pipeline that will improve things regarding device detection and supporting new platforms. They depend on this cleanup patch. I agree that we should strive to make pull requests transparent and focused on one task. But after talking to @DX-MON I think we will have to make an exception in this particular case. So I am merging this.

Thanks for the hard work @DX-MON :)

There is a bunch of patches in the pipeline that will improve things regarding device detection and supporting new platforms. They depend on this cleanup patch. I agree that we should strive to make pull requests transparent and focused on one task. But after talking to @DX-MON I think we will have to make an exception in this particular case. So I am merging this. Thanks for the hard work @DX-MON :)
Sign in to join this conversation.
No reviewers
Labels
Clear labels
BMD App
Black Magic Debug App (aka. PC hosted) (not firmware)
BMP Firmware
Black Magic Probe Firmware (not PC hosted software)
Bug
Confirmed bug
Build system
Build system
Can't reproduce
Maintainers can't reproduce this problem
CI
Continuous Integration System
Contribution wanted
User contributions welcome
Documentation
Project documentation
Draft
Work in progress draft
Duplicate
This issue or pull request already exists
Enhancement
General project improvement
Feedback wanted
Requires additional submitter feedback
Foreign Host Board
Non Native hardware to runing Black Magic firmware on
GDB
Issue/PR related to GDB
Good first issue
Good for newcommers
HwIssue Mitigation
Solving or mitigating a Hardware issue in Software
Information Needed
Maintainers need more information
NativeHardware
Official Black Magic Debug Hardware
New Host Board
New hardware to run Black Magic firmware on
New Target
New debug target
Off Topic
Something that does not involve the project in any way
Potential Bug
A potential, unconfirmed or very special circumstance bug
Regression
Bug caused by a regression
User Interest Needed
More user interest required before consideration
User Testing Needed
Looking for user testing reports
Won't fix
Outside of the project scope or works as intended
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
blackmagic-debug/blackmagic!978
Reference in a new issue
blackmagic-debug/blackmagic
No description provided.
Delete branch "scanchain-cleanup"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?