Merge branch 'adafruit:main' into pycubed_v05c

This commit is contained in:
Max Holliday 2021-09-08 19:37:06 -06:00 committed by GitHub
commit 5d29caf499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 274 additions and 467 deletions

View File

@ -15,6 +15,10 @@ on:
jobs:
test:
runs-on: ubuntu-20.04
outputs:
arm-boards: ${{ steps.set-matrix.outputs.arm-boards }}
riscv-boards: ${{ steps.set-matrix.outputs.riscv-boards }}
xtensa-boards: ${{ steps.set-matrix.outputs.xtensa-boards }}
steps:
- name: Dump GitHub context
env:
@ -43,9 +47,6 @@ jobs:
run: |
gcc --version
python3 --version
- name: New boards check
run: python3 -u ci_new_boards_check.py
working-directory: tools
- name: Duplicate USB VID/PID Check
run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid
- name: Build and Validate Stubs
@ -139,6 +140,29 @@ jobs:
# setup.py sdist was run by 'make stubs'
[ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi"
[ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/*
- uses: dorny/paths-filter@v2
id: filter
with:
# Enable listing of files matching each filter.
# Paths to files will be available in `${FILTER_NAME}_files` output variable.
# Paths will be formatted as JSON array
list-files: json
# Compare against this branch. (Ignored for PRs.)
base: ${{ github.ref }}
# In this example all changed files are passed to the following action to do
# some custom processing.
filters: |
changed:
- '**'
- name: "Set boards to build"
id: set-matrix
working-directory: tools
env:
CHANGED_FILES: ${{ steps.filter.outputs.changed_files }}
run: |
python3 -u ci_changed_board_list.py
mpy-cross-mac:
runs-on: macos-10.15
@ -203,205 +227,7 @@ jobs:
strategy:
fail-fast: false
matrix:
board:
- "8086_commander"
- "ADM_B_NRF52840_1"
- "TG-Watch"
- "adafruit_feather_rp2040"
- "adafruit_itsybitsy_rp2040"
- "adafruit_led_glasses_nrf52840"
- "adafruit_macropad_rp2040"
- "adafruit_neokey_trinkey_m0"
- "adafruit_proxlight_trinkey_m0"
- "adafruit_qt2040_trinkey"
- "adafruit_qtpy_rp2040"
- "adafruit_rotary_trinkey_m0"
- "adafruit_slide_trinkey_m0"
- "aloriumtech_evo_m51"
- "aramcon2_badge"
- "aramcon_badge_2019"
- "arduino_mkr1300"
- "arduino_mkrzero"
- "arduino_nano_33_ble"
- "arduino_nano_33_iot"
- "arduino_nano_rp2040_connect"
- "arduino_zero"
- "bast_pro_mini_m0"
- "bastble"
- "bdmicro_vina_d21"
- "bdmicro_vina_d51"
- "bdmicro_vina_d51_pcb7"
- "bless_dev_board_multi_sensor"
- "blm_badge"
- "bluemicro840"
- "capablerobot_usbhub"
- "catwan_usbstick"
- "circuitbrains_basic_m0"
- "circuitbrains_deluxe_m4"
- "circuitplayground_bluefruit"
- "circuitplayground_express"
- "circuitplayground_express_crickit"
- "circuitplayground_express_displayio"
- "clue_nrf52840_express"
- "cp32-m4"
- "cp_sapling_m0"
- "cp_sapling_m0_revb"
- "cp_sapling_m0_spiflash"
- "cytron_maker_pi_rp2040"
- "datalore_ip_m4"
- "datum_distance"
- "datum_imu"
- "datum_light"
- "datum_weather"
- "dynalora_usb"
- "dynossat_edu_eps"
- "dynossat_edu_obc"
- "electronut_labs_blip"
- "electronut_labs_papyr"
- "escornabot_makech"
- "espruino_pico"
- "espruino_wifi"
- "feather_bluefruit_sense"
- "feather_m0_adalogger"
- "feather_m0_basic"
- "feather_m0_express"
- "feather_m0_express_crickit"
- "feather_m0_rfm69"
- "feather_m0_rfm9x"
- "feather_m0_supersized"
- "feather_m4_can"
- "feather_m4_express"
- "feather_m7_1011"
- "feather_mimxrt1011"
- "feather_mimxrt1062"
- "feather_nrf52840_express"
- "feather_stm32f405_express"
- "fluff_m0"
- "gemma_m0"
- "grandcentral_m4_express"
- "hallowing_m0_express"
- "hallowing_m4_express"
- "hiibot_bluefi"
- "huntercat_nfc"
- "ikigaisense_vita"
- "imxrt1010_evk"
- "imxrt1020_evk"
- "imxrt1060_evk"
- "itsybitsy_m0_express"
- "itsybitsy_m4_express"
- "itsybitsy_nrf52840_express"
- "jpconstantineau_encoderpad_rp2040"
- "kicksat-sprite"
- "loc_ber_m4_base_board"
- "makerdiary_m60_keyboard"
- "makerdiary_nrf52840_m2_devkit"
- "makerdiary_nrf52840_mdk"
- "makerdiary_nrf52840_mdk_usb_dongle"
- "matrixportal_m4"
- "meowbit_v121"
- "meowmeow"
- "metro_m0_express"
- "metro_m4_airlift_lite"
- "metro_m4_express"
- "metro_m7_1011"
- "metro_nrf52840_express"
- "microbit_v2"
- "mini_sam_m4"
- "monster_m4sk"
- "ndgarage_ndbit6"
- "ndgarage_ndbit6_v2"
- "neopixel_trinkey_m0"
- "nfc_copy_cat"
- "nice_nano"
- "nucleo_f746zg"
- "nucleo_f767zi"
- "nucleo_h743zi_2"
- "ohs2020_badge"
- "openbook_m4"
- "openmv_h7"
- "particle_argon"
- "particle_boron"
- "particle_xenon"
- "pca10056"
- "pca10059"
- "pca10100"
- "pewpew10"
- "pewpew_m4"
- "picoplanet"
- "pimoroni_interstate75"
- "pimoroni_keybow2040"
- "pimoroni_pga2040"
- "pimoroni_picolipo_16mb"
- "pimoroni_picolipo_4mb"
- "pimoroni_picosystem"
- "pimoroni_plasma2040"
- "pimoroni_tiny2040"
- "pitaya_go"
- "pyb_nano_v2"
- "pybadge"
- "pyboard_v11"
- "pycubed"
- "pycubed_mram"
- "pygamer"
- "pyportal"
- "pyportal_titano"
- "pyruler"
- "qtpy_m0"
- "qtpy_m0_haxpress"
- "raspberry_pi_pico"
- "raytac_mdbt50q-db-40"
- "raytac_mdbt50q-rx"
- "robohatmm1_m4"
- "sam32"
- "same54_xplained"
- "seeeduino_wio_terminal"
- "seeeduino_xiao"
- "sensebox_mcu"
- "serpente"
- "shirtty"
- "silicognition-m4-shim"
- "simmel"
- "snekboard"
- "sparkfun_lumidrive"
- "sparkfun_micromod_rp2040"
- "sparkfun_nrf52840_micromod"
- "sparkfun_nrf52840_mini"
- "sparkfun_pro_micro_rp2040"
- "sparkfun_qwiic_micro_no_flash"
- "sparkfun_qwiic_micro_with_flash"
- "sparkfun_redboard_turbo"
- "sparkfun_samd21_dev"
- "sparkfun_samd21_mini"
- "sparkfun_samd51_micromod"
- "sparkfun_samd51_thing_plus"
- "sparkfun_stm32f405_micromod"
- "sparkfun_thing_plus_rp2040"
- "spresense"
- "stackrduino_m0_pro"
- "stm32f411ce_blackpill"
- "stm32f411ce_blackpill_with_flash"
- "stm32f411ve_discovery"
- "stm32f412zg_discovery"
- "stm32f4_discovery"
- "stm32f746g_discovery"
- "stringcar_m0_express"
- "teensy40"
- "teensy41"
- "teknikio_bluebird"
- "thunderpack_v11"
- "thunderpack_v12"
- "tinkeringtech_scoutmakes_azul"
- "trellis_m4_express"
- "trinket_m0"
- "trinket_m0_haxpress"
- "uartlogger2"
- "uchip"
- "ugame10"
- "warmbit_bluepixel"
- "winterbloom_big_honking_button"
- "winterbloom_sol"
- "xinabox_cc03"
- "xinabox_cs11"
board: ${{ fromJSON(needs.test.outputs.arm-boards) }}
steps:
- name: Set up Python 3.8
@ -451,8 +277,7 @@ jobs:
strategy:
fail-fast: false
matrix:
board:
- "fomu"
board: ${{ fromJSON(needs.test.outputs.riscv-boards) }}
steps:
- name: Set up Python 3.8
@ -501,41 +326,7 @@ jobs:
strategy:
fail-fast: false
matrix:
board:
- "adafruit_feather_esp32s2_nopsram"
- "adafruit_feather_esp32s2_tftback_nopsram"
- "adafruit_funhouse"
- "adafruit_magtag_2.9_grayscale"
- "adafruit_metro_esp32s2"
- "ai_thinker_esp_12k_nodemcu"
- "artisense_rd00"
- "atmegazero_esp32s2"
- "crumpspace_crumps2"
- "electroniccats_bastwifi"
- "espressif_hmi_devkit_1"
- "espressif_kaluga_1"
- "espressif_kaluga_1.3"
- "espressif_saola_1_wroom"
- "espressif_saola_1_wrover"
- "franzininho_wifi_wroom"
- "franzininho_wifi_wrover"
- "gravitech_cucumber_m"
- "gravitech_cucumber_ms"
- "gravitech_cucumber_r"
- "gravitech_cucumber_rs"
- "lilygo_ttgo_t8_s2_st7789"
- "lolin_s2_mini"
- "microdev_micro_s2"
- "morpheans_morphesp-240"
- "muselab_nanoesp32_s2_wroom"
- "muselab_nanoesp32_s2_wrover"
- "odt_pixelwing_esp32_s2"
- "targett_module_clip_wroom"
- "targett_module_clip_wrover"
- "unexpectedmaker_feathers2"
- "unexpectedmaker_feathers2_neo"
- "unexpectedmaker_feathers2_prerelease"
- "unexpectedmaker_tinys2"
board: ${{ fromJSON(needs.test.outputs.xtensa-boards) }}
steps:
- name: Set up Python 3.8

@ -1 +1 @@
Subproject commit ad4f2d32d3a35b412bab7c6c0ba3b7a46d5da5aa
Subproject commit 9ae0e7f870c0dd508d8a27c179b5d63b47567f85

@ -1 +1 @@
Subproject commit c6ea5d17c8c7bd391b3977c0195cff60dddf3f25
Subproject commit 99bf9e741dccd1271317e782eed49cbf42a4efae

@ -1 +1 @@
Subproject commit c31c0ef2da48bfed7da2188039b59251f02110ea
Subproject commit 99a296fb3bdf2743f9b5f487649d7721c8f83c24

@ -1 +1 @@
Subproject commit 78b0fbbb00c0431042b460fe20a76bbc440c4793
Subproject commit 1cb554987df86b008e5a0feaa56f0a24d806bf28

@ -1 +1 @@
Subproject commit 01ae093f1f73c152941cde9f4f850b163d278df2
Subproject commit 0f5651650c11a24e531e5dd1eadfc5654d84a478

@ -1 +1 @@
Subproject commit 9020acbab070d5842dcba83a5b7f7b7c86dc7414
Subproject commit 460e971e32ea53176b39ec093ae98fdac0d39d86

@ -1 +1 @@
Subproject commit 831a45f14bcc833d536cab39bef61cc67533fa73
Subproject commit 582e5dbac53aa2ac7c24249712081833986b3f27

View File

@ -370,7 +370,7 @@ STATIC int pyexec_raw_repl_process_char(int c) {
}
goto reset;
}
serial_write_compressed(translate("raw REPL; CTRL-B to exit\n"));
mp_hal_stdout_tx_str("raw REPL; CTRL-B to exit\r\n");
goto reset;
} else if (c == CHAR_CTRL_B) {
// change to friendly REPL
@ -469,7 +469,7 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
return PYEXEC_FORCED_EXIT;
} else if (ret == CHAR_CTRL_E) {
// paste mode
serial_write_compressed(translate("\npaste mode; Ctrl-C to cancel, Ctrl-D to finish\n=== "));
mp_hal_stdout_tx_str("\r\npaste mode; Ctrl-C to cancel, Ctrl-D to finish\r\n=== ");
vstr_reset(MP_STATE_VM(repl_line));
repl.paste_mode = true;
return 0;
@ -545,7 +545,7 @@ int pyexec_raw_repl(void) {
vstr_init(&line, 32);
raw_repl_reset:
serial_write_compressed(translate("raw REPL; CTRL-B to exit\n"));
mp_hal_stdout_tx_str("raw REPL; CTRL-B to exit\r\n");
for (;;) {
vstr_reset(&line);

View File

@ -35,13 +35,6 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: lib/utils/pyexec.c
msgid ""
"\n"
"paste mode; Ctrl-C to cancel, Ctrl-D to finish\n"
"=== "
msgstr ""
#: py/obj.c
msgid " File \"%q\""
msgstr ""
@ -400,6 +393,9 @@ msgstr ""
msgid "All UART peripherals are in use"
msgstr ""
#: ports/nrf/common-hal/countio/Counter.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/rotaryio/IncrementalEncoder.c
#: shared-bindings/pwmio/PWMOut.c
msgid "All channels in use"
msgstr ""
@ -623,10 +619,10 @@ msgstr ""
msgid "Buffer too short by %d bytes"
msgstr ""
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/esp32s2/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#: ports/raspberrypi/common-hal/displayio/ParallelBus.c
#: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c
#: ports/esp32s2/common-hal/paralleldisplay/ParallelBus.c
#: ports/nrf/common-hal/paralleldisplay/ParallelBus.c
#: ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c
#, c-format
msgid "Bus pin %d is already in use"
msgstr ""
@ -786,7 +782,7 @@ msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
#: shared-bindings/paralleldisplay/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr ""
@ -879,12 +875,12 @@ msgstr ""
msgid "DAC already in use"
msgstr ""
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c
#: ports/nrf/common-hal/paralleldisplay/ParallelBus.c
msgid "Data 0 pin must be byte aligned"
msgstr ""
#: ports/esp32s2/common-hal/displayio/ParallelBus.c
#: ports/esp32s2/common-hal/paralleldisplay/ParallelBus.c
msgid "Data 0 pin must be byte aligned."
msgstr ""
@ -1828,11 +1824,6 @@ msgstr ""
msgid "PWM slice channel A already in use"
msgstr ""
#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
#: ports/esp32s2/common-hal/audiobusio/__init__.c
msgid "Peripheral in use"
msgstr ""
@ -3655,7 +3646,7 @@ msgid "no module named '%q'"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
#: shared-bindings/paralleldisplay/ParallelBus.c
msgid "no reset pin available"
msgstr ""
@ -3928,6 +3919,7 @@ msgstr ""
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/crumpspace_crumps2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_hmi_devkit_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1.3/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -3948,6 +3940,7 @@ msgstr ""
#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h
#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h
#: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h
#: ports/esp32s2/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h
#: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h
#: ports/esp32s2/boards/unexpectedmaker_tinys2/mpconfigboard.h
msgid "pressing boot button at start up.\n"
@ -3981,10 +3974,6 @@ msgstr ""
msgid "queue overflow"
msgstr ""
#: lib/utils/pyexec.c
msgid "raw REPL; CTRL-B to exit\n"
msgstr ""
#: py/parse.c
msgid "raw f-strings are not implemented"
msgstr ""

View File

@ -7,8 +7,8 @@ msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-08-23 14:19+0000\n"
"Last-Translator: Jeff Epler <jepler@gmail.com>\n"
"PO-Revision-Date: 2021-09-04 23:34+0000\n"
"Last-Translator: hexthat <hexthat@gmail.com>\n"
"Language-Team: Chinese Hanyu Pinyin\n"
"Language: zh_Latn_pinyin\n"
"MIME-Version: 1.0\n"
@ -49,6 +49,9 @@ msgid ""
"paste mode; Ctrl-C to cancel, Ctrl-D to finish\n"
"=== "
msgstr ""
"\n"
"zhān tiē mó shì; Ctrl-C qǔ xiāo, Ctrl-D wán chéngh\n"
"=== "
#: py/obj.c
msgid " File \"%q\""
@ -85,11 +88,11 @@ msgstr ""
#: shared-bindings/microcontroller/Pin.c
msgid "%q and %q contain duplicate pins"
msgstr ""
msgstr "%q hé %q bāo hán chóng fù yǐn jiǎo"
#: shared-bindings/microcontroller/Pin.c
msgid "%q contains duplicate pins"
msgstr ""
msgstr "%q bāo hán chóng fù de yǐn jiǎo"
#: ports/atmel-samd/common-hal/sdioio/SDCard.c
msgid "%q failure: %d"
@ -114,11 +117,11 @@ msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s"
#: py/argcheck.c
msgid "%q length must be %d-%d"
msgstr ""
msgstr "%q cháng dù bì xū wéi %d-%d"
#: shared-bindings/usb_hid/Device.c
msgid "%q length must be >= 1"
msgstr ""
msgstr "%q cháng dù bì xū >= 1"
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
@ -162,7 +165,7 @@ msgstr "%q bì xū zài %d hé %d zhī jiān"
#: ports/atmel-samd/common-hal/busio/UART.c
msgid "%q must be power of 2"
msgstr ""
msgstr "%q bì xū shì 2 de gōng lǜ"
#: py/argcheck.c
msgid "%q must of type %q"
@ -187,7 +190,7 @@ msgstr "%q() cǎiyòng %d wèizhì cānshù, dàn gěi chū %d"
#: shared-bindings/usb_hid/Device.c
msgid "%q, %q, and %q must all be the same length"
msgstr ""
msgstr "%q, %q, hé %q bì xū cháng dù xiāng tóng"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
#, c-format
@ -341,7 +344,7 @@ msgstr "'yield' wàibù gōngnéng"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
msgstr "(x,y) suǒ xū de zhěng shù"
#: py/compile.c
msgid "*x must be assignment target"
@ -516,7 +519,7 @@ msgstr "dāng VM bú yùn xíng shí, cháng shì duī fēn pèi."
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
msgstr "wèi shí xiàn yīn pín zhuǎn huàn"
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
@ -1256,7 +1259,7 @@ msgstr "Jiāmì bùzú"
#: ports/atmel-samd/audio_dma.c ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
msgstr "nèi bù yīn pín huǎn chōng qì tài xiǎo"
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
@ -1551,12 +1554,12 @@ msgstr "quē shǎo dì yī zǔ yǐn jiǎo. zhǐ lìng %d shè zhì yǐn jiǎo"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing jmp_pin. Instruction %d jumps on pin"
msgstr ""
msgstr "shī zōng de jmp_pin. zhǐ lìng %d zài yǐn jiǎo shàng tiào yuè"
#: shared-module/usb_hid/Device.c
#, c-format
msgid "More than %d report ids not supported"
msgstr ""
msgstr "chāo guò %d bào gào bù zhī chí de ID"
#: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c
msgid "Must be a %q subclass."
@ -2637,7 +2640,7 @@ msgstr "zhóu tài cháng"
#: shared-bindings/bitmaptools/__init__.c
msgid "background value out of range of target"
msgstr ""
msgstr "bèi jǐng zhí tuō lí mù biāo fàn wéi"
#: py/builtinevex.c
msgid "bad compile mode"
@ -2859,7 +2862,7 @@ msgstr "wúfǎ cóng shǒudòng zìduàn guīgé qiēhuàn dào zìdòng zìduà
#: extmod/ulab/code/ndarray.c
msgid "cannot assign new shape"
msgstr ""
msgstr "wú fǎ fēn pèi xīn xíng zhuàng"
#: extmod/ulab/code/ndarray_operators.c
msgid "cannot cast output with casting rule"
@ -3166,7 +3169,7 @@ msgstr "wénjiàn bìxū shì zài zì jié móshì xià dǎkāi de wénjiàn"
#: shared-bindings/traceback/__init__.c
msgid "file write is not available"
msgstr ""
msgstr "wén jiàn biān xiě bù kě yòng"
#: shared-bindings/storage/__init__.c
msgid "filesystem must provide mount method"
@ -3457,7 +3460,7 @@ msgstr "wú xiào element_size %d, bì xū shì, 1, 2, huò 4"
#: shared-bindings/traceback/__init__.c
msgid "invalid exception"
msgstr ""
msgstr "wú xiào lì wài"
#: extmod/modframebuf.c
msgid "invalid format"
@ -3498,7 +3501,7 @@ msgstr "wúxiào de hàomǎ yǔfǎ"
#: py/objexcept.c shared-bindings/traceback/__init__.c
msgid "invalid traceback"
msgstr ""
msgstr "wú xiào zhuī sù"
#: py/objtype.c
msgid "issubclass() arg 1 must be a class"
@ -3626,7 +3629,7 @@ msgstr "nèi cún shì tú: cháng dù bú shì xiàng mù huà de bèi shù"
#: extmod/ulab/code/numpy/linalg/linalg.c
msgid "mode must be complete, or reduced"
msgstr ""
msgstr "mó shì bì xū wán chéng huò jiǎn shǎo"
#: py/builtinimport.c
msgid "module not found"
@ -3868,11 +3871,11 @@ msgstr "cāozuò shǔ bùnéng yīqǐ guǎngbò"
#: extmod/ulab/code/numpy/linalg/linalg.c
msgid "operation is defined for 2D arrays only"
msgstr ""
msgstr "jǐn zhēn duì 2D zhèn liè dìng yì cāo zuò"
#: extmod/ulab/code/numpy/linalg/linalg.c
msgid "operation is defined for ndarrays only"
msgstr ""
msgstr "cāo zuò jǐn dìng yì wéi ndarrays"
#: extmod/ulab/code/ndarray.c
msgid "operation is implemented for 1D Boolean arrays only"
@ -4042,7 +4045,7 @@ msgstr "duìliè yìchū"
#: lib/utils/pyexec.c
msgid "raw REPL; CTRL-B to exit\n"
msgstr ""
msgstr "yuán shǐ REPL; CTRL-B tuì chū\n"
#: py/parse.c
msgid "raw f-strings are not implemented"
@ -4451,7 +4454,7 @@ msgstr "Zhí bìxū fúhé %d zì jié"
#: shared-bindings/bitmaptools/__init__.c
msgid "value out of range of target"
msgstr ""
msgstr "zhí fàn wéi wài de mù biāo"
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"

2
main.c
View File

@ -236,7 +236,7 @@ STATIC void cleanup_after_vm(supervisor_allocation* heap, mp_obj_t exception) {
size_t traceback_len = 0;
mp_print_t print_count = {&traceback_len, count_strn};
mp_obj_print_exception(&print_count, exception);
prev_traceback_allocation = allocate_memory(align32_size(traceback_len + 1), false, true);
prev_traceback_allocation = allocate_memory(align32_size(traceback_len + 1), false, false);
// Empirically, this never fails in practice - even when the heap is totally filled up
// with single-block-sized objects referenced by a root pointer, exiting the VM frees
// up several hundred bytes, sufficient for the traceback (which tends to be shortened

View File

@ -27,21 +27,16 @@
// Micropython setup
#define MICROPY_HW_BOARD_NAME "S2Mini"
#define MICROPY_HW_MCU_NAME "ESP32S2"
#define MICROPY_HW_MCU_NAME "ESP32S2-S2FN4R2" // from Wemos MP
#define MICROPY_HW_NEOPIXEL (&pin_GPIO1)
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO15)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n")
#define AUTORESET_DELAY_MS 500
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO35) // no I2C labels on S2 Mini, def from Wemos MP
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) // no I2C labels on S2 Mini, def from Wemos MP
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO37)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO36)
#define DEFAULT_UART_BUS_RX (&pin_GPIO44)
#define DEFAULT_UART_BUS_TX (&pin_GPIO43)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO7) // no SPI labels on S2 Mini, def from Wemos MP
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) // no SPI labels on S2 Mini, def from Wemos MP
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO9) // no SPI labels on S2 Mini, def from Wemos MP

View File

@ -14,7 +14,6 @@ CIRCUITPY_ESP_FLASH_MODE=qio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB
CIRCUITPY_BITBANG_NEOPIXEL = 1
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel

View File

@ -8,32 +8,35 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
// mpconfigboard.h: GPIO0: CIRCUITPY_BOOT_BUTTON
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, // RTC_GPIO0,GPIO0
// mpconfigboard.h: GPIO1: MICROPY_HW_NEOPIXEL - left to user to solder on
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, // RTC_GPIO1,GPIO1,TOUCH1,ADC1_CH0
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, // RTC_GPIO2,GPIO2,TOUCH2,ADC1_CH1
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, // RTC_GPIO3,GPIO3,TOUCH3,ADC1_CH2
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO3) }, // D1 mini pin A0
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, // RTC_GPIO4,GPIO4,TOUCH4,ADC1_CH3
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, // RTC_GPIO5,GPIO5,TOUCH5,ADC1_CH4
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO5) }, // D1 mini pin D0 GPIO16
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, // RTC_GPIO6,GPIO6,TOUCH6,ADC1_CH5
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, // RTC_GPIO7,GPIO7,TOUCH7,ADC1_CH6
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO7) }, // def from Wemos MP
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO7) }, // D1 mini pin D5 GPIO14
// mpconfigboard.h: GPIO8/GPIO9: SCL/SDA I2C0
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, // RTC_GPIO8,GPIO8,TOUCH8,ADC1_CH7
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, // RTC_GPIO9,GPIO9,TOUCH9,ADC1_CH8,FSPIHD
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO9) }, // def from Wemos MP
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO9) }, // D1 mini pin D6 GPIO12
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },// RTC_GPIO10,GPIO10,TOUCH10,ADC1_CH9,FSPICS0,FSPIIO4
{ MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },// RTC_GPIO11,GPIO11,TOUCH11,ADC2_CH0,FSPID,FSPIIO5
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) },// def from Wemos MP
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO11) },// D1 mini pin D7 GPIO13
{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },// RTC_GPIO12,GPIO12,TOUCH12,ADC2_CH1,FSPICLK,FSPIIO6
{ MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },// RTC_GPIO13,GPIO13,TOUCH13,ADC2_CH2,FSPIQ,FSPIIO7
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO13) },// D1 mini pin D8 GPIO15
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },// RTC_GPIO14,GPIO14,TOUCH14,ADC2_CH3,FSPIWP,FSPIDQS
@ -43,9 +46,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },// XTAL_32K_P: RTC_GPIO15,GPIO15,U0RTS,ADC2_CH4,XTAL_32K_P
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },// XTAL_32K_N: RTC_GPIO16,GPIO16,U0CTS,ADC2_CH5,XTAL_32K_N
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO16) },// D1 mini pin D4 GPIO2 LED
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },// DAC_1: RTC_GPIO17,GPIO17,U1TXD,ADC2_CH6,DAC_1
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },// DAC_2: RTC_GPIO18,GPIO18,U1RXD,ADC2_CH7,DAC_2,CLK_OUT3
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO18) },// D1 mini pin D3 GPIO0
// skip GPIO19-GPIO20: USB_D-/USB_D+
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },// RTC_GPIO21,GPIO21
@ -54,18 +59,18 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
// GPIO33-GPIO40: broken out as a bloc on ESP32-S2FN4R2 SoC, last 2 half of JTAG
{ MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },// SPIIO4,GPIO33,FSPIHD
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) },// def from Wemos MP
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO33) },// D1 mini pin D2 GPIO4
{ MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },// SPIIO5,GPIO34,FSPICS0
// mpconfigboard.h: GPIO35/GPIO36/GPIO37: MOSI/MESO/SCK SPI
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) },
{ MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },// SPIIO6,GPIO35,FSPID
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO36) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO35) },// def from Wemos MP
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO35) },// D1 mini pin D1 GPIO5
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },// SPIIO7,GPIO36,FSPICLK
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO37) },
{ MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },// SPIDQS,GPIO37,FSPIQ
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },// GPIO38,FSPIWP
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },// MTCK,GPIO39,CLK_OUT3
{ MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) },// MTDO,GPIO40,CLK_OUT2

View File

@ -49,92 +49,74 @@ void audio_dma_reset(void) {
}
STATIC void audio_dma_convert_samples(
audio_dma_t *dma,
uint8_t *input, uint32_t input_length,
uint8_t *available_output_buffer, uint32_t available_output_buffer_length,
uint8_t **output, uint32_t *output_length) {
STATIC size_t audio_dma_convert_samples(audio_dma_t *dma, uint8_t *input, uint32_t input_length, uint8_t *output, uint32_t output_length) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
// Check whether a conversion is necessary
if (dma->signed_to_unsigned ||
dma->unsigned_to_signed ||
dma->sample_spacing > 1 ||
(dma->sample_resolution != dma->output_resolution)) {
uint32_t output_length_used = input_length / dma->sample_spacing;
// Must convert.
// Write the conversion into the passed-in output buffer
*output = available_output_buffer;
*output_length = input_length / dma->sample_spacing;
if (output_length_used > output_length) {
mp_raise_RuntimeError(translate("Internal audio buffer too small"));
}
if (*output_length > available_output_buffer_length) {
uint32_t out_i = 0;
if (dma->sample_resolution <= 8 && dma->output_resolution > 8) {
// reading bytes, writing 16-bit words, so output buffer will be bigger.
output_length_used = output_length * 2;
if (output_length_used > output_length) {
mp_raise_RuntimeError(translate("Internal audio buffer too small"));
}
uint32_t out_i = 0;
if (dma->sample_resolution <= 8 && dma->output_resolution > 8) {
// reading bytes, writing 16-bit words, so output buffer will be bigger.
size_t shift = dma->output_resolution - dma->sample_resolution;
*output_length = *output_length * 2;
if (*output_length > available_output_buffer_length) {
mp_raise_RuntimeError(translate("Internal audio buffer too small"));
for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) {
if (dma->signed_to_unsigned) {
((uint16_t *)output)[out_i] = ((uint16_t)((int8_t *)input)[i] + 0x80) << shift;
} else if (dma->unsigned_to_signed) {
((int16_t *)output)[out_i] = ((int16_t)((uint8_t *)input)[i] - 0x80) << shift;
} else {
((uint16_t *)output)[out_i] = ((uint16_t)((uint8_t *)input)[i]) << shift;
}
size_t shift = dma->output_resolution - dma->sample_resolution;
for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) {
if (dma->signed_to_unsigned) {
((uint16_t *)*output)[out_i] = ((uint16_t)((int8_t *)input)[i] + 0x80) << shift;
} else if (dma->unsigned_to_signed) {
((int16_t *)*output)[out_i] = ((int16_t)((uint8_t *)input)[i] - 0x80) << shift;
out_i += 1;
}
} else if (dma->sample_resolution <= 8 && dma->output_resolution <= 8) {
for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) {
if (dma->signed_to_unsigned) {
((uint8_t *)output)[out_i] = ((int8_t *)input)[i] + 0x80;
} else if (dma->unsigned_to_signed) {
((int8_t *)output)[out_i] = ((uint8_t *)input)[i] - 0x80;
} else {
((uint8_t *)output)[out_i] = ((uint8_t *)input)[i];
}
out_i += 1;
}
} else if (dma->sample_resolution > 8 && dma->output_resolution > 8) {
size_t shift = 16 - dma->output_resolution;
for (uint32_t i = 0; i < input_length / 2; i += dma->sample_spacing) {
if (dma->signed_to_unsigned) {
((uint16_t *)output)[out_i] = ((int16_t *)input)[i] + 0x8000;
} else if (dma->unsigned_to_signed) {
((int16_t *)output)[out_i] = ((uint16_t *)input)[i] - 0x8000;
} else {
((uint16_t *)output)[out_i] = ((uint16_t *)input)[i];
}
if (dma->output_resolution < 16) {
if (dma->output_signed) {
((int16_t *)output)[out_i] = ((int16_t *)output)[out_i] >> shift;
} else {
((uint16_t *)*output)[out_i] = ((uint16_t)((uint8_t *)input)[i]) << shift;
((uint16_t *)output)[out_i] = ((uint16_t *)output)[out_i] >> shift;
}
out_i += 1;
}
} else if (dma->sample_resolution <= 8 && dma->output_resolution <= 8) {
for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) {
if (dma->signed_to_unsigned) {
((uint8_t *)*output)[out_i] = ((int8_t *)input)[i] + 0x80;
} else if (dma->unsigned_to_signed) {
((int8_t *)*output)[out_i] = ((uint8_t *)input)[i] - 0x80;
} else {
((uint8_t *)*output)[out_i] = ((uint8_t *)input)[i];
}
out_i += 1;
}
} else if (dma->sample_resolution > 8 && dma->output_resolution > 8) {
size_t shift = 16 - dma->output_resolution;
for (uint32_t i = 0; i < input_length / 2; i += dma->sample_spacing) {
if (dma->signed_to_unsigned) {
((uint16_t *)*output)[out_i] = ((int16_t *)input)[i] + 0x8000;
} else if (dma->unsigned_to_signed) {
((int16_t *)*output)[out_i] = ((uint16_t *)input)[i] - 0x8000;
} else {
((uint16_t *)*output)[out_i] = ((uint16_t *)input)[i];
}
if (dma->output_resolution < 16) {
if (dma->output_signed) {
((int16_t *)*output)[out_i] = ((int16_t *)*output)[out_i] >> shift;
} else {
((uint16_t *)*output)[out_i] = ((uint16_t *)*output)[out_i] >> shift;
}
}
out_i += 1;
}
} else {
// (dma->sample_resolution > 8 && dma->output_resolution <= 8)
// Not currently used, but might be in the future.
mp_raise_RuntimeError(translate("Audio conversion not implemented"));
out_i += 1;
}
} else {
// No conversion necessary. Designate the input buffer as the output buffer.
*output = input;
*output_length = input_length;
// (dma->sample_resolution > 8 && dma->output_resolution <= 8)
// Not currently used, but might be in the future.
mp_raise_RuntimeError(translate("Audio conversion not implemented"));
}
#pragma GCC diagnostic pop
return output_length_used;
}
// buffer_idx is 0 or 1.
@ -154,21 +136,14 @@ STATIC void audio_dma_load_next_block(audio_dma_t *dma, size_t buffer_idx) {
// Convert the sample format resolution and signedness, as necessary.
// The input sample buffer is what was read from a file, Mixer, or a raw sample buffer.
// The output buffer is one of the DMA buffers (passed in), or if no conversion was done,
// the original sample buffer (to save copying).
// The output buffer is one of the DMA buffers (passed in).
// audio_dma_convert_samples() will write the converted samples into the given output
// buffer if necessary. If no conversion was needed, it will return the sample buffer
// as the output buffer.
uint8_t *output_buffer;
uint32_t output_buffer_length;
size_t output_length_used = audio_dma_convert_samples(
dma, sample_buffer, sample_buffer_length,
dma->buffer[buffer_idx], dma->buffer_length[buffer_idx]);
audio_dma_convert_samples(dma, sample_buffer, sample_buffer_length,
dma->buffer[buffer_idx], dma->buffer_length[buffer_idx],
&output_buffer, &output_buffer_length);
dma_channel_set_read_addr(dma_channel, output_buffer, false /* trigger */);
dma_channel_set_trans_count(dma_channel, output_buffer_length / dma->output_size, false /* trigger */);
dma_channel_set_read_addr(dma_channel, dma->buffer[buffer_idx], false /* trigger */);
dma_channel_set_trans_count(dma_channel, output_length_used / dma->output_size, false /* trigger */);
if (get_buffer_result == GET_BUFFER_DONE) {
if (dma->loop) {
@ -180,7 +155,7 @@ STATIC void audio_dma_load_next_block(audio_dma_t *dma, size_t buffer_idx) {
(c->al1_ctrl & ~DMA_CH0_CTRL_TRIG_CHAIN_TO_BITS) |
(dma_channel << DMA_CH0_CTRL_TRIG_CHAIN_TO_LSB);
if (output_buffer_length == 0 &&
if (output_length_used == 0 &&
!dma_channel_is_busy(dma->channel[0]) &&
!dma_channel_is_busy(dma->channel[1])) {
// No data has been read, and both DMA channels have now finished, so it's safe to stop.

View File

@ -174,14 +174,19 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self,
uint16_t bits_per_sample_output = bits_per_sample * 2;
size_t clocks_per_bit = 6;
uint32_t frequency = bits_per_sample_output * audiosample_sample_rate(sample);
common_hal_rp2pio_statemachine_set_frequency(&self->state_machine, clocks_per_bit * frequency);
common_hal_rp2pio_statemachine_restart(&self->state_machine);
uint8_t channel_count = audiosample_channel_count(sample);
if (channel_count > 2) {
mp_raise_ValueError(translate("Too many channels in sample."));
}
common_hal_rp2pio_statemachine_set_frequency(&self->state_machine, clocks_per_bit * frequency);
common_hal_rp2pio_statemachine_restart(&self->state_machine);
// On the RP2040, output registers are always written with a 32-bit write.
// If the write is 8 or 16 bits wide, the data will be replicated in upper bytes.
// See section 2.1.4 Narrow IO Register Writes in the RP2040 datasheet.
// This means that identical 16-bit audio data will be written in both halves of the incoming PIO
// FIFO register. Thus we get mono-to-stereo conversion for the I2S output for free.
audio_dma_result result = audio_dma_setup_playback(
&self->dma,
sample,
@ -201,8 +206,6 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self,
mp_raise_RuntimeError(translate("Unable to allocate buffers for signed conversion"));
}
// Turn on the state machine's clock.
self->playing = true;
}

View File

@ -131,7 +131,7 @@ STATIC void mp_help_print_modules(void) {
#if MICROPY_ENABLE_EXTERNAL_IMPORT
// let the user know there may be other modules available from the filesystem
mp_printf(MP_PYTHON_PRINTER, "%S", translate("Plus any modules on the filesystem\n"));
serial_write_compressed(translate("Plus any modules on the filesystem\n"));
#endif
}
#endif

View File

@ -195,7 +195,7 @@ STATIC mp_obj_t supervisor_set_next_code_file(size_t n_args, const mp_obj_t *pos
const char *filename = mp_obj_str_get_data(args.filename.u_obj, &len);
free_memory(next_code_allocation);
if (options != 0 || len != 0) {
next_code_allocation = allocate_memory(align32_size(sizeof(next_code_info_t) + len + 1), false, true);
next_code_allocation = allocate_memory(align32_size(sizeof(next_code_info_t) + len + 1), false, false);
if (next_code_allocation == NULL) {
m_malloc_fail(sizeof(next_code_info_t) + len + 1);
}

View File

@ -109,11 +109,20 @@ def get_board_mapping():
extensions = extension_by_port[port]
extensions = extension_by_board.get(board_path.name, extensions)
aliases = aliases_by_board.get(board_path.name, [])
frozen_libraries = []
with open(os.path.join(board_path, "mpconfigboard.mk")) as mpconfig:
frozen_lines = [
line for line in mpconfig if line.startswith("FROZEN_MPY_DIRS")
]
frozen_libraries.extend(
[line[line.rfind("/") + 1 :].strip() for line in frozen_lines]
)
boards[board_id] = {
"port": port,
"extensions": extensions,
"download_count": 0,
"aliases": aliases,
"frozen_libraries": frozen_libraries,
}
for alias in aliases:
boards[alias] = {
@ -300,6 +309,7 @@ def generate_download_info():
"modules": support_matrix[alias],
"languages": languages,
"extensions": board_info["extensions"],
"frozen_libraries": board_info["frozen_libraries"],
}
current_info[alias]["downloads"] = alias_info["download_count"]
current_info[alias]["versions"].append(new_version)

View File

@ -0,0 +1,94 @@
#! /usr/bin/env python3
"""This script is used in GitHub Actions to determine what boards are built
based on what files were changed. The base commit varies depending on the
event that triggered run. Pull request runs will compare to the base branch
while pushes will compare to the current ref. We override this for the
adafruit/circuitpython repo so we build all boards for pushes.
"""
# SPDX-FileCopyrightText: 2021 Scott Shawcroft
#
# SPDX-License-Identifier: MIT
import sys
import os
import json
import yaml
import re
import build_board_info
PORT_TO_ARCH = {
"atmel-samd": "arm",
"cxd56": "arm",
"esp32s2": "xtensa",
"litex": "riscv",
"mimxrt10xx": "arm",
"nrf": "arm",
"raspberrypi": "arm",
"stm": "arm",
}
changed_files = json.loads(os.environ["CHANGED_FILES"])
print("changed_files")
print(changed_files)
# Get boards in json format
boards_info_json = build_board_info.get_board_mapping()
all_board_ids = set()
port_to_boards = {}
board_to_port = {}
for board_id in boards_info_json:
info = boards_info_json[board_id]
if info.get("alias", False):
continue
all_board_ids.add(board_id)
port = info["port"]
if port not in port_to_boards:
port_to_boards[port] = set()
port_to_boards[port].add(board_id)
board_to_port[board_id] = port
# Build all boards if this is a push to an adafruit/circuitpython branch because we save the artifacts.
boards_to_build = all_board_ids
if not changed_files or (
os.environ.get("GITHUB_EVENT_NAME", "") == "push"
and os.environ.get("GITHUB_REPOSITORY", "") == "adafruit/circuitpython"
):
print("Building all boards because of adafruit/circuitpython branch")
else:
print("Adding boards to build based on changed files")
boards_to_build = set()
board_pattern = re.compile(r"ports/\w+/boards/(\w+)/")
port_pattern = re.compile(r"ports/(\w+)/")
for p in changed_files:
# See if it is board specific
board_matches = board_pattern.search(p)
if board_matches:
board = board_matches.group(1)
boards_to_build.add(board)
continue
# See if it is port specific
port_matches = port_pattern.search(p)
if port_matches:
port = port_matches.group(1)
boards_to_build.update(port_to_boards[port])
continue
# Otherwise build it all
boards_to_build = all_board_ids
break
# Split boards by architecture.
print("Building boards:")
arch_to_boards = {"arm": [], "riscv": [], "xtensa": []}
for board in boards_to_build:
print(" ", board)
arch = PORT_TO_ARCH[board_to_port[board]]
arch_to_boards[arch].append(board)
# Set the step outputs for each architecture
for arch in arch_to_boards:
print("::set-output name=" + arch + "-boards::" + json.dumps(sorted(arch_to_boards[arch])))

View File

@ -1,57 +0,0 @@
#! /usr/bin/env python3
# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
#
# SPDX-License-Identifier: MIT
import sys
import os
import json
import yaml
import build_board_info
workflow_file = ".github/workflows/build.yml"
# Get boards in json format
boards_info_json = build_board_info.get_board_mapping()
# Get all the boards out of the json format
info_boards = [
board for board in boards_info_json.keys() if not boards_info_json[board].get("alias", False)
]
# We need to know the path of the workflow file
base_path = os.path.dirname(__file__)
yml_path = os.path.abspath(os.path.join(base_path, "..", workflow_file))
# Loading board list based on build jobs in the workflow file.
ci_boards = []
with open(yml_path, "r") as f:
workflow = yaml.safe_load(f)
ok = True
for job in workflow["jobs"]:
if not job.startswith("build"):
continue
job_boards = workflow["jobs"][job]["strategy"]["matrix"]["board"]
if job_boards != sorted(job_boards):
print('Boards for job "{}" not sorted. Must be:'.format(job))
print(' - "' + '"\n - "'.join(sorted(job_boards)) + '"')
ok = False
ci_boards.extend(job_boards)
# All the travis_boards elements must be on info_boards
info_boards.sort()
ci_boards.sort()
missing_boards = set(info_boards) - set(ci_boards)
if missing_boards:
ok = False
print("Boards missing in {}:".format(workflow_file))
for board in missing_boards:
print(board)
if not ok:
sys.exit(1)