-
Notifications
You must be signed in to change notification settings - Fork 2.1k
boards: board<->debugger separation #7686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
891fec2
to
4df35d2
Compare
Refactored USB serial handling for the edbg tool to match openocd |
44294cd
to
cd9bb85
Compare
|
a34a166
to
a09c3ef
Compare
I would very much like this PR to be merged early in the next release cycle to avoid having to rebase this for every new board`that is added during the cycle. @kYc0o Do you think you will have time to review this during next two weeks? |
Yes! I need it for my OTA stuff, expect a review very soon! |
81c5d3e
to
47a2acc
Compare
rebased after dependency was merged |
Thanks for rebasing. I think the commit list is quite long. Can you maybe add only one commit for all the boards? The change is the same so I think a commit is enough and self-explanatory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this seems to improve the situation mostly for "common" boards, like nucleo or kinetis. However I don't see too much improvement when the files were moved (and simplified, that's nice) from the board directory to the common one.
Is there maybe a way to get rid completely of the config files and (even if it's somehow ugly) unify the definitions in a single file?
|
||
source [find target/stm32f4x.cfg] | ||
|
||
reset_config srst_only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the stm32f4discovery board configuration and stripped the interface configuration.
http://repo.or.cz/openocd.git/blob/refs/heads/master:/tcl/board/stm32f4discovery.cfg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I don't have the board to test it, but I observed this change somewhere else. I will try to test it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stm32 discovery boards have the same kind of change, if you have any of those?
sh -c "${OPENOCD} -f '${OPENOCD_CONFIG}' \ | ||
sh -c "${OPENOCD} \ | ||
${OPENOCD_ADAPTER_INIT} \ | ||
-f '${OPENOCD_CONFIG}' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't possible to factorise these 3 repeated commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I don't see the benefit of concatenating three variables into one when it's only in 3-4 places. It would make the script less readable though in my opinion.
@@ -3,6 +3,14 @@ EDBG ?= $(RIOT_EDBG) | |||
FLASHER ?= $(EDBG) | |||
OFLAGS ?= -O binary | |||
HEXFILE = $(ELFFILE:.elf=.bin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't this already been fixed in the previous PR? Or it was only done for OpenOCD?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, this should be IMAGE_FILE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, actually, it's still HEXFILE because that is the target of the OBJCOPY make rule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it's just that it looks wrong and needs to be fixed. I wouldn't mind to fix it in this PR but if you prefer it can be a following PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to keep this PR focused on separating the openocd configuration from the board Makefiles and do any other improvements in separate pulls.
It would be possible to remove the configuration files completely for some of the boards by introducing something at the CPU level for a default basic config. Some boards may need some more elaborate configuration so it won't eliminate them completely. |
ping @kYc0o |
Oops, sorry, this slipped in the queue. Yes, I have some ST-Link boards, I'll test asap. |
I guess testing most of the adaptors should be enough? |
Yes, I don't think we need to test all boards for this. |
For mulle I have this: embedded:startup.tcl:60: Error: Can't find /Users/facosta/git/RIOT2/RIOT/board/mulle/dist/openocd/mulle-programmer-0.70.cfg Otherwise I still don't like the things about ### Flashing Target ###
### Flashing at address 0x0 ###
HEXFILE found which should use an ELF file... |
34eee31
to
89b1214
Compare
@kYc0o fixed typo in the openocd config file name for mulle. Will test this PR with actual mulle programmer hardware later today. |
@kYc0o this PR does not touch the jlink.sh script (JLinkGDBServer launcher), it only touches the boards which use a jlink adapter with openocd.sh. |
@kYc0o A suggestion for a future improvement is to implement some kind of debug tool selection, like DEBUG_TOOL=openocd for using openocd.sh or DEBUG_TOOL=jlink for JLinkGDBServer. Others are also possible, like DEBUG_TOOL=avrdude. But this PR is large enough already in my opinion, and I don't have any experience with those other tools, only openocd. |
6bbd902
to
c045198
Compare
Tested and working on mulle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. Please squash.
c045198
to
6ccbf07
Compare
squashed, need to check if there have been any new boards since last rebase.. |
Added a config change for the bluepill board which was added after this PR was opened. |
# programmer board serial number. | ||
|
||
# Fall back to PROGRAMMER_SERIAL for backwards compatibility | ||
export DEBUG_ADAPTER_ID ?= $(PROGRAMMER_SERIAL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if for this just an announce that it changed would be enough... but let's keep it for now...
Murdock agreed, please squash again. |
Attempt to decouple board configuration from debugger interface configuration by specifying the DEBUG_IFACE variable for the debug hardware interface to use.
2d90c52
to
f4e9cad
Compare
squashed |
Excellent! Then go! |
The main goal of this PR is to reduce code duplication (look how many openocd.cfg files are almost identical in the repo). The unification of the debugger interface Makefiles will also make the debugger selection via USB serial number string available to all boards, instead of having different kludges in each board Makefile.
A secondary goal is to allow using any supported debug interface adapter (JTAG/SWD adapters etc.) to debug any supported board. This is especially useful when working with custom boards without integrated debug adapter or development boards which are installed in things where the original debug adapter connection (USB port) is physically inaccessible, but a JTAG header is available.
New environment variables for selecting debug adapter:
DEBUG_ADAPTER
: select which type of debugger should be used for flash programming and for debuggingDEBUG_ADAPTER_ID
: Use this identification to select which programmer to use when more than one device is connected to the same host machine. This is usually the USB serial number, found fromlist-ttys.sh
orlsusb -v
, but it is implementation specific to each debug adapter type.So far only Segger J-Link, CMSIS DAP, and Eistec Mulle are supported via the DEBUG_ADAPTER_ID selectionTODO:
Depends on #7685Testing status: