Skip to content

makefiles/docker.inc.mk: add PROGRAMMER to the exported variables#12207

Merged
jcarrano merged 1 commit intoRIOT-OS:masterfrom
cladmi:pr/docker/programmer
Sep 12, 2019
Merged

makefiles/docker.inc.mk: add PROGRAMMER to the exported variables#12207
jcarrano merged 1 commit intoRIOT-OS:masterfrom
cladmi:pr/docker/programmer

Conversation

@cladmi
Copy link
Copy Markdown
Contributor

@cladmi cladmi commented Sep 12, 2019

Contribution description

Depending on the PROGRAMMER used, the file used for flashing may be
different, like openocd/jlink, so the file being generated when
compiling should be different.

Because of this, when building in docker, the build system needs to know
for which programmer you are building for.

This manifested for 'nordic_softdevice' applications when using 'openocd'
but is not limited to this case.

Testing procedure

Try flashing 'tests/nordic_softdevice' for 'nrf52dk' when using 'PROGRAMMER=openocd' and 'BUILD_IN_DOCKER=1' this must be done in a clean directory.

You do not need a board to even test.

BUILD_IN_DOCKER=1 DOCKER="sudo docker" PROGRAMMER=openocd RIOT_CI_BUILD=1 make --no-print-directory -C tests/nordic_softdevice/ clean flash
Output with this PR

Note I tested without a board connected!

BUILD_IN_DOCKER=1 DOCKER="sudo docker" PROGRAMMER=openocd RIOT_CI_BUILD=1 make --no-print-directory -C tests/nordic_softdevice/ clean flash
rm -rf /home/harter/work/git/RIOT/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/
Launching build container using image "riot/riotbuild:latest".
sudo docker run --rm -t -u "$(id -u)" \
    -v '/usr/share/zoneinfo/Europe/Berlin:/etc/localtime:ro' -v '/home/harter/work/git/RIOT:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles' -v /home/harter/.gitcache:/data/riotbuild/gitcache -e GIT_CACHE_DIR=/data/riotbuild/gitcache   \
    -e 'PROGRAMMER=openocd' -e 'RIOT_CI_BUILD=1' \
    -w '/data/riotbuild/riotbase/tests/nordic_softdevice/' \
    'riot/riotbuild:latest' make
[sudo] password for harter:
Building application "tests_nordic_softdevice" for "nrf52dk" with MCU "nrf52".

rm -rf /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src
mkdir -p /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src
rm /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/ble/common/ble_conn_params.c
cat /data/riotbuild/riotbase/pkg/nordic_softdevice_ble/Makefile.module > /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/softdevice/common/softdevice_handler/Makefile
echo "MODULE=ble_common" > /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/ble/common/Makefile
cat /data/riotbuild/riotbase/pkg/nordic_softdevice_ble/Makefile.module >> /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/ble/common/Makefile
cat /data/riotbuild/riotbase/pkg/nordic_softdevice_ble/Makefile.module > /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/iot/ble_ipsp/Makefile
touch /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/.extracted
cp /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/iot/ble_6lowpan/lib/ble_6lowpan.a /data/riotbuild/riotbase/tests/nordic_softdevice/bin/nrf52dk/ble_6lowpan.a
   text    data     bss     dec     hex filename
  55764     512   28716   84992   14c00 /data/riotbuild/riotbase/tests/nordic_softdevice/bin/nrf52dk/tests_nordic_softdevice.elf
/home/harter/work/git/RIOT/dist/tools/openocd/openocd.sh flash /home/harter/work/git/RIOT/tests/nordic_softdevice/bin/nrf52dk/tests_nordic_softdevice.hex
### Flashing Target ###
GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00462-gdd1d90111 (2019-01-18-11:37)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
cortex_m reset_config sysresetreq
Error: No J-Link device found.

/home/harter/work/git/RIOT/tests/nordic_softdevice/../../Makefile.include:556: recipe for target 'flash' failed

