Migrate to 2.0.0 SDK (#2336)

* Update to 2.0.0 SDK
* Board type needs to be set before earliest SDK setup
* Platform includes update
* Boot2 files
* Simple compilation issues
* Build and link
* PIO rebuild with version
* Newlib wrapper update
* Force inclusion of runtime_init_* fcns
The linker was dropping all references to the library's included
runtime_init_xxx functions and hence things like the IRQ vector
table and mutexes and alarms weren't properly set up leading to
instant crashes on start up..

Explicitly call out one function from the object file stored in
the .A to force the inclusion of all the functions.  May be a better
way, heppy to hear any ideas.
* Fix SPI GPIO calls
* Fix Ethernet GPIO
* Remove SDK warnings
Remove the skipped error messages once the following PR merged:
https://github.com/raspberrypi/pico-sdk/pull/1786
* BTStack moved SBC encode/decode paths
* Platform.IO fixes
* BT No longer has special absolute mouse
* Rebuild and update OTA
* Rebuild BearSSL, too
* Update liker file to latest SDK
* Clean up libpicocmake
* Clean up LWIP/BT library names
This commit is contained in:
Earle F. Philhower, III 2024-08-17 10:39:13 -07:00 committed by GitHub
parent 16d9609ac9
commit f45db86cc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 1245 additions and 988 deletions

1440
boards.txt

File diff suppressed because it is too large Load diff

View file

@ -30,7 +30,6 @@
#include <pins_arduino.h>
#include <hardware/gpio.h> // Required for the port*Register macros
#include "debug_internal.h"
#include <RP2040.h> // CMSIS
// Try and make the best of the old Arduino abs() macro. When in C++, use
// the sane std::abs() call, but for C code use their macro since stdlib abs()

View file

@ -35,7 +35,6 @@
#include <pico/usb_reset_interface.h>
#include <hardware/watchdog.h>
#include <pico/bootrom.h>
#include "sdkoverride/tusb_absmouse.h"
#include "sdkoverride/tusb_gamepad16.h"
#include <device/usbd_pvt.h>

View file

@ -80,7 +80,7 @@ private:
uart_inst_t *_uart;
pin_size_t _tx, _rx;
pin_size_t _rts, _cts;
enum gpio_function _fcnTx, _fcnRx, _fcnRts, _fcnCts;
gpio_function_t _fcnTx, _fcnRx, _fcnRts, _fcnCts;
int _baud;
mutex_t _mutex;
bool _polling = false;

View file

@ -14,6 +14,7 @@
#define ccount_wrap_target 0
#define ccount_wrap 1
#define ccount_pio_version 0
static const uint16_t ccount_program_instructions[] = {
// .wrap_target
@ -27,6 +28,10 @@ static const struct pio_program ccount_program = {
.instructions = ccount_program_instructions,
.length = 2,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config ccount_program_get_default_config(uint offset) {

View file

@ -14,6 +14,7 @@
#define pio_tx_wrap_target 0
#define pio_tx_wrap 5
#define pio_tx_pio_version 0
static const uint16_t pio_tx_program_instructions[] = {
// .wrap_target
@ -31,6 +32,10 @@ static const struct pio_program pio_tx_program = {
.instructions = pio_tx_program_instructions,
.length = 6,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_tx_program_get_default_config(uint offset) {
@ -47,6 +52,7 @@ static inline pio_sm_config pio_tx_program_get_default_config(uint offset) {
#define pio_tx_inv_wrap_target 0
#define pio_tx_inv_wrap 5
#define pio_tx_inv_pio_version 0
static const uint16_t pio_tx_inv_program_instructions[] = {
// .wrap_target
@ -64,6 +70,10 @@ static const struct pio_program pio_tx_inv_program = {
.instructions = pio_tx_inv_program_instructions,
.length = 6,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_tx_inv_program_get_default_config(uint offset) {
@ -100,6 +110,7 @@ static inline void pio_tx_program_init(PIO pio, uint sm, uint offset, uint pin_t
#define pio_rx_wrap_target 0
#define pio_rx_wrap 6
#define pio_rx_pio_version 0
static const uint16_t pio_rx_program_instructions[] = {
// .wrap_target
@ -118,6 +129,10 @@ static const struct pio_program pio_rx_program = {
.instructions = pio_rx_program_instructions,
.length = 7,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_rx_program_get_default_config(uint offset) {
@ -133,6 +148,7 @@ static inline pio_sm_config pio_rx_program_get_default_config(uint offset) {
#define pio_rx_inv_wrap_target 0
#define pio_rx_inv_wrap 6
#define pio_rx_inv_pio_version 0
static const uint16_t pio_rx_inv_program_instructions[] = {
// .wrap_target
@ -151,6 +167,10 @@ static const struct pio_program pio_rx_inv_program = {
.instructions = pio_rx_inv_program_instructions,
.length = 7,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_rx_inv_program_get_default_config(uint offset) {

View file

@ -0,0 +1,200 @@
/*
Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdio.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/times.h>
#include <time.h>
#include <unistd.h>
#if PICO_ENTER_USB_BOOT_ON_EXIT
#include "pico/bootrom.h"
#endif
#include "pico/time.h"
#include "pico/runtime_init.h"
#if LIB_PICO_PRINTF_PICO
#include "pico/printf.h"
#else
#define weak_raw_printf printf
#define weak_raw_vprintf vprintf
#endif
#if LIB_PICO_STDIO
#include "pico/stdio.h"
#endif
#if PICO_ENTER_USB_BOOT_ON_EXIT
#include "pico/bootrom.h"
#endif
extern char __StackLimit; /* Set by linker. */
#define STDIO_HANDLE_STDIN 0
#define STDIO_HANDLE_STDOUT 1
#define STDIO_HANDLE_STDERR 2
void __attribute__((noreturn)) __weak _exit(__unused int status) {
#if PICO_ENTER_USB_BOOT_ON_EXIT
reset_usb_boot(0, 0);
#else
while (1) {
__breakpoint();
}
#endif
}
__weak void *_sbrk(int incr) {
extern char end; /* Set by linker. */
static char *heap_end;
char *prev_heap_end;
if (heap_end == 0) {
heap_end = &end;
}
prev_heap_end = heap_end;
char *next_heap_end = heap_end + incr;
if (__builtin_expect(next_heap_end > (&__StackLimit), false)) {
#if PICO_USE_OPTIMISTIC_SBRK
if (heap_end == &__StackLimit) {
// errno = ENOMEM;
return (char *) -1;
}
next_heap_end = &__StackLimit;
#else
return (char *) -1;
#endif
}
heap_end = next_heap_end;
return (void *) prev_heap_end;
}
#if 0
static int64_t epoch_time_us_since_boot;
__weak int _gettimeofday(struct timeval *__restrict tv, __unused void *__restrict tz) {
if (tv) {
int64_t us_since_epoch = ((int64_t)to_us_since_boot(get_absolute_time())) - epoch_time_us_since_boot;
tv->tv_sec = (time_t)(us_since_epoch / 1000000);
tv->tv_usec = (suseconds_t)(us_since_epoch % 1000000);
}
return 0;
}
__weak int settimeofday(__unused const struct timeval *tv, __unused const struct timezone *tz) {
if (tv) {
int64_t us_since_epoch = tv->tv_sec * 1000000 + tv->tv_usec;
epoch_time_us_since_boot = (int64_t)to_us_since_boot(get_absolute_time()) - us_since_epoch;
}
return 0;
}
__weak int _times(struct tms *tms) {
#if CLOCKS_PER_SEC >= 1000000
tms->tms_utime = (clock_t)(to_us_since_boot(get_absolute_time()) * (CLOCKS_PER_SEC / 1000000));
#else
tms->tms_utime = (clock_t)(to_us_since_boot(get_absolute_time()) / (1000000 / CLOCKS_PER_SEC));
#endif
tms->tms_stime = 0;
tms->tms_cutime = 0;
tms->tms_cstime = 0;
return 0;
}
__weak pid_t _getpid(void) {
return 0;
}
__weak int _kill(__unused pid_t pid, __unused int sig) {
return -1;
}
int __attribute__((weak)) _read(int handle, char *buffer, int length) {
#if LIB_PICO_STDIO
if (handle == STDIO_HANDLE_STDIN) {
return stdio_get_until(buffer, length, at_the_end_of_time);
}
#endif
return -1;
}
int __attribute__((weak)) _write(int handle, char *buffer, int length) {
#if LIB_PICO_STDIO
if (handle == STDIO_HANDLE_STDOUT || handle == STDIO_HANDLE_STDERR) {
stdio_put_string(buffer, length, false, true);
return length;
}
#endif
return -1;
}
int __attribute__((weak)) _open(__unused const char *fn, __unused int oflag, ...) {
return -1;
}
int __attribute__((weak)) _close(__unused int fd) {
return -1;
}
off_t __attribute__((weak)) _lseek(__unused int fd, __unused off_t pos, __unused int whence) {
return -1;
}
int __attribute__((weak)) _fstat(__unused int fd, __unused struct stat *buf) {
return -1;
}
int __attribute__((weak)) _isatty(int fd) {
return fd == STDIO_HANDLE_STDIN || fd == STDIO_HANDLE_STDOUT || fd == STDIO_HANDLE_STDERR;
}
// exit is not useful... no desire to pull in __call_exitprocs
void exit(int status) {
_exit(status);
}
// incorrect warning from GCC 6
GCC_Pragma("GCC diagnostic push")
GCC_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
void __weak __assert_func(const char *file, int line, const char *func, const char *failedexpr) {
weak_raw_printf("assertion \"%s\" failed: file \"%s\", line %d%s%s\n",
failedexpr, file, line, func ? ", function: " : "",
func ? func : "");
_exit(1);
}
GCC_Pragma("GCC diagnostic pop")
#endif
void runtime_init(void) {
#ifndef NDEBUG
if (__get_current_exception()) {
// crap; started in exception handler
__breakpoint();
}
#endif
#if !PICO_RUNTIME_SKIP_INIT_PER_CORE_INSTALL_STACK_GUARD
// install core0 stack guard
extern char __StackBottom;
runtime_init_per_core_install_stack_guard(&__StackBottom);
#endif
// todo maybe we want to do this in the future, but it does stuff like register_tm_clones
// which we didn't do in previous SDKs
//extern void __libc_init_array(void);
//__libc_init_array();
// ... so instead just do the __preinit_array
runtime_run_initializers();
// ... and the __init_array
extern void (*__init_array_start)(void);
extern void (*__init_array_end)(void);
for (void (**p)(void) = &__init_array_start; p < &__init_array_end; ++p) {
(*p)();
}
}

View file

@ -1,101 +0,0 @@
/*
Expost absolute mouse HID descriptor and report
Taken from @tobozo PR https://github.com/hathach/tinyusb/pull/1363
TODO - remove once that PR merged with TinyUSB
Copyright (c) 2023 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "tusb.h"
#include "class/hid/hid_device.h"
// Absolute Mouse: same as the Standard (relative) Mouse Report but
// with int16_t instead of int8_t for X and Y coordinates.
typedef struct TU_ATTR_PACKED {
uint8_t buttons; /**< buttons mask for currently pressed buttons in the mouse. */
int16_t x; /**< Current x position of the mouse. */
int16_t y; /**< Current y position of the mouse. */
int8_t wheel; /**< Current delta wheel movement on the mouse. */
int8_t pan; // using AC Pan
} hid_abs_mouse_report_t;
// Absolute Mouse Report Descriptor Template
#define TUD_HID_REPORT_DESC_ABSMOUSE(...) \
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_MOUSE ) ,\
HID_COLLECTION ( HID_COLLECTION_APPLICATION ) ,\
/* Report ID if any */\
__VA_ARGS__ \
HID_USAGE ( HID_USAGE_DESKTOP_POINTER ) ,\
HID_COLLECTION ( HID_COLLECTION_PHYSICAL ) ,\
HID_USAGE_PAGE ( HID_USAGE_PAGE_BUTTON ) ,\
HID_USAGE_MIN ( 1 ) ,\
HID_USAGE_MAX ( 5 ) ,\
HID_LOGICAL_MIN ( 0 ) ,\
HID_LOGICAL_MAX ( 1 ) ,\
/* Left, Right, Middle, Backward, Forward buttons */ \
HID_REPORT_COUNT( 5 ) ,\
HID_REPORT_SIZE ( 1 ) ,\
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\
/* 3 bit padding */ \
HID_REPORT_COUNT( 1 ) ,\
HID_REPORT_SIZE ( 3 ) ,\
HID_INPUT ( HID_CONSTANT ) ,\
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ) ,\
/* X, Y absolute position [0, 32767] */ \
HID_USAGE ( HID_USAGE_DESKTOP_X ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_Y ) ,\
HID_LOGICAL_MIN ( 0x00 ) ,\
HID_LOGICAL_MAX_N( 0x7FFF, 2 ) ,\
HID_REPORT_SIZE ( 16 ) ,\
HID_REPORT_COUNT ( 2 ) ,\
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\
/* Vertical wheel scroll [-127, 127] */ \
HID_USAGE ( HID_USAGE_DESKTOP_WHEEL ) ,\
HID_LOGICAL_MIN ( 0x81 ) ,\
HID_LOGICAL_MAX ( 0x7f ) ,\
HID_REPORT_COUNT( 1 ) ,\
HID_REPORT_SIZE ( 8 ) ,\
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ) ,\
HID_USAGE_PAGE ( HID_USAGE_PAGE_CONSUMER ), \
/* Horizontal wheel scroll [-127, 127] */ \
HID_USAGE_N ( HID_USAGE_CONSUMER_AC_PAN, 2 ), \
HID_LOGICAL_MIN ( 0x81 ), \
HID_LOGICAL_MAX ( 0x7f ), \
HID_REPORT_COUNT( 1 ), \
HID_REPORT_SIZE ( 8 ), \
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ), \
HID_COLLECTION_END , \
HID_COLLECTION_END \
static inline bool tud_hid_abs_mouse_report(uint8_t report_id,
uint8_t buttons, int16_t x, int16_t y, int8_t vertical, int8_t horizontal) {
hid_abs_mouse_report_t report = {
.buttons = buttons,
.x = x,
.y = y,
.wheel = vertical,
.pan = horizontal
};
return tud_hid_n_report(0, report_id, &report, sizeof(report));
}

View file

@ -2,6 +2,8 @@
// This file is autogenerated by pioasm; do not edit! //
// -------------------------------------------------- //
#pragma once
#if !PICO_NO_HARDWARE
#include "hardware/pio.h"
#endif
@ -12,6 +14,7 @@
#define tone2_wrap_target 0
#define tone2_wrap 8
#define tone2_pio_version 0
static const uint16_t tone2_program_instructions[] = {
// .wrap_target
@ -32,6 +35,10 @@ static const struct pio_program tone2_program = {
.instructions = tone2_program_instructions,
.length = 9,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config tone2_program_get_default_config(uint offset) {

View file

@ -1,2 +1,2 @@
// Do not edit -- Automatically generated by tools/sdk/ssl/bearssl/Makefile
#define BEARSSL_GIT 5166f2b
#define BEARSSL_GIT c2c9d9d

View file

@ -11,9 +11,9 @@
#ifndef _PICO_VERSION_H
#define _PICO_VERSION_H
#define PICO_SDK_VERSION_MAJOR 1
#define PICO_SDK_VERSION_MINOR 5
#define PICO_SDK_VERSION_REVISION 1
#define PICO_SDK_VERSION_STRING "1.5.1"
#define PICO_SDK_VERSION_MAJOR 2
#define PICO_SDK_VERSION_MINOR 0
#define PICO_SDK_VERSION_REVISION 0
#define PICO_SDK_VERSION_STRING "2.0.0"
#endif

Binary file not shown.

Binary file not shown.

View file

@ -58,13 +58,6 @@ SECTIONS
.ota : {
/* Start image with OTA */
KEEP (*(.OTA))
/* Align to the last 16-bytes of the OTA region */
/* If anyone has a better way of doing this, please submit a PR! */
/* . = __flash_binary_start + 0x2ff0;
LONG(__FS_START__)
LONG(__FS_END__)
LONG(__EEPROM_START__)
LONG(__FLASH_LENGTH__)*/
} > FLASH
.partition : {
@ -89,6 +82,8 @@ SECTIONS
KEEP (*(.vectors))
KEEP (*(.binary_info_header))
__binary_info_header_end = .;
KEEP (*(.embedded_block))
__embedded_block_end = .;
KEEP (*(.reset))
/* TODO revisit this now memset/memcpy/float in ROM */
/* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from
@ -111,6 +106,27 @@ SECTIONS
*(SORT(.dtors.*))
*(.dtors)
. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP(*(SORT(.preinit_array.*)))
KEEP(*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
/* init data */
PROVIDE_HIDDEN (__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
/* finit data */
PROVIDE_HIDDEN (__fini_array_start = .);
*(SORT(.fini_array.*))
*(.fini_array)
PROVIDE_HIDDEN (__fini_array_end = .);
*(.eh_frame*)
. = ALIGN(4);
} > FLASH
@ -136,10 +152,7 @@ SECTIONS
. = ALIGN(4);
/* End of .text-like segments */
__etext = .;
.ram_vector_table (COPY): {
.ram_vector_table (NOLOAD): {
*(.ram_vector_table)
} > RAM
@ -159,6 +172,7 @@ SECTIONS
. = ALIGN(4);
*(.after_data.*)
. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__mutex_array_start = .);
@ -167,32 +181,61 @@ SECTIONS
PROVIDE_HIDDEN (__mutex_array_end = .);
. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP(*(SORT(.preinit_array.*)))
KEEP(*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
/* init data */
PROVIDE_HIDDEN (__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
/* finit data */
PROVIDE_HIDDEN (__fini_array_start = .);
*(SORT(.fini_array.*))
*(.fini_array)
PROVIDE_HIDDEN (__fini_array_end = .);
*(.jcr)
. = ALIGN(4);
/* All data end */
__data_end__ = .;
} > RAM AT> FLASH
.tdata : {
. = ALIGN(4);
*(.tdata .tdata.* .gnu.linkonce.td.*)
/* All data end */
__tdata_end = .;
} > RAM AT> FLASH
PROVIDE(__data_end__ = .);
/* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */
__etext = LOADADDR(.data);
.tbss (NOLOAD) : {
. = ALIGN(4);
__bss_start__ = .;
__tls_base = .;
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
__tls_end = .;
} > RAM
.bss (NOLOAD) : {
. = ALIGN(4);
__tbss_end = .;
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*)))
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
} > RAM
/* At most one of the following two will be engaged, depending on the SDK version */
.uninitialized_ram MAX(0x20003000, .) (NOLOAD) : {
*(.uninitialized_ram*)
} > RAM
.uninitialized_data MAX(0x20003000, .) (NOLOAD) : {
*(.uninitialized_data*)
} > RAM
.heap (NOLOAD):
{
__end__ = .;
end = __end__;
KEEP(*(.heap*))
/* historically on GCC sbrk was growing past __HeapLimit to __StackLimit, however
to be more compatible, we now set __HeapLimit explicitly to where the end of the heap is */
. = ORIGIN(RAM) + LENGTH(RAM);
__HeapLimit = .;
} > RAM
/* Start and end symbols must be word-aligned */
.scratch_x : {
__scratch_x_start__ = .;
@ -210,32 +253,6 @@ SECTIONS
} > SCRATCH_Y AT > FLASH
__scratch_y_source__ = LOADADDR(.scratch_y);
.bss : {
. = ALIGN(4);
__bss_start__ = .;
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*)))
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
} > RAM
/* At most one of the following two will be engaged, depending on the SDK version */
.uninitialized_ram MAX(0x20003000, .) (NOLOAD) : {
*(.uninitialized_ram*)
} > RAM
.uninitialized_data MAX(0x20003000, .) (NOLOAD) : {
*(.uninitialized_data*)
} > RAM
.heap (COPY):
{
__end__ = .;
end = __end__;
*(.heap*)
__HeapLimit = .;
} > RAM
/* .stack*_dummy section doesn't contains any symbols. It is only
* used for linker to calculate size of stack sections, and assign
* values to stack symbols later
@ -245,17 +262,18 @@ SECTIONS
/* by default we put core 0 stack at the end of scratch Y, so that if core 1
* stack is not used then all of SCRATCH_X is free.
*/
.stack1_dummy (COPY):
.stack1_dummy (NOLOAD):
{
*(.stack1*)
} > SCRATCH_X
.stack_dummy (COPY):
.stack_dummy (NOLOAD):
{
*(.stack*)
KEEP(*(.stack*))
} > SCRATCH_Y
.flash_end : {
__flash_binary_end = .;
KEEP(*(.embedded_end_block*))
PROVIDE(__flash_binary_end = .);
} > FLASH
/* stack limit is poorly named, but historically is maximum heap ptr */
@ -266,6 +284,17 @@ SECTIONS
__StackBottom = __StackTop - SIZEOF(.stack_dummy);
PROVIDE(__stack = __StackTop);
/* picolibc and LLVM */
PROVIDE (__heap_start = __end__);
PROVIDE (__heap_end = __HeapLimit);
PROVIDE( __tls_align = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss)) );
PROVIDE( __tls_size_align = (__tls_size + __tls_align - 1) & ~(__tls_align - 1));
PROVIDE( __arm32_tls_tcb_offset = MAX(8, __tls_align) );
/* llvm-libc */
PROVIDE (_end = __end__);
PROVIDE (__llvm_libc_heap_limit = __HeapLimit);
/* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed")

BIN
lib/ota.o

Binary file not shown.

View file

@ -1,8 +1,9 @@
-iwithprefixbefore/cores/rp2040/api/deprecated-avr-comp/
-iwithprefixbefore/include/pico_base/
-iwithprefixbefore/pico-sdk/lib/tinyusb/src/
-iwithprefixbefore/cores/rp2040/api/deprecated-avr-comp
-iwithprefixbefore/include/pico_base
-iwithprefixbefore/pico-sdk/lib/tinyusb/src
-iwithprefixbefore/pico-sdk/src/boards/include
-iwithprefixbefore/pico-sdk/src/common/pico_base/include
-iwithprefixbefore/pico-sdk/src/common/pico_base_headers/include
-iwithprefixbefore/pico-sdk/src/common/pico_binary_info/include
-iwithprefixbefore/pico-sdk/src/common/pico_bit_ops/include
-iwithprefixbefore/pico-sdk/src/common/pico_divider/include
@ -11,13 +12,21 @@
-iwithprefixbefore/pico-sdk/src/common/pico_time/include
-iwithprefixbefore/pico-sdk/src/common/pico_usb_reset_interface/include
-iwithprefixbefore/pico-sdk/src/common/pico_util/include
-iwithprefixbefore/pico-sdk/src/common/pico_stdlib_headers/include
-iwithprefixbefore/pico-sdk/src/common/pico_usb_reset_interface_headers/include
-iwithprefixbefore/pico-sdk/src/rp2040/hardware_regs/include
-iwithprefixbefore/pico-sdk/src/rp2040/hardware_structs/include
-iwithprefixbefore/pico-sdk/src/rp2040/pico_platform/include
-iwithprefixbefore/pico-sdk/src/rp2_common/cmsis/include
-iwithprefixbefore/pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include
-iwithprefixbefore/pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RaspberryPi/RP2040/Include
-iwithprefixbefore/pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RP2040/Include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_adc/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_base/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_boot_lock/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_claim/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_clocks/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_divider/include
@ -35,6 +44,7 @@
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_resets/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_spi/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_sync/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_sync_spin_lock/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_timer/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_uart/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_vreg/include
@ -51,8 +61,12 @@
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_lwip/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_multicore/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_platform/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_platform_compiler/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_platform_sections/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_platform_panic/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_printf/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_runtime/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_runtime_init/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_rand/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_stdio/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_stdio_uart/include
@ -60,4 +74,6 @@
-iwithprefixbefore/pico-sdk/lib/cyw43-driver/src
-iwithprefixbefore/pico-sdk/lib/lwip/src/include
-iwithprefixbefore/pico-sdk/lib/btstack/src
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/decoder/include
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/encoder/include
-iwithprefixbefore/pico-sdk/lib/btstack/platform/embedded

View file

@ -8,11 +8,6 @@
#pragma once
//necessary to implement the absolute mouse descriptor define,
//remove if merged into TinyUSB
#include <sdkoverride/tusb_absmouse.h>
//override weak declarations to include HID report to report map.
//done in each library (KeyboardBT,...)
extern void __BTInstallKeyboard() __attribute__((weak));

View file

@ -38,15 +38,15 @@ loop_mclk:
; +----- WCLK
; |+---- BCLK
mov x, y side 0b01
left:
left1:
out pins, 1 side 0b00
jmp x--, left side 0b01
jmp x--, left1 side 0b01
out pins, 1 side 0b10 ; Last bit of left has WCLK change per I2S spec
mov x, y side 0b11
right:
right1:
out pins, 1 side 0b10
jmp x--, right side 0b11
jmp x--, right1 side 0b11
out pins, 1 side 0b00 ; Last bit of right also has WCLK change
; Loop back to beginning...
@ -59,15 +59,15 @@ right:
; +----- BCLK
; |+---- WCLK
mov x, y side 0b10
left:
left1:
out pins, 1 side 0b00
jmp x--, left side 0b10
jmp x--, left1 side 0b10
out pins, 1 side 0b01 ; Last bit of left has WCLK change per I2S spec
mov x, y side 0b11
right:
right1:
out pins, 1 side 0b01
jmp x--, right side 0b11
jmp x--, right1 side 0b11
out pins, 1 side 0b00 ; Last bit of right also has WCLK change
; Loop back to beginning...
@ -114,15 +114,15 @@ lastbit:
; +----- WCLK
; |+---- BCLK
mov x, y side 0b01
left:
left1:
out pins, 1 side 0b10
jmp x--, left side 0b11
jmp x--, left1 side 0b11
out pins, 1 side 0b10
mov x, y side 0b11
right:
right1:
out pins, 1 side 0b00
jmp x--, right side 0b01
jmp x--, right1 side 0b01
out pins, 1 side 0b00
; Loop back to beginning...
@ -136,15 +136,15 @@ right:
; +----- BCLK
; |+---- WCLK
mov x, y side 0b10
left:
left1:
out pins, 1 side 0b01
jmp x--, left side 0b11
jmp x--, left1 side 0b11
out pins, 1 side 0b01
mov x, y side 0b11
right:
right1:
out pins, 1 side 0b00
jmp x--, right side 0b10
jmp x--, right1 side 0b10
out pins, 1 side 0b00
; Loop back to beginning...
@ -159,15 +159,15 @@ right:
; +----- WCLK
; |+---- BCLK
mov x, y side 0b00
left:
left1:
in pins, 1 side 0b01
jmp x--, left side 0b00
jmp x--, left1 side 0b00
in pins, 1 side 0b11 ; Last bit of left has WCLK change per I2S spec
mov x, y side 0b10
right:
right1:
in pins, 1 side 0b11
jmp x--, right side 0b10
jmp x--, right1 side 0b10
in pins, 1 side 0b01 ; Last bit of right also has WCLK change
; Loop back to beginning...
@ -181,15 +181,15 @@ right:
; +----- BCLK
; |+---- WCLK
mov x, y side 0b00
left:
left1:
in pins, 1 side 0b10
jmp x--, left side 0b00
jmp x--, left1 side 0b00
in pins, 1 side 0b11 ; Last bit of left has WCLK change per I2S spec
mov x, y side 0b01
right:
right1:
in pins, 1 side 0b11
jmp x--, right side 0b01
jmp x--, right1 side 0b01
in pins, 1 side 0b10 ; Last bit of right also has WCLK change
; Loop back to beginning...

View file

@ -14,6 +14,7 @@
#define pio_i2s_mclk_wrap_target 0
#define pio_i2s_mclk_wrap 1
#define pio_i2s_mclk_pio_version 0
static const uint16_t pio_i2s_mclk_program_instructions[] = {
// .wrap_target
@ -27,6 +28,10 @@ static const struct pio_program pio_i2s_mclk_program = {
.instructions = pio_i2s_mclk_program_instructions,
.length = 2,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_i2s_mclk_program_get_default_config(uint offset) {
@ -42,6 +47,7 @@ static inline pio_sm_config pio_i2s_mclk_program_get_default_config(uint offset)
#define pio_i2s_out_wrap_target 0
#define pio_i2s_out_wrap 7
#define pio_i2s_out_pio_version 0
static const uint16_t pio_i2s_out_program_instructions[] = {
// .wrap_target
@ -61,6 +67,10 @@ static const struct pio_program pio_i2s_out_program = {
.instructions = pio_i2s_out_program_instructions,
.length = 8,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_i2s_out_program_get_default_config(uint offset) {
@ -77,6 +87,7 @@ static inline pio_sm_config pio_i2s_out_program_get_default_config(uint offset)
#define pio_i2s_out_swap_wrap_target 0
#define pio_i2s_out_swap_wrap 7
#define pio_i2s_out_swap_pio_version 0
static const uint16_t pio_i2s_out_swap_program_instructions[] = {
// .wrap_target
@ -96,6 +107,10 @@ static const struct pio_program pio_i2s_out_swap_program = {
.instructions = pio_i2s_out_swap_program_instructions,
.length = 8,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_i2s_out_swap_program_get_default_config(uint offset) {
@ -112,6 +127,7 @@ static inline pio_sm_config pio_i2s_out_swap_program_get_default_config(uint off
#define pio_tdm_out_wrap_target 0
#define pio_tdm_out_wrap 3
#define pio_tdm_out_pio_version 0
static const uint16_t pio_tdm_out_program_instructions[] = {
// .wrap_target
@ -127,6 +143,10 @@ static const struct pio_program pio_tdm_out_program = {
.instructions = pio_tdm_out_program_instructions,
.length = 4,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_tdm_out_program_get_default_config(uint offset) {
@ -143,6 +163,7 @@ static inline pio_sm_config pio_tdm_out_program_get_default_config(uint offset)
#define pio_tdm_out_swap_wrap_target 0
#define pio_tdm_out_swap_wrap 3
#define pio_tdm_out_swap_pio_version 0
static const uint16_t pio_tdm_out_swap_program_instructions[] = {
// .wrap_target
@ -158,6 +179,10 @@ static const struct pio_program pio_tdm_out_swap_program = {
.instructions = pio_tdm_out_swap_program_instructions,
.length = 4,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_tdm_out_swap_program_get_default_config(uint offset) {
@ -174,6 +199,7 @@ static inline pio_sm_config pio_tdm_out_swap_program_get_default_config(uint off
#define pio_lsbj_out_wrap_target 0
#define pio_lsbj_out_wrap 7
#define pio_lsbj_out_pio_version 0
static const uint16_t pio_lsbj_out_program_instructions[] = {
// .wrap_target
@ -193,6 +219,10 @@ static const struct pio_program pio_lsbj_out_program = {
.instructions = pio_lsbj_out_program_instructions,
.length = 8,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_lsbj_out_program_get_default_config(uint offset) {
@ -209,6 +239,7 @@ static inline pio_sm_config pio_lsbj_out_program_get_default_config(uint offset)
#define pio_lsbj_out_swap_wrap_target 0
#define pio_lsbj_out_swap_wrap 7
#define pio_lsbj_out_swap_pio_version 0
static const uint16_t pio_lsbj_out_swap_program_instructions[] = {
// .wrap_target
@ -228,6 +259,10 @@ static const struct pio_program pio_lsbj_out_swap_program = {
.instructions = pio_lsbj_out_swap_program_instructions,
.length = 8,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_lsbj_out_swap_program_get_default_config(uint offset) {
@ -244,6 +279,7 @@ static inline pio_sm_config pio_lsbj_out_swap_program_get_default_config(uint of
#define pio_i2s_in_wrap_target 0
#define pio_i2s_in_wrap 7
#define pio_i2s_in_pio_version 0
static const uint16_t pio_i2s_in_program_instructions[] = {
// .wrap_target
@ -263,6 +299,10 @@ static const struct pio_program pio_i2s_in_program = {
.instructions = pio_i2s_in_program_instructions,
.length = 8,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_i2s_in_program_get_default_config(uint offset) {
@ -279,6 +319,7 @@ static inline pio_sm_config pio_i2s_in_program_get_default_config(uint offset) {
#define pio_i2s_in_swap_wrap_target 0
#define pio_i2s_in_swap_wrap 7
#define pio_i2s_in_swap_pio_version 0
static const uint16_t pio_i2s_in_swap_program_instructions[] = {
// .wrap_target
@ -298,6 +339,10 @@ static const struct pio_program pio_i2s_in_swap_program = {
.instructions = pio_i2s_in_swap_program_instructions,
.length = 8,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pio_i2s_in_swap_program_get_default_config(uint offset) {

View file

@ -24,7 +24,6 @@
#include "tusb.h"
#include "class/hid/hid_device.h"
#include <sdkoverride/tusb_absmouse.h>
// Weak function override to add our descriptor to the TinyUSB list
void __USBInstallAbsoluteMouse() { /* noop */ }

View file

@ -20,7 +20,6 @@
*/
#include "MouseBLE.h"
#include <sdkoverride/tusb_absmouse.h>
#include <HID_Bluetooth.h>
#include <PicoBluetoothBLEHID.h>

View file

@ -20,7 +20,6 @@
*/
#include "MouseBT.h"
#include <sdkoverride/tusb_absmouse.h>
#include <HID_Bluetooth.h>
#include <PicoBluetoothHID.h>

View file

@ -2,6 +2,8 @@
// This file is autogenerated by pioasm; do not edit! //
// -------------------------------------------------- //
#pragma once
#if !PICO_NO_HARDWARE
#include "hardware/pio.h"
#endif
@ -12,6 +14,7 @@
#define pdm_pio_wrap_target 0
#define pdm_pio_wrap 1
#define pdm_pio_pio_version 0
static const uint16_t pdm_pio_program_instructions[] = {
// .wrap_target
@ -25,6 +28,10 @@ static const struct pio_program pdm_pio_program = {
.instructions = pdm_pio_program_instructions,
.length = 2,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config pdm_pio_program_get_default_config(uint offset) {

View file

@ -200,7 +200,7 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
_initted = true;
}
// Disable any IRQs that are being used for SPI
io_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
io_bank0_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
DEBUGSPI("SPI: IRQ masks before = %08x %08x %08x %08x\n", (unsigned)irq_ctrl_base->inte[0], (unsigned)irq_ctrl_base->inte[1], (unsigned)irq_ctrl_base->inte[2], (unsigned)irq_ctrl_base->inte[3]);
for (auto entry : _usingIRQs) {
int gpio = entry.first;
@ -225,7 +225,7 @@ void SPIClassRP2040::endTransaction(void) {
int mode = entry.second;
gpio_set_irq_enabled(gpio, mode, true);
}
io_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
io_bank0_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
(void) irq_ctrl_base;
DEBUGSPI("SPI: IRQ masks = %08x %08x %08x %08x\n", (unsigned)irq_ctrl_base->inte[0], (unsigned)irq_ctrl_base->inte[1], (unsigned)irq_ctrl_base->inte[2], (unsigned)irq_ctrl_base->inte[3]);
interrupts();

View file

@ -2,6 +2,8 @@
// This file is autogenerated by pioasm; do not edit! //
// -------------------------------------------------- //
#pragma once
#if !PICO_NO_HARDWARE
#include "hardware/pio.h"
#endif
@ -12,6 +14,7 @@
#define servo_wrap_target 0
#define servo_wrap 7
#define servo_pio_version 0
#define servo_offset_halt 2u
@ -33,6 +36,10 @@ static const struct pio_program servo_program = {
.instructions = servo_program_instructions,
.length = 8,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};
static inline pio_sm_config servo_program_get_default_config(uint offset) {

View file

@ -79,7 +79,7 @@ static uint32_t gpioMask[4] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff};
void ethernet_arch_lwip_gpio_mask() {
noInterrupts();
memmove(gpioMaskStack[1], gpioMaskStack[0], 4 * sizeof(uint32_t) * (GPIOSTACKSIZE - 1)); // Push down the stack
io_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
io_bank0_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &io_bank0_hw->proc1_irq_ctrl : &io_bank0_hw->proc0_irq_ctrl;
for (int i = 0; i < 4; i++) {
gpioMaskStack[0][i] = irq_ctrl_base->inte[i];
irq_ctrl_base->inte[i] = irq_ctrl_base->inte[i] & gpioMask[i];
@ -89,7 +89,7 @@ void ethernet_arch_lwip_gpio_mask() {
void ethernet_arch_lwip_gpio_unmask() {
noInterrupts();
io_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
io_bank0_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &io_bank0_hw->proc1_irq_ctrl : &io_bank0_hw->proc0_irq_ctrl;
for (int i = 0; i < 4; i++) {
irq_ctrl_base->inte[i] = gpioMaskStack[0][i];
}

View file

@ -23,12 +23,12 @@
// - An auxiliary (glitchy) mux, whose output glitches when switched, but has
// no constraints on its inputs
// Not all clocks have both types of mux.
static inline bool has_glitchless_mux(enum clock_index clk_index) {
static inline bool has_glitchless_mux(clock_handle_t clk_index) {
return clk_index == clk_sys || clk_index == clk_ref;
}
/// \tag::clock_configure[]
bool _clock_configure(enum clock_index clk_index, uint32_t src, uint32_t auxsrc, uint32_t src_freq, uint32_t freq, uint32_t div) {
bool _clock_configure(clock_handle_t clk_index, uint32_t src, uint32_t auxsrc, uint32_t src_freq, uint32_t freq, uint32_t div) {
//uint32_t div;
assert(src_freq >= freq);

@ -1 +1 @@
Subproject commit 6a7db34ff63345a7badec79ebea3aaef1712f374
Subproject commit efe2103f9b28458a1615ff096054479743ade236

View file

@ -46,10 +46,10 @@ compiler.warning_flags=-Werror=return-type -Wno-psabi
compiler.warning_flags.none=-Werror=return-type -Wno-psabi
compiler.warning_flags.default=-Werror=return-type -Wno-psabi
compiler.warning_flags.more=-Wall -Werror=return-type -Wno-ignored-qualifiers -Wno-psabi
compiler.warning_flags.all=-Wall -Wextra -Werror=return-type -Wno-ignored-qualifiers -Wno-psabi
compiler.warning_flags.all=-Wall -Wextra -Werror=return-type -Wno-ignored-qualifiers -Wno-psabi -Wno-unused-parameter -Wno-missing-field-initializers
compiler.netdefines=-DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_LWIP=1 {build.libpicowdefs} -DLWIP_IGMP=1 -DLWIP_CHECKSUM_CTRL_PER_NETIF=1
compiler.defines={build.led} {build.usbstack_flags} -DCFG_TUSB_MCU=OPT_MCU_RP2040 {build.usbpid} {build.usbvid} {build.usbpwr} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' {compiler.netdefines} -DARDUINO_VARIANT="{build.variant}" -DTARGET_RP2040 -DPICO_FLASH_SIZE_BYTES={build.flash_total}
compiler.defines={build.led} {build.usbstack_flags} -DCFG_TUSB_MCU=OPT_MCU_RP2040 {build.usbpid} {build.usbvid} {build.usbpwr} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' {compiler.netdefines} -DARDUINO_VARIANT="{build.variant}" -DTARGET_RP2040 -DPICO_FLASH_SIZE_BYTES={build.flash_total} -DPICO_RP2040=1
compiler.includes="-iprefix{runtime.platform.path}/" "@{runtime.platform.path}/lib/platform_inc.txt" "-I{runtime.platform.path}/include"
compiler.flags=-march=armv6-m -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections {build.flags.exceptions} {build.flags.stackprotect} {build.flags.cmsis} {build.picodebugflags}
compiler.wrap="@{runtime.platform.path}/lib/platform_wrap.txt"
@ -71,7 +71,7 @@ compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,
compiler.elf2hex.bin.flags=-O binary
compiler.elf2hex.hex.flags=-O ihex -R .eeprom
compiler.elf2hex.cmd=arm-none-eabi-objcopy
compiler.ldflags={compiler.wrap} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common
compiler.ldflags={compiler.wrap} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--undefined=runtime_init_install_ram_vector_table
compiler.size.cmd=arm-none-eabi-size
compiler.define=-DARDUINO=
compiler.readelf.cmd=arm-none-eabi-readelf

@ -1 +1 @@
Subproject commit 5166f2bb03fb03597b0f2c8c7fbcf01616df67c9
Subproject commit c2c9d9d08f1de656fd3f07ab950285e63d30073f

View file

@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 3.12)
# Enable PicoW driver support. Compatible with standard Pico
set(PICO_BOARD pico_w)
set(PICO_PLATFORM rp2040)
set(PICO_CYW43_SUPPORTED 1)
include(pico_sdk_import.cmake)
project(pico_lib C CXX ASM)
@ -7,9 +12,6 @@ set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
# Enable PicoW driver support. Compatible with standard Pico
set(PICO_BOARD pico_w)
# Initialize the SDK
pico_sdk_init()
@ -32,6 +34,8 @@ target_compile_definitions(common INTERFACE
LWIP_UDP=1
LWIP_IGMP=1
LWIP_CHECKSUM_CTRL_PER_NETIF=1
PICO_PLATFORM=rp2040
PICO_CYW43_SUPPORTED=1
)
target_compile_options(common INTERFACE
@ -90,6 +94,7 @@ target_link_libraries(pico
pico_platform
pico_rand
pico_runtime
pico_runtime_init
pico_standard_link
pico_stdlib
pico_unique_id
@ -98,19 +103,20 @@ target_link_libraries(pico
tinyusb_device_unmarked
)
add_library(picow-noipv6-nobtc-noble STATIC)
target_compile_definitions(picow-noipv6-nobtc-noble PUBLIC
add_library(ipv4 STATIC)
target_compile_definitions(ipv4 PUBLIC
LWIP_IPV6=0
)
add_library(picow-noipv6-nobtc-noble-big STATIC)
target_compile_definitions(picow-noipv6-nobtc-noble-big PUBLIC
add_library(ipv4-big STATIC)
target_compile_definitions(ipv4-big PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=0
)
set(picow_link_libraries
common
pico_cyw43_driver
cyw43_driver
cyw43_driver_picow
pico_async_context
@ -123,40 +129,40 @@ set(picow_link_libraries
pico_stdlib
)
target_link_libraries(picow-noipv6-nobtc-noble
target_link_libraries(ipv4
${picow_link_libraries}
)
target_link_libraries(picow-noipv6-nobtc-noble-big
target_link_libraries(ipv4-big
${picow_link_libraries}
)
add_library(picow-ipv6-nobtc-noble STATIC)
target_compile_definitions(picow-ipv6-nobtc-noble PUBLIC
add_library(ipv4-ipv6 STATIC)
target_compile_definitions(ipv4-ipv6 PUBLIC
LWIP_IPV6=1
)
add_library(picow-ipv6-nobtc-noble-big STATIC)
target_compile_definitions(picow-ipv6-nobtc-noble-big PUBLIC
add_library(ipv4-ipv6-big STATIC)
target_compile_definitions(ipv4-ipv6-big PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=1
)
target_link_libraries(picow-ipv6-nobtc-noble
target_link_libraries(ipv4-ipv6
${picow_link_libraries}
)
target_link_libraries(picow-ipv6-nobtc-noble-big
target_link_libraries(ipv4-ipv6-big
${picow_link_libraries}
)
add_library(picow-noipv6-btc-ble STATIC)
target_compile_definitions(picow-noipv6-btc-ble PUBLIC
add_library(ipv4-bt STATIC)
target_compile_definitions(ipv4-bt PUBLIC
LWIP_IPV6=0
)
add_library(picow-noipv6-btc-ble-big STATIC)
target_compile_definitions(picow-noipv6-btc-ble-big PUBLIC
add_library(ipv4-bt-big STATIC)
target_compile_definitions(ipv4-bt PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=0
)
@ -169,41 +175,41 @@ set(picow_bt_link_libraries
pico_btstack_sbc_decoder
)
target_link_libraries(picow-noipv6-btc-ble
target_link_libraries(ipv4-bt
${picow_link_libraries}
${picow_bt_link_libraries}
)
target_link_libraries(picow-noipv6-btc-ble-big
target_link_libraries(ipv4-bt-big
${picow_link_libraries}
${picow_bt_link_libraries}
)
add_library(picow-ipv6-btc-ble STATIC)
target_compile_definitions(picow-ipv6-btc-ble PUBLIC
add_library(ipv4-ipv6-bt STATIC)
target_compile_definitions(ipv4-ipv6-bt PUBLIC
LWIP_IPV6=1
)
add_library(picow-ipv6-btc-ble-big STATIC)
target_compile_definitions(picow-ipv6-btc-ble-big PUBLIC
add_library(ipv4-ipv6-bt-big STATIC)
target_compile_definitions(ipv4-ipv6-bt-big PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=1
)
target_link_libraries(picow-ipv6-btc-ble
target_link_libraries(ipv4-ipv6-bt
${picow_link_libraries}
${picow_bt_link_libraries}
)
target_link_libraries(picow-ipv6-btc-ble-big
target_link_libraries(ipv4-ipv6-bt-big
${picow_link_libraries}
${picow_bt_link_libraries}
)
foreach(tgt pico picow-noipv6-nobtc-noble picow-ipv6-nobtc-noble picow-noipv6-btc-ble picow-ipv6-btc-ble picow-noipv6-nobtc-noble-big picow-ipv6-nobtc-noble-big picow-noipv6-btc-ble-big picow-ipv6-btc-ble-big)
foreach(tgt pico ipv4 ipv4-ipv6 ipv4-bt ipv4-ipv6-bt ipv4-big ipv4-ipv6-big ipv4-bt-big ipv4-ipv6-bt-big)
add_custom_command(TARGET ${tgt} POST_BUILD
COMMAND ar d lib${tgt}.a stdio.c.obj stdio_uart.c.obj stdio_usb.c.obj stdio_usb_descriptors.c.obj pico_malloc.c.obj
COMMAND ar d lib${tgt}.a stdio.c.obj stdio_uart.c.obj stdio_usb.c.obj stdio_usb_descriptors.c.obj pico_malloc.c.obj newlib_interface.c.obj
COMMAND ar d lib${tgt}.a btstack_flash_bank.c.obj # Need to override with our own implementation
COMMAND cp lib${tgt}.a ../../../lib/.
)

View file

@ -26,16 +26,18 @@ for type in boot2_generic_03h boot2_is25lp080 boot2_w25q080 boot2_w25x10cl; do
for div in 2 4; do
arm-none-eabi-gcc -march=armv6-m -mcpu=cortex-m0plus -mthumb -O3 \
-DNDEBUG -DPICO_FLASH_SPI_CLKDIV=$div \
-c "$PICO_SDK_PATH/src/rp2_common/boot_stage2/$type.S" \
-c "$PICO_SDK_PATH/src/rp2040/boot_stage2/$type.S" \
-I "$PICO_SDK_PATH/src/boards/include/boards/" \
-I "$PICO_SDK_PATH/src/rp2040/hardware_regs/include/" \
-I "$PICO_SDK_PATH/src/rp2_common/pico_platform/include/" \
-I "$PICO_SDK_PATH/src/rp2_common/boot_stage2/asminclude/" \
-I "$PICO_SDK_PATH/src/rp2040/pico_platform/include/" \
-I "$PICO_SDK_PATH/src/rp2040/boot_stage2/asminclude/" \
-I .
arm-none-eabi-gcc -march=armv6-m -mcpu=cortex-m0plus -mthumb -O3 \
-DNDEBUG -Wl,--build-id=none --specs=nosys.specs -nostartfiles \
-Wl,--script="$PICO_SDK_PATH/src/rp2_common/boot_stage2/boot_stage2.ld" \
-Wl,--script="$PICO_SDK_PATH/src/rp2040/boot_stage2/boot_stage2.ld" \
-Wl,-Map=$type.$div.elf.map $type.o -o $type.$div.elf
arm-none-eabi-objdump -h $type.$div.elf > $type.$div.dis
@ -43,7 +45,7 @@ for type in boot2_generic_03h boot2_is25lp080 boot2_w25q080 boot2_w25x10cl; do
arm-none-eabi-objcopy -Obinary $type.$div.elf $type.$div.bin
python3 "$PICO_SDK_PATH/src/rp2_common/boot_stage2/pad_checksum" \
python3 "$PICO_SDK_PATH/src/rp2040/boot_stage2/pad_checksum" \
-s 0xffffffff $type.$div.bin ${type}_${div}_padded_checksum.S
done
done

View file

@ -18,9 +18,20 @@ if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_P
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
endif ()
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
endif()
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT)
@ -29,11 +40,22 @@ if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
)
endif ()
if (NOT pico_sdk)
message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk)

View file

@ -106,28 +106,28 @@ def BuildCountry(name):
def BuildIPBTStack(name):
print("%s.menu.ipbtstack.ipv4only=IPv4 Only" % (name))
print('%s.menu.ipbtstack.ipv4only.build.libpicow=libpicow-noipv6-nobtc-noble.a' % (name))
print('%s.menu.ipbtstack.ipv4only.build.libpicow=libipv4.a' % (name))
print('%s.menu.ipbtstack.ipv4only.build.libpicowdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1' % (name))
print("%s.menu.ipbtstack.ipv4ipv6=IPv4 + IPv6" % (name))
print('%s.menu.ipbtstack.ipv4ipv6.build.libpicow=libpicow-ipv6-nobtc-noble.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6.build.libpicow=libipv4-ipv6.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6.build.libpicowdefs=-DLWIP_IPV6=1 -DLWIP_IPV4=1' % (name))
print("%s.menu.ipbtstack.ipv4btcble=IPv4 + Bluetooth" % (name))
print('%s.menu.ipbtstack.ipv4btcble.build.libpicow=libpicow-noipv6-btc-ble.a' % (name))
print('%s.menu.ipbtstack.ipv4btcble.build.libpicow=libipv4-bt.a' % (name))
print('%s.menu.ipbtstack.ipv4btcble.build.libpicowdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1 -DENABLE_CLASSIC=1 -DENABLE_BLE=1' % (name))
print("%s.menu.ipbtstack.ipv4ipv6btcble=IPv4 + IPv6 + Bluetooth" % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcble.build.libpicow=libpicow-ipv6-btc-ble.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcble.build.libpicow=libipv4-ipv6-bt.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcble.build.libpicowdefs=-DLWIP_IPV6=1 -DLWIP_IPV4=1 -DENABLE_CLASSIC=1 -DENABLE_BLE=1' % (name))
print("%s.menu.ipbtstack.ipv4onlybig=IPv4 Only - 32K" % (name))
print('%s.menu.ipbtstack.ipv4onlybig.build.libpicow=libpicow-noipv6-nobtc-noble-big.a' % (name))
print('%s.menu.ipbtstack.ipv4onlybig.build.libpicow=libipv4-big.a' % (name))
print('%s.menu.ipbtstack.ipv4onlybig.build.libpicowdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1 -D__LWIP_MEMMULT=2' % (name))
print("%s.menu.ipbtstack.ipv4ipv6big=IPv4 + IPv6 - 32K" % (name))
print('%s.menu.ipbtstack.ipv4ipv6big.build.libpicow=libpicow-ipv6-nobtc-noble-big.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6big.build.libpicow=libipv4-ipv6-big.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6big.build.libpicowdefs=-DLWIP_IPV6=1 -DLWIP_IPV4=1 -D__LWIP_MEMMULT=2' % (name))
print("%s.menu.ipbtstack.ipv4btcblebig=IPv4 + Bluetooth - 32K" % (name))
print('%s.menu.ipbtstack.ipv4btcblebig.build.libpicow=libpicow-noipv6-btc-ble-big.a' % (name))
print('%s.menu.ipbtstack.ipv4btcblebig.build.libpicow=libipv4-bt-big.a' % (name))
print('%s.menu.ipbtstack.ipv4btcblebig.build.libpicowdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1 -DENABLE_CLASSIC=1 -DENABLE_BLE=1 -D__LWIP_MEMMULT=2' % (name))
print("%s.menu.ipbtstack.ipv4ipv6btcblebig=IPv4 + IPv6 + Bluetooth - 32K" % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcblebig.build.libpicow=libpicow-ipv6-btc-ble-big.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcblebig.build.libpicow=libipv4-ipv6-bt-big.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcblebig.build.libpicowdefs=-DLWIP_IPV6=1 -DLWIP_IPV4=1 -DENABLE_CLASSIC=1 -DENABLE_BLE=1 -D__LWIP_MEMMULT=2' % (name))

View file

@ -92,9 +92,9 @@ env.Replace(
libpico = File(os.path.join(FRAMEWORK_DIR, "lib", "libpico.a"))
if "PIO_FRAMEWORK_ARDUINO_ENABLE_BLUETOOTH" in flatten_cppdefines:
if "PIO_FRAMEWORK_ARDUINO_ENABLE_IPV6" in flatten_cppdefines:
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libpicow-ipv6-btc-ble.a"))
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libipv4-ipv6-bt.a"))
else:
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libpicow-noipv6-btc-ble.a"))
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libipv4-bt.a"))
env.Append(
CPPDEFINES=[
("ENABLE_CLASSIC", 1),
@ -102,9 +102,9 @@ if "PIO_FRAMEWORK_ARDUINO_ENABLE_BLUETOOTH" in flatten_cppdefines:
]
)
elif "PIO_FRAMEWORK_ARDUINO_ENABLE_IPV6" in flatten_cppdefines:
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libpicow-ipv6-nobtc-noble.a"))
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libipv4-ipv6.a"))
else:
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libpicow-noipv6-nobtc-noble.a"))
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libipv4.a"))
env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:],
@ -137,6 +137,7 @@ env.Append(
"ARM_MATH_CM0_FAMILY",
"ARM_MATH_CM0_PLUS",
"TARGET_RP2040",
("PICO_RP2040", "1"),
# at this point, the main.py builder script hasn't updated upload.maximum_size yet,
# so it's the original value for the full flash.
("PICO_FLASH_SIZE_BYTES", board.get("upload.maximum_size"))
@ -162,7 +163,8 @@ env.Append(
"-Wl,--check-sections",
"-Wl,--gc-sections",
"-Wl,--unresolved-symbols=report-all",
"-Wl,--warn-common"
"-Wl,--warn-common",
"-Wl,--undefined=runtime_init_install_ram_vector_table"
],
LIBSOURCE_DIRS=[os.path.join(FRAMEWORK_DIR, "libraries")],