0

我正在尝试设置环境为新的 PICO 开发一些程序,但在出现此错误后只编译一次:

[main] Building folder: pico-examples 
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/pico/pico-examples/build --config Debug --target blink --
[build] Scanning dependencies of target bs2_default
[build] [  0%] Built target bs2_default
[build] [  0%] Built target bs2_default_padded_checksummed_asm
[build] [  0%] Performing build step for 'ELF2UF2Build'
[build] 
[build] Microsoft (R) Program Maintenance Utility Version 14.28.29337.0
[build] Copyright (C) Microsoft Corporation.  All rights reserved.
[build] 
[build] [100%] Built target elf2uf2
[build] [  0%] No install step for 'ELF2UF2Build'
[build] [  0%] Completed 'ELF2UF2Build'
[build] [  0%] Built target ELF2UF2Build
[build] Scanning dependencies of target blink
[build] Consolidate compiler generated dependencies of target blink
[build] blink\CMakeFiles\blink.dir\compiler_depend.make(4) : fatal error U1033: syntax error : ':' unexpected
[build] Stop.
[build] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x86\Nmake.exe"' : return code '0x2'
[build] Stop.
[build] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x86\Nmake.exe"' : return code '0x2'
[build] Stop.
[build] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x86\Nmake.exe"' : return code '0x2'
[build] Stop.
[build] Build finished with exit code 2

我正在从 Raspberry SDK 编译它的标准示例的闪烁应用程序:

#include "pico/stdlib.h"

int main() {
    const uint LED_PIN = 25;
    gpio_init(LED_PIN);
    gpio_set_dir(LED_PIN, GPIO_OUT);
    while (true) {
        gpio_put(LED_PIN, 1);
        sleep_ms(250);
        gpio_put(LED_PIN, 0);
        sleep_ms(250);
    }
}




我已经安装了 VS 代码,并且在为此 PICO 安装了 VS 2019 之后。我一步一步地按照 Raspberry 的文档(开始使用 Raspberry PICO)进行操作。也由 VS2019 的命令提示符启动。

我曾尝试单独安装最后一个 Windows SDK,我也重新安装了 Visual Studio。但还是一样。

有人可以在这个话题上帮助我吗?这个问题我睡不着:(

自动生成的文件是什么问题示例:

# CMAKE generated file: DO NOT EDIT!
# Generated by "NMake Makefiles" Generator, CMake Version 3.20

blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C:\pico\pico-sdk\src\common\pico_sync\critical_section.c
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_sync\critical_section.c
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_sync\include\pico\critical_section.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_sync\include\pico\lock_core.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\types.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\machine\_default_types.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\features.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\_newlib_version.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_intsup.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdbool.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stddef.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-examples\build\generated\pico_base\pico\version.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\config.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-examples\build\generated\pico_base\pico\config_autogen.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\boards\include\boards\pico.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync
...

blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\types.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_intsup.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdbool.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-examples\build\generated\pico_base\pico\version.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\config.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-examples\build\generated\pico_base\pico\config_autogen.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\boards\include\boards\pico.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\rp2_common\pico_platform\include\pico\platform.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float.
...
.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\machine\_default_types.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\features.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\_newlib_version.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_intsup.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\stdio.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\_ansi.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\newlib.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\config.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\machine\ieeefp.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\cdefs.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stddef.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdarg.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\reent.h

blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2_common\pico_platform\include\pico\platform.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\cdefs.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\types.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\platform_defs.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\regs\addressmap.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\assert.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\assert.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\_ansi.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\newlib.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\config.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\machine\ieeefp.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\error.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2_common\pico_stdio\include\pico\stdio.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\common\pico_time\include\pico\time.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2_common\hardware_timer\include\hardware\timer.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2040\hardware_structs\include\hardware\structs\timer.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2_common\ha
C:\pico\pico-sdk\src\rp2_common\hardware_vreg\vreg.c:

C\:\pico\pico-sdk\src\rp2_common\hardware_vreg\vreg.c:

C\:\pico\pico-sdk\src\rp2_common\hardware_vreg\include\hardware\vreg.h:

C\:\pico\pico-sdk\src\rp2040\hardware_structs\include\hardware\structs\vreg_and_chip_reset.h:

C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\regs\vreg_and_chip_reset.h:

C:\pico\pico-sdk\src\rp2_common\hardware_watchdog\watchdog.c:

C\:\pico\pico-sdk\src\rp2_common\hardware_watchdog\watchdog.c:

C\:\pico\pico-sdk\src\rp2040\hardware_structs\include\hardware\structs\watchdog.h:

C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\regs\watchdog.h:

C\:\pico\pico-sdk\src\rp2040\hardware_structs\include\hardware\structs\psm.h:

C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\regs\psm.h:

C\:\pico\pico-sdk\src\rp2_common\hardware_xosc\xosc.c:

C\:\pico\pico-sdk\src\rp2_common\pico_stdio_uart\stdio_uart.c:

C\:\pico\pico-sdk\src\rp2_common\pico_bootrom\bootrom.c:

C\:\pico\pico-sdk\src\rp2_common\pico_bootrom\include\pico\bootrom.h:

C\:\pico\pico-sdk\src\rp2_common\pico_double\double_init_rom.c:


提前致谢。此致

4

4 回答 4

1

好的,解决方案是从自动生成的文件中删除内容,保存文件并再次构建...,

经过几次构建错误再次出现,同样的过程是成功的:D

感谢所有试图帮助我的人,如果知道根本问题会很棒!

于 2021-02-22T13:50:25.530 回答
1

我自己尝试在 VS Code 中编译时遇到了同样的问题,第一遍工作正常,任何重新编译都失败并出现相同的错误。

错误的原因是包含错误转义路径的 compiler_depend.make 文件。它试图转义 : 在 Windows 驱动器号之后。它不会对每个部分中的第一个条目执行此操作,尽管该条目与不正确的路径重复,作为每个部分中的第二个条目。

例如

blink\CMakeFiles\blink.dir\D_\projects\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: D\:\projects\pico\pico-sdk\src\common\pico_sync\critical_section.c

应该

blink\CMakeFiles\blink.dir\D_\projects\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: D:\projects\pico\pico-sdk\src\common\pico_sync\critical_section.c

到目前为止,我目前的快速修复是在所有 compiler_depend.make 文件中将“\:”替换为“:”

于 2021-03-08T22:21:38.463 回答
0

这是已经提到的解决方案(删除 /build 的内容)作为重建 DOS 命令,适用于那些不太了解它的人。从构建文件夹运行它。

del /q /s * && cmake .. -G "NMake Makefiles" && nmake

于 2021-05-26T18:24:24.200 回答
0

卸载当前的 CMAKE 版本并从这里安装 3.20 版本: https ://cmake.org/files/v3.20/

不要忘记将 CMAKE 添加到路径

于 2021-12-02T13:06:04.163 回答