Failed output with master
BUILD_IN_DOCKER=1 DOCKER="sudo docker" PROGRAMMER=openocd RIOT_CI_BUILD=1 make --no-print-directory -C tests/nordic_softdevice/ clean flash
rm -rf /home/harter/work/git/worktree/riot_master/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/
Launching build container using image "riot/riotbuild:latest".
sudo docker run --rm -t -u "$(id -u)" \
    -v '/usr/share/zoneinfo/Europe/Berlin:/etc/localtime:ro' -v '/home/harter/work/git/worktree/riot_master:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles' -v /home/harter/.gitcache:/data/riotbuild/gitcache -e GIT_CACHE_DIR=/data/riotbuild/gitcache  -v /home/harter/work/git/RIOT/.git:/home/harter/work/git/RIOT/.git \
    -e 'RIOT_CI_BUILD=1' \
    -w '/data/riotbuild/riotbase/tests/nordic_softdevice/' \
    'riot/riotbuild:latest' make
Building application "tests_nordic_softdevice" for "nrf52dk" with MCU "nrf52".

rm -rf /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src
mkdir -p /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src
rm /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/ble/common/ble_conn_params.c
cat /data/riotbuild/riotbase/pkg/nordic_softdevice_ble/Makefile.module > /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/softdevice/common/softdevice_handler/Makefile
echo "MODULE=ble_common" > /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/ble/common/Makefile
cat /data/riotbuild/riotbase/pkg/nordic_softdevice_ble/Makefile.module >> /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/ble/common/Makefile
cat /data/riotbuild/riotbase/pkg/nordic_softdevice_ble/Makefile.module > /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/iot/ble_ipsp/Makefile
touch /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/.extracted
cp /data/riotbuild/riotbase/tests/nordic_softdevice/bin/pkg/nrf52dk/nordic_softdevice_ble/src/components/iot/ble_6lowpan/lib/ble_6lowpan.a /data/riotbuild/riotbase/tests/nordic_softdevice/bin/nrf52dk/ble_6lowpan.a
   text    data     bss     dec     hex filename
  55764     512   28716   84992   14c00 /data/riotbuild/riotbase/tests/nordic_softdevice/bin/nrf52dk/tests_nordic_softdevice.elf
/home/harter/work/git/worktree/riot_master/dist/tools/openocd/openocd.sh flash /home/harter/work/git/worktree/riot_master/tests/nordic_softdevice/bin/nrf52dk/tests_nordic_softdevice.hex
### Flashing Target ###
Error: Unable to locate IMAGE_FILE
       (/home/harter/work/git/worktree/riot_master/tests/nordic_softdevice/bin/nrf52dk/tests_nordic_softdevice.hex)
/home/harter/work/git/worktree/riot_master/tests/nordic_softdevice/../../Makefile.include:556: recipe for target 'flash' failed
make: *** [flash] Error 1

The test currently fails on my board, but this will be another issue.
examples/default works though.

Issues/PRs references

This issue was found after testing #11470 with building in docker.

Depending on the PROGRAMMER used, the file used for flashing may be
different, like openocd/jlink, so the file being generated when
compiling should be different.

Because of this, when building in docker, the build system needs to know
for which programmer you are building for.

This manifested for 'nordic_softdevice' applications when using 'openocd'
but is not limited to this case.
@aabadie aabadie added Area: build system Area: Build system Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels Sep 12, 2019
Copy link
Copy Markdown
Contributor

@jcarrano jcarrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works as described.

@jcarrano jcarrano merged commit 7364c91 into RIOT-OS:master Sep 12, 2019
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Sep 12, 2019

Thank you for the review.

@cladmi cladmi deleted the pr/docker/programmer branch September 12, 2019 14:52
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Sep 12, 2019

I opened an issue for the test failing #12214

@kb2ma kb2ma added this to the Release 2019.10 milestone Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants