diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 9af82b2..44069a3 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -7,8 +7,8 @@ on: types: [created] env: - MICROPYTHON_VERSION: b88262ce96c3433a02b2c8d984ba01e071b60c1f - PIMORONI_PICO_VERSION: 7678ba5da966c3d8b7238e2b2f4e604ffe377dd6 + MICROPYTHON_VERSION: 17d82344581ad3a76033fae54c5d3304e17f185f + PIMORONI_PICO_VERSION: 49a5d4292586f5851978f6f4a2f6b3214fb379ce WORKFLOW_VERSION: v2 jobs: @@ -30,7 +30,7 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' uses: actions/checkout@v4 with: - repository: pimoroni/micropython + repository: micropython/micropython ref: ${{env.MICROPYTHON_VERSION}} submodules: false # MicroPython submodules are hideously broken path: micropython @@ -41,9 +41,12 @@ jobs: working-directory: micropython run: | git submodule update --init lib/pico-sdk + git submodule update --init lib/cyw43-driver + git submodule update --init lib/lwip git submodule update --init lib/mbedtls git submodule update --init lib/micropython-lib git submodule update --init lib/tinyusb + git submodule update --init lib/btstack - name: Build mpy-cross if: steps.cache.outputs.cache-hit != 'true' @@ -61,9 +64,6 @@ jobs: - name: Yukon shortname: yukon board: PIMORONI_YUKON - # 0x10000000 + (16*1024*1024) - (15*1024*1024) - dir2uf2_fs_start: 269484032 - dir2uf2_fs_size: 15728640 env: RELEASE_FILE: pimoroni-${{matrix.shortname}}-${{github.event.release.tag_name || github.sha}}-micropython @@ -104,11 +104,18 @@ jobs: submodules: true path: pimoroni-pico + - name: "Py_Decl: Checkout py_decl" + uses: actions/checkout@v4 + with: + repository: gadgetoid/py_decl + ref: v0.0.1 + path: py_decl + # Check out dir2u2f - uses: actions/checkout@v4 with: repository: gadgetoid/dir2uf2 - ref: v0.0.1 + ref: v0.0.6 path: dir2uf2 # HACK: Patch startup overclock into Pico SDK @@ -123,16 +130,19 @@ jobs: working-directory: micropython run: git apply "${{env.FIRMWARE_DIR}}/micropython_nano_specs.patch" - - name: "HACK: Yukon Reset Patch" + - name: "HACK: Yukon Expander Patch" shell: bash working-directory: micropython - run: git apply "${{env.FIRMWARE_DIR}}/yukon_reset.patch" + run: git apply "${{env.FIRMWARE_DIR}}/yukon_expander.patch" - # Install apt packages - - name: Install CCache & Compiler - shell: bash - run: - sudo apt update && sudo apt install ccache gcc-arm-none-eabi + - name: Install Arm GNU Toolchain (arm-none-eabi-gcc) + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '9-2020-q2' + + - name: Install CCache + run: | + sudo apt update && sudo apt install ccache # Build firmware - name: Configure MicroPython @@ -155,11 +165,16 @@ jobs: run: | cp firmware.uf2 ${{env.RELEASE_FILE}}.uf2 + - name: "Py_Decl: Verify UF2" + shell: bash + run: | + python3 py_decl/py_decl.py --to-json --verify micropython/ports/rp2/build/${{env.RELEASE_FILE}}.uf2 + - name: Append Filesystem shell: bash run: | - python3 -m pip install littlefs-python==0.4.0 - ./dir2uf2/dir2uf2 --verbose --fs-start ${{matrix.dir2uf2_fs_start}} --fs-size ${{matrix.dir2uf2_fs_size}} --append-to micropython/ports/rp2/build/${{env.RELEASE_FILE}}.uf2 --manifest ${{env.BOARD_DIR}}/uf2-manifest.txt --filename ${{env.FILESYSTEM_SUFFIX}}.uf2 ${{env.FILESYSTEM_DIR}}/ + python3 -m pip install littlefs-python==0.12.0 + ./dir2uf2/dir2uf2 --fs-compact --append-to micropython/ports/rp2/build/${{env.RELEASE_FILE}}.uf2 --manifest ${{env.BOARD_DIR}}/uf2-manifest.txt --filename ${{env.FILESYSTEM_SUFFIX}}.uf2 ${{env.FILESYSTEM_DIR}}/ - name: Store .uf2 as artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/python-linting.yml b/.github/workflows/python-linting.yml index 666641d..0f97d32 100644 --- a/.github/workflows/python-linting.yml +++ b/.github/workflows/python-linting.yml @@ -12,14 +12,14 @@ jobs: - uses: actions/checkout@v4 - name: Install Python Deps - run: python3 -m pip install ruff + run: python3 -m pip install flake8 - name: Lint Yukon Examples shell: bash run: | - python3 -m ruff --show-source --ignore E501 examples/ + python3 -m flake8 --show-source --ignore E501,E201,E241,E222,E116,E266 examples/ - name: Lint Yukon Python Libraries shell: bash run: | - python3 -m ruff --show-source --ignore E501 lib/ \ No newline at end of file + python3 -m flake8 --show-source --ignore E501,E201,E241,E222,E116,E266 lib/ \ No newline at end of file diff --git a/firmware/PIMORONI_YUKON/mpconfigboard.h b/firmware/PIMORONI_YUKON/mpconfigboard.h index 0d02b72..5f46555 100644 --- a/firmware/PIMORONI_YUKON/mpconfigboard.h +++ b/firmware/PIMORONI_YUKON/mpconfigboard.h @@ -21,5 +21,5 @@ #define MICROPY_BOARD_EARLY_INIT board_init void board_init(void); -#define MICROPY_BOARD_EARLY_RESET board_reset +#define MICROPY_BOARD_START_SOFT_RESET board_reset void board_reset(void); \ No newline at end of file diff --git a/firmware/drivers/tca9555/machine_pin_tca9555.c b/firmware/drivers/tca9555/machine_pin_tca9555.c index a1e58b8..2438603 100644 --- a/firmware/drivers/tca9555/machine_pin_tca9555.c +++ b/firmware/drivers/tca9555/machine_pin_tca9555.c @@ -38,7 +38,7 @@ void machine_pin_ext_init(void) { // Read the state of each IO expander pin, as some are initialised as outputs - const mp_map_t *named_map = &pin_board_pins_locals_dict.map; + const mp_map_t *named_map = &machine_pin_board_pins_locals_dict.map; for (uint i = 0; i < named_map->used; i++) { machine_pin_obj_t *pin = (machine_pin_obj_t *)named_map->table[i].value; if(pin->is_ext) { diff --git a/firmware/micropython_nano_specs.patch b/firmware/micropython_nano_specs.patch index 098c0bf..5ae938b 100644 --- a/firmware/micropython_nano_specs.patch +++ b/firmware/micropython_nano_specs.patch @@ -1,11 +1,11 @@ diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt -index 094031c6852a..5f268414c08f 100644 +index fcc435b7b..efabcb3a3 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt -@@ -374,6 +374,15 @@ target_compile_options(${MICROPY_TARGET} PRIVATE - target_link_options(${MICROPY_TARGET} PRIVATE - -Wl,--defsym=__micropy_c_heap_size__=${MICROPY_C_HEAP_SIZE} +@@ -464,6 +464,16 @@ set_source_files_properties( + COMPILE_OPTIONS "-O2" ) + +# Do not include stack unwinding & exception handling for C++ user modules +target_compile_definitions(usermod INTERFACE PICO_CXX_ENABLE_EXCEPTIONS=0) +target_compile_options(usermod INTERFACE $<$: @@ -15,6 +15,7 @@ index 094031c6852a..5f268414c08f 100644 + -fno-use-cxa-atexit +>) +target_link_options(usermod INTERFACE -specs=nano.specs) - ++ set_source_files_properties( ${PICO_SDK_PATH}/src/rp2_common/pico_double/double_math.c + ${PICO_SDK_PATH}/src/rp2_common/pico_float/float_math.c diff --git a/firmware/modules/tca9555/tca.c b/firmware/modules/tca9555/tca.c index acc517f..424c874 100644 --- a/firmware/modules/tca9555/tca.c +++ b/firmware/modules/tca9555/tca.c @@ -2,9 +2,10 @@ #include "py/runtime.h" #include "machine_pin.h" +#include "extmod/modmachine.h" #include "tca9555.h" -STATIC mp_obj_t tca_pin_get_number(mp_obj_t pin_obj) { +static mp_obj_t tca_pin_get_number(mp_obj_t pin_obj) { if (!mp_obj_is_type(pin_obj, &machine_pin_type)) { mp_raise_msg_varg(&mp_type_TypeError, MP_ERROR_TEXT("pin must be of type %q, not %q"), machine_pin_type.name, mp_obj_get_type(pin_obj)->name); } @@ -17,9 +18,9 @@ STATIC mp_obj_t tca_pin_get_number(mp_obj_t pin_obj) { uint8_t tca_gpio = pin->id; return mp_obj_new_int(tca_gpio % TCA9555_GPIO_COUNT); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_pin_get_number_obj, tca_pin_get_number); +static MP_DEFINE_CONST_FUN_OBJ_1(tca_pin_get_number_obj, tca_pin_get_number); -STATIC mp_obj_t tca_pin_get_chip(mp_obj_t pin_obj) { +static mp_obj_t tca_pin_get_chip(mp_obj_t pin_obj) { if (!mp_obj_is_type(pin_obj, &machine_pin_type)) { mp_raise_msg_varg(&mp_type_TypeError, MP_ERROR_TEXT("pin must be of type %q, not %q"), machine_pin_type.name, mp_obj_get_type(pin_obj)->name); } @@ -32,9 +33,9 @@ STATIC mp_obj_t tca_pin_get_chip(mp_obj_t pin_obj) { uint8_t tca_gpio = pin->id; return mp_obj_new_int(CHIP_FROM_GPIO(tca_gpio)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_pin_get_chip_obj, tca_pin_get_chip); +static MP_DEFINE_CONST_FUN_OBJ_1(tca_pin_get_chip_obj, tca_pin_get_chip); -STATIC mp_obj_t tca_pin_change_output_mask(mp_obj_t chip_obj, mp_obj_t mask_obj, mp_obj_t state_obj) { +static mp_obj_t tca_pin_change_output_mask(mp_obj_t chip_obj, mp_obj_t mask_obj, mp_obj_t state_obj) { int chip = mp_obj_get_int(chip_obj); int mask = mp_obj_get_int(mask_obj); int state = mp_obj_get_int(state_obj); @@ -52,9 +53,9 @@ STATIC mp_obj_t tca_pin_change_output_mask(mp_obj_t chip_obj, mp_obj_t mask_obj, return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(tca_pin_change_output_mask_obj, tca_pin_change_output_mask); +static MP_DEFINE_CONST_FUN_OBJ_3(tca_pin_change_output_mask_obj, tca_pin_change_output_mask); -STATIC mp_obj_t tca_pin_change_config_mask(mp_obj_t chip_obj, mp_obj_t mask_obj, mp_obj_t state_obj) { +static mp_obj_t tca_pin_change_config_mask(mp_obj_t chip_obj, mp_obj_t mask_obj, mp_obj_t state_obj) { int chip = mp_obj_get_int(chip_obj); int mask = mp_obj_get_int(mask_obj); int state = mp_obj_get_int(state_obj); @@ -72,9 +73,9 @@ STATIC mp_obj_t tca_pin_change_config_mask(mp_obj_t chip_obj, mp_obj_t mask_obj, return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(tca_pin_change_config_mask_obj, tca_pin_change_config_mask); +static MP_DEFINE_CONST_FUN_OBJ_3(tca_pin_change_config_mask_obj, tca_pin_change_config_mask); -STATIC mp_obj_t tca_pin_change_polarity_mask(mp_obj_t chip_obj, mp_obj_t mask_obj, mp_obj_t state_obj) { +static mp_obj_t tca_pin_change_polarity_mask(mp_obj_t chip_obj, mp_obj_t mask_obj, mp_obj_t state_obj) { int chip = mp_obj_get_int(chip_obj); int mask = mp_obj_get_int(mask_obj); int state = mp_obj_get_int(state_obj); @@ -92,10 +93,10 @@ STATIC mp_obj_t tca_pin_change_polarity_mask(mp_obj_t chip_obj, mp_obj_t mask_ob return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(tca_pin_change_polarity_mask_obj, tca_pin_change_polarity_mask); +static MP_DEFINE_CONST_FUN_OBJ_3(tca_pin_change_polarity_mask_obj, tca_pin_change_polarity_mask); #if TCA9555_READ_INTERNALS -STATIC mp_obj_t tca_port_read_input_state(mp_obj_t chip_obj) { +static mp_obj_t tca_port_read_input_state(mp_obj_t chip_obj) { int chip = mp_obj_get_int(chip_obj); if (chip < 0 || chip >= TCA9555_CHIP_COUNT) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("chip can only be 0 to %d"), TCA9555_CHIP_COUNT - 1); @@ -103,9 +104,9 @@ STATIC mp_obj_t tca_port_read_input_state(mp_obj_t chip_obj) { return mp_obj_new_int(tca_get_input_port(chip)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_port_read_input_state_obj, tca_port_read_input_state); +static MP_DEFINE_CONST_FUN_OBJ_1(tca_port_read_input_state_obj, tca_port_read_input_state); -STATIC mp_obj_t tca_port_read_output_state(mp_obj_t chip_obj) { +static mp_obj_t tca_port_read_output_state(mp_obj_t chip_obj) { int chip = mp_obj_get_int(chip_obj); if (chip < 0 || chip >= TCA9555_CHIP_COUNT) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("chip can only be 0 to %d"), TCA9555_CHIP_COUNT - 1); @@ -113,9 +114,9 @@ STATIC mp_obj_t tca_port_read_output_state(mp_obj_t chip_obj) { return mp_obj_new_int(tca_get_output_port(chip)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_port_read_output_state_obj, tca_port_read_output_state); +static MP_DEFINE_CONST_FUN_OBJ_1(tca_port_read_output_state_obj, tca_port_read_output_state); -STATIC mp_obj_t tca_port_read_config_state(mp_obj_t chip_obj) { +static mp_obj_t tca_port_read_config_state(mp_obj_t chip_obj) { int chip = mp_obj_get_int(chip_obj); if (chip < 0 || chip >= TCA9555_CHIP_COUNT) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("chip can only be 0 to %d"), TCA9555_CHIP_COUNT - 1); @@ -123,9 +124,9 @@ STATIC mp_obj_t tca_port_read_config_state(mp_obj_t chip_obj) { return mp_obj_new_int(tca_get_config_port(chip)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_port_read_config_state_obj, tca_port_read_config_state); +static MP_DEFINE_CONST_FUN_OBJ_1(tca_port_read_config_state_obj, tca_port_read_config_state); -STATIC mp_obj_t tca_port_read_polarity_state(mp_obj_t chip_obj) { +static mp_obj_t tca_port_read_polarity_state(mp_obj_t chip_obj) { int chip = mp_obj_get_int(chip_obj); if (chip < 0 || chip >= TCA9555_CHIP_COUNT) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("chip can only be 0 to %d"), TCA9555_CHIP_COUNT - 1); @@ -133,10 +134,10 @@ STATIC mp_obj_t tca_port_read_polarity_state(mp_obj_t chip_obj) { return mp_obj_new_int(tca_get_polarity_port(chip)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_port_read_polarity_state_obj, tca_port_read_polarity_state); +static MP_DEFINE_CONST_FUN_OBJ_1(tca_port_read_polarity_state_obj, tca_port_read_polarity_state); #if TCA9555_LOCAL_MEMORY -STATIC mp_obj_t tca_port_stored_output_state(mp_obj_t chip_obj) { +static mp_obj_t tca_port_stored_output_state(mp_obj_t chip_obj) { int chip = mp_obj_get_int(chip_obj); if (chip < 0 || chip >= TCA9555_CHIP_COUNT) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("chip can only be 0 to %d"), TCA9555_CHIP_COUNT - 1); @@ -144,9 +145,9 @@ STATIC mp_obj_t tca_port_stored_output_state(mp_obj_t chip_obj) { return mp_obj_new_int((tca9555_output_state[HIGH_BYTE(chip)] << 8) | tca9555_output_state[LOW_BYTE(chip)]); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_port_stored_output_state_obj, tca_port_stored_output_state); +static MP_DEFINE_CONST_FUN_OBJ_1(tca_port_stored_output_state_obj, tca_port_stored_output_state); -STATIC mp_obj_t tca_port_stored_config_state(mp_obj_t chip_obj) { +static mp_obj_t tca_port_stored_config_state(mp_obj_t chip_obj) { int chip = mp_obj_get_int(chip_obj); if (chip < 0 || chip >= TCA9555_CHIP_COUNT) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("chip can only be 0 to %d"), TCA9555_CHIP_COUNT - 1); @@ -154,9 +155,9 @@ STATIC mp_obj_t tca_port_stored_config_state(mp_obj_t chip_obj) { return mp_obj_new_int((tca9555_config_state[HIGH_BYTE(chip)] << 8) | tca9555_config_state[LOW_BYTE(chip)]); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_port_stored_config_state_obj, tca_port_stored_config_state); +static MP_DEFINE_CONST_FUN_OBJ_1(tca_port_stored_config_state_obj, tca_port_stored_config_state); -STATIC mp_obj_t tca_port_stored_polarity_state(mp_obj_t chip_obj) { +static mp_obj_t tca_port_stored_polarity_state(mp_obj_t chip_obj) { int chip = mp_obj_get_int(chip_obj); if (chip < 0 || chip >= TCA9555_CHIP_COUNT) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("chip can only be 0 to %d"), TCA9555_CHIP_COUNT - 1); @@ -164,7 +165,7 @@ STATIC mp_obj_t tca_port_stored_polarity_state(mp_obj_t chip_obj) { return mp_obj_new_int((tca9555_polarity_state[HIGH_BYTE(chip)] << 8) | tca9555_polarity_state[LOW_BYTE(chip)]); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_port_stored_polarity_state_obj, tca_port_stored_polarity_state); +static MP_DEFINE_CONST_FUN_OBJ_1(tca_port_stored_polarity_state_obj, tca_port_stored_polarity_state); #endif #endif @@ -173,7 +174,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(tca_port_stored_polarity_state_obj, tca_port_st // and the MicroPython object reference. // All identifiers and strings are written as MP_QSTR_xxx and will be // optimized to word-sized integers by the build system (interned strings). -STATIC const mp_rom_map_elem_t tca_module_globals_table[] = { +static const mp_rom_map_elem_t tca_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_tca) }, { MP_ROM_QSTR(MP_QSTR_get_number), &tca_pin_get_number_obj }, { MP_ROM_QSTR(MP_QSTR_get_chip), &tca_pin_get_chip_obj }, @@ -192,7 +193,7 @@ STATIC const mp_rom_map_elem_t tca_module_globals_table[] = { #endif #endif }; -STATIC MP_DEFINE_CONST_DICT(tca_module_globals, tca_module_globals_table); +static MP_DEFINE_CONST_DICT(tca_module_globals, tca_module_globals_table); // Define module object. const mp_obj_module_t tca_cmodule = { diff --git a/firmware/yukon_expander.patch b/firmware/yukon_expander.patch new file mode 100644 index 0000000..9cd91ec --- /dev/null +++ b/firmware/yukon_expander.patch @@ -0,0 +1,30 @@ +diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt +index 19c7178fc..4f98e904b 100644 +--- a/ports/rp2/CMakeLists.txt ++++ b/ports/rp2/CMakeLists.txt +@@ -335,6 +335,25 @@ target_include_directories(${MICROPY_TARGET} PRIVATE + ${MICROPY_DIR}/shared/tinyusb/ + ) + ++if (MICROPY_TCA9555_DIR) ++ target_compile_definitions(${MICROPY_TARGET} PRIVATE ++ MICROPY_PY_TCA9555=1 ++ MICROPY_HW_PIN_EXT_COUNT=32 ++ ) ++ ++ list(APPEND MICROPY_SOURCE_PORT ++ ${MICROPY_TCA9555_DIR}/machine_pin_tca9555.c ++ ) ++ ++ list(APPEND MICROPY_SOURCE_DRIVERS ++ ${MICROPY_TCA9555_DIR}/tca9555.c ++ ) ++ ++ target_include_directories(${MICROPY_TARGET} PRIVATE ++ ${MICROPY_TCA9555_DIR} ++ ) ++endif() ++ + if (MICROPY_PY_NETWORK_CYW43) + string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/cyw43-driver) + if((NOT (${ECHO_SUBMODULES})) AND NOT EXISTS ${MICROPY_DIR}/lib/cyw43-driver/src/cyw43.h) diff --git a/firmware/yukon_reset.patch b/firmware/yukon_reset.patch deleted file mode 100644 index 17a1178..0000000 --- a/firmware/yukon_reset.patch +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt -index 87bc91b82..bf736ff91 100644 ---- a/ports/rp2/CMakeLists.txt -+++ b/ports/rp2/CMakeLists.txt -@@ -281,6 +281,25 @@ target_include_directories(${MICROPY_TARGET} PRIVATE - ${MICROPY_DIR}/shared/tinyusb/ - ) - -+if (MICROPY_TCA9555_DIR) -+ target_compile_definitions(${MICROPY_TARGET} PRIVATE -+ MICROPY_PY_TCA9555=1 -+ MICROPY_HW_PIN_EXT_COUNT=32 -+ ) -+ -+ list(APPEND MICROPY_SOURCE_PORT -+ ${MICROPY_TCA9555_DIR}/machine_pin_tca9555.c -+ ) -+ -+ list(APPEND MICROPY_SOURCE_DRIVERS -+ ${MICROPY_TCA9555_DIR}/tca9555.c -+ ) -+ -+ target_include_directories(${MICROPY_TARGET} PRIVATE -+ ${MICROPY_TCA9555_DIR} -+ ) -+endif() -+ - if (MICROPY_PY_NETWORK_CYW43) - string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/cyw43-driver) - if((NOT (${ECHO_SUBMODULES})) AND NOT EXISTS ${MICROPY_DIR}/lib/cyw43-driver/src/cyw43.h) -@@ -498,6 +527,11 @@ target_sources(${MICROPY_TARGET} PRIVATE - ${GEN_PINS_HDR} - ) - -+# Temporary hack to get build finding correct CSV file -+pico_find_in_paths(GEN_PINS_BOARD_CSV PICO_BOARD_HEADER_DIRS pins.csv) -+message(WARNING "${GEN_PINS_BOARD_CSV}") -+set(GEN_PINS_CSV_ARG --board "${GEN_PINS_BOARD_CSV}") -+ - # Generate pins - add_custom_command( - OUTPUT ${GEN_PINS_HDR} ${GEN_PINS_SRC} ${GEN_PINS_QSTR} -diff --git a/ports/rp2/main.c b/ports/rp2/main.c -index bb5ecc68d..9890bf580 100644 ---- a/ports/rp2/main.c -+++ b/ports/rp2/main.c -@@ -150,6 +150,7 @@ int main(int argc, char **argv) { - // Hook for setting up anything that can wait until after other hardware features are initialised - MICROPY_BOARD_EARLY_INIT(); - -+ bool run_main = true; - for (;;) { - - // Initialise MicroPython runtime. -@@ -182,25 +183,34 @@ int main(int argc, char **argv) { - pyexec_frozen_module("_boot.py", false); - #endif - -- // Execute user scripts. -- int ret = pyexec_file_if_exists("boot.py"); -- if (ret & PYEXEC_FORCED_EXIT) { -- goto soft_reset_exit; -- } -- if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) { -- ret = pyexec_file_if_exists("main.py"); -+ if (run_main) { -+ // Execute user scripts. -+ int ret = pyexec_file_if_exists("boot.py"); - if (ret & PYEXEC_FORCED_EXIT) { -+ run_main = !(ret & PYEXEC_SKIP_USER_CODE); - goto soft_reset_exit; - } -+ if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) { -+ ret = pyexec_file_if_exists("main.py"); -+ if (ret & PYEXEC_FORCED_EXIT) { -+ run_main = !(ret & PYEXEC_SKIP_USER_CODE); -+ goto soft_reset_exit; -+ } -+ } - } -+ run_main = true; - - for (;;) { - if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { -- if (pyexec_raw_repl() != 0) { -+ int ret = pyexec_raw_repl(); -+ if (ret != 0) { -+ run_main = !(ret & PYEXEC_SKIP_USER_CODE); - break; - } - } else { -- if (pyexec_friendly_repl() != 0) { -+ int ret = pyexec_friendly_repl(); -+ if (ret != 0) { -+ run_main = !(ret & PYEXEC_SKIP_USER_CODE); - break; - } - } -diff --git a/shared/runtime/pyexec.h b/shared/runtime/pyexec.h -index 64c5ef943..6a2cd8b8f 100644 ---- a/shared/runtime/pyexec.h -+++ b/shared/runtime/pyexec.h -@@ -41,6 +41,7 @@ extern pyexec_mode_kind_t pyexec_mode_kind; - extern int pyexec_system_exit; - - #define PYEXEC_FORCED_EXIT (0x100) -+#define PYEXEC_SKIP_USER_CODE (0x200) - - int pyexec_raw_repl(void); - int pyexec_friendly_repl(void); diff --git a/lib/pimoroni_yukon/__init__.py b/lib/pimoroni_yukon/__init__.py index 2770b23..1e41bdb 100644 --- a/lib/pimoroni_yukon/__init__.py +++ b/lib/pimoroni_yukon/__init__.py @@ -15,7 +15,7 @@ from ucollections import OrderedDict, namedtuple -YUKON_VERSION = "1.0.1" +YUKON_VERSION = "1.0.2" Slot = namedtuple("Slot", ("ID", "FAST1",