Skip to content

Commit

Permalink
Merge branch 'master' into feature/add-sparkfun-iotnode-lorawan-board
Browse files Browse the repository at this point in the history
  • Loading branch information
sfe-SparkFro committed Jan 8, 2025
2 parents 31bdaf4 + 8caa590 commit ebe82e6
Show file tree
Hide file tree
Showing 89 changed files with 3,750 additions and 393 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: codespell-project/actions-codespell@v2
with:
skip: ./ArduinoCore-API,./libraries/ESP8266SdFat,./libraries/Adafruit_TinyUSB_Arduino,./libraries/LittleFS/lib,./tools/pyserial,./pico-sdk,./.github,./docs/i2s.rst,./cores/rp2040/api,./libraries/FreeRTOS,./tools/libbearssl/bearssl,./include,./libraries/WiFi/examples/BearSSL_Server,./ota/uzlib,./libraries/http-parser/lib,./libraries/WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino,./libraries/HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino,./.git,./libraries/FatFS/lib/fatfs,./libraries/FatFS/src/diskio.h,./libraries/FatFS/src/ff.cpp,./libraries/FatFS/src/ffconf.h,./libraries/FatFS/src/ffsystem.cpp,./libraries/FatFS/src/ff.h,./libraries/lwIP_WINC1500/src/driver,./libraries/lwIP_WINC1500/src/common,./libraries/lwIP_WINC1500/src/bus_wrapper,./libraries/lwIP_WINC1500/src/spi_flash
ignore_words_list: ser,dout,shiftIn,acount
ignore_words_list: ser,dout,shiftIn,acount,froms
- name: Get submodules for following tests
run: git submodule update --init
- name: Check package references
Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:
name: Mac
strategy:
matrix:
os: [macOS-12, macOS-14]
os: [macOS-13, macOS-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ system
tools/dist
docs/_build
ota/build
ota/build-rp2350
ota/build-rp2350-riscv
tools/libpico/build
platform.local.txt
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ sphinx:
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
formats:
- pdf
# - epub

# Optional but recommended, declare the Python requirements required
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* Melopero Cookie RP2040
* Melopero Shake RP2040
* METE HOCA Akana R1
* MyMakers RP2040
* Neko Systems BL2040 Mini
* Olimex RP2040-Pico30
* Newsan Archi
* nullbits Bit-C PRO
* Olimex RP2040-Pico30
* Pimoroni PGA2040
* Pimoroni Pico Plus 2
* Pimoroni Pico Plus 2W
* Pimoroni Plasma2040
* Pimoroni Plasma2350
* Pimoroni Tiny2040
* Pimoroni Tiny2350
* Pintronix PinMax
Expand Down Expand Up @@ -137,6 +139,8 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* printf (i.e. debug) output over USB serial
* Transparent use of PSRAM globals and heap (RP2350 only)
* ARM or RISC-V (Hazard3) support for the RP2350
* Semihosted serial and file system access
* GPROF profiling support

The RP2040 PIO state machines (SMs) are used to generate jitter-free:
* Servos
Expand Down
1,770 changes: 1,537 additions & 233 deletions boards.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cores/rp2040/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ extern const String emptyString;
#endif

#include "SerialUART.h"
#include "SerialSemi.h"
#include "RP2040Support.h"
#include "SerialPIO.h"
#include "Bootsel.h"
Expand Down
21 changes: 21 additions & 0 deletions cores/rp2040/AudioOutputBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Abstract class for audio output devices to allow easy swapping between output devices

#pragma once

#include <Print.h>

class AudioOutputBase : public Print {
public:
virtual ~AudioOutputBase() { }
virtual bool setBuffers(size_t buffers, size_t bufferWords, int32_t silenceSample = 0) = 0;
virtual bool setBitsPerSample(int bps) = 0;
virtual bool setFrequency(int freq) = 0;
virtual bool setStereo(bool stereo = true) = 0;
virtual bool begin() = 0;
virtual bool end() = 0;
virtual bool getUnderflow() = 0;
virtual void onTransmit(void(*)(void *), void *) = 0;
// From Print
virtual size_t write(const uint8_t *buffer, size_t size) = 0;
virtual int availableForWrite() = 0;
};
18 changes: 17 additions & 1 deletion cores/rp2040/RP2040Support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include <Arduino.h>
#include <pico/runtime.h>

#ifdef PICO_RP2040

#include <Arduino.h>
#include <hardware/structs/psm.h>

extern "C" void boot_double_tap_check();
Expand All @@ -35,3 +37,17 @@ void RP2040::enableDoubleResetBootloader() {
}

#endif

#ifdef __PROFILE
Stream *__profileFile;
int __writeProfileCB(const void *data, int len) {
return __profileFile->write((const char *)data, len);
}

#ifdef __PROFILE
extern "C" void runtime_init_setup_profiling();
#define PICO_RUNTIME_INIT_PROFILING "11011" // Towards the end, after PSRAM
PICO_RUNTIME_INIT_FUNC_RUNTIME(runtime_init_setup_profiling, PICO_RUNTIME_INIT_PROFILING);
#endif

#endif
36 changes: 30 additions & 6 deletions cores/rp2040/RP2040Support.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#pragma once

#include <hardware/clocks.h>
#include <hardware/irq.h>
#include <hardware/pio.h>
Expand Down Expand Up @@ -45,6 +47,13 @@

extern "C" volatile bool __otherCoreIdled;

extern "C" {
#ifdef __PROFILE
typedef int (*profileWriteCB)(const void *data, int len);
extern void _writeProfile(profileWriteCB writeCB);
#endif
}

class _MFIFO {
public:
_MFIFO() { /* noop */ };
Expand Down Expand Up @@ -180,7 +189,7 @@ class RP2040 {

void begin() {
_epoch = 0;
#if !defined(__riscv)
#if !defined(__riscv) && !defined(__PROFILE)
if (!__isFreeRTOS) {
// Enable SYSTICK exception
exception_set_exclusive_handler(SYSTICK_EXCEPTION, _SystickHandler);
Expand All @@ -193,7 +202,7 @@ class RP2040 {
_ccountPgm->prepare(&_pio, &_sm, &off);
ccount_program_init(_pio, _sm, off);
pio_sm_set_enabled(_pio, _sm, true);
#if !defined(__riscv)
#if !defined(__riscv) && !defined(__PROFILE)
}
#endif
}
Expand All @@ -217,7 +226,7 @@ class RP2040 {
// Get CPU cycle count. Needs to do magic to extens 24b HW to something longer
volatile uint64_t _epoch = 0;
inline uint32_t getCycleCount() {
#if !defined(__riscv)
#if !defined(__riscv) && !defined(__PROFILE)
if (!__isFreeRTOS) {
uint32_t epoch;
uint32_t ctr;
Expand All @@ -229,13 +238,13 @@ class RP2040 {
} else {
#endif
return ccount_read(_pio, _sm);
#if !defined(__riscv)
#if !defined(__riscv) && !defined(__PROFILE)
}
#endif
}

inline uint64_t getCycleCount64() {
#if !defined(__riscv)
#if !defined(__riscv) && !defined(__PROFILE)
if (!__isFreeRTOS) {
uint64_t epoch;
uint64_t ctr;
Expand All @@ -247,7 +256,7 @@ class RP2040 {
} else {
#endif
return ccount_read(_pio, _sm);
#if !defined(__riscv)
#if !defined(__riscv) && !defined(__PROFILE)
}
#endif
}
Expand Down Expand Up @@ -473,6 +482,21 @@ class RP2040 {
#endif
}

#ifdef __PROFILE
void writeProfiling(Stream *f) {
extern Stream *__profileFile;
extern int __writeProfileCB(const void *data, int len);
__profileFile = f;
_writeProfile(__writeProfileCB);
}

size_t getProfileMemoryUsage() {
extern int __profileMemSize;
return (size_t) __profileMemSize;
}
#endif



private:
static void _SystickHandler() {
Expand Down
4 changes: 2 additions & 2 deletions cores/rp2040/RP2040Version.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#define ARDUINO_PICO_MAJOR 4
#define ARDUINO_PICO_MINOR 3
#define ARDUINO_PICO_MINOR 4
#define ARDUINO_PICO_REVISION 1
#define ARDUINO_PICO_VERSION_STR "4.3.1"
#define ARDUINO_PICO_VERSION_STR "4.4.1"
Loading

0 comments on commit ebe82e6

Please sign in to comment.