10 Commits

Author SHA1 Message Date
Angus Gratton
a792c8f3bf lib/littlefs: Fix string initializer in lfs1.c.
Avoids the new Wunterminated-string-literal when compiled with gcc 15.1.

It would be preferable to just disable this warning, but Clang
-Wunknown-warning-option kicks in even when disabling warnings so this
becomes fiddly to apply.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-20 20:04:43 +02:00
Angus Gratton
f4ff9dac89 py/emitinlinethumb: Refactor string literal as array initializer.
Avoids the new Wunterminated-string-literal when compiled with gcc 15.1.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-20 20:04:31 +02:00
Angus Gratton
fb05f048e9 extmod/moductypes: Refactor string literal as array initializer.
Avoids the new Wunterminated-string-literal when compiled with gcc 15.1.

Also split out the duplicate string to a top-level array (probably the
duplicate string literal was interned, so unlikely to have any impact.)

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-20 20:04:17 +02:00
Angus Gratton
f6a4651af9 rp2: Add temporary workaround for GCC 15.1 build failure.
This is a workaround for this upstream issue:
https://github.com/raspberrypi/pico-sdk/issues/2448

Can be removed after the next pico-sdk update.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-20 20:03:58 +02:00
33dc78967d rp2: Fix stacks for multicore operation
Unfortunately, no way to override this from board config.
2025-05-20 19:57:07 +02:00
074dd7ac06 rp2: Modify linker script to run MP3 decoder from RAM 2025-05-20 19:56:50 +02:00
Damien George
f498a16c7d all: Bump version to 1.25.0.
Signed-off-by: Damien George <damien@micropython.org>
2025-04-16 00:28:30 +10:00
Damien George
9f30627996 lib/micropython-lib: Update submodule to latest.
This brings in:
- requests: do not leak header modifications when calling request
- mip: allow relative URLs in package.json
- mip: make mip.install() skip /rom*/lib directories
- umqtt.simple: restore legacy ssl/ssl_params arguments
- nrf24l01: increase startup delay
- nrf24l01: properly handle timeout
- nrf24l01: optimize status reading
- lora-sx126x: fix invert_iq_rx / invert_iq_tx behaviour
- unix-ffi/json: accept both str and bytes as arg for json.loads()
- unix-ffi/machine: use libc if librt is not present
- requests: use the host in the redirect url, not the one in headers
- aiohttp: fix header case sensitivity
- aiohttp: allow headers to be passed to a WebSocketClient
- usb-device-cdc: optimise writing small data so it doesn't require alloc
- inspect: fix isgenerator logic
- inspect: implement iscoroutinefunction and iscoroutine

Signed-off-by: Damien George <damien@micropython.org>
2025-04-14 14:32:41 +10:00
Damien George
9ee2ef5108 py/emitinlinerv32: Move include of asmrv32.h to within feature guard.
Otherwise, when compiling on 16-bit systems (where `mp_uint_t` is 16 bits
wide) the compiler warns about "left shift count >= width of type", from
the static inline functions that have RV32_ENCODE_TYPE_xxx macros which
do a lot of bit shifting.

Signed-off-by: Damien George <damien@micropython.org>
2025-04-14 11:13:19 +10:00
Damien George
0b3ad98ea9 mimxrt/Makefile: Fix dependencies for generation of flexram_config.s.
Prior to this fix the following would fail:

    $ make build-TEENSY40/flexram_config.s

because it didn't create the build directory before generating the file.

Also, make `hal/resethandler_MIMXRT10xx.S` have an explicit dependency on
`flexram_config.s` rather than the latter just being forced to be built
before everything else.

Signed-off-by: Damien George <damien@micropython.org>
2025-04-10 13:56:51 +10:00
10 changed files with 134 additions and 67 deletions

View File

@@ -277,15 +277,18 @@ static mp_obj_t uctypes_struct_sizeof(size_t n_args, const mp_obj_t *args) {
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(uctypes_struct_sizeof_obj, 1, 2, uctypes_struct_sizeof);
static const char type2char[16] = {
'B', 'b', 'H', 'h', 'I', 'i', 'Q', 'q',
'-', '-', '-', '-', '-', '-', 'f', 'd'
};
static inline mp_obj_t get_unaligned(uint val_type, byte *p, int big_endian) {
char struct_type = big_endian ? '>' : '<';
static const char type2char[16] = "BbHhIiQq------fd";
return mp_binary_get_val(struct_type, type2char[val_type], p, &p);
}
static inline void set_unaligned(uint val_type, byte *p, int big_endian, mp_obj_t val) {
char struct_type = big_endian ? '>' : '<';
static const char type2char[16] = "BbHhIiQq------fd";
mp_binary_set_val(struct_type, type2char[val_type], val, p, &p);
}

View File

@@ -2141,7 +2141,7 @@ int lfs1_format(lfs1_t *lfs1, const struct lfs1_config *cfg) {
.d.elen = sizeof(superblock.d) - sizeof(superblock.d.magic) - 4,
.d.nlen = sizeof(superblock.d.magic),
.d.version = LFS1_DISK_VERSION,
.d.magic = {"littlefs"},
.d.magic = {'l', 'i', 't', 't', 'l', 'e', 'f', 's'},
.d.block_size = lfs1->cfg->block_size,
.d.block_count = lfs1->cfg->block_count,
.d.root = {lfs1->root[0], lfs1->root[1]},

View File

@@ -327,6 +327,8 @@ SRC_SS = \
SRC_S += shared/runtime/gchelper_thumb2.s \
hal/resethandler_MIMXRT10xx.S: $(GEN_FLEXRAM_CONFIG_SRC)
# =============================================================================
# QSTR Sources
# =============================================================================
@@ -521,16 +523,16 @@ $(BUILD)/firmware.uf2: $(BUILD)/firmware.elf
# any of the objects. The normal dependency generation will deal with the
# case when pins.h is modified. But when it doesn't exist, we don't know
# which source files might need it.
$(OBJ): | $(GEN_PINS_HDR) $(GEN_FLEXRAM_CONFIG_SRC)
$(OBJ): | $(GEN_PINS_HDR)
# With conditional pins, we may need to regenerate qstrdefs.h when config
# options change.
$(HEADER_BUILD)/qstrdefs.generated.h: $(BOARD_DIR)/mpconfigboard.h
$(GEN_FLEXRAM_CONFIG_SRC):
$(GEN_FLEXRAM_CONFIG_SRC): $(HEADER_BUILD)
$(ECHO) "Create $@"
$(Q)$(PYTHON) $(MAKE_FLEXRAM_LD) -d $(TOP)/$(MCU_DIR)/$(MCU_SERIES)$(MCU_CORE).h \
-f $(TOP)/$(MCU_DIR)/$(MCU_SERIES)$(MCU_CORE)_features.h -l boards/$(MCU_SERIES).ld -c $(MCU_SERIES) > $(GEN_FLEXRAM_CONFIG_SRC)
-f $(TOP)/$(MCU_DIR)/$(MCU_SERIES)$(MCU_CORE)_features.h -l boards/$(MCU_SERIES).ld -c $(MCU_SERIES) > $@
# Use a pattern rule here so that make will only call make-pins.py once to make
# both pins_gen.c and pins.h

View File

@@ -79,6 +79,9 @@ endif()
list(APPEND GIT_SUBMODULES lib/mbedtls)
list(APPEND GIT_SUBMODULES lib/tinyusb)
# Workaround for pico-sdk host toolchain issue, see directory for details
list(APPEND CMAKE_MODULE_PATH "${MICROPY_PORT_DIR}/tools_patch")
# Include component cmake fragments
include(${MICROPY_DIR}/py/py.cmake)
include(${MICROPY_DIR}/extmod/extmod.cmake)
@@ -556,8 +559,8 @@ target_compile_definitions(${MICROPY_TARGET} PRIVATE
LFS1_NO_MALLOC LFS1_NO_DEBUG LFS1_NO_WARN LFS1_NO_ERROR LFS1_NO_ASSERT
LFS2_NO_MALLOC LFS2_NO_DEBUG LFS2_NO_WARN LFS2_NO_ERROR LFS2_NO_ASSERT
PICO_FLOAT_PROPAGATE_NANS=1
PICO_STACK_SIZE=0x2000
PICO_CORE1_STACK_SIZE=0
PICO_STACK_SIZE=0x1000
PICO_CORE1_STACK_SIZE=0x1000
PICO_MAX_SHARED_IRQ_HANDLERS=8 # we need more than the default
PICO_PROGRAM_NAME="MicroPython"
PICO_NO_PROGRAM_VERSION_STRING=1 # do it ourselves in main.c

View File

@@ -69,7 +69,7 @@ SECTIONS
* FLASH ... we will include any thing excluded here in .data below by default */
*(.init)
/* Change for MicroPython... exclude gc.c, parse.c, vm.c from flash */
*(EXCLUDE_FILE(*libgcc.a: *libc.a: *lib_a-mem*.o *libm.a: *gc.c.obj *vm.c.obj *parse.c.obj) .text*)
*(EXCLUDE_FILE(*libgcc.a: *libc.a: *lib_a-mem*.o *libm.a: *gc.c.obj *vm.c.obj *parse.c.obj *libhelix_mp3.a:) .text*)
*(.fini)
/* Pull all c'tors into .text */
*crtbegin.o(.ctors)
@@ -89,7 +89,7 @@ SECTIONS
} > FLASH
.rodata : {
*(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*)
*(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a: *libhelix_mp3.a:) .rodata*)
. = ALIGN(4);
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*)))
. = ALIGN(4);

