Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't compile from fresh install (doesn't recognize iobank0_hw) #16

Open
Plaque-fcc opened this issue Jan 4, 2025 · 3 comments · May be fixed by #17
Open

Doesn't compile from fresh install (doesn't recognize iobank0_hw) #16

Plaque-fcc opened this issue Jan 4, 2025 · 3 comments · May be fixed by #17

Comments

@Plaque-fcc
Copy link

I clone this repo, launch ./build.sh, and this is what i get:

[ 20%] Building CXX object CMakeFiles/picorvd.dir/src/Console.cpp.o
[ 21%] Building CXX object CMakeFiles/picorvd.dir/src/GDBServer.cpp.o
[ 22%] Building CXX object CMakeFiles/picorvd.dir/src/utils.cpp.o
/build/picorvd/src/PicoSWIO.cpp: In member function 'void PicoSWIO::reset(int)':
/build/picorvd/src/PicoSWIO.cpp:61:3: error: 'iobank0_hw' was not declared in this scope; did you mean 'io_bank0_hw'?
   61 |   iobank0_hw->io[pin].ctrl = GPIO_FUNC_SIO << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
      |   ^~~~~~~~~~
      |   io_bank0_hw
make[2]: *** [CMakeFiles/picorvd.dir/build.make:94: CMakeFiles/picorvd.dir/src/PicoSWIO.cpp.o] Error 1

Regardless of whether I offer it the latest Pico SDK repo via PICO_SDK_PATH or let it download its own copy of the SDK, the result is the same.

When I look into the SDK:

$ git grep -i 'iobank0_hw'
src/rp2040/hardware_structs/include/hardware/structs/iobank0.h:#define iobank0_hw io_bank0_hw
src/rp2350/hardware_structs/include/hardware/structs/iobank0.h:#define iobank0_hw io_bank0_hw

Do you have any ideas or advices?

@Plaque-fcc Plaque-fcc linked a pull request Jan 4, 2025 that will close this issue
@Plaque-fcc
Copy link
Author

As @maxgerhardt kindly mentioned in his PR #15, the current state of the branch master in Pico SDK repo doesn't let your project build correctly. Using version 1.5.1 (tag 1.5.1) instead solves the issue.

@intx82
Copy link

intx82 commented Jan 11, 2025

Try to use next patch:

diff --git a/src/PicoSWIO.cpp b/src/PicoSWIO.cpp
index f0a3b02..7ca99a7 100644
--- a/src/PicoSWIO.cpp
+++ b/src/PicoSWIO.cpp
@@ -58,10 +58,10 @@ void PicoSWIO::reset(int pin) {
   // If we use the sdk functions to do this we get jitter :/
   sio_hw->gpio_clr    = (1 << pin);
   sio_hw->gpio_oe_set = (1 << pin);
-  iobank0_hw->io[pin].ctrl = GPIO_FUNC_SIO << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
+  io_bank0_hw->io[pin].ctrl = GPIO_FUNC_SIO << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
   busy_wait(100); // ~8 usec
   sio_hw->gpio_oe_clr = (1 << pin);
-  iobank0_hw->io[pin].ctrl = GPIO_FUNC_PIO0 << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
+  io_bank0_hw->io[pin].ctrl = GPIO_FUNC_PIO0 << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
 
   // Enable debug output pin on target
   put(WCH_DM_SHDWCFGR, 0x5AA50400);

@Plaque-fcc
Copy link
Author

Try to use next patch:

diff --git a/src/PicoSWIO.cpp b/src/PicoSWIO.cpp
index f0a3b02..7ca99a7 100644
--- a/src/PicoSWIO.cpp
+++ b/src/PicoSWIO.cpp
@@ -58,10 +58,10 @@ void PicoSWIO::reset(int pin) {
   // If we use the sdk functions to do this we get jitter :/
   sio_hw->gpio_clr    = (1 << pin);
   sio_hw->gpio_oe_set = (1 << pin);
-  iobank0_hw->io[pin].ctrl = GPIO_FUNC_SIO << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
+  io_bank0_hw->io[pin].ctrl = GPIO_FUNC_SIO << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
   busy_wait(100); // ~8 usec
   sio_hw->gpio_oe_clr = (1 << pin);
-  iobank0_hw->io[pin].ctrl = GPIO_FUNC_PIO0 << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
+  io_bank0_hw->io[pin].ctrl = GPIO_FUNC_PIO0 << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
 
   // Enable debug output pin on target
   put(WCH_DM_SHDWCFGR, 0x5AA50400);

Yeah, I think this will be useful for other users as well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants