1

这是我的设置:

  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 
4

1 回答 1

0

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

a) 使 BUILD_IN_DOCKER=1 BOARD=stm32f4discovery 全部

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=stm32f4discovery 闪存

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)还有下一个输出:

### Flashing Target ###
sh: 1: openocd: not found
/home/shubuntu1/g/RIOT-2019.04/examples/hello-world/../../
Makefile.include:538: recipe for target 'flash ' 制作失败
:*** [flash] 错误 127

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

看到这个,搜索一下OpenOCD,很明显需要你安装openocd,然后在docker容器完成构建后,二进制也将在主机中,因为它在docker卷中,最后openocd在主机上可以刷你的二进制文件。

于 2019-05-21T09:39:40.507 回答