[riot-notifications] [RIOT-OS/RIOT] makefiles/docker.inc.mk: add PROGRAMMER to the exported variables (#12207)

Gaëtan Harter notifications at github.com
Thu Sep 12 13:45:37 CEST 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
```

<details><summary>Output with this PR</summary>

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

```
</details>

<details><summary>Failed output with master</summary>

```
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
```
</details>


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 https://github.com/RIOT-OS/RIOT/pull/11470 with building in docker.

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/12207

-- Commit Summary --

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

-- File Changes --

    M makefiles/docker.inc.mk (1)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/12207.patch
https://github.com/RIOT-OS/RIOT/pull/12207.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12207
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190912/e05fc4b4/attachment.htm>


More information about the notifications mailing list