Skip to content

[BUG] error: 'sio_hw' undeclared. Possible missing #include in RP2040 port.c #1184

@JLKenyon

Description

@JLKenyon

Describe the bug
I got the following error while trying to build an RP2040 hello world app:

/home/jlkenyon/Projects/SomeFreeRTOSExamples/submodules/FreeRTOS-Kernel/portable/ThirdParty/GCC/RP2040/port.c:1091:17: error: 'sio_hw' undeclared (first use in this function); did you mean 'scb_hw'?
 1091 |                 sio_hw->fifo_wr = 0;
      |                 ^~~~~~
      |                 scb_hw      

It looks like the sio_hw object is defined in hardware/structs/sio.h in the pico-sdk, and the FreeRTOS RP2040/port.c references the clocks.h and exception.h from the pico-sdk already.

sio_hw definition:
https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2040/hardware_structs/include/hardware/structs/sio.h#L196

Proposed fix:

diff --git a/portable/ThirdParty/GCC/RP2040/port.c b/portable/ThirdParty/GCC/RP2040/port.c
index 6c5d0e513..7c2041993 100644
--- a/portable/ThirdParty/GCC/RP2040/port.c
+++ b/portable/ThirdParty/GCC/RP2040/port.c
@@ -36,6 +36,7 @@
 #include "rp2040_config.h"
 #include "hardware/clocks.h"
 #include "hardware/exception.h"
+#include "hardware/structs/sio.h"
 
 /*
  * LIB_PICO_MULTICORE == 1, if we are linked with pico_multicore (note that

Target

  • Development board: Adafruit Feather RP2040
  • Instruction Set Architecture: ARM Cortex M0+
  • IDE and version: Vim/Ubuntu
  • Toolchain and version: arm-none-eabi-gcc (15:13.2.rel1-2) 13.2.1 20231009

Host

  • Host OS: Ubuntu
  • Version: 24.04

To Reproduce

  • I am working on sharing the project in question to github as a separate project. If will add a comment referencing this project if needed (and if I get it shared in a timely manner)

Expected behavior
Build RP2040 example without "undeclared" errors

Screenshots
N/A

Additional context
I am having trouble getting CMake to behave in a way that makes sense, so I am unsure if I setting up my project correctly. I will share this information later if I can get my code posted for reference.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions