gpt4 book ai didi

docker - 使用Docker构建riot/helloworld

转载 作者:行者123 更新时间:2023-12-02 19:58:24 25 4
gpt4 key购买 nike

这是我的设置:

  • docker pull riot/riotbuild
  • wget https://github.com/RIOT-OS/RIOT/archive/2019.04.zip
  • unzip 2019.04.zip
  • cd RIOT-2019.04/examples/hello-world/
  • make BUILD_IN_DOCKER=1 BOARD=stm32f4discovery all
    所有这些都可以。
  • 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

    最佳答案

    我检查了脚本,实际上它最终将如下调用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 = stm32f4discovery flash
    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' failed
    make: *** [flash] Error 127



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

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

    关于docker - 使用Docker构建riot/helloworld,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56231750/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com