TcMenu / TaskManagerIO

A task, event, scheduling, and interrupt marshalling library for Arduino and mbed boards.
Apache License 2.0
122 stars 12 forks source link

[issue with ESP32 core] 1.4.1 compile fails for nano esp32 #53

Open tomelgato opened 5 months ago

tomelgato commented 5 months ago

On PlatformIO with board "arduino_nano_esp32" compile fails:

/Users/tm/.platformio/packages/framework-arduinoespressif32/cores/esp32/io_pin_remap.h:44:69: error: 'digitalPinToGPIONumber' is not a type

define attachInterrupt(pin, fcn, mode) attachInterrupt(digitalPinToGPIONumber(pin), fcn, mode)

tomelgato commented 5 months ago

[env:arduino_nano_esp32] platform = espressif32 board = arduino_nano_esp32 framework = arduino

davetcc commented 5 months ago

I'm afraid I don't have one of those boards so for now can't fix it. If you can find what's wrong and raise a PR I'm happy to merge.

And you're using PlatformIO too, it seems that PlatformIO ESP32 latest versions are now running into a few issues just like Pico support. I would start by checking for compilation in Arduino IDE before anything else. This is deep in ESP32 core code framework-arduinoespressif32/cores/esp32/io_pin_remap.h.

tomelgato commented 5 months ago

You dont need the board, you just need to set the environment and try to compile. I just included your libs, no more code ;)

out of memory ... the Arduino nano esp33 libs are missing the digitalPinToGPIONumber function, i did read somewhere that a user managed to get it running with a generic esp32 library (on arduino ide)

Edit: this is the mentioned link: https://www.reddit.com/r/arduino/comments/1bl5a66/error_digitalpintogpionumber_was_not_declared_in/

davetcc commented 5 months ago

EDIT - see linked issue directly below, and the last comment.

More Arduino incompatibilities unfortunately. If you thought things were a mess in the past, at least then writers of cores tried to keep critical functions that were relied on by libraries, now it seems to be a free for all. I'm not sure it is supportable with that missing. Just to be clear, that is not in code I can do anything about, we are just calling attachInterrupt(pin, function, mode).

tomelgato commented 5 months ago

See here for a solution:

https://github.com/espressif/arduino-esp32/issues/9150

tomelgato commented 5 months ago

Other solution could be this:

I tried the IDE Tools option "Pin numbering: By GPIO number (legacy)" and the compilation was OK!

But i dont know if its possible to do in PlatformIO

tomelgato commented 5 months ago

I didnt post the complete compiler error, the first one is this and then a lot more with the same problem:

Compiling .pio/build/arduino_nano_esp32/lib7f3/SimpleCollections/SCThreadingSupport.cpp.o Compiling .pio/build/arduino_nano_esp32/lib7f3/SimpleCollections/SimpleCollections.cpp.o In file included from /Users/tm/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:223, from .pio/libdeps/arduino_nano_esp32/TaskManagerIO/src/TaskPlatformDeps.h:28, from .pio/libdeps/arduino_nano_esp32/TaskManagerIO/src/TaskManagerIO.cpp:6: /Users/tm/.platformio/packages/framework-arduinoespressif32/cores/esp32/io_pin_remap.h:44:69: error: 'digitalPinToGPIONumber' is not a type

define attachInterrupt(pin, fcn, mode) attachInterrupt(digitalPinToGPIONumber(pin), fcn, mode)

                                                                 ^~~~~~~~~~~~~~~~~~~~~~

.pio/libdeps/arduino_nano_esp32/TaskManagerIO/src/TaskManagerIO.h:64:18: note: in expansion of macro 'attachInterrupt' virtual void attachInterrupt(pintype_t pin, RawIntHandler fn, uint8_t mode) = 0;

tomelgato commented 5 months ago

More Arduino incompatibilities unfortunately. If you thought things were a mess in the past, at least then writers of cores tried to keep critical functions that were relied on by libraries, now it seems to be a free for all.

The pin numbering puzzled me some times already. The convention for the ESP using D2 instead of 5 ... dont know if i like it or not. If it would be across all Arduino boards it could be good. Btw. with the FastAccelStepper library as example i had to use the 5 instead of D2 ... so confusion will stay ;)

Pinout_Arduino-Nano-ESP32

me-no-dev commented 5 months ago

Hi @tomelgato . I am no platformio fluent, but I know there is a way for you to define additional build flags. If you add the following define to your build env, you should be able to compile with pin remap off: -D BOARD_USES_HW_GPIO_NUMBERS (and use the yellow GPIO numbers from the image above)

tomelgato commented 5 months ago

@me-no-dev Supercool, thanks a lot. It compiles with that option. Where did you find that info? Even googeling with "BOARD_USES_HW_GPIO_NUMBERS" brings nothing.

me-no-dev commented 5 months ago

Hi @tomelgato :) Found it in the Arduino board definition (that menu option that allows you to turn it off): https://github.com/espressif/arduino-esp32/blob/master/boards.txt#L35586