SmingHub / Sming

Sming - powerful open source framework simplifying the creation of embedded C++ applications.
https://sming.readthedocs.io
GNU Lesser General Public License v3.0
1.48k stars 347 forks source link

build issue for SMING_SOC=esp32c3 #2899

Closed pljakobs closed 2 weeks ago

pljakobs commented 2 weeks ago

building for Esp8266 and Esp32 work fine, esp32c3 breaks at the link stage:

esp_rgbww_firmware: Linking out/Esp32/esp32c3/debug/build/app.out
/opt/esp32/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: /home/pjakobs/devel/esp_rgbww_firmware/out/Esp32/esp32c3/debug/lib/clib-App-84defe71fcfacfe13450f15434de8b6f.a(application.o): in function `CallbackTimer<OsTimer64Api<Timer> >::internalSetInterval(unsigned long long)':
/opt/Sming/Sming/Core/CallbackTimer.h:415:(.text._ZN21DelegateCallbackTimerI12OsTimer64ApiI5TimerEE12initializeMsEj8DelegateIFvvEE[_ZN21DelegateCallbackTimerI12OsTimer64ApiI5TimerEE12initializeMsEj8DelegateIFvvEE]+0x132): undefined reference to `smg_timer_arm_ticks(smg_timer_t*, unsigned int, bool)'
/opt/esp32/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: /home/pjakobs/devel/esp_rgbww_firmware/out/Esp32/esp32c3/debug/lib/clib-App-84defe71fcfacfe13450f15434de8b6f.a(application.o): in function `CallbackTimer<OsTimer64Api<Timer> >::start(bool)':
/opt/Sming/Sming/Core/CallbackTimer.h:216:(.text._ZN11Application7restartEv+0xa8): undefined reference to `smg_timer_arm_ticks(smg_timer_t*, unsigned int, bool)'
/opt/esp32/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: /opt/Sming/Sming/Core/CallbackTimer.h:216:(.text._ZN11Application23forget_wifi_and_restartEv+0x98): undefined reference to `smg_timer_arm_ticks(smg_timer_t*, unsigned int, bool)'
/opt/esp32/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: /home/pjakobs/devel/esp_rgbww_firmware/out/Esp32/esp32c3/debug/lib/clib-App-84defe71fcfacfe13450f15434de8b6f.a(application.o): in function `Application::delayedCMD(String, int)':
/home/pjakobs/devel/esp_rgbww_firmware/app/application.cpp:467:(.text._ZN11Application10delayedCMDE6Stringi+0x192): undefined reference to `smg_timer_arm_ticks(smg_timer_t*, unsigned int, bool)'
/opt/esp32/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: /home/pjakobs/devel/esp_rgbww_firmware/out/Esp32/esp32c3/debug/lib/clib-App-84defe71fcfacfe13450f15434de8b6f.a(application.o): in function `CallbackTimer<OsTimer64Api<Timer> >::stop()':
/opt/Sming/Sming/Core/CallbackTimer.h:239:(.text._ZN11Application4initEv+0x12c): undefined reference to `smg_timer_arm_ticks(smg_timer_t*, unsigned int, bool)'
/opt/esp32/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: /home/pjakobs/devel/esp_rgbww_firmware/out/Esp32/esp32c3/debug/lib/clib-App-84defe71fcfacfe13450f15434de8b6f.a(application.o):/home/pjakobs/devel/esp_rgbww_firmware/app/application.cpp:232: more undefined references to `smg_timer_arm_ticks(smg_timer_t*, unsigned int, bool)' follow
/opt/esp32/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: /home/pjakobs/devel/esp_rgbww_firmware/out/Esp32/esp32c3/debug/lib/clib-App-84defe71fcfacfe13450f15434de8b6f.a(application.o): in function `HardwareSerial::begin(unsigned int)':
/opt/Sming/Sming/Wiring/Print.h:114:(.text._Z4initv+0x22): undefined reference to `HardwareSerial::begin(unsigned int, SerialFormat, SerialMode, unsigned char, unsigned char)'

not sure what to do with this.

pljakobs commented 2 weeks ago

I think, the function signature is smg_timer_arm_ticks(smg_timer_t*, unsigned long, bool) while the linker is looking for unsigned int, so this is a data type size issue again? I have this in my app:

#ifdef __riscv
//#if SMING_SOC==esp32c3
//#warning "redefining INT32 to be int, not long int for riscv based esp32c3"
#undef __INT32_TYPE__
#define __INT32_TYPE__ int

#undef __UINT32_TYPE__
#define __UINT32_TYPE__ unsigned int

#endif // __riscv
pljakobs commented 2 weeks ago

with this redefine removed, the app builds ok. Is this no longer necessary with IDF 5.2?

pljakobs commented 2 weeks ago

okay, I can't see any issues without this redefine - it seems that this has been fixed in the espressif code.