-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Makefile.include: set default PROGRAMMER value when flashing on IoT-LAB #12317
Conversation
d296051
to
c81c1cc
Compare
Makefile.include
Outdated
@@ -106,6 +106,11 @@ OS := $(shell uname) | |||
# set python path, e.g. for tests | |||
PYTHONPATH := $(RIOTBASE)/dist/pythonlibs/:$(PYTHONPATH) | |||
|
|||
# set default PROGRAMMER value if flashing a board on IoT-LAB | |||
ifneq (,$(IOTLAB_NODE)) | |||
PROGRAMMER = iotlab |
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.
Keep it with ?=
to allow easily overwriting it from the environment in case it is required.
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.
Done and comment added.
It is possible to define an unknown PROGRAMMER without errors since your cleanup in b3b0cd9 and a4463be Unfortunately, right now this must indeed be done at the beginning and processing the I could currently see some issue when building the |
I'll add a comment about that. Do you think the actual position is ok ?
That would be cleaner indeed. I'll change for that. |
c81c1cc
to
556be74
Compare
@cladmi are you ok with the changes now? |
Comment is good. I did not thought about the location. As your comment is saying, it does not need to be that early. Before docker is even maybe problematic or implying there is a reason for be there. |
This will avoid to load edbg logic and especially adds it to the list of FLASHDEPS: it won't be unnecessarily built when flashing a samr21-xpro/arduino-zero board on IoT-LAB
556be74
to
06123ef
Compare
👍 |
I moved the change right after PREFIX is exported. Directly amended. |
@fjmolinas, I think we are good here. Any chance you could try and ACK ? |
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.
Changes look good and make sense, I can see the issue and that this fixes it:
master: make BOARD=samr21-xpro IOTLAB_NODE=auto-ssh -C examples/hello-world flash
make BOARD=samr21-xpro IOTLAB_NODE=auto-ssh -C examples/hello-world flash
make: Entering directory '/home/francisco/workspace/RIOT/examples/hello-world'
Building application "hello-world" for "samr21-xpro" with MCU "samd21".
"make" -C /home/francisco/workspace/RIOT/boards/samr21-xpro
"make" -C /home/francisco/workspace/RIOT/core
"make" -C /home/francisco/workspace/RIOT/cpu/samd21
"make" -C /home/francisco/workspace/RIOT/cpu/cortexm_common
"make" -C /home/francisco/workspace/RIOT/cpu/cortexm_common/periph
"make" -C /home/francisco/workspace/RIOT/cpu/sam0_common
"make" -C /home/francisco/workspace/RIOT/cpu/sam0_common/periph
"make" -C /home/francisco/workspace/RIOT/cpu/samd21/periph
"make" -C /home/francisco/workspace/RIOT/drivers
"make" -C /home/francisco/workspace/RIOT/drivers/periph_common
"make" -C /home/francisco/workspace/RIOT/sys
"make" -C /home/francisco/workspace/RIOT/sys/auto_init
"make" -C /home/francisco/workspace/RIOT/sys/newlib_syscalls_default
"make" -C /home/francisco/workspace/RIOT/sys/pm_layered
"make" -C /home/francisco/workspace/RIOT/sys/stdio_uart
text data bss dec hex filename
8484 120 2560 11164 2b9c /home/francisco/workspace/RIOT/examples/hello-world/bin/samr21-xpro/hello-world.elf
[INFO] edbg binary not found - building it from source now
CC= CFLAGS= make -C /home/francisco/workspace/RIOT/dist/tools/edbg
rm -Rf /home/francisco/workspace/RIOT/dist/tools/edbg/bin
mkdir -p /home/francisco/workspace/RIOT/dist/tools/edbg/bin
/home/francisco/workspace/RIOT/dist/tools/git/git-cache clone "https://github.com/ataradov/edbg" "4f5d490bfffc7fd10855e513e6e88be5a9a3f789" "/home/francisco/workspace/RIOT/dist/tools/edbg/bin"
Cloning into '/home/francisco/workspace/RIOT/dist/tools/edbg/bin'
In iotlab:
make: Entering directory '/senslab/users/molina/RIOT/examples/hello-world'
[INFO] edbg binary not found - building it from source now
CC= CFLAGS= make -C /senslab/users/molina/RIOT/dist/tools/edbg
if [ 4f5d490bfffc7fd10855e513e6e88be5a9a3f789 != 4f5d490bfffc7fd10855e513e6e88be5a9a3f789 ] ; then \
git -C /senslab/users/molina/RIOT/dist/tools/edbg/bin clean -xdff ; \
git -C /senslab/users/molina/RIOT/dist/tools/edbg/bin fetch "https://github.com/ataradov/edbg" "4f5d490bfffc7fd10855e513e6e88be5a9a3f789" ; \
git -C /senslab/users/molina/RIOT/dist/tools/edbg/bin checkout -f 4f5d490bfffc7fd10855e513e6e88be5a9a3f789 ; \
touch /senslab/users/molina/RIOT/dist/tools/edbg/bin/.git-downloaded ; \
fi
env -i PATH="/opt/gcc-arm-none-eabi-7-2018-q2-update/bin:/opt/gcc-arm-none-eabi-4_9-2015q1/bin:/opt/mspgcc-3.2.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin" TERM="xterm-256color" "make" -C "/senslab/users/molina/RIOT/dist/tools/edbg/bin"
make: Entering directory '/senslab/users/molina/RIOT/dist/tools/edbg/bin'
gcc -W -Wall -Wextra -O2 -std=gnu11 dap.c edbg.c target.c target_atmel_cm0p.c target_atmel_cm3.c target_atmel_cm4.c target_atmel_cm7.c target_atmel_cm4v2.c target_mchp_cm23.c dbg_lin.c -ludev -o edbg
dbg_lin.c:42:21: fatal error: libudev.h: No such file or directory
#include <libudev.h>
^
compilation terminated.
Makefile:46: recipe for target 'edbg' failed
make: *** [edbg] Error 1
make: Leaving directory '/senslab/users/molina/RIOT/dist/tools/edbg/bin'
Makefile:13: recipe for target 'all' failed
make[1]: *** [all] Error 2
/senslab/users/molina/RIOT/makefiles/tools/targets.inc.mk:16: recipe for target '/senslab/users/molina/RIOT/dist/tools/edbg/edbg' failed
make: *** [/senslab/users/molina/RIOT/dist/tools/edbg/edbg] Error 2
make: Leaving directory '/senslab/users/molina/RIOT/examples/hello-world'
pr: make BOARD=samr21-xpro IOTLAB_NODE=auto-ssh -C examples/hello-world flash
make: Entering directory '/home/francisco/workspace/RIOT/examples/hello-world'
Building application "hello-world" for "samr21-xpro" with MCU "samd21".
"make" -C /home/francisco/workspace/RIOT/boards/samr21-xpro
"make" -C /home/francisco/workspace/RIOT/core
"make" -C /home/francisco/workspace/RIOT/cpu/samd21
"make" -C /home/francisco/workspace/RIOT/cpu/cortexm_common
"make" -C /home/francisco/workspace/RIOT/cpu/cortexm_common/periph
"make" -C /home/francisco/workspace/RIOT/cpu/sam0_common
"make" -C /home/francisco/workspace/RIOT/cpu/sam0_common/periph
"make" -C /home/francisco/workspace/RIOT/cpu/samd21/periph
"make" -C /home/francisco/workspace/RIOT/drivers
"make" -C /home/francisco/workspace/RIOT/drivers/periph_common
"make" -C /home/francisco/workspace/RIOT/sys
"make" -C /home/francisco/workspace/RIOT/sys/auto_init
"make" -C /home/francisco/workspace/RIOT/sys/newlib_syscalls_default
"make" -C /home/francisco/workspace/RIOT/sys/pm_layered
"make" -C /home/francisco/workspace/RIOT/sys/stdio_uart
text data bss dec hex filename
8488 120 2560 11168 2ba0 /home/francisco/workspace/RIOT/examples/hello-world/bin/samr21-xpro/hello-world.elf
iotlab-node --jmespath='keys(@)[0]' --format='int' --list saclay,samr21,1 --update /home/francisco/workspace/RIOT/examples/hello-world/bin/samr21-xpro/hello-world.elf | grep 0
0
make: Leaving directory '/home/francisco/workspace/RIOT/examples/hello-world'
In iotlab fronted:
make BOARD=samr21-xpro IOTLAB_NODE=auto-ssh -C examples/hello-world flash-only
make: Entering directory '/senslab/users/molina/RIOT/examples/hello-world'
iotlab-node --jmespath='keys(@)[0]' --format='int' --list saclay,samr21,1 --update /senslab/users/molina/RIOT/examples/hello-world/bin/samr21-xpro/hello-world.elf | grep 0
0
make: Leaving directory '/senslab/users/molina/RIOT/examples/hello-world'
ACK
Thanks for reviewing @cladmi and @fjmolinas ! |
Contribution description
This will avoid to load all edbg programmer management logic from a board Makefile.include and especially will avoid to add edbg to the list of FLASHDEPS: it won't be unnecessarily built when flashing a samr21-xpro/arduino-zero board on IoT-LAB.
The idea is to set a default value to the PROGRAMMER variable when IOTLAB_NODE is set (the arbitrary
iotlab
value is used) before the Makefile.include from the board is included. This way all edbg logic is skipped (including the addition to FLASHDEPS).Also note that in master, issuing a flash command for samr21-xpro or arduino-zero from an IoT-LAB SSH Frontend is broken because edbg cannot be built on the fly (due to missing libudev libraries).
@cladmi, what's opinion on this fix ?
Testing procedure
Locally, ensure that you don't have edbg already built/available (in dist/tools) and flash the board from your machine:
=> on master, edbg is rebuilt before flashing on IoT-LAB. With this PR, only
iotlab-node --update
is calledOn the SSH frontend:
=> on master, the last command fails. With this PR, the board is flashed correctly.
Issues/PRs references
Related to #9694