roskuttan opened a new pull request, #16196:
URL: https://github.com/apache/nuttx/pull/16196
## Summary
This change introduces CMake build support for the Raspberry Pi Pico board
in Apache NuttX to provide an alternative build system widely used in modern
embedded development, enhancing accessibility and maintainability.
The functional part of the code being changed includes the build
configuration for the RP2040 architecture and the Raspberry Pi Pico board.
The change adds new `CMakeLists.txt` files to define build rules:
`arch/arm/src/rp2040/CMakeLists.txt,
arch/arm/src/rp2040/hardware/CMakeLists.txt,
boards/arm/rp2040/raspberrypi-pico/CMakeLists.txt, and
boards/arm/rp2040/raspberrypi-pico/src/CMakeLists.txt.`
This work is inspired by existing CMake implementations for other boards in
the NuttX ecosystem.
## Impact
New Feature Added?: YES - Adds CMake build support as an optional build
method for the Raspberry Pi Pico.
Impact on User: YES - Users familiar with CMake can adopt this build method,
but the existing Make-based system remains unaffected.
Impact on Build: YES - Introduces an alternative build process requiring
CMake installation, with potential configuration adjustments (see Testing).
Impact on Hardware: YES - Specific to the Raspberry Pi Pico and RP2040
architecture, with no impact on other hardware.
Impact on Documentation: NO - As there is existing documentation
demonstrates the use of cmake in nuttx
Impact on Security: NO - No security implications as this is a build system
enhancement.
Impact on Compatibility: YES - Intended to be compatible with existing
builds, but current issues prevent full compatibility (see Testing).
## Testing
- **Build Host(s)**: OS (Ubuntu 24.04 on WSL), CPU (x86_64), compiler
(arm-none-eabi-gcc), etc.
- **Target(s)**: arch (ARM), board:config (Raspberry Pi Pico with nsh
configuration), etc.
- Steps to reproduce:
- Configure the board using `cmake -B build
-DBOARD_CONFIG=raspberrypi-pico:nsh -GNinja`
- Build using `cmake --build build -t clean -j12 && cmake --build build
-j12`
Testing logs before change:
```
roskuttan@SILENT-KILLERED:~/nuttxspace/nuttx$ cmake -B build
-DBOARD_CONFIG=raspberrypi-pico:nsh -DBUILD_SHARED_LIBS=OFF -GNinja
CMake Error at CMakeLists.txt:239 (message):
No CMakeLists.txt found at
/home/roskuttan/nuttxspace/nuttx/boards/arm/rp2040/raspberrypi-pico
-- Configuring incomplete, errors occurred!
```
Testing logs after change:
```
roskuttan@SILENT-KILLERED:~/nuttxspace/nuttx$ cmake --build build -t clean
-j12 && cmake --build build -j12
[1/1] Cleaning all built files...
Cleaning... 0 files.
[18/1235] Building C object
arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_flash_mtd.c.obj
FAILED: arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_flash_mtd.c.obj
/usr/bin/arm-none-eabi-gcc -D__KERNEL__ -D__NuttX__
-I/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040
-I/home/roskuttan/nuttxspace/nuttx/arch/arm/src/common
-I/home/roskuttan/nuttxspace/nuttx/arch/arm/src/armv6-m
-I/home/roskuttan/nuttxspace/nuttx/sched -isystem
/home/roskuttan/nuttxspace/nuttx/include -isystem
/home/roskuttan/nuttxspace/nuttx/build/include -mcpu=cortex-m0 -mthumb
-mfloat-abi=soft --param=min-pagesize=0 -fno-common -Wall -Wshadow -Wundef
-nostdlib -Os -fno-strict-aliasing -fomit-frame-pointer -Wa,-mthumb
-Wa,-mimplicit-it=always -ffunction-sections -fdata-sections -g -Wno-attributes
-Wno-unknown-pragmas -Wstrict-prototypes -Wno-psabi -fdiagnostics-color=always
-DNDEBUG -fmacro-prefix-map=/home/roskuttan/nuttxspace/nuttx=
-fmacro-prefix-map=/home/roskuttan/nuttxspace/apps=
-fmacro-prefix-map=/home/roskuttan/nuttxspace/nuttx/boards/arm/rp2040/raspberrypi-pico=
-fmacro-prefix-map=/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040=
@arch/CMakeFiles/arch.dir/arm
/src/rp2040/rp2040_flash_mtd.c.obj.rsp -MD -MT
arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_flash_mtd.c.obj -MF
arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_flash_mtd.c.obj.d -o
arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_flash_mtd.c.obj -c
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_flash_mtd.c
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_flash_mtd.c: In
function 'rp2040_flash_ioctl':
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_flash_mtd.c:88:29:
error: 'CONFIG_RP2040_FLASH_LENGTH' undeclared (first use in this function);
did you mean 'CONFIG_RP2040_FLASH_BOOT'?
88 | #define FLASH_BLOCK_COUNT (CONFIG_RP2040_FLASH_LENGTH -
FLASH_START_OFFSET)\
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_flash_mtd.c:467:35:
note: in expansion of macro 'FLASH_BLOCK_COUNT'
467 | geo->neraseblocks = FLASH_BLOCK_COUNT;
| ^~~~~~~~~~~~~~~~~
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_flash_mtd.c:88:29:
note: each undeclared identifier is reported only once for each function it
appears in
88 | #define FLASH_BLOCK_COUNT (CONFIG_RP2040_FLASH_LENGTH -
FLASH_START_OFFSET)\
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_flash_mtd.c:467:35:
note: in expansion of macro 'FLASH_BLOCK_COUNT'
467 | geo->neraseblocks = FLASH_BLOCK_COUNT;
| ^~~~~~~~~~~~~~~~~
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_flash_mtd.c: In
function 'rp2040_flash_mtd_initialize':
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_flash_mtd.c:88:29:
error: 'CONFIG_RP2040_FLASH_LENGTH' undeclared (first use in this function);
did you mean 'CONFIG_RP2040_FLASH_BOOT'?
88 | #define FLASH_BLOCK_COUNT (CONFIG_RP2040_FLASH_LENGTH -
FLASH_START_OFFSET)\
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_flash_mtd.c:513:7:
note: in expansion of macro 'FLASH_BLOCK_COUNT'
513 | if (FLASH_BLOCK_COUNT < 4)
| ^~~~~~~~~~~~~~~~~
[28/1235] Building C object
arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_i2s_pio.c.obj
FAILED: arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_i2s_pio.c.obj
/usr/bin/arm-none-eabi-gcc -D__KERNEL__ -D__NuttX__
-I/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040
-I/home/roskuttan/nuttxspace/nuttx/arch/arm/src/common
-I/home/roskuttan/nuttxspace/nuttx/arch/arm/src/armv6-m
-I/home/roskuttan/nuttxspace/nuttx/sched -isystem
/home/roskuttan/nuttxspace/nuttx/include -isystem
/home/roskuttan/nuttxspace/nuttx/build/include -mcpu=cortex-m0 -mthumb
-mfloat-abi=soft --param=min-pagesize=0 -fno-common -Wall -Wshadow -Wundef
-nostdlib -Os -fno-strict-aliasing -fomit-frame-pointer -Wa,-mthumb
-Wa,-mimplicit-it=always -ffunction-sections -fdata-sections -g -Wno-attributes
-Wno-unknown-pragmas -Wstrict-prototypes -Wno-psabi -fdiagnostics-color=always
-DNDEBUG -fmacro-prefix-map=/home/roskuttan/nuttxspace/nuttx=
-fmacro-prefix-map=/home/roskuttan/nuttxspace/apps=
-fmacro-prefix-map=/home/roskuttan/nuttxspace/nuttx/boards/arm/rp2040/raspberrypi-pico=
-fmacro-prefix-map=/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040=
@arch/CMakeFiles/arch.dir/arm
/src/rp2040/rp2040_i2s_pio.c.obj.rsp -MD -MT
arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_i2s_pio.c.obj -MF
arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_i2s_pio.c.obj.d -o
arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_i2s_pio.c.obj -c
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_i2s_pio.c
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_i2s_pio.c: In
function 'rp2040_i2s_pio_configure':
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_i2s_pio.c:271:23:
error: 'CONFIG_RP2040_I2S_DATA' undeclared (first use in this function); did
you mean 'CONFIG_RP2040_I2S_PIO'?
271 | uint32_t data_pin = CONFIG_RP2040_I2S_DATA;
| ^~~~~~~~~~~~~~~~~~~~~~
| CONFIG_RP2040_I2S_PIO
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_i2s_pio.c:271:23:
note: each undeclared identifier is reported only once for each function it
appears in
/home/roskuttan/nuttxspace/nuttx/arch/arm/src/rp2040/rp2040_i2s_pio.c:272:29:
error: 'CONFIG_RP2040_I2S_CLOCK' undeclared (first use in this function); did
you mean 'CONFIG_RP2040_I2S_PIO'?
272 | uint32_t clock_pin_base = CONFIG_RP2040_I2S_CLOCK;
| ^~~~~~~~~~~~~~~~~~~~~~~
| CONFIG_RP2040_I2S_PIO
[29/1235] Building C object
arch/CMakeFiles/arch.dir/arm/src/rp2040/rp2040_cyw43439.c.obj
ninja: build stopped: subcommand failed.
```
- In my observation, the CMake is working well according to the logs, but it
fails due to undeclared macros (`CONFIG_RP2040_FLASH_LENGTH`,
`CONFIG_RP2040_I2S_DATA`, and `CONFIG_RP2040_I2S_CLOCK`). These need to be
defined in the configuration files to resolve the compilation errors but i
tried adding these still the error persist maybe i have done it wrong.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]