View File

@@ -0,0 +1,58 @@
# Finds (or builds) the pioasm executable
#
# This will define the following imported targets
#
# pioasm
#
# This is a temporary patched copy of pico-sdk file Findpioasm.cmake to work around
# a host toolchain issue with GCC 15.1:
# https://github.com/raspberrypi/pico-sdk/issues/2448
if (NOT TARGET pioasm)
# todo we would like to use pckgconfig to look for it first
# see https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
include(ExternalProject)
set(PIOASM_SOURCE_DIR ${PICO_SDK_PATH}/tools/pioasm)
set(PIOASM_BINARY_DIR ${CMAKE_BINARY_DIR}/pioasm)
set(PIOASM_INSTALL_DIR ${CMAKE_BINARY_DIR}/pioasm-install CACHE PATH "Directory where pioasm has been installed" FORCE)
set(pioasmBuild_TARGET pioasmBuild)
set(pioasm_TARGET pioasm)
if (NOT TARGET ${pioasmBuild_TARGET})
pico_message_debug("PIOASM will need to be built")
# message("Adding external project ${pioasmBuild_Target} in ${CMAKE_CURRENT_LIST_DIR}}")
ExternalProject_Add(${pioasmBuild_TARGET}
PREFIX pioasm
SOURCE_DIR ${PIOASM_SOURCE_DIR}
BINARY_DIR ${PIOASM_BINARY_DIR}
INSTALL_DIR ${PIOASM_INSTALL_DIR}
CMAKE_ARGS
"--no-warn-unused-cli"
"-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}"
"-DPIOASM_FLAT_INSTALL=1"
"-DCMAKE_INSTALL_PREFIX=${PIOASM_INSTALL_DIR}"
"-DCMAKE_RULE_MESSAGES=OFF" # quieten the build
"-DCMAKE_INSTALL_MESSAGE=NEVER" # quieten the install
# Toolchain workaround follows
"-DCMAKE_CXX_FLAGS=-include cstdint"
CMAKE_CACHE_ARGS "-DPIOASM_EXTRA_SOURCE_FILES:STRING=${PIOASM_EXTRA_SOURCE_FILES}"
BUILD_ALWAYS 1 # force dependency checking
EXCLUDE_FROM_ALL TRUE
)
endif()
if (CMAKE_HOST_WIN32)
set(pioasm_EXECUTABLE ${PIOASM_INSTALL_DIR}/pioasm/pioasm.exe)
else()
set(pioasm_EXECUTABLE ${PIOASM_INSTALL_DIR}/pioasm/pioasm)
endif()
add_executable(${pioasm_TARGET} IMPORTED GLOBAL)
set_property(TARGET ${pioasm_TARGET} PROPERTY IMPORTED_LOCATION
${pioasm_EXECUTABLE})
add_dependencies(${pioasm_TARGET} ${pioasmBuild_TARGET})
endif()

