boards/arm/rp2040: Fix code style and error checking
Summary
This patch tries to follow the coding style of NuttX and avoids nesting functions, handling the error return.
Impact
Improvement
Testing
build only
@nmaggioni please test if you temperature sensor still working. I just tested compiling it!
CI build error :-(
@acassis Thanks for having taken care of this, I've retested my hw and the sensor still works fine.
@cederom I'm on it, SDK 2.2.0 is misbehaving on clean pulls for me too. Sorry if I didn't catch that earlier, I may have been tricked by some cache somewhere.
There are errors in job Linux (arm-06)
https://github.com/apache/nuttx/actions/runs/17084057983/job/48447096636#logs`
====================================================================================
Configuration/Tool: raspberrypi-pico-w/nsh-flash,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2025-08-20 00:22:32
------------------------------------------------------------------------------------
Cleaning...
Configuring...
Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
Building NuttX...
In file included from /tools/pico-sdk/src/common/pico_base_headers/include/pico.h:64,
from /tools/pico-sdk/src/rp2040/pico_platform/include/pico/asm_helper.S:7,
from /tools/pico-sdk/src/rp2040/boot_stage2/boot2_w25q080.S:29:
/tools/pico-sdk/src/rp2040/pico_platform/include/pico/platform.h:26:10: fatal error: pico/platform/common.h: No such file or directory
26 | #include "pico/platform/common.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [chip/boot2/Make.defs:56: rp2040_boot_stage2.elf] Error 1
make[2]: Target 'makedepfile' not remade because of errors.
make[1]: *** [Makefile:261: .depend] Error 2
make[1]: Target 'depend' not remade because of errors.
make: *** [tools/Unix.mk:660: pass2dep] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
[1/1] Normalize raspberrypi-pico-w/nsh-flash
====================================================================================
- This CI build comes from pico-sdk version 2.2.0. I had exactly the same problem in local build, so had to revert pico-sdk to version 2.1.0.
- https://github.com/apache/nuttx/pull/16862 adds local fetch of pico-sdk 2.2.0 to CI to help with builds, but 2.2.0 breaks self-compatibility in a minor release :D :D :D
- thus my push for avoiding and clearly marking breaking changes :-)
- external SDKs are soooo sweet :-) this is why we avoid it here in NuttX :-)
- although this sdk issue is not related with this specific PR, rather a result, we should fix that probably before merging this PR, and use this PR as testbench to verify build? :-)
@cederom Care to try #16876? The fix was simple enough but, as you said, the upstream did not mark it as a breaking change (...?).
@cederom Care to try #16876? The fix was simple enough but, as you said, the upstream did not mark it as a breaking change (...?).
Im on it, thanks! :-)
Looking at https://github.com/raspberrypi/pico-sdk/releases/tag/2.2.0 there is only one mention of breaking change for pico_encrypt_binary, no mention on headers relocation / change :-P
no mention on headers relocation / change :-P
In their defense, I suppose not using the SDK in its entirety is outside their scope - even if they should care about that IMO.
Anyway, my bad for having trusted their changelog and not having retested everything on a clean slate :) Fortunately there's CI for that, though.
As https://github.com/apache/nuttx/pull/16876 is merged lets see how this CI builds now :-)
please fix the conflict @acassis
@acassis any updates on this PR? It can get merged once the conflict is fixed and I think it would be good.
@acassis any updates on this PR? It can get merged once the conflict is fixed and I think it would be good.
Hi,
Please see my comment above regarding the commit log. I think a better log message is (copying from my earlier comment):
boards/arm/rp2040: Improve error handling in board bringup
rp2040_common_bringup: In case of failure to initialize SPI and/or I2C
buses, do not try to initialize devices that depend on these buses:
MCP3008 (SPI), RP2040, SHT4X, MCP9600, MS56XX (I2C).
Thanks!