1.更新cmake
报错:
-- Using the single-header code from pico/picotool/picotool-src/lib/nlohmann_json/single_include/
CMake Deprecation Warning at pico/pico-sdk/lib/mbedtls/CMakeLists.txt:23 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions.
cmake官网:https://cmake.org/download/#previous
实测cmake-3.30.6是可行的。下载cmake-3.30.6:
#先下载压缩包,然后解压
tar -xvzf cmake-3.30.6.tar.gz cmake-3.30.6-linux-aarch64.tar.gz
#添加权限
cd cmake-3.30.6
chmod 777 configure
因为下载过程漫长,可以编写一个脚本让它自动下载。保存在与cmake-3.30.6同目录下,以root运行:
download.sh
#!/bin/bash
cd cmake-3.30.6
./configure
make -j8#CPU核心数x2
make install
2.添加PATH
报错:
It is recommended to build and install picotool separately, or to set
PICOTOOL_FETCH_FROM_GIT_PATH to a common directory for all your SDK projectsCall Stack (most recent call first): pico/pico-sdk/tools/CMakeLists.txt:138 (find_package) pico/pico-sdk/tools/CMakeLists.txt:485 (pico_init_picotool) pico/pico-sdk/src/cmake/on_device.cmake:57 (picotool_postprocess_binary) blink/CMakeLists.txt:13 (pico_add_extra_outputs) . ~/.bash_aliases
解决:
vim ~/.bashrc
在末尾添加
export PICOTOOL_FETCH_FROM_GIT_PATH=#这里写picotool的路径
3. 重装picotool
报错:
CMake Warning (dev) at /usr/local/share/cmake-3.30/Modules/FetchContent.cmake:1953 (message):
Calling FetchContent_Populate(picotool) is deprecated, call FetchContent_MakeAvailable(picotool) instead. Policy CMP0169 can be set to OLD to allow FetchContent_Populate(picotool) to be called directly for now, but the ability to call it with declared details will be removed completely in a future version.Call Stack (most recent call first): pico/pico-sdk/tools/Findpicotool.cmake:46 (FetchContent_Populate) pico/pico-sdk/tools/CMakeLists.txt:138 (find_package) pico/pico-sdk/tools/CMakeLists.txt:485 (pico_init_picotool) pico/pico-sdk/src/cmake/on_device.cmake:57 (picotool_postprocess_binary) blink/CMakeLists.txt:13 (pico_add_extra_outputs)This warning is for project developers. Use -Wno-dev to suppress it.
解决:
cd ~/pico
#强制递归删除
rm -rf picotool
#重装
git clone https://github.com/raspberrypi/picotool.git
具体内容请见官方文档:datasheets
4.重装pico-sdk
报错:
arm-none-eabi-gcc: fatal error: cannot read spec file 'nosys.specs': No such file or directory
compilation terminated.make[2]: *** [pico-sdk/src/rp2040/boot_stage2/CMakeFiles/bs2_default.dir/build.make:97: pico-sdk/src/rp2040/boot_stage2/bs2_default.elf]
Error 1make[1]: *** [CMakeFiles/Makefile2:5628: pico-sdk/src/rp2040/boot_stage2/CMakeFiles/bs2_default.dir/all]
Error 2make[1]: *** Waiting for unfinished jobs....
与3同理,删除pico-sdk后重装,方法见3中的官方文档
文档来自树莓派Pico中文站:https://pico.org.cn/
如果是git下载速度太慢导致的报错,可以见【git clone速度慢导致失败的解决方法】