stimav4: master firmware do not compile
pat1 opened this issue · 2 comments
The cyphal definition in dsdl are not all uppercase.
Those are patch to get correct include:
diff --git a/platformio/stima_v4/master/include/canard_class_master.hpp b/platformio/stima_v4/master/include/canard_class_master.hpp
index 81e649c91..0395b1f4a 100644
--- a/platformio/stima_v4/master/include/canard_class_master.hpp
+++ b/platformio/stima_v4/master/include/canard_class_master.hpp
@@ -49,16 +49,16 @@
// Namespace RMAP
#include <rmap/_module/TH_1_0.h>
#include <rmap/service/_module/TH_1_0.h>
-#include <rmap/_module/RAIN_1_0.h>
-#include <rmap/service/_module/RAIN_1_0.h>
-#include <rmap/_module/POWER_1_0.h>
-#include <rmap/service/_module/POWER_1_0.h>
-#include <rmap/_module/RADIATION_1_0.h>
-#include <rmap/service/_module/RADIATION_1_0.h>
+#include <rmap/_module/Rain_1_0.h>
+#include <rmap/service/_module/Rain_1_0.h>
+#include <rmap/_module/Power_1_0.h>
+#include <rmap/service/_module/Power_1_0.h>
+#include <rmap/_module/Radiation_1_0.h>
+#include <rmap/service/_module/Radiation_1_0.h>
#include <rmap/_module/VWC_1_0.h>
#include <rmap/service/_module/VWC_1_0.h>
-#include <rmap/_module/WIND_1_0.h>
-#include <rmap/service/_module/WIND_1_0.h>
+#include <rmap/_module/Wind_1_0.h>
+#include <rmap/service/_module/Wind_1_0.h>
#ifndef _CANARD_CLASS_H
#define _CANARD_CLASS_H
@@ -616,4 +616,4 @@ class canardClass {
uint8_t _rxSubscriptionIdx;
};
-#endif
\ No newline at end of file
+#endif
diff --git a/platformio/stima_v4/master/include/tasks/mqtt_task.h b/platformio/stima_v4/master/include/tasks/mqtt_task.h
index 203c85867..d72b467e8 100644
--- a/platformio/stima_v4/master/include/tasks/mqtt_task.h
+++ b/platformio/stima_v4/master/include/tasks/mqtt_task.h
@@ -72,16 +72,16 @@
// Canard Type data
#include <rmap/_module/TH_1_0.h>
#include <rmap/service/_module/TH_1_0.h>
-#include <rmap/_module/RAIN_1_0.h>
-#include <rmap/service/_module/RAIN_1_0.h>
-#include <rmap/_module/POWER_1_0.h>
-#include <rmap/service/_module/POWER_1_0.h>
-#include <rmap/_module/RADIATION_1_0.h>
-#include <rmap/service/_module/RADIATION_1_0.h>
+#include <rmap/_module/Rain_1_0.h>
+#include <rmap/service/_module/Rain_1_0.h>
+#include <rmap/_module/Power_1_0.h>
+#include <rmap/service/_module/Power_1_0.h>
+#include <rmap/_module/Radiation_1_0.h>
+#include <rmap/service/_module/Radiation_1_0.h>
#include <rmap/_module/VWC_1_0.h>
#include <rmap/service/_module/VWC_1_0.h>
-#include <rmap/_module/WIND_1_0.h>
-#include <rmap/service/_module/WIND_1_0.h>
+#include <rmap/_module/Wind_1_0.h>
+#include <rmap/service/_module/Wind_1_0.h>
#if (MODULE_TYPE == STIMA_MODULE_TYPE_MASTER_ETH)
// #include "drivers/spi/arduino_spi_driver.h"
@@ -268,4 +268,4 @@ private:
};
#endif
-#endif
\ No newline at end of file
+#endif
but at the end I get:
Building in release mode
Linking .pio/build/stimav4_master/firmware.elf
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/stimav4_master/lib699/CycloneTCP-DriversUart/drivers/uart/uart_driver.c.o: in function `USART2_IRQHandler':
/home/pat1/git/rmap/platformio/stima_v4/libraries/CycloneTCP-DriversUart/src/drivers/uart/uart_driver.c:159: multiple definition of `USART2_IRQHandler'; .pio/build/stimav4_master/SrcWrapper/src/stm32/uart.c.o:/home/pat1/.platformio/packages/framework-arduinoststm32/libraries/SrcWrapper/src/stm32/uart.c:951: first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/stimav4_master/firmware.elf] Error 1
Ho trovato queste note:
******************************* NOTE VARIE STIMA V4 MASTER ********************************
1) Modificare STM32Duino attribute __weak prima di USART2_IRQHandler
La Libreria è gestita da Cyclone che istanzia IRQ_Handler (Com2 in questo caso)
Arduino prenderebbe possesso di tutte le seriali (anche non utilizzate) senza lasciare possibilità
di gestione esterna di alcun genere.
Modulo uart.c in libraries\srcWrapper\src\stm32\uart.c Line 950
#if defined(USART2_BASE)
__weak void USART2_IRQHandler(void)
{
__weak void Consente una redifinizione esterna o mantiene quella esistente se non necessaria la redifinizione
2) Raddoppio del Buffer RX UsbSerial x trasmissione a pacchetti 64Byte in polling per modalità CDC STM32
Modulo cdc_queue.h in libraries\srcWrapper\src\stm32\usb\cdc\cdc_queue.h Line 57
#define CDC_RECEIVE_QUEUE_BUFFER_SIZE ((uint16_t)(CDC_QUEUE_MAX_PACKET_SIZE * 6)) // (Originale = *3)
seguendo le istruzioni a :
https://github.com/stm32duino/Arduino_Core_STM32/wiki/HAL-configuration
aggiungendo il file hal_conf_extra.h in include con:
#define HAL_UART_MODULE_ONLY
si ottiene:
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/stimav4_master/src/debug.cpp.o: in function `HardwareSerial::begin(unsigned long)':
/home/pat1/.platformio/packages/framework-arduinoststm32/cores/arduino/HardwareSerial.h:120: undefined reference to `Serial4'
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/pat1/.platformio/packages/framework-arduinoststm32/cores/arduino/HardwareSerial.h:120: undefined reference to `HardwareSerial::begin(unsigned long, unsigned char)'
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/stimav4_master/src/debug.cpp.o: in function `print_debug_F(__FlashStringHelper const*, ...)':
/home/pat1/git/rmap/platformio/stima_v4/master/src/debug.cpp:72: undefined reference to `HardwareSerial::flush()'
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/pat1/git/rmap/platformio/stima_v4/master/src/debug.cpp:74: undefined reference to `Serial4'
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/stimav4_master/src/debug.cpp.o: in function `HardwareSerial::write(int)':
/home/pat1/.platformio/packages/framework-arduinoststm32/cores/arduino/HardwareSerial.h:144: undefined reference to `HardwareSerial::write(unsigned char)'
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/stimav4_master/src/debug.cpp.o: in function `fputc':
/home/pat1/git/rmap/platformio/stima_v4/master/src/debug.cpp:47: undefined reference to `Serial4'
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/stimav4_master/src/drivers/freeRTOS_callback.cpp.o: in function `vApplicationStackOverflowHook':
/home/pat1/git/rmap/platformio/stima_v4/master/src/drivers/freeRTOS_callback.cpp:134: undefined reference to `HardwareSerial::flush()'
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/pat1/git/rmap/platformio/stima_v4/master/src/drivers/freeRTOS_callback.cpp:138: undefined reference to `Serial4'
/home/pat1/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/stimav4_master/src/main.cpp.o: in function `setup':
/home/pat1/git/rmap/platformio/stima_v4/master/src/main.cpp:191: undefined reference to `Serial4'
il che fa desumere che almeno una seriale di Arduino (Serial4) sia utilizzata e che quindi sovrascrivere le sue ISR non sia indolore ?
Il secondo punto delle note è affrontato qui:
stm32duino/Arduino_Core_STM32#1929
la redifinizione delle macro per gcc è affrontata qui:
https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html
e qui:
https://stackoverflow.com/questions/18483166/override-macro-from-the-command-line#18488707
quindi rimane di provare ad usare build_opt.h prima di fare un fork di stm32duino
il primo punto per il momento è stato risolto disabilitando l'uso della Serial di arduino attivata con la macro DISABLE_SERIAL in platform.ini
il secondo punto è stato risolto creando un fork di st32duino e creando un branch dalla versione 2.5 e creando una patch per abilitare la definizione da macro del numero di pacchetti usati per il buffer CDC tramite macro CDC_RECEIVE_QUEUE_BUFFER_PACKET_NUMBER=6
Questo il commit di riferimento:
255d950
ora il firmware compila con successo nella continous integration
Il bug rimane aperto per risolvere l'utilizzo della Serial