nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

boards/arm/rp2040: Fix code style and error checking

Open acassis opened this issue 4 months ago • 12 comments

Summary

This patch tries to follow the coding style of NuttX and avoids nesting functions, handling the error return.

Impact

Improvement

Testing

build only

acassis avatar Aug 19 '25 23:08 acassis

@nmaggioni please test if you temperature sensor still working. I just tested compiling it!

acassis avatar Aug 19 '25 23:08 acassis

CI build error :-(

cederom avatar Aug 20 '25 00:08 cederom

@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.

nmaggioni avatar Aug 20 '25 11:08 nmaggioni

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
====================================================================================

simbit18 avatar Aug 20 '25 11:08 simbit18

  • 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 avatar Aug 20 '25 11:08 cederom

@cederom Care to try #16876? The fix was simple enough but, as you said, the upstream did not mark it as a breaking change (...?).

nmaggioni avatar Aug 20 '25 11:08 nmaggioni

@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

cederom avatar Aug 20 '25 12:08 cederom

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.

nmaggioni avatar Aug 20 '25 12:08 nmaggioni

As https://github.com/apache/nuttx/pull/16876 is merged lets see how this CI builds now :-)

cederom avatar Aug 20 '25 16:08 cederom

please fix the conflict @acassis

xiaoxiang781216 avatar Aug 25 '25 12:08 xiaoxiang781216

@acassis any updates on this PR? It can get merged once the conflict is fixed and I think it would be good.

linguini1 avatar Oct 31 '25 13:10 linguini1

@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!

hartmannathan avatar Nov 02 '25 15:11 hartmannathan