From 82e3d1d1f35019fd8050b8d0756df3aa833f243c Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 19 Oct 2022 17:45:54 +0200 Subject: [PATCH 1/5] sys/stdio_uart: fix undefined behavior Also drop the `-Wno-cast-function-type` hack that allowed the bug to sneak past Murdock. --- sys/stdio_uart/Makefile | 3 --- sys/stdio_uart/stdio_uart.c | 37 +++++++++++++++++-------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/sys/stdio_uart/Makefile b/sys/stdio_uart/Makefile index 7f3b72f4a69c5..48422e909a47d 100644 --- a/sys/stdio_uart/Makefile +++ b/sys/stdio_uart/Makefile @@ -1,4 +1 @@ -ifeq (gnu, $(TOOLCHAIN)) - CFLAGS += -Wno-cast-function-type -endif include $(RIOTBASE)/Makefile.base diff --git a/sys/stdio_uart/stdio_uart.c b/sys/stdio_uart/stdio_uart.c index 07c12a34f39fd..19e0530f8b665 100644 --- a/sys/stdio_uart/stdio_uart.c +++ b/sys/stdio_uart/stdio_uart.c @@ -30,11 +30,11 @@ #include #include -#include "stdio_uart.h" - #include "board.h" -#include "periph/uart.h" #include "isrpipe.h" +#include "kernel_defines.h" +#include "periph/uart.h" +#include "stdio_uart.h" #if MODULE_VFS #include "vfs.h" @@ -43,23 +43,23 @@ #define ENABLE_DEBUG 0 #include "debug.h" -#ifdef MODULE_STDIO_UART_RX static uint8_t _rx_buf_mem[STDIO_UART_RX_BUFSIZE]; isrpipe_t stdio_uart_isrpipe = ISRPIPE_INIT(_rx_buf_mem); -#endif + +static void _isrpipe_write_one_wrapper(void *arg, uint8_t value) +{ + isrpipe_write_one(arg, value); +} void stdio_init(void) { - uart_rx_cb_t cb; - void *arg; + uart_rx_cb_t cb = NULL; + void *arg = NULL; -#ifdef MODULE_STDIO_UART_RX - cb = (uart_rx_cb_t) isrpipe_write_one; - arg = &stdio_uart_isrpipe; -#else - cb = NULL; - arg = NULL; -#endif + if (IS_USED(MODULE_STDIO_UART_RX)) { + cb = _isrpipe_write_one_wrapper; + arg = &stdio_uart_isrpipe; + } uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg); @@ -77,13 +77,10 @@ int stdio_available(void) ssize_t stdio_read(void* buffer, size_t count) { -#ifdef MODULE_STDIO_UART_RX - return (ssize_t)isrpipe_read(&stdio_uart_isrpipe, buffer, count); -#else - (void)buffer; - (void)count; + if (IS_USED(MODULE_STDIO_UART_RX)) { + return (ssize_t)isrpipe_read(&stdio_uart_isrpipe, buffer, count); + } return -ENOTSUP; -#endif } ssize_t stdio_write(const void *buffer, size_t len) From b9b63da98445dd43881053dd652e56c6f76740c9 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Fri, 21 Oct 2022 17:27:45 +0200 Subject: [PATCH 2/5] makefiles/tools/gdb.inc.mk: prefer $(target)-gdb over gdb-multiarch In an ideal world everyone would just install `gdb-multiarch` and be happy. However, some MCUs need magic GDB versions sprinkled with unicorn-stardust-Espressif-patches... Since there is little reason to have `$(target)-gdb` installed in addition to `gdb-multiarch` if `gdb-multiarch` would work fine, let's assume the user wants to use `$(target)-gdb` when present over `gdb-multiarch`. Co-authored-by: Gunar Schorcht --- makefiles/tools/gdb.inc.mk | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/makefiles/tools/gdb.inc.mk b/makefiles/tools/gdb.inc.mk index cfe06254d5d37..5567495cbf161 100644 --- a/makefiles/tools/gdb.inc.mk +++ b/makefiles/tools/gdb.inc.mk @@ -1,7 +1,11 @@ -# new versions of gdb will support all architectures in one binary -ifeq ($(shell gdb-multiarch -v > /dev/null 2>&1; echo $$?),0) -export GDB ?= gdb-multiarch +export GDBPREFIX ?= $(PREFIX) + +# If the user installed a magic single target GDB rather than just using +# gdb-multiarch, there typically is a reason for it - e.g. missing support for +# that particular target in gdb-multiarch. +ifeq ($(shell $(GDBPREFIX)gdb -v > /dev/null 2>&1; echo $$?),0) + export GDB ?= $(GDBPREFIX)gdb else -export GDBPREFIX ?= $(PREFIX) -export GDB ?= $(GDBPREFIX)gdb + # gdb-multiarch is normally + export GDB ?= gdb-multiarch endif From 3f39c090dae80809fd4a5da3b294b4faaad56235 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 24 Oct 2022 14:42:16 +0200 Subject: [PATCH 3/5] pkg/lvgl: bump to 8.3.3 --- pkg/lvgl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/lvgl/Makefile b/pkg/lvgl/Makefile index 030e544389d41..e3673fa261b05 100644 --- a/pkg/lvgl/Makefile +++ b/pkg/lvgl/Makefile @@ -1,7 +1,7 @@ PKG_NAME=lvgl PKG_URL=https://github.com/littlevgl/lvgl -# v8.3.1 -PKG_VERSION=9024b72b4853e1e7ac29a42e54b7a10d3c4f3b20 +# v8.3.3 +PKG_VERSION=5545ffc9257808ee26eac833ec5326706cdf2007 PKG_LICENSE=MIT include $(RIOTBASE)/pkg/pkg.mk From 980eb89f574520622e293748f43dbadfe83821f8 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 25 Oct 2022 10:26:43 +0200 Subject: [PATCH 4/5] pkg/arduino_sdi_12: bump version, fix patches --- pkg/arduino_sdi_12/Makefile | 4 +- ...gpio-to-handle-pin-change-interrupts.patch | 24 ++--- ...on-with-RIOT-to-support-other-boards.patch | 26 +++--- .../0003-RIOT-Fix-for-SAMD-boards.patch | 90 ++++++++++++++----- 4 files changed, 95 insertions(+), 49 deletions(-) diff --git a/pkg/arduino_sdi_12/Makefile b/pkg/arduino_sdi_12/Makefile index bc4e253f625e0..cb7e3eecbbcc8 100644 --- a/pkg/arduino_sdi_12/Makefile +++ b/pkg/arduino_sdi_12/Makefile @@ -1,10 +1,8 @@ PKG_NAME=arduino_sdi_12 PKG_URL=https://github.com/EnviroDIY/Arduino-SDI-12 -PKG_VERSION=fd9699b390edeac3a8681e2a6d4fe2ba8b1f9a51 +PKG_VERSION=1fa8edbeb25fbb6cff71495583e664b5e8ae18a5 PKG_LICENSE=BSD-3-Clause -GITAMFLAGS = --3way - include $(RIOTBASE)/pkg/pkg.mk all: diff --git a/pkg/arduino_sdi_12/patches/0001-Use-RIOT-s-gpio-to-handle-pin-change-interrupts.patch b/pkg/arduino_sdi_12/patches/0001-Use-RIOT-s-gpio-to-handle-pin-change-interrupts.patch index 4f226975ee244..fc5ddaff23512 100644 --- a/pkg/arduino_sdi_12/patches/0001-Use-RIOT-s-gpio-to-handle-pin-change-interrupts.patch +++ b/pkg/arduino_sdi_12/patches/0001-Use-RIOT-s-gpio-to-handle-pin-change-interrupts.patch @@ -1,4 +1,4 @@ -From 275a4d976ea9140076e2625a69e495aec60d2fe4 Mon Sep 17 00:00:00 2001 +From 24135451e8161eca75ceafc1a62854ffa4b14ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= Date: Thu, 7 Oct 2021 19:35:14 +0200 Subject: [PATCH 1/3] Use RIOT's gpio to handle pin change interrupts @@ -12,11 +12,11 @@ Signed-off-by: J. David Ibáñez src/SDI12.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) -diff --git src/SDI12.cpp src/SDI12.cpp -index c71e998..257eb5a 100644 ---- src/SDI12.cpp -+++ src/SDI12.cpp -@@ -349,10 +349,11 @@ void SDI12::setPinInterrupts(bool enable) { +diff --git a/src/SDI12.cpp b/src/SDI12.cpp +index f88fc56..477b16d 100644 +--- a/src/SDI12.cpp ++++ b/src/SDI12.cpp +@@ -345,10 +345,11 @@ void SDI12::setPinInterrupts(bool enable) { // We don't detach the function from the interrupt for AVR processors } #else @@ -30,7 +30,7 @@ index c71e998..257eb5a 100644 } #endif } -@@ -557,7 +558,8 @@ void ICACHE_RAM_ATTR SDI12::handleInterrupt() { +@@ -552,7 +553,8 @@ void ICACHE_RAM_ATTR SDI12::handleInterrupt() { if (_activeObject) _activeObject->receiveISR(); } #else @@ -40,11 +40,11 @@ index c71e998..257eb5a 100644 if (_activeObject) _activeObject->receiveISR(); } #endif -diff --git src/SDI12.h src/SDI12.h -index ec949e3..6469c7b 100644 ---- src/SDI12.h -+++ src/SDI12.h -@@ -971,10 +971,10 @@ class SDI12 : public Stream { +diff --git a/src/SDI12.h b/src/SDI12.h +index 06eb7ab..9ac77f7 100644 +--- a/src/SDI12.h ++++ b/src/SDI12.h +@@ -972,10 +972,10 @@ class SDI12 : public Stream { * * On espressif boards (ESP8266 and ESP32), the ISR must be stored in IRAM */ diff --git a/pkg/arduino_sdi_12/patches/0002-Integration-with-RIOT-to-support-other-boards.patch b/pkg/arduino_sdi_12/patches/0002-Integration-with-RIOT-to-support-other-boards.patch index eac8b7dda7a23..28e0d40609d21 100644 --- a/pkg/arduino_sdi_12/patches/0002-Integration-with-RIOT-to-support-other-boards.patch +++ b/pkg/arduino_sdi_12/patches/0002-Integration-with-RIOT-to-support-other-boards.patch @@ -1,4 +1,4 @@ -From e5a4be53f1bdc4a3c435ad7a35f2d6333277837e Mon Sep 17 00:00:00 2001 +From 3bcd51536348265cf44ed326ccb568a06f96f761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= Date: Tue, 3 Aug 2021 12:19:19 +0200 Subject: [PATCH 2/3] Integration with RIOT, to support other boards @@ -19,10 +19,10 @@ Signed-off-by: J. David Ibáñez src/SDI12_boards.h | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 3 deletions(-) -diff --git src/SDI12.h src/SDI12.h -index 6469c7b..b57b5bc 100644 ---- src/SDI12.h -+++ src/SDI12.h +diff --git a/src/SDI12.h b/src/SDI12.h +index 9ac77f7..6709771 100644 +--- a/src/SDI12.h ++++ b/src/SDI12.h @@ -191,11 +191,19 @@ enum LookaheadMode { * processor timer directly. */ @@ -44,10 +44,10 @@ index 6469c7b..b57b5bc 100644 #endif // defined(ESP32) || defined(ESP8266) /** -diff --git src/SDI12_boards.cpp src/SDI12_boards.cpp +diff --git a/src/SDI12_boards.cpp b/src/SDI12_boards.cpp index beb28e8..2159eee 100644 ---- src/SDI12_boards.cpp -+++ src/SDI12_boards.cpp +--- a/src/SDI12_boards.cpp ++++ b/src/SDI12_boards.cpp @@ -275,5 +275,13 @@ sdi12timer_t SDI12Timer::SDI12TimerRead(void) { } // Unknown board @@ -63,11 +63,11 @@ index beb28e8..2159eee 100644 +} + #endif -diff --git src/SDI12_boards.h src/SDI12_boards.h -index a2a533e..ff0e69e 100644 ---- src/SDI12_boards.h -+++ src/SDI12_boards.h -@@ -387,7 +387,38 @@ class SDI12Timer { +diff --git a/src/SDI12_boards.h b/src/SDI12_boards.h +index d91eff4..686444f 100644 +--- a/src/SDI12_boards.h ++++ b/src/SDI12_boards.h +@@ -511,7 +511,38 @@ class SDI12Timer { // Unknown board #else diff --git a/pkg/arduino_sdi_12/patches/0003-RIOT-Fix-for-SAMD-boards.patch b/pkg/arduino_sdi_12/patches/0003-RIOT-Fix-for-SAMD-boards.patch index 34cd473bb44e1..9d0390288aa51 100644 --- a/pkg/arduino_sdi_12/patches/0003-RIOT-Fix-for-SAMD-boards.patch +++ b/pkg/arduino_sdi_12/patches/0003-RIOT-Fix-for-SAMD-boards.patch @@ -1,4 +1,4 @@ -From a22d62b524c624ce4ec16f690439d3b737e69bac Mon Sep 17 00:00:00 2001 +From ff9eba693d589c8241b02e8c29a176a55c665816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= Date: Tue, 11 Jan 2022 13:09:40 +0100 Subject: [PATCH 3/3] RIOT: Fix for SAMD boards @@ -11,16 +11,16 @@ it hangs. Signed-off-by: J. David Ibáñez --- - src/SDI12.cpp | 4 +-- - src/SDI12_boards.cpp | 58 -------------------------------------------- - src/SDI12_boards.h | 45 ---------------------------------- - 3 files changed, 1 insertion(+), 106 deletions(-) + src/SDI12.cpp | 4 +- + src/SDI12_boards.cpp | 58 --------------------------- + src/SDI12_boards.h | 93 -------------------------------------------- + 3 files changed, 1 insertion(+), 154 deletions(-) -diff --git src/SDI12.cpp src/SDI12.cpp -index 257eb5a..cd8b25c 100644 ---- src/SDI12.cpp -+++ src/SDI12.cpp -@@ -244,7 +244,6 @@ SDI12::~SDI12() { +diff --git a/src/SDI12.cpp b/src/SDI12.cpp +index 477b16d..f83c6fe 100644 +--- a/src/SDI12.cpp ++++ b/src/SDI12.cpp +@@ -241,7 +241,6 @@ SDI12::~SDI12() { setState(SDI12_DISABLED); if (isActive()) { _activeObject = NULL; } // Set the timer prescalers back to original values @@ -28,15 +28,15 @@ index 257eb5a..cd8b25c 100644 sdi12timer.resetSDI12TimerPrescale(); } -@@ -266,7 +265,6 @@ void SDI12::end() { +@@ -264,7 +263,6 @@ void SDI12::end() { setState(SDI12_DISABLED); - _activeObject = NULL; + _activeObject = nullptr; // Set the timer prescalers back to original values - // NOTE: This does NOT reset SAMD board pre-scalers! sdi12timer.resetSDI12TimerPrescale(); } -@@ -323,7 +321,7 @@ uint8_t SDI12::parity_even_bit(uint8_t v) { +@@ -319,7 +317,7 @@ uint8_t SDI12::parity_even_bit(uint8_t v) { // a helper function to switch pin interrupts on or off void SDI12::setPinInterrupts(bool enable) { @@ -45,10 +45,10 @@ index 257eb5a..cd8b25c 100644 // Merely need to attach the interrupt function to the pin if (enable) attachInterrupt(digitalPinToInterrupt(_dataPin), handleInterrupt, CHANGE); // Merely need to detach the interrupt function from the pin -diff --git src/SDI12_boards.cpp src/SDI12_boards.cpp +diff --git a/src/SDI12_boards.cpp b/src/SDI12_boards.cpp index 2159eee..177da96 100644 ---- src/SDI12_boards.cpp -+++ src/SDI12_boards.cpp +--- a/src/SDI12_boards.cpp ++++ b/src/SDI12_boards.cpp @@ -204,64 +204,6 @@ void SDI12Timer::resetSDI12TimerPrescale(void) { #endif @@ -114,10 +114,10 @@ index 2159eee..177da96 100644 // Espressif ESP32/ESP8266 boards // #elif defined(ESP32) || defined(ESP8266) -diff --git src/SDI12_boards.h src/SDI12_boards.h -index ff0e69e..a86bc79 100644 ---- src/SDI12_boards.h -+++ src/SDI12_boards.h +diff --git a/src/SDI12_boards.h b/src/SDI12_boards.h +index 686444f..45585c6 100644 +--- a/src/SDI12_boards.h ++++ b/src/SDI12_boards.h @@ -50,10 +50,6 @@ class SDI12Timer { /** * @brief Reset the processor timer prescaler to whatever it was prior to being @@ -129,7 +129,7 @@ index ff0e69e..a86bc79 100644 */ void resetSDI12TimerPrescale(void); -@@ -303,47 +299,6 @@ class SDI12Timer { +@@ -375,95 +371,6 @@ class SDI12Timer { #endif @@ -140,10 +140,54 @@ index ff0e69e..a86bc79 100644 - -/** - * @brief A string description of the timer to use +- * +- * The Generic Clock controller GCLK provides nine Generic Clock Generators that can +- * provide a wide range of clock frequencies. +- * +- * Generators can be set to use different external and internal oscillators as source. +- * The clock of each Generator can be divided. The outputs from the Generators are used +- * as sources for the Generic Clock Multiplexers, which provide the Generic Clock +- * (GCLK_PERIPHERAL) to the peripheral modules, as shown in Generic Clock Controller +- * Block Diagram. +- * +- * Features +- * - Provides Generic Clocks +- * - Wide frequency range +- * - Clock source for the generator can be changed on the fly +- * +- * The TC consists of a counter, a prescaler, compare/capture channels and control +- * logic. The counter can be set to count events, or it can be configured to count clock +- * pulses. The counter, together with the compare/capture channels, can be configured to +- * timestamp input events, allowing capture of frequency and pulse width. It can also +- * perform waveform generation, such as frequency generation and pulse-width modulation +- * (PWM). +- * +- * Features +- * - Selectable configuration +- * – Up to five 16-bit Timer/Counters (TC) including one low-power TC, each +- * configurable as: +- * - 8-bit TC with two compare/capture channels +- * - 16-bit TC with two compare/capture channels +- * - 32-bit TC with two compare/capture channels, by using two TCs +- * - Waveform generation +- * – Frequency generation +- * – Single-slope pulse-width modulation +- * - Input capture +- * – Event capture +- * – Frequency capture +- * – Pulse-width capture +- * - One input event +- * - Interrupts/output events on: +- * – Counter overflow/underflow +- * – Compare match or capture +- * - Internal prescaler +- * - Can be used with DMA and to trigger DMA transactions - */ -#define TIMER_IN_USE_STR "GCLK4-TC3" -/** - * @brief The c macro name for the assembly timer to use +- * +- * This signifies the register of timer/counter 3, the 8-bit count, the count value - */ -#define TCNTX REG_TC3_COUNT8_COUNT // Using Timer 3 with generic clock 4 - @@ -158,6 +202,10 @@ index ff0e69e..a86bc79 100644 - * 48MHz / 3 pre-prescaler = 16MHz - * 16MHz / 1024 prescaler = 15624 'ticks'/sec = 64 µs / 'tick' - * (1 sec/1200 bits) * (1 tick/64 µs) = 13.0208 ticks/bit +- * +- * The 8-bit count rolls over after 256 ticks, 19.66 bits, or 16.38505 ms +- * (256 ticks/roll-over) * (1 bit/13.0208 ticks) = 19.66 bits +- * (256 ticks/roll-over) * (1 sec/15624 ticks) = 16.38505 milliseconds - */ -#define TICKS_PER_BIT 13 -/** From 149aadc8418e14688ba904d18a634f0c2fe6529c Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Tue, 25 Oct 2022 12:35:17 +0200 Subject: [PATCH 5/5] shell_cmd_gnrc_udp: add missing netutils dependency The `gnrc_udp` shell command uses the function `netutils_get_ipv6()` but does not include the corresponding module `netutils`. The only reason most applications that use `shell_cmd_gnrc_udp` link is because they also include the `shell_cmd_gnrc_icmpv6_echo` module (e.g. implicit via `gnrc_ipcmpv6_echo`), which includes this dependency. --- sys/shell/Makefile.dep | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/shell/Makefile.dep b/sys/shell/Makefile.dep index dd8e0dd82fb04..a36517319cf45 100644 --- a/sys/shell/Makefile.dep +++ b/sys/shell/Makefile.dep @@ -208,6 +208,7 @@ endif ifneq (,$(filter shell_cmd_gnrc_udp,$(USEMODULE))) USEMODULE += gnrc_udp USEMODULE += gnrc_pktdump + USEMODULE += netutils endif ifneq (,$(filter shell_cmd_i2c_scan,$(USEMODULE))) FEATURES_REQUIRED += periph_i2c