From 49613fc1dccd93dd1c043abf3d85b44ce79e15d0 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 9 Aug 2023 11:33:20 +0200 Subject: [PATCH 1/4] CI: extend CI build to platforms "renesas_portenta" and "renesas_uno". --- .github/workflows/compile-examples.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index c064059..5eb21fc 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -57,6 +57,12 @@ jobs: platforms: | - name: adafruit:samd source-url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json + - fqbn: arduino:renesas_portenta:portenta_c33 + platforms: | + - name: arduino:renesas_portenta + - fqbn: arduino:renesas_uno:minima + platforms: | + - name: arduino:renesas_uno steps: - name: Checkout From 08d896f4c67e83aa17d31aa0ac8533e8e1b13700 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 9 Aug 2023 11:34:13 +0200 Subject: [PATCH 2/4] List "renesas_portenta" and "renesas_uno" as supported target architectures. --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 053d1ea..0cfd185 100644 --- a/library.properties +++ b/library.properties @@ -6,5 +6,5 @@ sentence=Arduino library for providing a consistent critical section interface o paragraph= category=Other url=https://github.com/107-systems/107-Arduino-CriticalSection -architectures=samd,mbed,mbed_nano,mbed_portenta,mbed_edge,esp32,rp2040 +architectures=samd,mbed,mbed_nano,mbed_portenta,mbed_edge,esp32,rp2040,renesas_portenta,renesas_uno includes=107-Arduino-CriticalSection.h From f2ebde48a53bed87e3d9d6ddb255e935dc865ce7 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 9 Aug 2023 11:39:05 +0200 Subject: [PATCH 3/4] List support for ArduinoCore-renesas in README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 106a758..5458abd 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ This library works for * [arduino-esp32](https://github.com/espressif/arduino-esp32): `ESP32 Dev Module`, `ESP32 Wrover Module`, ... :heavy_check_mark: * [arduino-pico](https://github.com/earlephilhower/arduino-pico): [`Raspberry Pi Pico`](https://www.raspberrypi.org/products/raspberry-pi-pico), `Adafruit Feather RP2040`, ... :heavy_check_mark: * [adafruit/ArduinoCore-samd](https://github.com/adafruit/ArduinoCore-samd): [`Adafruit Feather M4 CAN Express`](https://www.adafruit.com/product/4759), ... :heavy_check_mark: +* [ArduinoCore-renesas](https://github.com/arduino/ArduinoCore-renesas): [`Portenta C33`](https://store.arduino.cc/products/portenta-c33), [`Uno R4 WiFi`](https://store.arduino.cc/products/uno-r4-wifi), [`Uno R4 Minima`](https://store.arduino.cc/products/uno-r4-minima), ... :heavy_check_mark: ### Example ```C++ From 92773474641e8bfa02221b6075bea5e15623d3d9 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 9 Aug 2023 11:52:16 +0200 Subject: [PATCH 4/4] Implement critical section handling for the Renesas core. --- src/CritSec-renesas.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/CritSec-renesas.cpp diff --git a/src/CritSec-renesas.cpp b/src/CritSec-renesas.cpp new file mode 100644 index 0000000..6a84e1d --- /dev/null +++ b/src/CritSec-renesas.cpp @@ -0,0 +1,39 @@ +/** + * This software is distributed under the terms of the MIT License. + * Copyright (c) 2023 LXRobotics. + * Author: Alexander Entinger + * Contributors: https://github.com/107-systems/107-Arduino-CriticalSection/graphs/contributors. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include "CritSec.h" + +#if defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_PORTENTA_C33) + +#include + +/************************************************************************************** + * GLOBAL VARIABLES + **************************************************************************************/ + +static volatile uint32_t interrupt_save = 0; + +/************************************************************************************** + * FUNCTION DEFINITION + **************************************************************************************/ + +extern "C" void crit_sec_enter() +{ + interrupt_save = __get_PRIMASK(); + __disable_irq(); +} + +extern "C" void crit_sec_leave() +{ + __set_PRIMASK(interrupt_save); +} + +#endif /* defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_PORTENTA_C33) */