From af8c99e467c44dfcaec2b7221fa1ccdbe45fe55d Mon Sep 17 00:00:00 2001 From: Nicolas Rabault Date: Mon, 15 Feb 2021 17:30:54 +0100 Subject: [PATCH] Add a weak attribute to serial IRQ allowing real time communication lib. --- variants/arduino_mzero/variant.cpp | 4 ++-- variants/arduino_zero/variant.cpp | 4 ++-- variants/circuitplay/variant.cpp | 6 +++--- variants/mkr1000/variant.cpp | 2 +- variants/mkrfox1200/variant.cpp | 4 ++-- variants/mkrgsm1400/variant.cpp | 6 +++--- variants/mkrnb1500/variant.cpp | 6 +++--- variants/mkrvidor4000/variant.cpp | 4 ++-- variants/mkrwan1300/variant.cpp | 8 ++++---- variants/mkrwifi1010/variant.cpp | 6 +++--- variants/nano_33_iot/variant.cpp | 4 ++-- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/variants/arduino_mzero/variant.cpp b/variants/arduino_mzero/variant.cpp index e7adf3566..cb132ed6a 100644 --- a/variants/arduino_mzero/variant.cpp +++ b/variants/arduino_mzero/variant.cpp @@ -212,12 +212,12 @@ SERCOM sercom5( SERCOM5 ) ; Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; Uart Serial( &sercom5, PIN_SERIAL_RX, PIN_SERIAL_TX, PAD_SERIAL_RX, PAD_SERIAL_TX ) ; -void SERCOM0_Handler() +__attribute__((weak)) void SERCOM0_Handler() { Serial1.IrqHandler(); } -void SERCOM5_Handler() +__attribute__((weak)) void SERCOM5_Handler() { Serial.IrqHandler(); } diff --git a/variants/arduino_zero/variant.cpp b/variants/arduino_zero/variant.cpp index 2bc8b4a4e..70137491d 100644 --- a/variants/arduino_zero/variant.cpp +++ b/variants/arduino_zero/variant.cpp @@ -221,12 +221,12 @@ SERCOM sercom5( SERCOM5 ) ; Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; Uart Serial( &sercom5, PIN_SERIAL_RX, PIN_SERIAL_TX, PAD_SERIAL_RX, PAD_SERIAL_TX ) ; -void SERCOM0_Handler() +__attribute__((weak)) void SERCOM0_Handler() { Serial1.IrqHandler(); } -void SERCOM5_Handler() +__attribute__((weak)) void SERCOM5_Handler() { Serial.IrqHandler(); } diff --git a/variants/circuitplay/variant.cpp b/variants/circuitplay/variant.cpp index d9e7b9017..afd3d1df5 100644 --- a/variants/circuitplay/variant.cpp +++ b/variants/circuitplay/variant.cpp @@ -149,7 +149,7 @@ const PinDescription g_APinDescription[]= { PORTA, 11, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG), ADC_Channel19, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 }, // A8 / Light Sensor { PORTA, 9, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_ANALOG), ADC_Channel17, PWM0_CH1, TCC0_CH1, EXTERNAL_INT_9 }, // A9 / Thermistor { PORTA, 4, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG), ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // A10 Proximity - + // GPIO 25 / IR Transmit { PORTA, 23, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM4_CH1, TC4_CH1, EXTERNAL_INT_7 }, // GPIO D25 - IR Transmitter // GPIO 26 / IR Remote in @@ -177,7 +177,7 @@ const PinDescription g_APinDescription[]= // 36..38 - USB - // -------------------- + // -------------------- { PORTA, 22, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // GPIO 29 - Host USB (not used) { PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM { PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP @@ -202,7 +202,7 @@ SERCOM sercom5( SERCOM5 ) ; Uart Serial1( &sercom4, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; -void SERCOM4_Handler() +__attribute__((weak)) void SERCOM4_Handler() { Serial1.IrqHandler(); } diff --git a/variants/mkr1000/variant.cpp b/variants/mkr1000/variant.cpp index 79c2d8e0e..335006613 100644 --- a/variants/mkr1000/variant.cpp +++ b/variants/mkr1000/variant.cpp @@ -179,7 +179,7 @@ SERCOM sercom5(SERCOM5); // Serial1 Uart Serial1(&sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX); -void SERCOM5_Handler() +__attribute__((weak)) void SERCOM5_Handler() { Serial1.IrqHandler(); } diff --git a/variants/mkrfox1200/variant.cpp b/variants/mkrfox1200/variant.cpp index 2c55ed00c..8a318fbf3 100644 --- a/variants/mkrfox1200/variant.cpp +++ b/variants/mkrfox1200/variant.cpp @@ -149,7 +149,7 @@ const PinDescription g_APinDescription[] = { { PORTA, 14, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SS: as GPIO { PORTA, 15, PIO_SERCOM_ALT, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MISO: SERCOM4/PAD[3] { PORTA, 27, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, - + { PORTA, 28, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, { PORTB, 8, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG ), ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, { PORTB, 9, PIO_ANALOG, (PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel3, PWM4_CH1, TC4_CH1, EXTERNAL_INT_9 }, @@ -177,7 +177,7 @@ SERCOM sercom5(SERCOM5); // Serial1 Uart Serial1(&sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX); -void SERCOM5_Handler() +__attribute__((weak)) void SERCOM5_Handler() { Serial1.IrqHandler(); } diff --git a/variants/mkrgsm1400/variant.cpp b/variants/mkrgsm1400/variant.cpp index 2b25934b2..6bd3049dc 100644 --- a/variants/mkrgsm1400/variant.cpp +++ b/variants/mkrgsm1400/variant.cpp @@ -151,7 +151,7 @@ const PinDescription g_APinDescription[] = { { PORTA, 14, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SS: as GPIO { PORTA, 15, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MISO: SERCOM4/PAD[3] { PORTA, 27, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, - + { PORTB, 8, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG ), ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, { PORTB, 9, PIO_ANALOG, (PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel3, PWM4_CH1, TC4_CH1, EXTERNAL_INT_9 }, @@ -261,7 +261,7 @@ void initVariant() { // Serial1 Uart Serial1(&sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX); -void SERCOM5_Handler() +__attribute__((weak)) void SERCOM5_Handler() { Serial1.IrqHandler(); } @@ -269,7 +269,7 @@ void SERCOM5_Handler() // SerialGSM Uart Serial2(&sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX, PIN_SERIAL2_RTS, PIN_SERIAL2_CTS); -void SERCOM4_Handler() +__attribute__((weak)) void SERCOM4_Handler() { Serial2.IrqHandler(); } diff --git a/variants/mkrnb1500/variant.cpp b/variants/mkrnb1500/variant.cpp index 5e61669e5..f1e471ec0 100644 --- a/variants/mkrnb1500/variant.cpp +++ b/variants/mkrnb1500/variant.cpp @@ -151,7 +151,7 @@ const PinDescription g_APinDescription[] = { { PORTA, 14, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SS: as GPIO { PORTA, 15, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MISO: SERCOM4/PAD[3] { PORTA, 27, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, - + { PORTB, 8, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG ), ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, { PORTB, 9, PIO_ANALOG, (PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel3, PWM4_CH1, TC4_CH1, EXTERNAL_INT_9 }, @@ -265,7 +265,7 @@ void initVariant() { // Serial1 Uart Serial1(&sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX); -void SERCOM5_Handler() +__attribute__((weak)) void SERCOM5_Handler() { Serial1.IrqHandler(); } @@ -273,7 +273,7 @@ void SERCOM5_Handler() // SerialSARA Uart Serial2(&sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX); -void SERCOM4_Handler() +__attribute__((weak)) void SERCOM4_Handler() { Serial2.IrqHandler(); } diff --git a/variants/mkrvidor4000/variant.cpp b/variants/mkrvidor4000/variant.cpp index 3a4ece488..b5b32e20b 100644 --- a/variants/mkrvidor4000/variant.cpp +++ b/variants/mkrvidor4000/variant.cpp @@ -151,7 +151,7 @@ const PinDescription g_APinDescription[] = { { PORTA, 14, PIO_DIGITAL, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SS: as GPIO { PORTA, 15, PIO_SERCOM, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MISO: SERCOM2/PAD[3] { PORTA, 27, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, - + { PORTA, 28, PIO_DIGITAL, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, { PORTB, 8, PIO_DIGITAL, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, { PORTB, 9, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel3, PWM4_CH1, TC4_CH1, EXTERNAL_INT_9 }, @@ -251,7 +251,7 @@ SERCOM sercom5(SERCOM5); // Serial1 Uart Serial1(&sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX); -void SERCOM5_Handler() +__attribute__((weak)) void SERCOM5_Handler() { Serial1.IrqHandler(); } diff --git a/variants/mkrwan1300/variant.cpp b/variants/mkrwan1300/variant.cpp index 8e07454fb..fc23d9f6c 100644 --- a/variants/mkrwan1300/variant.cpp +++ b/variants/mkrwan1300/variant.cpp @@ -153,7 +153,7 @@ const PinDescription g_APinDescription[] = { { PORTA, 14, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SS: as GPIO { PORTA, 15, PIO_SERCOM_ALT, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MISO: SERCOM4/PAD[3] { PORTA, 27, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, - + { PORTA, 28, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, { PORTB, 8, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG ), ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, { PORTB, 9, PIO_DIGITAL, (PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel3, PWM4_CH1, TC4_CH1, EXTERNAL_INT_9 }, @@ -267,7 +267,7 @@ SERCOM sercom5(SERCOM5); // Serial1 Uart Serial1(&sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX); -void SERCOM5_Handler() +__attribute__((weak)) void SERCOM5_Handler() { Serial1.IrqHandler(); } @@ -275,7 +275,7 @@ void SERCOM5_Handler() // SerialLoRa Uart Serial2(&sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX); -void SERCOM4_Handler() +__attribute__((weak)) void SERCOM4_Handler() { Serial2.IrqHandler(); -} \ No newline at end of file +} diff --git a/variants/mkrwifi1010/variant.cpp b/variants/mkrwifi1010/variant.cpp index eb146fa59..23ed940c4 100644 --- a/variants/mkrwifi1010/variant.cpp +++ b/variants/mkrwifi1010/variant.cpp @@ -151,7 +151,7 @@ const PinDescription g_APinDescription[] = { { PORTA, 14, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SS: as GPIO { PORTA, 15, PIO_SERCOM_ALT, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MISO: SERCOM4/PAD[3] { PORTA, 27, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, - + { PORTB, 8, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG ), ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, { PORTB, 9, PIO_ANALOG, (PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel3, PWM4_CH1, TC4_CH1, EXTERNAL_INT_9 }, @@ -244,7 +244,7 @@ void initVariant() { // Serial1 Uart Serial1(&sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX); -void SERCOM5_Handler() +__attribute__((weak)) void SERCOM5_Handler() { Serial1.IrqHandler(); } @@ -252,7 +252,7 @@ void SERCOM5_Handler() // Serial2 Uart Serial2(&sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX, PIN_SERIAL2_RTS, PIN_SERIAL2_CTS); -void SERCOM4_Handler() +__attribute__((weak)) void SERCOM4_Handler() { Serial2.IrqHandler(); } diff --git a/variants/nano_33_iot/variant.cpp b/variants/nano_33_iot/variant.cpp index 82c5b9e52..627179eee 100644 --- a/variants/nano_33_iot/variant.cpp +++ b/variants/nano_33_iot/variant.cpp @@ -194,14 +194,14 @@ void SERCOM5_Handler() Uart Serial2(&sercom3, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX); -void SERCOM3_Handler() +__attribute__((weak)) void SERCOM3_Handler() { Serial2.IrqHandler(); } Uart SerialHCI(&sercom2, PIN_SERIALHCI_RX, PIN_SERIALHCI_TX, PAD_SERIALHCI_RX, PAD_SERIALHCI_TX, PIN_SERIALHCI_RTS, PIN_SERIALHCI_CTS); -void SERCOM2_Handler() +__attribute__((weak)) void SERCOM2_Handler() { SerialHCI.IrqHandler(); }