View File

@@ -30,12 +30,13 @@
#include <stdio.h>
#include <string.h>
#include "py/asmrv32.h"
#include "py/emit.h"
#include "py/misc.h"
#if MICROPY_EMIT_INLINE_RV32
#include "py/asmrv32.h"
typedef enum {
// define rules with a compile function
#define DEF_RULE(rule, comp, kind, ...) PN_##rule,

View File

@@ -150,27 +150,27 @@ typedef struct _reg_name_t { byte reg;
byte name[3];
} reg_name_t;
static const reg_name_t reg_name_table[] = {
{0, "r0\0"},
{1, "r1\0"},
{2, "r2\0"},
{3, "r3\0"},
{4, "r4\0"},
{5, "r5\0"},
{6, "r6\0"},
{7, "r7\0"},
{8, "r8\0"},
{9, "r9\0"},
{10, "r10"},
{11, "r11"},
{12, "r12"},
{13, "r13"},
{14, "r14"},
{15, "r15"},
{10, "sl\0"},
{11, "fp\0"},
{13, "sp\0"},
{14, "lr\0"},
{15, "pc\0"},
{0, {'r', '0' }},
{1, {'r', '1' }},
{2, {'r', '2' }},
{3, {'r', '3' }},
{4, {'r', '4' }},
{5, {'r', '5' }},
{6, {'r', '6' }},
{7, {'r', '7' }},
{8, {'r', '8' }},
{9, {'r', '9' }},
{10, {'r', '1', '0' }},
{11, {'r', '1', '1' }},
{12, {'r', '1', '2' }},
{13, {'r', '1', '3' }},
{14, {'r', '1', '4' }},
{15, {'r', '1', '5' }},
{10, {'s', 'l' }},
{11, {'f', 'p' }},
{13, {'s', 'p' }},
{14, {'l', 'r' }},
{15, {'p', 'c' }},
};
#define MAX_SPECIAL_REGISTER_NAME_LENGTH 7
@@ -368,20 +368,20 @@ typedef struct _cc_name_t { byte cc;
byte name[2];
} cc_name_t;
static const cc_name_t cc_name_table[] = {
{ ASM_THUMB_CC_EQ, "eq" },
{ ASM_THUMB_CC_NE, "ne" },
{ ASM_THUMB_CC_CS, "cs" },
{ ASM_THUMB_CC_CC, "cc" },
{ ASM_THUMB_CC_MI, "mi" },
{ ASM_THUMB_CC_PL, "pl" },
{ ASM_THUMB_CC_VS, "vs" },
{ ASM_THUMB_CC_VC, "vc" },
{ ASM_THUMB_CC_HI, "hi" },
{ ASM_THUMB_CC_LS, "ls" },
{ ASM_THUMB_CC_GE, "ge" },
{ ASM_THUMB_CC_LT, "lt" },
{ ASM_THUMB_CC_GT, "gt" },
{ ASM_THUMB_CC_LE, "le" },
{ ASM_THUMB_CC_EQ, { 'e', 'q' }},
{ ASM_THUMB_CC_NE, { 'n', 'e' }},
{ ASM_THUMB_CC_CS, { 'c', 's' }},
{ ASM_THUMB_CC_CC, { 'c', 'c' }},
{ ASM_THUMB_CC_MI, { 'm', 'i' }},
{ ASM_THUMB_CC_PL, { 'p', 'l' }},
{ ASM_THUMB_CC_VS, { 'v', 's' }},
{ ASM_THUMB_CC_VC, { 'v', 'c' }},
{ ASM_THUMB_CC_HI, { 'h', 'i' }},
{ ASM_THUMB_CC_LS, { 'l', 's' }},
{ ASM_THUMB_CC_GE, { 'g', 'e' }},
{ ASM_THUMB_CC_LT, { 'l', 't' }},
{ ASM_THUMB_CC_GT, { 'g', 't' }},
{ ASM_THUMB_CC_LE, { 'l', 'e' }},
};
typedef struct _format_4_op_t { byte op;
@@ -389,21 +389,21 @@ typedef struct _format_4_op_t { byte op;
} format_4_op_t;
#define X(x) (((x) >> 4) & 0xff) // only need 1 byte to distinguish these ops
static const format_4_op_t format_4_op_table[] = {
{ X(ASM_THUMB_FORMAT_4_EOR), "eor" },
{ X(ASM_THUMB_FORMAT_4_LSL), "lsl" },
{ X(ASM_THUMB_FORMAT_4_LSR), "lsr" },
{ X(ASM_THUMB_FORMAT_4_ASR), "asr" },
{ X(ASM_THUMB_FORMAT_4_ADC), "adc" },
{ X(ASM_THUMB_FORMAT_4_SBC), "sbc" },
{ X(ASM_THUMB_FORMAT_4_ROR), "ror" },
{ X(ASM_THUMB_FORMAT_4_TST), "tst" },
{ X(ASM_THUMB_FORMAT_4_NEG), "neg" },
{ X(ASM_THUMB_FORMAT_4_CMP), "cmp" },
{ X(ASM_THUMB_FORMAT_4_CMN), "cmn" },
{ X(ASM_THUMB_FORMAT_4_ORR), "orr" },
{ X(ASM_THUMB_FORMAT_4_MUL), "mul" },
{ X(ASM_THUMB_FORMAT_4_BIC), "bic" },
{ X(ASM_THUMB_FORMAT_4_MVN), "mvn" },
{ X(ASM_THUMB_FORMAT_4_EOR), {'e', 'o', 'r' }},
{ X(ASM_THUMB_FORMAT_4_LSL), {'l', 's', 'l' }},
{ X(ASM_THUMB_FORMAT_4_LSR), {'l', 's', 'r' }},
{ X(ASM_THUMB_FORMAT_4_ASR), {'a', 's', 'r' }},
{ X(ASM_THUMB_FORMAT_4_ADC), {'a', 'd', 'c' }},
{ X(ASM_THUMB_FORMAT_4_SBC), {'s', 'b', 'c' }},
{ X(ASM_THUMB_FORMAT_4_ROR), {'r', 'o', 'r' }},
{ X(ASM_THUMB_FORMAT_4_TST), {'t', 's', 't' }},
{ X(ASM_THUMB_FORMAT_4_NEG), {'n', 'e', 'g' }},
{ X(ASM_THUMB_FORMAT_4_CMP), {'c', 'm', 'p' }},
{ X(ASM_THUMB_FORMAT_4_CMN), {'c', 'm', 'n' }},
{ X(ASM_THUMB_FORMAT_4_ORR), {'o', 'r', 'r' }},
{ X(ASM_THUMB_FORMAT_4_MUL), {'m', 'u', 'l' }},
{ X(ASM_THUMB_FORMAT_4_BIC), {'b', 'i', 'c' }},
{ X(ASM_THUMB_FORMAT_4_MVN), {'m', 'v', 'n' }},
};
#undef X
@@ -428,10 +428,10 @@ typedef struct _format_vfp_op_t {
char name[3];
} format_vfp_op_t;
static const format_vfp_op_t format_vfp_op_table[] = {
{ 0x30, "add" },
{ 0x34, "sub" },
{ 0x20, "mul" },
{ 0x80, "div" },
{ 0x30, {'a', 'd', 'd' }},
{ 0x34, {'s', 'u', 'b' }},
{ 0x20, {'m', 'u', 'l' }},
{ 0x80, {'d', 'i', 'v' }},
};
// shorthand alias for whether we allow ARMv7-M instructions

View File

@@ -32,7 +32,7 @@
#define MICROPY_VERSION_MAJOR 1
#define MICROPY_VERSION_MINOR 25
#define MICROPY_VERSION_MICRO 0
#define MICROPY_VERSION_PRERELEASE 1
#define MICROPY_VERSION_PRERELEASE 0
// Combined version as a 32-bit number for convenience to allow version
// comparison. Doesn't include prerelease state.