kopia lustrzana https://github.com/pimoroni/pimoroni-pico
CI: Switch to MICROPY_BOARD_DIR and simplify fixups.
rodzic
acf0e568bd
commit
883d751f52
|
@ -75,17 +75,19 @@ jobs:
|
||||||
- name: picolipo_16mb
|
- name: picolipo_16mb
|
||||||
board: PIMORONI_PICOLIPO_16MB
|
board: PIMORONI_PICOLIPO_16MB
|
||||||
- name: tufty2040
|
- name: tufty2040
|
||||||
board: PIMORONI_TUFTY2040
|
board: PICO
|
||||||
- name: picow
|
- name: picow
|
||||||
board: PICO_W
|
board: PICO_W
|
||||||
- name: picow_enviro
|
- name: picow_enviro
|
||||||
board: PICO_W_ENVIRO
|
board: PICO_W
|
||||||
|
patch: true
|
||||||
- name: picow_galactic_unicorn
|
- name: picow_galactic_unicorn
|
||||||
board: PICO_W
|
board: PICO_W
|
||||||
- name: picow_cosmic_unicorn
|
- name: picow_cosmic_unicorn
|
||||||
board: PICO_W
|
board: PICO_W
|
||||||
- name: picow_inky_frame
|
- name: picow_inky_frame
|
||||||
board: PICO_W_INKY
|
board: PICO_W
|
||||||
|
patch: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# MicroPython version will be contained in github.event.release.tag_name for releases
|
# MicroPython version will be contained in github.event.release.tag_name for releases
|
||||||
|
@ -119,11 +121,12 @@ jobs:
|
||||||
submodules: true
|
submodules: true
|
||||||
path: pimoroni-pico-${{ github.sha }}
|
path: pimoroni-pico-${{ github.sha }}
|
||||||
|
|
||||||
- name: "HACK: MicroPython Board Fixups"
|
- name: "HACK: Pico SDK Patch"
|
||||||
|
if: matrix.patch == true
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: micropython/ports/rp2
|
working-directory: micropython/ports/rp2
|
||||||
run: |
|
run: |
|
||||||
../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board/board-fixup.sh ${{matrix.name}} ${{matrix.board}} ../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board
|
../../../pimoroni-pico-${GITHUB_SHA}/micropython/board/pico-sdk-patch.sh ${{matrix.board}}
|
||||||
|
|
||||||
- name: Configure MicroPython
|
- name: Configure MicroPython
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
"deploy": [
|
|
||||||
"../deploy.md"
|
|
||||||
],
|
|
||||||
"docs": "",
|
|
||||||
"features": [
|
|
||||||
"296*128 e-Ink",
|
|
||||||
"Buttons"
|
|
||||||
],
|
|
||||||
"images": [
|
|
||||||
],
|
|
||||||
"mcu": "rp2040",
|
|
||||||
"product": "Badger2040 (2MiB)",
|
|
||||||
"thumbnail": "",
|
|
||||||
"url": "https://shop.pimoroni.com/products/badger-2040",
|
|
||||||
"vendor": "Pimoroni"
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
# cmake file for Pimoroni Badger 2040
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This is a hack! Need to replace with upstream board definition.
|
|
||||||
#define MICROPY_HW_BOARD_NAME "Pimoroni Badger2040 2MB"
|
|
||||||
#define MICROPY_HW_FLASH_STORAGE_BYTES (1024 * 1024)
|
|
|
@ -1,6 +0,0 @@
|
||||||
SRC_DIR=$1
|
|
||||||
DST_DIR=$2
|
|
||||||
|
|
||||||
echo "Applying wakeup_gpio.patch"
|
|
||||||
cd "$DST_DIR/../../lib/pico-sdk"
|
|
||||||
git apply "$SRC_DIR/wakeup_gpio.patch"
|
|
|
@ -1,116 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
// -----------------------------------------------------
|
|
||||||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
|
||||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
|
||||||
// -----------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef _BOARDS_PIMORONI_BADGER2040_H
|
|
||||||
#define _BOARDS_PIMORONI_BADGER2040_H
|
|
||||||
|
|
||||||
// For board detection
|
|
||||||
#define PIMORONI_BADGER2040
|
|
||||||
|
|
||||||
// --- BOARD SPECIFIC ---
|
|
||||||
#define BADGER2040_UART 0
|
|
||||||
#define BADGER2040_TX_PIN 0
|
|
||||||
#define BADGER2040_RX_PIN 1
|
|
||||||
|
|
||||||
#define BADGER2040_I2C 0
|
|
||||||
#define BADGER2040_INT_PIN 3
|
|
||||||
#define BADGER2040_SDA_PIN 4
|
|
||||||
#define BADGER2040_SCL_PIN 5
|
|
||||||
|
|
||||||
#define BADGER2040_3V3_EN_PIN 10
|
|
||||||
|
|
||||||
#define BADGER2040_SW_DOWN_PIN 11
|
|
||||||
#define BADGER2040_SW_A_PIN 12
|
|
||||||
#define BADGER2040_SW_B_PIN 13
|
|
||||||
#define BADGER2040_SW_C_PIN 14
|
|
||||||
#define BADGER2040_SW_UP_PIN 15
|
|
||||||
|
|
||||||
#define BADGER2040_INKY_SPI 0
|
|
||||||
#define BADGER2040_INKY_MISO_PIN 16
|
|
||||||
#define BADGER2040_INKY_CSN_PIN 17
|
|
||||||
#define BADGER2040_INKY_SCK_PIN 18
|
|
||||||
#define BADGER2040_INKY_MOSI_PIN 19
|
|
||||||
#define BADGER2040_INKY_DC_PIN 20
|
|
||||||
#define BADGER2040_INKY_RESET_PIN 21
|
|
||||||
#define BADGER2040_INKY_BUSY_PIN 26
|
|
||||||
|
|
||||||
#define BADGER2040_USER_SW_PIN 23
|
|
||||||
#define BADGER2040_USER_LED_PIN 25
|
|
||||||
|
|
||||||
#define BADGER2040_VBUS_DETECT_PIN 24
|
|
||||||
#define BADGER2040_VREF_POWER_PIN 27
|
|
||||||
#define BADGER2040_1V2_REF_PIN 28
|
|
||||||
#define BADGER2040_BAT_SENSE_PIN 29
|
|
||||||
|
|
||||||
// --- UART ---
|
|
||||||
#ifndef PICO_DEFAULT_UART
|
|
||||||
#define PICO_DEFAULT_UART BADGER2040_UART
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
|
||||||
#define PICO_DEFAULT_UART_TX_PIN BADGER2040_TX_PIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
|
||||||
#define PICO_DEFAULT_UART_RX_PIN BADGER2040_RX_PIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- LED ---
|
|
||||||
#ifndef PICO_DEFAULT_LED_PIN
|
|
||||||
#define PICO_DEFAULT_LED_PIN BADGER2040_USER_LED_PIN
|
|
||||||
#endif
|
|
||||||
// no PICO_DEFAULT_WS2812_PIN
|
|
||||||
|
|
||||||
// --- I2C ---
|
|
||||||
#ifndef PICO_DEFAULT_I2C
|
|
||||||
#define PICO_DEFAULT_I2C BADGER2040_I2C
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SDA_PIN BADGER2040_SDA_PIN
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SCL_PIN BADGER2040_SCL_PIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- SPI ---
|
|
||||||
#ifndef PICO_DEFAULT_SPI
|
|
||||||
#define PICO_DEFAULT_SPI BADGER2040_INKY_SPI
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_SCK_PIN BADGER2040_INKY_SCK_PIN
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_TX_PIN BADGER2040_INKY_MOSI_PIN
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_RX_PIN BADGER2040_INKY_MISO_PIN
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_CSN_PIN BADGER2040_INKY_CSN_PIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- FLASH ---
|
|
||||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
|
||||||
#define PICO_FLASH_SPI_CLKDIV 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SIZE_BYTES
|
|
||||||
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// All boards have B1 RP2040
|
|
||||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
|
||||||
#define PICO_RP2040_B0_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,138 +0,0 @@
|
||||||
diff --git a/src/rp2_common/pico_runtime/runtime.c b/src/rp2_common/pico_runtime/runtime.c
|
|
||||||
index f9018d0..ae8c479 100644
|
|
||||||
--- a/src/rp2_common/pico_runtime/runtime.c
|
|
||||||
+++ b/src/rp2_common/pico_runtime/runtime.c
|
|
||||||
@@ -20,6 +20,7 @@
|
|
||||||
#include "hardware/clocks.h"
|
|
||||||
#include "hardware/irq.h"
|
|
||||||
#include "hardware/resets.h"
|
|
||||||
+#include "hardware/gpio.h"
|
|
||||||
|
|
||||||
#include "pico/mutex.h"
|
|
||||||
#include "pico/time.h"
|
|
||||||
@@ -35,6 +36,21 @@
|
|
||||||
#include "pico/bootrom.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+// Pins to toggle on wakeup
|
|
||||||
+#ifndef PICO_WAKEUP_PIN_MASK
|
|
||||||
+#define PICO_WAKEUP_PIN_MASK ((0b1 << 10) | (0b1 << 25))
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+// Direction
|
|
||||||
+#ifndef PICO_WAKEUP_PIN_DIR
|
|
||||||
+#define PICO_WAKEUP_PIN_DIR ((0b1 << 10) | (0b1 << 25))
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+// Value
|
|
||||||
+#ifndef PICO_WAKEUP_PIN_VALUE
|
|
||||||
+#define PICO_WAKEUP_PIN_VALUE ((0b1 << 10) | (0b1 << 25))
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
extern char __StackLimit; /* Set by linker. */
|
|
||||||
|
|
||||||
uint32_t __attribute__((section(".ram_vector_table"))) ram_vector_table[48];
|
|
||||||
@@ -64,7 +80,13 @@ void runtime_install_stack_guard(void *stack_bottom) {
|
|
||||||
| 0x10000000; // XN = disable instruction fetch; no other bits means no permissions
|
|
||||||
}
|
|
||||||
|
|
||||||
-void runtime_init(void) {
|
|
||||||
+void runtime_user_init(void) {
|
|
||||||
+ gpio_init_mask(PICO_WAKEUP_PIN_MASK);
|
|
||||||
+ gpio_set_dir_masked(PICO_WAKEUP_PIN_MASK, PICO_WAKEUP_PIN_DIR);
|
|
||||||
+ gpio_put_masked(PICO_WAKEUP_PIN_MASK, PICO_WAKEUP_PIN_VALUE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void runtime_reset_peripherals(void) {
|
|
||||||
// Reset all peripherals to put system into a known state,
|
|
||||||
// - except for QSPI pads and the XIP IO bank, as this is fatal if running from flash
|
|
||||||
// - and the PLLs, as this is fatal if clock muxing has not been reset on this boot
|
|
||||||
@@ -89,7 +111,9 @@ void runtime_init(void) {
|
|
||||||
RESETS_RESET_UART1_BITS |
|
|
||||||
RESETS_RESET_USBCTRL_BITS
|
|
||||||
));
|
|
||||||
+}
|
|
||||||
|
|
||||||
+void runtime_init(void) {
|
|
||||||
// pre-init runs really early since we need it even for memcpy and divide!
|
|
||||||
// (basically anything in aeabi that uses bootrom)
|
|
||||||
|
|
||||||
diff --git a/src/rp2_common/pico_standard_link/crt0.S b/src/rp2_common/pico_standard_link/crt0.S
|
|
||||||
index d061108..e48d870 100644
|
|
||||||
--- a/src/rp2_common/pico_standard_link/crt0.S
|
|
||||||
+++ b/src/rp2_common/pico_standard_link/crt0.S
|
|
||||||
@@ -10,6 +10,8 @@
|
|
||||||
#include "hardware/regs/sio.h"
|
|
||||||
#include "pico/asm_helper.S"
|
|
||||||
#include "pico/binary_info/defs.h"
|
|
||||||
+#include "hardware/regs/resets.h"
|
|
||||||
+#include "hardware/regs/rosc.h"
|
|
||||||
|
|
||||||
#ifdef NDEBUG
|
|
||||||
#ifndef COLLAPSE_IRQS
|
|
||||||
@@ -226,6 +228,23 @@ _reset_handler:
|
|
||||||
cmp r0, #0
|
|
||||||
bne hold_non_core0_in_bootrom
|
|
||||||
|
|
||||||
+ // Increase ROSC frequency to ~48MHz (range 14.4 - 96)
|
|
||||||
+ // Startup drops from ~160ms to ~32ms on Pico W MicroPython
|
|
||||||
+ ldr r0, =(ROSC_BASE + ROSC_DIV_OFFSET)
|
|
||||||
+ ldr r1, =0xaa2
|
|
||||||
+ str r1, [r0]
|
|
||||||
+
|
|
||||||
+ ldr r1, =runtime_reset_peripherals
|
|
||||||
+ blx r1
|
|
||||||
+
|
|
||||||
+ ldr r1, =runtime_user_init
|
|
||||||
+ blx r1
|
|
||||||
+
|
|
||||||
+ // Read GPIO state for front buttons and store
|
|
||||||
+ movs r3, 0xd0 // Load 0xd0 into r3
|
|
||||||
+ lsls r3, r3, 24 // Shift left 24 to get 0xd0000000
|
|
||||||
+ ldr r6, [r3, 4] // Load GPIO state (0xd0000004) into r6
|
|
||||||
+
|
|
||||||
// In a NO_FLASH binary, don't perform .data copy, since it's loaded
|
|
||||||
// in-place by the SRAM load. Still need to clear .bss
|
|
||||||
#if !PICO_NO_FLASH
|
|
||||||
@@ -252,6 +271,10 @@ bss_fill_test:
|
|
||||||
cmp r1, r2
|
|
||||||
bne bss_fill_loop
|
|
||||||
|
|
||||||
+ // runtime_wakeup_gpio_state gets zero init above
|
|
||||||
+ ldr r2, =runtime_wakeup_gpio_state // Load output var addr into r2
|
|
||||||
+ str r6, [r2] // Store r6 to r2
|
|
||||||
+
|
|
||||||
platform_entry: // symbol for stack traces
|
|
||||||
// Use 32-bit jumps, in case these symbols are moved out of branch range
|
|
||||||
// (e.g. if main is in SRAM and crt0 in flash)
|
|
||||||
@@ -311,6 +334,19 @@ data_cpy_table:
|
|
||||||
runtime_init:
|
|
||||||
bx lr
|
|
||||||
|
|
||||||
+.weak runtime_user_init
|
|
||||||
+.type runtime_user_init,%function
|
|
||||||
+.thumb_func
|
|
||||||
+runtime_user_init:
|
|
||||||
+ bx lr
|
|
||||||
+
|
|
||||||
+.weak runtime_reset_peripherals
|
|
||||||
+.type runtime_reset_peripherals,%function
|
|
||||||
+.thumb_func
|
|
||||||
+runtime_reset_peripherals:
|
|
||||||
+ bx lr
|
|
||||||
+
|
|
||||||
+
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// If core 1 somehow gets into crt0 due to a spectacular VTOR mishap, we need to
|
|
||||||
// catch it and send back to the sleep-and-launch code in the bootrom. Shouldn't
|
|
||||||
@@ -335,3 +371,9 @@ hold_non_core0_in_bootrom:
|
|
||||||
.align 2
|
|
||||||
.equ HeapSize, PICO_HEAP_SIZE
|
|
||||||
.space HeapSize
|
|
||||||
+
|
|
||||||
+.section .data._reset_handler
|
|
||||||
+.global runtime_wakeup_gpio_state
|
|
||||||
+.align 4
|
|
||||||
+runtime_wakeup_gpio_state:
|
|
||||||
+.word 0x00000000
|
|
||||||
\ No newline at end of file
|
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
"deploy": [
|
|
||||||
"../deploy.md"
|
|
||||||
],
|
|
||||||
"docs": "",
|
|
||||||
"features": [
|
|
||||||
"296*128 e-Ink",
|
|
||||||
"Buttons"
|
|
||||||
],
|
|
||||||
"images": [
|
|
||||||
],
|
|
||||||
"mcu": "rp2040",
|
|
||||||
"product": "Badger2040 W (2MiB)",
|
|
||||||
"thumbnail": "",
|
|
||||||
"url": "https://shop.pimoroni.com/products/badger-2040w",
|
|
||||||
"vendor": "Pimoroni"
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
# cmake file for Pimoroni Badger 2040W
|
|
||||||
set(MICROPY_BOARD PICO_W)
|
|
||||||
|
|
||||||
set(MICROPY_PY_LWIP ON)
|
|
||||||
set(MICROPY_PY_NETWORK_CYW43 ON)
|
|
||||||
|
|
||||||
# Board specific version of the frozen manifest
|
|
||||||
set(MICROPY_FROZEN_MANIFEST ${CMAKE_SOURCE_DIR}/boards/PIMORONI_BADGER2040W/manifest.py)
|
|
|
@ -1,20 +0,0 @@
|
||||||
// This is a hack! Need to replace with upstream board definition.
|
|
||||||
#define MICROPY_HW_BOARD_NAME "Pimoroni Badger2040W 2MB"
|
|
||||||
#define MICROPY_HW_FLASH_STORAGE_BYTES (848 * 1024)
|
|
||||||
|
|
||||||
// Enable networking.
|
|
||||||
#define MICROPY_PY_NETWORK 1
|
|
||||||
|
|
||||||
// CYW43 driver configuration.
|
|
||||||
#define CYW43_USE_SPI (1)
|
|
||||||
#define CYW43_LWIP (1)
|
|
||||||
#define CYW43_GPIO (1)
|
|
||||||
#define CYW43_SPI_PIO (1)
|
|
||||||
|
|
||||||
// For debugging mbedtls - also set
|
|
||||||
// Debug level (0-4) 1=warning, 2=info, 3=debug, 4=verbose
|
|
||||||
// #define MODUSSL_MBEDTLS_DEBUG_LEVEL 1
|
|
||||||
|
|
||||||
#define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT
|
|
||||||
|
|
||||||
#define MICROPY_HW_PIN_RESERVED(i) ((i) == CYW43_PIN_WL_HOST_WAKE || (i) == CYW43_PIN_WL_REG_ON)
|
|
|
@ -1,30 +0,0 @@
|
||||||
GP0,GPIO0
|
|
||||||
GP1,GPIO1
|
|
||||||
GP2,GPIO2
|
|
||||||
GP3,GPIO3
|
|
||||||
GP4,GPIO4
|
|
||||||
GP5,GPIO5
|
|
||||||
GP6,GPIO6
|
|
||||||
GP7,GPIO7
|
|
||||||
GP8,GPIO8
|
|
||||||
GP9,GPIO9
|
|
||||||
GP10,GPIO10
|
|
||||||
GP11,GPIO11
|
|
||||||
GP12,GPIO12
|
|
||||||
GP13,GPIO13
|
|
||||||
GP14,GPIO14
|
|
||||||
GP15,GPIO15
|
|
||||||
GP16,GPIO16
|
|
||||||
GP17,GPIO17
|
|
||||||
GP18,GPIO18
|
|
||||||
GP19,GPIO19
|
|
||||||
GP20,GPIO20
|
|
||||||
GP21,GPIO21
|
|
||||||
GP22,GPIO22
|
|
||||||
GP26,GPIO26
|
|
||||||
GP27,GPIO27
|
|
||||||
GP28,GPIO28
|
|
||||||
WL_GPIO0,EXT_GPIO0
|
|
||||||
WL_GPIO1,EXT_GPIO1
|
|
||||||
WL_GPIO2,EXT_GPIO2
|
|
||||||
LED,EXT_GPIO0
|
|
|
|
@ -1,6 +0,0 @@
|
||||||
SRC_DIR=$1
|
|
||||||
DST_DIR=$2
|
|
||||||
|
|
||||||
echo "Applying wakeup_gpio.patch"
|
|
||||||
cd "$DST_DIR/../../lib/pico-sdk"
|
|
||||||
git apply "$SRC_DIR/wakeup_gpio.patch"
|
|
|
@ -1,137 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
// -----------------------------------------------------
|
|
||||||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
|
||||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
|
||||||
// -----------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef _BOARDS_PIMORONI_BADGER2040_H
|
|
||||||
#define _BOARDS_PIMORONI_BADGER2040_H
|
|
||||||
|
|
||||||
// For board detection
|
|
||||||
#define RASPBERRYPI_PICO_W
|
|
||||||
#define PIMORONI_BADGER2040
|
|
||||||
#define PIMORONI_BADGER2040W
|
|
||||||
|
|
||||||
// --- BOARD SPECIFIC ---
|
|
||||||
#define BADGER2040_UART 0
|
|
||||||
#define BADGER2040_TX_PIN 0
|
|
||||||
#define BADGER2040_RX_PIN 1
|
|
||||||
|
|
||||||
#define BADGER2040_I2C 0
|
|
||||||
#define BADGER2040_INT_PIN 3
|
|
||||||
#define BADGER2040_SDA_PIN 4
|
|
||||||
#define BADGER2040_SCL_PIN 5
|
|
||||||
|
|
||||||
#define BADGER2040_3V3_EN_PIN 10
|
|
||||||
|
|
||||||
#define BADGER2040_SW_DOWN_PIN 11
|
|
||||||
#define BADGER2040_SW_A_PIN 12
|
|
||||||
#define BADGER2040_SW_B_PIN 13
|
|
||||||
#define BADGER2040_SW_C_PIN 14
|
|
||||||
#define BADGER2040_SW_UP_PIN 15
|
|
||||||
|
|
||||||
#define BADGER2040_INKY_SPI 0
|
|
||||||
#define BADGER2040_INKY_MISO_PIN 16
|
|
||||||
#define BADGER2040_INKY_CSN_PIN 17
|
|
||||||
#define BADGER2040_INKY_SCK_PIN 18
|
|
||||||
#define BADGER2040_INKY_MOSI_PIN 19
|
|
||||||
#define BADGER2040_INKY_DC_PIN 20
|
|
||||||
#define BADGER2040_INKY_RESET_PIN 21
|
|
||||||
#define BADGER2040_INKY_BUSY_PIN 26
|
|
||||||
|
|
||||||
#define BADGER2040_USER_SW_PIN 23
|
|
||||||
#define BADGER2040_USER_LED_PIN 25
|
|
||||||
|
|
||||||
#define BADGER2040_VBUS_DETECT_PIN 24
|
|
||||||
#define BADGER2040_VREF_POWER_PIN 27
|
|
||||||
#define BADGER2040_1V2_REF_PIN 28
|
|
||||||
#define BADGER2040_BAT_SENSE_PIN 29
|
|
||||||
|
|
||||||
// --- UART ---
|
|
||||||
#ifndef PICO_DEFAULT_UART
|
|
||||||
#define PICO_DEFAULT_UART BADGER2040_UART
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
|
||||||
#define PICO_DEFAULT_UART_TX_PIN BADGER2040_TX_PIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
|
||||||
#define PICO_DEFAULT_UART_RX_PIN BADGER2040_RX_PIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- LED ---
|
|
||||||
#ifndef PICO_DEFAULT_LED_PIN
|
|
||||||
#define PICO_DEFAULT_LED_PIN BADGER2040_USER_LED_PIN
|
|
||||||
#endif
|
|
||||||
// no PICO_DEFAULT_WS2812_PIN
|
|
||||||
|
|
||||||
// --- I2C ---
|
|
||||||
#ifndef PICO_DEFAULT_I2C
|
|
||||||
#define PICO_DEFAULT_I2C BADGER2040_I2C
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SDA_PIN BADGER2040_SDA_PIN
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SCL_PIN BADGER2040_SCL_PIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- SPI ---
|
|
||||||
#ifndef PICO_DEFAULT_SPI
|
|
||||||
#define PICO_DEFAULT_SPI BADGER2040_INKY_SPI
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_SCK_PIN BADGER2040_INKY_SCK_PIN
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_TX_PIN BADGER2040_INKY_MOSI_PIN
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_RX_PIN BADGER2040_INKY_MISO_PIN
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_CSN_PIN BADGER2040_INKY_CSN_PIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- FLASH ---
|
|
||||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
|
||||||
#define PICO_FLASH_SPI_CLKDIV 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SIZE_BYTES
|
|
||||||
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
|
||||||
#define PICO_RP2040_B0_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_RP2040_B1_SUPPORTED
|
|
||||||
#define PICO_RP2040_B1_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_PIN_WL_HOST_WAKE
|
|
||||||
#define CYW43_PIN_WL_HOST_WAKE 24
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_PIN_WL_REG_ON
|
|
||||||
#define CYW43_PIN_WL_REG_ON 23
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_WL_GPIO_COUNT
|
|
||||||
#define CYW43_WL_GPIO_COUNT 3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_WL_GPIO_LED_PIN
|
|
||||||
#define CYW43_WL_GPIO_LED_PIN 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,138 +0,0 @@
|
||||||
diff --git a/src/rp2_common/pico_runtime/runtime.c b/src/rp2_common/pico_runtime/runtime.c
|
|
||||||
index f9018d0..ae8c479 100644
|
|
||||||
--- a/src/rp2_common/pico_runtime/runtime.c
|
|
||||||
+++ b/src/rp2_common/pico_runtime/runtime.c
|
|
||||||
@@ -20,6 +20,7 @@
|
|
||||||
#include "hardware/clocks.h"
|
|
||||||
#include "hardware/irq.h"
|
|
||||||
#include "hardware/resets.h"
|
|
||||||
+#include "hardware/gpio.h"
|
|
||||||
|
|
||||||
#include "pico/mutex.h"
|
|
||||||
#include "pico/time.h"
|
|
||||||
@@ -35,6 +36,21 @@
|
|
||||||
#include "pico/bootrom.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+// Pins to toggle on wakeup
|
|
||||||
+#ifndef PICO_WAKEUP_PIN_MASK
|
|
||||||
+#define PICO_WAKEUP_PIN_MASK ((0b1 << 10) | (0b1 << 22))
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+// Direction
|
|
||||||
+#ifndef PICO_WAKEUP_PIN_DIR
|
|
||||||
+#define PICO_WAKEUP_PIN_DIR ((0b1 << 10) | (0b1 << 22))
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+// Value
|
|
||||||
+#ifndef PICO_WAKEUP_PIN_VALUE
|
|
||||||
+#define PICO_WAKEUP_PIN_VALUE ((0b1 << 10) | (0b1 << 22))
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
extern char __StackLimit; /* Set by linker. */
|
|
||||||
|
|
||||||
uint32_t __attribute__((section(".ram_vector_table"))) ram_vector_table[48];
|
|
||||||
@@ -64,7 +80,13 @@ void runtime_install_stack_guard(void *stack_bottom) {
|
|
||||||
| 0x10000000; // XN = disable instruction fetch; no other bits means no permissions
|
|
||||||
}
|
|
||||||
|
|
||||||
-void runtime_init(void) {
|
|
||||||
+void runtime_user_init(void) {
|
|
||||||
+ gpio_init_mask(PICO_WAKEUP_PIN_MASK);
|
|
||||||
+ gpio_set_dir_masked(PICO_WAKEUP_PIN_MASK, PICO_WAKEUP_PIN_DIR);
|
|
||||||
+ gpio_put_masked(PICO_WAKEUP_PIN_MASK, PICO_WAKEUP_PIN_VALUE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void runtime_reset_peripherals(void) {
|
|
||||||
// Reset all peripherals to put system into a known state,
|
|
||||||
// - except for QSPI pads and the XIP IO bank, as this is fatal if running from flash
|
|
||||||
// - and the PLLs, as this is fatal if clock muxing has not been reset on this boot
|
|
||||||
@@ -89,7 +111,9 @@ void runtime_init(void) {
|
|
||||||
RESETS_RESET_UART1_BITS |
|
|
||||||
RESETS_RESET_USBCTRL_BITS
|
|
||||||
));
|
|
||||||
+}
|
|
||||||
|
|
||||||
+void runtime_init(void) {
|
|
||||||
// pre-init runs really early since we need it even for memcpy and divide!
|
|
||||||
// (basically anything in aeabi that uses bootrom)
|
|
||||||
|
|
||||||
diff --git a/src/rp2_common/pico_standard_link/crt0.S b/src/rp2_common/pico_standard_link/crt0.S
|
|
||||||
index d061108..e48d870 100644
|
|
||||||
--- a/src/rp2_common/pico_standard_link/crt0.S
|
|
||||||
+++ b/src/rp2_common/pico_standard_link/crt0.S
|
|
||||||
@@ -10,6 +10,8 @@
|
|
||||||
#include "hardware/regs/sio.h"
|
|
||||||
#include "pico/asm_helper.S"
|
|
||||||
#include "pico/binary_info/defs.h"
|
|
||||||
+#include "hardware/regs/resets.h"
|
|
||||||
+#include "hardware/regs/rosc.h"
|
|
||||||
|
|
||||||
#ifdef NDEBUG
|
|
||||||
#ifndef COLLAPSE_IRQS
|
|
||||||
@@ -226,6 +228,23 @@ _reset_handler:
|
|
||||||
cmp r0, #0
|
|
||||||
bne hold_non_core0_in_bootrom
|
|
||||||
|
|
||||||
+ // Increase ROSC frequency to ~48MHz (range 14.4 - 96)
|
|
||||||
+ // Startup drops from ~160ms to ~32ms on Pico W MicroPython
|
|
||||||
+ ldr r0, =(ROSC_BASE + ROSC_DIV_OFFSET)
|
|
||||||
+ ldr r1, =0xaa2
|
|
||||||
+ str r1, [r0]
|
|
||||||
+
|
|
||||||
+ ldr r1, =runtime_reset_peripherals
|
|
||||||
+ blx r1
|
|
||||||
+
|
|
||||||
+ ldr r1, =runtime_user_init
|
|
||||||
+ blx r1
|
|
||||||
+
|
|
||||||
+ // Read GPIO state for front buttons and store
|
|
||||||
+ movs r3, 0xd0 // Load 0xd0 into r3
|
|
||||||
+ lsls r3, r3, 24 // Shift left 24 to get 0xd0000000
|
|
||||||
+ ldr r6, [r3, 4] // Load GPIO state (0xd0000004) into r6
|
|
||||||
+
|
|
||||||
// In a NO_FLASH binary, don't perform .data copy, since it's loaded
|
|
||||||
// in-place by the SRAM load. Still need to clear .bss
|
|
||||||
#if !PICO_NO_FLASH
|
|
||||||
@@ -252,6 +271,10 @@ bss_fill_test:
|
|
||||||
cmp r1, r2
|
|
||||||
bne bss_fill_loop
|
|
||||||
|
|
||||||
+ // runtime_wakeup_gpio_state gets zero init above
|
|
||||||
+ ldr r2, =runtime_wakeup_gpio_state // Load output var addr into r2
|
|
||||||
+ str r6, [r2] // Store r6 to r2
|
|
||||||
+
|
|
||||||
platform_entry: // symbol for stack traces
|
|
||||||
// Use 32-bit jumps, in case these symbols are moved out of branch range
|
|
||||||
// (e.g. if main is in SRAM and crt0 in flash)
|
|
||||||
@@ -311,6 +334,19 @@ data_cpy_table:
|
|
||||||
runtime_init:
|
|
||||||
bx lr
|
|
||||||
|
|
||||||
+.weak runtime_user_init
|
|
||||||
+.type runtime_user_init,%function
|
|
||||||
+.thumb_func
|
|
||||||
+runtime_user_init:
|
|
||||||
+ bx lr
|
|
||||||
+
|
|
||||||
+.weak runtime_reset_peripherals
|
|
||||||
+.type runtime_reset_peripherals,%function
|
|
||||||
+.thumb_func
|
|
||||||
+runtime_reset_peripherals:
|
|
||||||
+ bx lr
|
|
||||||
+
|
|
||||||
+
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// If core 1 somehow gets into crt0 due to a spectacular VTOR mishap, we need to
|
|
||||||
// catch it and send back to the sleep-and-launch code in the bootrom. Shouldn't
|
|
||||||
@@ -335,3 +371,9 @@ hold_non_core0_in_bootrom:
|
|
||||||
.align 2
|
|
||||||
.equ HeapSize, PICO_HEAP_SIZE
|
|
||||||
.space HeapSize
|
|
||||||
+
|
|
||||||
+.section .data._reset_handler
|
|
||||||
+.global runtime_wakeup_gpio_state
|
|
||||||
+.align 4
|
|
||||||
+runtime_wakeup_gpio_state:
|
|
||||||
+.word 0x00000000
|
|
||||||
\ No newline at end of file
|
|
|
@ -1,21 +0,0 @@
|
||||||
NAME=$1
|
|
||||||
BOARD=$2
|
|
||||||
FIXUP_DIR=$3
|
|
||||||
MPY_DIR=`pwd`
|
|
||||||
|
|
||||||
echo "Fixup: $NAME $BOARD $MPY_DIR"
|
|
||||||
|
|
||||||
if [[ ! -f "$MPY_DIR/../../lib/pico-sdk/src/boards/include/boards/pimoroni_$NAME.h" ]] && [[ -f "$FIXUP_DIR/$NAME/pimoroni_$NAME.h" ]]; then
|
|
||||||
echo "Missing Pico SDK board .h. Copying: $FIXUP_DIR/$NAME/pimoroni_$NAME.h to $MPY_DIR/../../lib/pico-sdk/src/boards/include/boards/pimoroni_$NAME.h"
|
|
||||||
cp "$FIXUP_DIR/$NAME/pimoroni_$NAME.h" "$MPY_DIR/../../lib/pico-sdk/src/boards/include/boards/pimoroni_$NAME.h"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d "$MPY_DIR/boards/$BOARD" ]] && [[ -d "$FIXUP_DIR/$NAME/$BOARD/" ]]; then
|
|
||||||
echo "Missing board dir. Copying: $FIXUP_DIR/$NAME/$BOARD/ to $MPY_DIR/boards/"
|
|
||||||
cp -r "$FIXUP_DIR/$NAME/$BOARD/" "$MPY_DIR/boards/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "$FIXUP_DIR/$NAME/fixup.sh" ]]; then
|
|
||||||
echo "Running custom fixup.sh"
|
|
||||||
bash "$FIXUP_DIR/$NAME/fixup.sh" "$FIXUP_DIR/$NAME" "$MPY_DIR"
|
|
||||||
fi
|
|
|
@ -1,6 +0,0 @@
|
||||||
include("../manifest.py")
|
|
||||||
|
|
||||||
require("mip")
|
|
||||||
require("ntptime")
|
|
||||||
require("urequests")
|
|
||||||
require("umqtt.simple")
|
|
|
@ -1,6 +0,0 @@
|
||||||
SRC_DIR=$1
|
|
||||||
DST_DIR=$2
|
|
||||||
|
|
||||||
echo "Applying wakeup_gpio.patch"
|
|
||||||
cd "$DST_DIR/../../lib/pico-sdk"
|
|
||||||
git apply "$SRC_DIR/wakeup_gpio.patch"
|
|
|
@ -1,102 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
// -----------------------------------------------------
|
|
||||||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
|
||||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
|
||||||
// -----------------------------------------------------
|
|
||||||
|
|
||||||
// This header may be included by other board headers as "boards/pico.h"
|
|
||||||
|
|
||||||
#ifndef _BOARDS_PICO_W_H
|
|
||||||
#define _BOARDS_PICO_W_H
|
|
||||||
|
|
||||||
// For board detection
|
|
||||||
#define RASPBERRYPI_PICO_W
|
|
||||||
|
|
||||||
// --- UART ---
|
|
||||||
#ifndef PICO_DEFAULT_UART
|
|
||||||
#define PICO_DEFAULT_UART 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
|
||||||
#define PICO_DEFAULT_UART_TX_PIN 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
|
||||||
#define PICO_DEFAULT_UART_RX_PIN 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- LED ---
|
|
||||||
// no PICO_DEFAULT_LED_PIN - LED is on Wireless chip
|
|
||||||
// no PICO_DEFAULT_WS2812_PIN
|
|
||||||
|
|
||||||
// --- I2C ---
|
|
||||||
#ifndef PICO_DEFAULT_I2C
|
|
||||||
#define PICO_DEFAULT_I2C 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SDA_PIN 4
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SCL_PIN 5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- SPI ---
|
|
||||||
#ifndef PICO_DEFAULT_SPI
|
|
||||||
#define PICO_DEFAULT_SPI 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_SCK_PIN 18
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_TX_PIN 19
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_RX_PIN 16
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_CSN_PIN 17
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- FLASH ---
|
|
||||||
|
|
||||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
|
||||||
#define PICO_FLASH_SPI_CLKDIV 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SIZE_BYTES
|
|
||||||
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// note the SMSP mode pin is on WL_GPIO1
|
|
||||||
// #define PICO_SMPS_MODE_PIN
|
|
||||||
|
|
||||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
|
||||||
#define PICO_RP2040_B0_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_RP2040_B1_SUPPORTED
|
|
||||||
#define PICO_RP2040_B1_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_PIN_WL_HOST_WAKE
|
|
||||||
#define CYW43_PIN_WL_HOST_WAKE 24
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_PIN_WL_REG_ON
|
|
||||||
#define CYW43_PIN_WL_REG_ON 23
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_WL_GPIO_COUNT
|
|
||||||
#define CYW43_WL_GPIO_COUNT 3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_WL_GPIO_LED_PIN
|
|
||||||
#define CYW43_WL_GPIO_LED_PIN 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,7 +0,0 @@
|
||||||
include("../manifest.py")
|
|
||||||
|
|
||||||
require("mip")
|
|
||||||
require("ntptime")
|
|
||||||
require("urequests")
|
|
||||||
require("urllib.urequest")
|
|
||||||
require("umqtt.simple")
|
|
|
@ -1,6 +0,0 @@
|
||||||
SRC_DIR=$1
|
|
||||||
DST_DIR=$2
|
|
||||||
|
|
||||||
echo "Applying wakeup_gpio.patch"
|
|
||||||
cd "$DST_DIR/../../lib/pico-sdk"
|
|
||||||
git apply "$SRC_DIR/wakeup_gpio.patch"
|
|
|
@ -1,102 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
// -----------------------------------------------------
|
|
||||||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
|
||||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
|
||||||
// -----------------------------------------------------
|
|
||||||
|
|
||||||
// This header may be included by other board headers as "boards/pico.h"
|
|
||||||
|
|
||||||
#ifndef _BOARDS_PICO_W_H
|
|
||||||
#define _BOARDS_PICO_W_H
|
|
||||||
|
|
||||||
// For board detection
|
|
||||||
#define RASPBERRYPI_PICO_W
|
|
||||||
|
|
||||||
// --- UART ---
|
|
||||||
#ifndef PICO_DEFAULT_UART
|
|
||||||
#define PICO_DEFAULT_UART 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
|
||||||
#define PICO_DEFAULT_UART_TX_PIN 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
|
||||||
#define PICO_DEFAULT_UART_RX_PIN 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- LED ---
|
|
||||||
// no PICO_DEFAULT_LED_PIN - LED is on Wireless chip
|
|
||||||
// no PICO_DEFAULT_WS2812_PIN
|
|
||||||
|
|
||||||
// --- I2C ---
|
|
||||||
#ifndef PICO_DEFAULT_I2C
|
|
||||||
#define PICO_DEFAULT_I2C 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SDA_PIN 4
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SCL_PIN 5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- SPI ---
|
|
||||||
#ifndef PICO_DEFAULT_SPI
|
|
||||||
#define PICO_DEFAULT_SPI 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_SCK_PIN 18
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_TX_PIN 19
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_RX_PIN 16
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_CSN_PIN 17
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- FLASH ---
|
|
||||||
|
|
||||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
|
||||||
#define PICO_FLASH_SPI_CLKDIV 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SIZE_BYTES
|
|
||||||
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// note the SMSP mode pin is on WL_GPIO1
|
|
||||||
// #define PICO_SMPS_MODE_PIN
|
|
||||||
|
|
||||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
|
||||||
#define PICO_RP2040_B0_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_RP2040_B1_SUPPORTED
|
|
||||||
#define PICO_RP2040_B1_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_PIN_WL_HOST_WAKE
|
|
||||||
#define CYW43_PIN_WL_HOST_WAKE 24
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_PIN_WL_REG_ON
|
|
||||||
#define CYW43_PIN_WL_REG_ON 23
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_WL_GPIO_COUNT
|
|
||||||
#define CYW43_WL_GPIO_COUNT 3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CYW43_WL_GPIO_LED_PIN
|
|
||||||
#define CYW43_WL_GPIO_LED_PIN 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,68 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
// -----------------------------------------------------
|
|
||||||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
|
||||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
|
||||||
// -----------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef _BOARDS_PIMORONI_TUFTY_2040_H
|
|
||||||
#define _BOARDS_PIMORONI_TUFTY_2040_H
|
|
||||||
|
|
||||||
// For board detection
|
|
||||||
#define PIMORONI_TUFTY_2040
|
|
||||||
|
|
||||||
// --- LED ---
|
|
||||||
#ifndef PICO_DEFAULT_LED_PIN
|
|
||||||
#define PICO_DEFAULT_LED_PIN 25
|
|
||||||
#endif
|
|
||||||
// no PICO_DEFAULT_WS2812_PIN
|
|
||||||
|
|
||||||
// --- I2C ---
|
|
||||||
#ifndef PICO_DEFAULT_I2C
|
|
||||||
#define PICO_DEFAULT_I2C 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SDA_PIN 4
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
|
||||||
#define PICO_DEFAULT_I2C_SCL_PIN 5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- SPI ---
|
|
||||||
#ifndef PICO_DEFAULT_SPI
|
|
||||||
#define PICO_DEFAULT_SPI 0
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_SCK_PIN 18
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_TX_PIN 19
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_RX_PIN 16
|
|
||||||
#endif
|
|
||||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
|
||||||
#define PICO_DEFAULT_SPI_CSN_PIN 17
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- FLASH ---
|
|
||||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
|
||||||
#define PICO_FLASH_SPI_CLKDIV 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_FLASH_SIZE_BYTES
|
|
||||||
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// All boards have B1 RP2040
|
|
||||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
|
||||||
#define PICO_RP2040_B0_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
include("$(PORT_DIR)/boards/manifest.py")
|
||||||
|
|
||||||
|
require("mip")
|
||||||
|
require("ntptime")
|
||||||
|
require("urequests")
|
||||||
|
require("umqtt.simple")
|
|
@ -1,4 +1,4 @@
|
||||||
include("../manifest.py")
|
include("$(PORT_DIR)/boards/manifest.py")
|
||||||
|
|
||||||
require("mip")
|
require("mip")
|
||||||
require("ntptime")
|
require("ntptime")
|
|
@ -0,0 +1,10 @@
|
||||||
|
BOARD=$1
|
||||||
|
FIXUP_DIR="$(dirname -- "$(readlink -f "${BASH_SOURCE}")")"
|
||||||
|
|
||||||
|
MPY_DIR=`pwd`
|
||||||
|
|
||||||
|
if [[ -f "$FIXUP_DIR/$BOARD/pico_sdk.patch" ]]; then
|
||||||
|
echo "Applying pico_sdk.patch"
|
||||||
|
cd $MPY_DIR/lib/pico-sdk
|
||||||
|
git apply "$FIXUP_DIR/$BOARD/pico_sdk.patch"
|
||||||
|
fi
|
|
@ -7,6 +7,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../")
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
set(MICROPY_BOARD_DIR "${CMAKE_CURRENT_LIST_DIR}/../board/PICO_W_ENVIRO")
|
||||||
|
|
||||||
# Essential
|
# Essential
|
||||||
include(pimoroni_i2c/micropython)
|
include(pimoroni_i2c/micropython)
|
||||||
include(pimoroni_bus/micropython)
|
include(pimoroni_bus/micropython)
|
||||||
|
|
|
@ -7,6 +7,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../")
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
set(MICROPY_BOARD_DIR "${CMAKE_CURRENT_LIST_DIR}/../board/PICO_W_INKY")
|
||||||
|
|
||||||
# Essential
|
# Essential
|
||||||
include(pimoroni_i2c/micropython)
|
include(pimoroni_i2c/micropython)
|
||||||
include(pimoroni_bus/micropython)
|
include(pimoroni_bus/micropython)
|
||||||
|
|
|
@ -7,6 +7,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../")
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
set(MICROPY_BOARD_DIR "${CMAKE_CURRENT_LIST_DIR}/../board/PIMORONI_TUFTY2040")
|
||||||
|
|
||||||
# Essential
|
# Essential
|
||||||
include(pimoroni_i2c/micropython)
|
include(pimoroni_i2c/micropython)
|
||||||
include(pimoroni_bus/micropython)
|
include(pimoroni_bus/micropython)
|
||||||
|
|
Ładowanie…
Reference in New Issue