使用Docker构建riot / helloworld

时间:2019-05-21 05:42:29

标签: docker riot

这是我的设置:

  1. docker pull riot/riotbuild
  2. wget https://github.com/RIOT-OS/RIOT/archive/2019.04.zip
  3. unzip 2019.04.zip
  4. cd RIOT-2019.04/examples/hello-world/
  5. make BUILD_IN_DOCKER=1 BOARD=stm32f4discovery all

    所有这些都可以。

  6. make BUILD_IN_DOCKER=1 BOARD=stm32f4discovery flash

    此步骤失败。错误是:

>   Building application "hello-world" for "stm32f4discovery" with MCU
> "stm32f4". "make" -C /data/riotbuild/riotbase/boards/stm32f4discovery
> "make" -C /data/riotbuild/riotbase/core "make" -C
> /data/riotbuild/riotbase/cpu/stm32f4 "make" -C
> /data/riotbuild/riotbase/cpu/cortexm_common "make" -C
> /data/riotbuild/riotbase/cpu/cortexm_common/periph "make" -C
> /data/riotbuild/riotbase/cpu/stm32_common "make" -C
> /data/riotbuild/riotbase/cpu/stm32_common/periph "make" -C
> /data/riotbuild/riotbase/cpu/stm32f4/periph "make" -C
> /data/riotbuild/riotbase/drivers "make" -C
> /data/riotbuild/riotbase/drivers/periph_common "make" -C
> /data/riotbuild/riotbase/sys "make" -C
> /data/riotbuild/riotbase/sys/auto_init "make" -C
> /data/riotbuild/riotbase/sys/isrpipe "make" -C
> /data/riotbuild/riotbase/sys/newlib_syscalls_default "make" -C
> /data/riotbuild/riotbase/sys/pm_layered "make" -C
> /data/riotbuild/riotbase/sys/stdio_uart "make" -C
> /data/riotbuild/riotbase/sys/tsrb    text    data     bss     dec    
> hex filename    8756     140    2620   11516    2cfc
> /data/riotbuild/riotbase/examples/hello-world/bin/stm32f4discovery/hello-world.elf
> /home/huaxing/oproj/riot/RIOT-2019.04/dist/tools/openocd/openocd.sh
> flash
> /home/huaxing/oproj/riot/RIOT-2019.04/examples/hello-world/bin/stm32f4discovery/hello-world.elf
> Flashing Target  sh: 1: openocd: not found
> /home/huaxing/oproj/riot/RIOT-2019.04/examples/hello-world/../../Makefile.include:538:
> recipe for target 'flash' failed make: *** [flash] Error 127 

1 个答案:

答案 0 :(得分:0)

我检查了脚本,实际上它最终将在下一个调用docker:

a)使BUILD_IN_DOCKER = 1 BOARD = stm32f4全部发现

docker run --rm -t -u "$(id -u)" \
-v '/usr/share/zoneinfo/PRC:/etc/localtime:ro' -v '/home/shubuntu1/g/RIOT-2019.04:/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/examples/hello-world' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'     \
-e 'BOARD=stm32f4discovery' \
-w '/data/riotbuild/riotbase/examples/hello-world/' \
'riot/riotbuild:latest' make all 'BOARD=stm32f4discovery'

b)使BUILD_IN_DOCKER = 1 BOARD = stm32f4发现闪存

docker run --rm -t -u "$(id -u)" \
-v '/usr/share/zoneinfo/PRC:/etc/localtime:ro' -v '/home/shubuntu1/g/RIOT-2019.04:/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/examples/hello-world' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'     \
-e 'BOARD=stm32f4discovery' \
-w '/data/riotbuild/riotbase/examples/hello-world/' \
'riot/riotbuild:latest' make  'BOARD=stm32f4discovery'

它们几乎相同,容器的主要用途只是将源代码构建为stm32二进制文件,因为启动容器时它没有添加任何控制硬件的权限。

a)相比,b)还有下一个输出:

  

###闪烁目标###
  sh:1:openocd:找不到
  /home/shubuntu1/g/RIOT-2019.04/examples/hello-world/../../
Makefile.include:538:目标“闪存”的配方失败
  make:*** [flash]错误127

这实际上与容器无关,它在主机上运行,​​根本原因是您没有在用于将stm32二进制文件刷新到设备的主机上安装openocd

请参见this,搜索OpenOCD,很明显,您需要安装openocd,然后在Docker容器完成构建后,二进制文件也将在主机中,就像在docker卷中一样,最后是主机上的openocd可能会刷新您的二进制文件。

相关问题