boards/common/remote: fix JLink flashing and debug#9851
boards/common/remote: fix JLink flashing and debug#9851kYc0o wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
JLink flashing and debug was broken before this commit. I added the required variables to flash and also a reset command using JLink too, which turns to be more handy than the cc2538-bsl. An option to use it anyways is given.
|
Cool! Unfortunately I don't have a re-mote with JTAG header at hand. Personally I find it a bit confusing to have two default tools, defendant on what you do. Further, we won't need the newly introduced variable. I would go with cc2538-bsl as default. |
me neither, also I don't like to have JLINK reseter the default as it requires the JTAG header which is not on any remote by default. |
|
The requirements for the usage of the target The logic behind this PR is that murdock can run |
|
For background purposes: we are trying to find a solution to accommodate the ReMote in the CI. |
|
The purpose is fully clear as well as the usefulness. I didn't think about workers inability to get environmental variables. Still feels like the wrong fix but I have no alternative at hand so I won't NACK. Still needs to be tested though. |
it sounds like we should fix that, and not setting a default which will not work for most people, ie. those with unmodified remotes. Also its a counter intuitive to have the default flasher and reset using different tools. maybe @kaspar030 can help with the Murdock issue and explain how to pass or set ENV variables for workers. |
IMHO it seems quite complicated to "fix it" if there's something to fix. Let's say you send a command to the workers to flash and test for a specific board, then you need to make
I see the things like this: remote-revb didn't have a functional reset target since it was added to RIOT, nobody complained about it. A need raises which requires this reset functional, thus I added this functionality with the hope that it would solve the problem, but it didn't, though the functionality seemed nice and it stayed. Now I change the functionality to another default because that solves the problem for what I originally worked on it, and now it's counter intuitive... I agree actually, but it seems to me that this change hurts nobody and we can live with it. I should add a notice in the makefile though, to explicitly say that we can still use the script to reset the board. |
|
@kaspar030 any opinions here? |
|
Is this going to break someone's usecase? Seems not. |
|
On my side it currently lacks testing capabilities. We have a Segger debugger but currently no cable to connect this board, stupid... I already confirmed not to NACK this PR |
I'm still missing an analysis how exactly cc2538-bsl resets the remote, and why we cannot replicate that over serial. |
The cc2538-bsl communicates with the ROM bootloader embedded on the cc2538 with a specific protocol. The reset command is sent over the serial when a reboot is required, which consists in toggling RTS/DTR plus sending a command through the serial line. RTS/DTR pass through a PIC microcontroller which in turn talks with the cc2538, but I don't know the details on how, since toggling the lines performs no reset. Now, sending the reset command while doing |
|
I just tested this on a remote-reva and works as intended. PROGRAMMER=jlink BOARD=remote-reva make -C tests/shell/ flash testperforms the test. |
|
It seems that TI worked on some support for OpenOCD, see this PR and they have a fork of OpenOCD with a full support of their board. We are currently evaluating this on IoT-LAB. With their work, there would be no need for a custom setup and a JLink debugger. |
|
@aabadie seems like a nice feature for the future. However, I would guess that it might take a while until it gets mainline. So we don't need to obsolete this PR in favor of potential TI/OpenOCD support, right? @kaspar030 you had some open questions, do you agree with this PR now? |
I was very excited when I read this. However, when I went to the link you provided I found that the support is only intended to work on cc26xx/cc13xx chips, aiming to replace the uniflash tool which is currently needed to flash such devices (cc2538-bsl was never working for those ones). TL;DR: It doesn't work for our use case. |
Yes it does, we used it on IoT-LAB. There might a commit in the git history that provides support to cc2538 but I haven't looked at it in detail. |
Are you sure openocd can talk BSL protocol? It seems to me very complicated since the script we're using is closely coupled with the expected commands by the embedded ROM bootloader on cc2538. Can you point me at least to the IoT-Lab branch where you're using it? |
| export PROGRAMMER ?= cc2538-bsl | ||
|
|
||
| # define the default reset-tool | ||
| RESETER ?= jlink |
There was a problem hiding this comment.
I would not make jlink the default, because the pinout is not present by default but USB is. If you need that for testing on IoT lab or similar just set the environmental variable on that node accordingly.
There was a problem hiding this comment.
Well the point here is to make automated testing on Murdock slaves, where some testing boards are attached. I don't know if we can pass environmental variables to the command for flashing (e.g. make flash-only). @kaspar030 is that possible?
There was a problem hiding this comment.
I do not like to add the RESETER, PROGRAMMER variable is configuring this by default everywhere and it should be enough.
Murdock board slaves have local configuration on the system so can set PROGRAMMER. And if not, I would not force an inconsistent default value in RIOT just for this but solve it in murdock.
After changing this, it would be great to also update boards/cc2538dk in an upcoming PR as it is also duplicating JLink.
|
Any activity here or shall we just close? |
|
Let's close as archived. No real progress for over a year now. |
Contribution description
This PR fixes the flashing command using JLink, which is not currently working.
It makes use of the jlink.inc.mk Makefile which in turn configure and uses dist/tools/jlink/jlink.sh.
Flashing works correctly and is faster than cc2538-bsl, however it needs an external JLink adapter and to solder the header on the remote.
Additionally, I modified the reset command to use JLink by default, since the cc2538-bsl script is not very handy to perform
make test. With JLink that command works correctly and thus we can use it for CI HIL tests.Testing procedure
I've tested using a remote-revb.
PROGRAMMER=jlink BOARD=remote-revb make -C tests/shell/ flashshould use JLink as the flasher.make resetshould now by default use JLink, therefore, in order to continue using cc2538-bsl one needs to override the "reseter" as following:RESETER=cc2538-bsl.Issues/PRs references
#9428 added reset and this PR overrides the default reseter.