Skip to content

Commit a07825d

Browse files
authored
Merge pull request #73 from pimoroni/dev
Development
2 parents e3f680b + 0701060 commit a07825d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1229
-203
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Python Linting
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
name: Python Linting
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Source
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
14+
15+
- name: Install Python
16+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55
17+
with:
18+
python-version: '3.13'
19+
20+
- name: Install Python Deps
21+
run: source ci/python.sh && qa_prepare_all
22+
23+
- name: Lint MicroPython Examples
24+
shell: bash
25+
run: source ci/python.sh && qa_examples_check
26+
27+
- name: Lint MicroPython Modules
28+
shell: bash
29+
run: source ci/python.sh && qa_modules_check
30+
31+
- name: Lint Python Tools
32+
shell: bash
33+
run: source ci/python.sh && qa_tools_check

boards/common.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (EXISTS "${PIMORONI_TOOLS_DIR}/dir2uf2/dir2uf2" AND EXISTS "${PIMORONI_UF2_MA
2525
MESSAGE("dir2uf2: Using manifest ${PIMORONI_UF2_MANIFEST}.")
2626
MESSAGE("dir2uf2: Using root ${PIMORONI_UF2_DIR}.")
2727
add_custom_target("${MICROPY_TARGET}-with-filesystem.uf2" ALL
28-
COMMAND ${Python_EXECUTABLE} "${PIMORONI_TOOLS_DIR}/dir2uf2/dir2uf2" --fs-compact --sparse --append-to "${MICROPY_TARGET}.uf2" --manifest "${PIMORONI_UF2_MANIFEST}" --filename with-filesystem.uf2 "${PIMORONI_UF2_DIR}"
28+
COMMAND ${Python_EXECUTABLE} "${PIMORONI_TOOLS_DIR}/dir2uf2/dir2uf2" --verbose --fs-compact --sparse --append-to "${MICROPY_TARGET}.uf2" --manifest "${PIMORONI_UF2_MANIFEST}" --filename with-filesystem.uf2 "${PIMORONI_UF2_DIR}"
2929
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
3030
COMMENT "dir2uf2: Appending filesystem to ${MICROPY_TARGET}.uf2."
3131
DEPENDS ${MICROPY_TARGET}

boards/presto/mpconfigboard.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ set(MICROPY_BLUETOOTH_BTSTACK ON)
4040
# MICROPY_PY_BLUETOOTH_CYW43 = 1
4141
set(MICROPY_PY_BLUETOOTH_CYW43 ON)
4242

43-
set(MICROPY_HW_ENABLE_PSRAM ON)
43+
set(MICROPY_BOARD_LINKER_SCRIPT ${MICROPY_BOARD_DIR}/presto.ld)
4444

4545
# Board specific version of the frozen manifest
4646
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)

boards/presto/mpconfigboard.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
int mp_hal_is_pin_reserved(int n);
2929
#define MICROPY_HW_PIN_RESERVED(i) mp_hal_is_pin_reserved(i)
3030

31+
// Enable PSRAM
32+
#define MICROPY_HW_ENABLE_PSRAM (1)
33+
3134
// Alias the chip select pin specified by presto.h
3235
#define MICROPY_HW_PSRAM_CS_PIN PIMORONI_PRESTO_PSRAM_CS_PIN
3336

boards/presto/presto.ld

Lines changed: 322 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,322 @@
1+
/* Based on GCC ARM embedded samples.
2+
Defines the following symbols for use by code:
3+
__exidx_start
4+
__exidx_end
5+
__etext
6+
__data_start__
7+
__preinit_array_start
8+
__preinit_array_end
9+
__init_array_start
10+
__init_array_end
11+
__fini_array_start
12+
__fini_array_end
13+
__data_end__
14+
__bss_start__
15+
__bss_end__
16+
__end__
17+
end
18+
__HeapLimit
19+
__StackLimit
20+
__StackTop
21+
__stack (== StackTop)
22+
*/
23+
24+
MEMORY
25+
{
26+
FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 4096k
27+
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k
28+
SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k
29+
SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k
30+
PSRAM(rw) : ORIGIN = 0x11000000, LENGTH = 8128k /* 64k reserved for RAMFS */
31+
}
32+
33+
ENTRY(_entry_point)
34+
35+
SECTIONS
36+
{
37+
.flash_begin : {
38+
__flash_binary_start = .;
39+
} > FLASH
40+
41+
/* The bootrom will enter the image at the point indicated in your
42+
IMAGE_DEF, which is usually the reset handler of your vector table.
43+
44+
The debugger will use the ELF entry point, which is the _entry_point
45+
symbol, and in our case is *different from the bootrom's entry point.*
46+
This is used to go back through the bootrom on debugger launches only,
47+
to perform the same initial flash setup that would be performed on a
48+
cold boot.
49+
*/
50+
51+
.text : {
52+
__logical_binary_start = .;
53+
KEEP (*(.vectors))
54+
KEEP (*(.binary_info_header))
55+
__binary_info_header_end = .;
56+
KEEP (*(.embedded_block))
57+
__embedded_block_end = .;
58+
KEEP (*(.reset))
59+
/* TODO revisit this now memset/memcpy/float in ROM */
60+
/* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from
61+
* FLASH ... we will include any thing excluded here in .data below by default */
62+
*(.init)
63+
*libgcc.a:cmse_nonsecure_call.o
64+
/* Change for MicroPython... exclude gc.c, parse.c, vm.c from flash */
65+
*(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a: *gc.c.obj *vm.c.obj *parse.c.obj) .text*)
66+
*(.fini)
67+
/* Pull all c'tors into .text */
68+
*crtbegin.o(.ctors)
69+
*crtbegin?.o(.ctors)
70+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
71+
*(SORT(.ctors.*))
72+
*(.ctors)
73+
/* Followed by destructors */
74+
*crtbegin.o(.dtors)
75+
*crtbegin?.o(.dtors)
76+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
77+
*(SORT(.dtors.*))
78+
*(.dtors)
79+
80+
. = ALIGN(4);
81+
/* preinit data */
82+
PROVIDE_HIDDEN (__preinit_array_start = .);
83+
KEEP(*(SORT(.preinit_array.*)))
84+
KEEP(*(.preinit_array))
85+
PROVIDE_HIDDEN (__preinit_array_end = .);
86+
87+
. = ALIGN(4);
88+
/* init data */
89+
PROVIDE_HIDDEN (__init_array_start = .);
90+
KEEP(*(SORT(.init_array.*)))
91+
KEEP(*(.init_array))
92+
PROVIDE_HIDDEN (__init_array_end = .);
93+
94+
. = ALIGN(4);
95+
/* finit data */
96+
PROVIDE_HIDDEN (__fini_array_start = .);
97+
*(SORT(.fini_array.*))
98+
*(.fini_array)
99+
PROVIDE_HIDDEN (__fini_array_end = .);
100+
*(.eh_frame*)
101+
. = ALIGN(4);
102+
} > FLASH
103+
104+
/* Note the boot2 section is optional, and should be discarded if there is
105+
no reference to it *inside* the binary, as it is not called by the
106+
bootrom. (The bootrom performs a simple best-effort XIP setup and
107+
leaves it to the binary to do anything more sophisticated.) However
108+
there is still a size limit of 256 bytes, to ensure the boot2 can be
109+
stored in boot RAM.
110+
111+
Really this is a "XIP setup function" -- the name boot2 is historic and
112+
refers to its dual-purpose on RP2040, where it also handled vectoring
113+
from the bootrom into the user image.
114+
*/
115+
116+
.boot2 : {
117+
__boot2_start__ = .;
118+
*(.boot2)
119+
__boot2_end__ = .;
120+
} > FLASH
121+
122+
ASSERT(__boot2_end__ - __boot2_start__ <= 256,
123+
"ERROR: Pico second stage bootloader must be no more than 256 bytes in size")
124+
125+
.rodata : {
126+
*(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*)
127+
*(.srodata*)
128+
. = ALIGN(4);
129+
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*)))
130+
. = ALIGN(4);
131+
} > FLASH
132+
133+
.ARM.extab :
134+
{
135+
*(.ARM.extab* .gnu.linkonce.armextab.*)
136+
} > FLASH
137+
138+
__exidx_start = .;
139+
.ARM.exidx :
140+
{
141+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
142+
} > FLASH
143+
__exidx_end = .;
144+
145+
/* Machine inspectable binary information */
146+
. = ALIGN(4);
147+
__binary_info_start = .;
148+
.binary_info :
149+
{
150+
KEEP(*(.binary_info.keep.*))
151+
*(.binary_info.*)
152+
} > FLASH
153+
__binary_info_end = .;
154+
. = ALIGN(4);
155+
156+
.ram_vector_table (NOLOAD): {
157+
*(.ram_vector_table)
158+
} > RAM
159+
160+
.uninitialized_data (NOLOAD): {
161+
. = ALIGN(4);
162+
*(.uninitialized_data*)
163+
} > RAM
164+
165+
.data : {
166+
__data_start__ = .;
167+
*(vtable)
168+
169+
*(.time_critical*)
170+
171+
/* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */
172+
*(.text*)
173+
. = ALIGN(4);
174+
*(.rodata*)
175+
. = ALIGN(4);
176+
177+
*(.data*)
178+
*(.sdata*)
179+
180+
. = ALIGN(4);
181+
*(.after_data.*)
182+
. = ALIGN(4);
183+
/* preinit data */
184+
PROVIDE_HIDDEN (__mutex_array_start = .);
185+
KEEP(*(SORT(.mutex_array.*)))
186+
KEEP(*(.mutex_array))
187+
PROVIDE_HIDDEN (__mutex_array_end = .);
188+
189+
*(.jcr)
190+
. = ALIGN(4);
191+
} > RAM AT> FLASH
192+
193+
.tdata : {
194+
. = ALIGN(4);
195+
*(.tdata .tdata.* .gnu.linkonce.td.*)
196+
/* All data end */
197+
__tdata_end = .;
198+
} > RAM AT> FLASH
199+
PROVIDE(__data_end__ = .);
200+
201+
/* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */
202+
__etext = LOADADDR(.data);
203+
204+
.tbss (NOLOAD) : {
205+
. = ALIGN(4);
206+
__bss_start__ = .;
207+
__tls_base = .;
208+
*(.tbss .tbss.* .gnu.linkonce.tb.*)
209+
*(.tcommon)
210+
211+
__tls_end = .;
212+
} > RAM
213+
214+
.bss (NOLOAD) : {
215+
. = ALIGN(4);
216+
__tbss_end = .;
217+
218+
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*)))
219+
*(COMMON)
220+
PROVIDE(__global_pointer$ = . + 2K);
221+
*(.sbss*)
222+
. = ALIGN(4);
223+
__bss_end__ = .;
224+
} > RAM
225+
226+
.heap (NOLOAD):
227+
{
228+
__end__ = .;
229+
end = __end__;
230+
KEEP(*(.heap*))
231+
/* historically on GCC sbrk was growing past __HeapLimit to __StackLimit, however
232+
to be more compatible, we now set __HeapLimit explicitly to where the end of the heap is */
233+
/* Change for MicroPython: don't include this, it increases reported firmware size.
234+
/* . = ORIGIN(RAM) + LENGTH(RAM); */
235+
__HeapLimit = .;
236+
} > RAM
237+
238+
/* Start and end symbols must be word-aligned */
239+
.scratch_x : {
240+
__scratch_x_start__ = .;
241+
*(.scratch_x.*)
242+
. = ALIGN(4);
243+
__scratch_x_end__ = .;
244+
} > SCRATCH_X AT > FLASH
245+
__scratch_x_source__ = LOADADDR(.scratch_x);
246+
247+
.scratch_y : {
248+
__scratch_y_start__ = .;
249+
*(.scratch_y.*)
250+
. = ALIGN(4);
251+
__scratch_y_end__ = .;
252+
} > SCRATCH_Y AT > FLASH
253+
__scratch_y_source__ = LOADADDR(.scratch_y);
254+
255+
/* .stack*_dummy section doesn't contains any symbols. It is only
256+
* used for linker to calculate size of stack sections, and assign
257+
* values to stack symbols later
258+
*
259+
* stack1 section may be empty/missing if platform_launch_core1 is not used */
260+
261+
/* by default we put core 0 stack at the end of scratch Y, so that if core 1
262+
* stack is not used then all of SCRATCH_X is free.
263+
*/
264+
.stack1_dummy (NOLOAD):
265+
{
266+
*(.stack1*)
267+
} > SCRATCH_X
268+
.stack_dummy (NOLOAD):
269+
{
270+
KEEP(*(.stack*))
271+
} > SCRATCH_Y
272+
273+
.flash_end : {
274+
KEEP(*(.embedded_end_block*))
275+
PROVIDE(__flash_binary_end = .);
276+
} > FLASH =0xaa
277+
278+
/* PSRAM data section */
279+
.psram_data (NOLOAD): {
280+
. = ALIGN(4);
281+
*(.psram_data*)
282+
PROVIDE(__psram_data_end = .);
283+
} > PSRAM
284+
285+
/* stack limit is poorly named, but historically is maximum heap ptr */
286+
__StackLimit = __bss_end__ + __micropy_c_heap_size__;
287+
288+
/* Define start and end of internal RAM GC heap */
289+
__GcHeapStart = __StackLimit; /* after the C heap (sbrk limit) */
290+
__GcHeapEnd = ORIGIN(RAM) + LENGTH(RAM) - __micropy_extra_stack__;
291+
292+
/* Define start and end of PSRAM GC heap */
293+
__PsramGcHeapStart = __psram_data_end; /* after the C heap (sbrk limit) */
294+
__PsramGcHeapEnd = ORIGIN(PSRAM) + LENGTH(PSRAM);
295+
296+
/* Define start and end of C stack */
297+
__StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y);
298+
__StackBottom = __GcHeapEnd;
299+
PROVIDE(__stack = __StackTop);
300+
301+
/* picolibc and LLVM */
302+
PROVIDE (__heap_start = __end__);
303+
PROVIDE (__heap_end = __HeapLimit);
304+
PROVIDE( __tls_align = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss)) );
305+
PROVIDE( __tls_size_align = (__tls_size + __tls_align - 1) & ~(__tls_align - 1));
306+
PROVIDE( __arm32_tls_tcb_offset = MAX(8, __tls_align) );
307+
308+
/* llvm-libc */
309+
PROVIDE (_end = __end__);
310+
PROVIDE (__llvm_libc_heap_limit = __HeapLimit);
311+
312+
/* Ensure internal RAM didn't overflow */
313+
ASSERT((__GcHeapEnd - __GcHeapStart) > 0, "Main RAM overflow")
314+
315+
/* Check GC heap is at least 128kB */
316+
ASSERT((__PsramGcHeapEnd - __PsramGcHeapStart) > 128*1024, "GcHeap is too small")
317+
318+
ASSERT( __binary_info_header_end - __logical_binary_start <= 1024, "Binary info must be in first 1024 bytes of the binary")
319+
ASSERT( __embedded_block_end - __logical_binary_start <= 4096, "Embedded block must be in first 4096 bytes of the binary")
320+
321+
/* todo assert on extra code */
322+
}

ci/micropython.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export TERM=${TERM:="xterm-256color"}
22

33
MICROPYTHON_FLAVOUR="pimoroni"
4-
MICROPYTHON_VERSION="feature/presto-wireless-2025"
4+
MICROPYTHON_VERSION="feature/presto-wireless-april-2025"
55

66
PIMORONI_PICO_FLAVOUR="pimoroni"
7-
PIMORONI_PICO_VERSION="feature/picovector2-and-layers"
7+
PIMORONI_PICO_VERSION="main"
88

99
PY_DECL_VERSION="v0.0.3"
1010
DIR2UF2_VERSION="v0.0.9"

0 commit comments

Comments
 (0)