From 472a5a99ec31a2acf14883caf635f66080947d78 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 3 Nov 2020 16:31:53 -0500 Subject: [PATCH 001/146] Add API reset to reset_pin_number --- ports/esp32s2/common-hal/microcontroller/Pin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 3c2611efeb..72db5da471 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -63,6 +63,8 @@ void reset_pin_number(gpio_num_t pin_number) { never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32); in_use[pin_number / 32] &= ~(1 << pin_number % 32); + gpio_reset_pin(pin_number); + #ifdef MICROPY_HW_NEOPIXEL if (pin_number == MICROPY_HW_NEOPIXEL->number) { neopixel_in_use = false; @@ -83,9 +85,7 @@ void reset_all_pins(void) { (never_reset_pins[i / 32] & (1 << i % 32)) != 0) { continue; } - gpio_set_direction(i, GPIO_MODE_DEF_INPUT); - gpio_pullup_dis(i); - gpio_pulldown_dis(i); + gpio_reset_pin(i); } in_use[0] = 0; in_use[1] = 0; From 6a6e998ea5bcfcc5ca4ca8a689720acc365b6927 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Sat, 7 Nov 2020 19:21:36 -0600 Subject: [PATCH 002/146] Added BastBLE --- ports/nrf/boards/bastble/README.md | 8 ++++ ports/nrf/boards/bastble/board.c | 41 +++++++++++++++++++ ports/nrf/boards/bastble/mpconfigboard.h | 16 ++++++++ ports/nrf/boards/bastble/mpconfigboard.mk | 12 ++++++ ports/nrf/boards/bastble/pins.c | 48 +++++++++++++++++++++++ 5 files changed, 125 insertions(+) create mode 100644 ports/nrf/boards/bastble/README.md create mode 100644 ports/nrf/boards/bastble/board.c create mode 100644 ports/nrf/boards/bastble/mpconfigboard.h create mode 100644 ports/nrf/boards/bastble/mpconfigboard.mk create mode 100644 ports/nrf/boards/bastble/pins.c diff --git a/ports/nrf/boards/bastble/README.md b/ports/nrf/boards/bastble/README.md new file mode 100644 index 0000000000..c684641062 --- /dev/null +++ b/ports/nrf/boards/bastble/README.md @@ -0,0 +1,8 @@ +# Electronic Cats BastBLE + +The [BastBLE](https://electroniccats.com/store/bast-ble/) based on Nordic nRF 52840 and containing +a powerful Cortex M4F. This board include a external memory QSPI flash. + + +I2C pins `board.SCL1` and `board.SDA1` are not exposed and are used for onboard peripherals. + diff --git a/ports/nrf/boards/bastble/board.c b/ports/nrf/boards/bastble/board.c new file mode 100644 index 0000000000..d91a915f19 --- /dev/null +++ b/ports/nrf/boards/bastble/board.c @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "nrf.h" +#include "nrf_rtc.h" + +void board_init(void) { + +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/bastble/mpconfigboard.h b/ports/nrf/boards/bastble/mpconfigboard.h new file mode 100644 index 0000000000..67a62e915b --- /dev/null +++ b/ports/nrf/boards/bastble/mpconfigboard.h @@ -0,0 +1,16 @@ +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "BastBLE" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 + +#define DEFAULT_I2C_BUS_SCL (&pin_P1_10) +#define DEFAULT_I2C_BUS_SDA (&pin_P1_11) + +#define DEFAULT_SPI_BUS_SCK (&pin_P1_00) +#define DEFAULT_SPI_BUS_MOSI (&pin_P1_06) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) + +#define DEFAULT_UART_BUS_RX (&pin_P0_09) +#define DEFAULT_UART_BUS_TX (&pin_P0_10) diff --git a/ports/nrf/boards/bastble/mpconfigboard.mk b/ports/nrf/boards/bastble/mpconfigboard.mk new file mode 100644 index 0000000000..9441b913b7 --- /dev/null +++ b/ports/nrf/boards/bastble/mpconfigboard.mk @@ -0,0 +1,12 @@ +USB_VID = 0x2341 +USB_PID = 0x805A +USB_PRODUCT = "BastBLE" +USB_MANUFACTURER = "ElectronicCats" + +MCU_CHIP = nrf52840 + +INTERNAL_FLASH_FILESYSTEM = 1 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/nrf/boards/bastble/pins.c b/ports/nrf/boards/bastble/pins.c new file mode 100644 index 0000000000..6e4cc511b0 --- /dev/null +++ b/ports/nrf/boards/bastble/pins.c @@ -0,0 +1,48 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P1_09) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P0_07) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_03) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P1_11) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P1_10) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_P0_24) }, + + { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) }, + + // voltage sense battery + { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_P0_26) }, + + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_09) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 78dffd8ef8d88eb88e3186f68eeb988f649a7971 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 9 Nov 2020 14:17:25 -0600 Subject: [PATCH 003/146] add board on build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 404d2ea2e5..8f098cb92e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -182,6 +182,7 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" + - "bastBLE" - "bdmicro_vina_d21" - "bdmicro_vina_d51" - "bless_dev_board_multi_sensor" From ee57bc4d8359b6f833c6a34f3cc0dceabdf51cdb Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 9 Nov 2020 14:25:42 -0600 Subject: [PATCH 004/146] fix name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f098cb92e..f68402be8f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -182,7 +182,7 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" - - "bastBLE" + - "bastble" - "bdmicro_vina_d21" - "bdmicro_vina_d51" - "bless_dev_board_multi_sensor" From 7253b2eb31890d24cee10975844b8de9b4880a23 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Fri, 13 Nov 2020 09:22:42 -0600 Subject: [PATCH 005/146] fix name board --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f68402be8f..70fc723761 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -182,7 +182,7 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" - - "bastble" + - "bastble" - "bdmicro_vina_d21" - "bdmicro_vina_d51" - "bless_dev_board_multi_sensor" From 089fa82067549b97990eaf0d61c073b852cf7636 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 16 Nov 2020 21:21:24 -0600 Subject: [PATCH 006/146] Fix pre-commit --- ports/nrf/boards/bastble/README.md | 6 +----- ports/nrf/boards/bastble/board.c | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/ports/nrf/boards/bastble/README.md b/ports/nrf/boards/bastble/README.md index c684641062..0af6209bdb 100644 --- a/ports/nrf/boards/bastble/README.md +++ b/ports/nrf/boards/bastble/README.md @@ -1,8 +1,4 @@ # Electronic Cats BastBLE The [BastBLE](https://electroniccats.com/store/bast-ble/) based on Nordic nRF 52840 and containing -a powerful Cortex M4F. This board include a external memory QSPI flash. - - -I2C pins `board.SCL1` and `board.SDA1` are not exposed and are used for onboard peripherals. - +a powerful Cortex M4F. This board include a external memory QSPI flash. diff --git a/ports/nrf/boards/bastble/board.c b/ports/nrf/boards/bastble/board.c index d91a915f19..7c42cee57d 100644 --- a/ports/nrf/boards/bastble/board.c +++ b/ports/nrf/boards/bastble/board.c @@ -29,7 +29,7 @@ #include "nrf_rtc.h" void board_init(void) { - + } bool board_requests_safe_mode(void) { From 33ca357094b58f136c3d9bdf30b73d297302cbbc Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 16 Nov 2020 22:10:37 -0600 Subject: [PATCH 007/146] fix VID and PID --- ports/nrf/boards/bastble/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/bastble/mpconfigboard.mk b/ports/nrf/boards/bastble/mpconfigboard.mk index 9441b913b7..0e01c4d0f3 100644 --- a/ports/nrf/boards/bastble/mpconfigboard.mk +++ b/ports/nrf/boards/bastble/mpconfigboard.mk @@ -1,4 +1,4 @@ -USB_VID = 0x2341 +USB_VID = 0x1209 USB_PID = 0x805A USB_PRODUCT = "BastBLE" USB_MANUFACTURER = "ElectronicCats" From 1c9f33a372dd1fcb55625abbf2fc14a2ac5764ae Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 23 Nov 2020 19:01:30 -0500 Subject: [PATCH 008/146] Replace reset with mux change --- ports/esp32s2/common-hal/microcontroller/Pin.c | 4 ++-- ports/esp32s2/esp-idf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 72db5da471..961f77f33c 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -63,7 +63,7 @@ void reset_pin_number(gpio_num_t pin_number) { never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32); in_use[pin_number / 32] &= ~(1 << pin_number % 32); - gpio_reset_pin(pin_number); + gpio_matrix_out(pin_number, 0x100, 0, 0); #ifdef MICROPY_HW_NEOPIXEL if (pin_number == MICROPY_HW_NEOPIXEL->number) { @@ -85,7 +85,7 @@ void reset_all_pins(void) { (never_reset_pins[i / 32] & (1 << i % 32)) != 0) { continue; } - gpio_reset_pin(i); + gpio_matrix_out(i, 0x100, 0, 0); } in_use[0] = 0; in_use[1] = 0; diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index d06744f5ef..8bc19ba893 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit d06744f5efc382c61cbad8758107cec308feef09 +Subproject commit 8bc19ba893e5544d571a753d82b44a84799b94b1 From 1553a647ca84f221fbadf1202844b91500d3ae9e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 24 Nov 2020 10:53:37 -0600 Subject: [PATCH 009/146] build: Update to gcc10 preview --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 046598a6e2..c032b1b8a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -341,8 +341,8 @@ jobs: run: | sudo apt-get install -y gettext pip install requests sh click setuptools awscli - wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 - sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + wget --no-verbose https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q2/gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 + sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 - name: Versions run: | gcc --version From bde1c4166d08bd9530b1dc4dcf3bfff7f3e33bca Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 28 Nov 2020 23:09:05 +0100 Subject: [PATCH 010/146] Revert "Prevent exceptions from accumulating in REPL" This reverts commit 0cd951fb73198f5c3dd03ea0463382edac0d3d4d. It is not a correct solution because it prevents printing the same exception twice. --- py/obj.c | 1 - 1 file changed, 1 deletion(-) diff --git a/py/obj.c b/py/obj.c index d8e34746ca..b6462641ce 100644 --- a/py/obj.c +++ b/py/obj.c @@ -125,7 +125,6 @@ void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc) { mp_printf(print, decompressed_block, block); } } - mp_obj_exception_clear_traceback(exc); } } mp_obj_print_helper(print, exc, PRINT_EXC); From 57fa6bece8fb841de10aaa6e96ced59749e6c566 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 3 Dec 2020 21:27:35 -0500 Subject: [PATCH 011/146] allow radio.enabled to be settable --- shared-bindings/wifi/Radio.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 991abd4f12..d9d7dd5b53 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -55,10 +55,19 @@ STATIC mp_obj_t wifi_radio_get_enabled(mp_obj_t self) { } MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_enabled_obj, wifi_radio_get_enabled); +static mp_obj_t wifi_radio_set_enabled(mp_obj_t self, mp_obj_t value) { + const bool enabled = mp_obj_is_true(value); + + common_hal_wifi_radio_set_enabled(self, enabled); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(wifi_radio_set_enabled_obj, wifi_radio_set_enabled); + const mp_obj_property_t wifi_radio_enabled_obj = { .base.type = &mp_type_property, .proxy = { (mp_obj_t)&wifi_radio_get_enabled_obj, - (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&wifi_radio_set_enabled_obj, (mp_obj_t)&mp_const_none_obj }, }; From 2f0e676fcba318bbfcd39e6c50e75d6aeb739ac6 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 3 Dec 2020 22:05:02 -0500 Subject: [PATCH 012/146] update doc per review --- shared-bindings/wifi/Radio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index d9d7dd5b53..edbd9fd2ff 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -48,7 +48,9 @@ //| //| enabled: bool -//| """True when the wifi radio is enabled.""" +//| """``True`` when the wifi radio is enabled. +//| If you set the value to ``False``, any open sockets will be closed. +//| """ //| STATIC mp_obj_t wifi_radio_get_enabled(mp_obj_t self) { return mp_obj_new_bool(common_hal_wifi_radio_get_enabled(self)); From db04582af95e27b6d7fdd94ddc11da5150585eab Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Thu, 3 Dec 2020 05:50:06 +0000 Subject: [PATCH 013/146] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (875 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 239a83037d..4ac698bd31 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-11-30 18:06+0000\n" +"PO-Revision-Date: 2020-12-04 06:29+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -868,7 +868,7 @@ msgstr "Um endereço esperado" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" -msgstr "" +msgstr "Um alarme era esperado" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -1019,7 +1019,7 @@ msgstr "O I2SOut não está disponível" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IOs 0, 2 e 4 não suportam pullup interno em repouso (sleep)" #: shared-bindings/aesio/aes.c #, c-format @@ -1324,7 +1324,7 @@ msgstr "Nenhum canal DMA encontrado" #: shared-module/busdevice/I2CDevice.c #, c-format msgid "No I2C device at address: %x" -msgstr "" +msgstr "Nenhum dispositivo I2C no endereço: %x" #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c @@ -1486,7 +1486,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "Apenas um alarme alarm.time pode ser definido." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1551,7 +1551,7 @@ msgstr "Número do PIN já está reservado através da EXTI" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "PinAlarm not yet implemented" -msgstr "" +msgstr "PinAlarm ainda não foi implementado" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1772,7 +1772,7 @@ msgstr "Forneça pelo menos um pino UART" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Forneça um de monotonic_time ou de epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" @@ -1848,7 +1848,7 @@ msgstr "A largura do bloco deve dividir exatamente com a largura do bitmap" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "O tempo está no passado." #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -2592,7 +2592,7 @@ msgstr "end_x deve ser um int" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "O epoch_time não é compatível com esta placa" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -2965,7 +2965,7 @@ msgstr "sintaxe inválida para o número" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" -msgstr "" +msgstr "O io deve ser rtc io" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3668,7 +3668,7 @@ msgstr "o trapz está definido para 1D arrays de igual tamanho" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" -msgstr "" +msgstr "nível do gatilho deve ser 0 ou 1" #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" @@ -3814,7 +3814,7 @@ msgstr "os vetores devem ter os mesmos comprimentos" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" -msgstr "" +msgstr "conflito de wakeup" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" From 11d829e20eddfbe2a8c2da29fcd4a9232031639a Mon Sep 17 00:00:00 2001 From: vkuthan Date: Fri, 4 Dec 2020 13:22:25 +0000 Subject: [PATCH 014/146] Translated using Weblate (Czech) Currently translated at 3.7% (33 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/cs/ --- locale/cs.po | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/locale/cs.po b/locale/cs.po index e8287d266f..39ea8fcd87 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-12-02 20:29+0000\n" +"PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" "Language: cs\n" @@ -22,7 +22,7 @@ msgid "" "Code done running. Waiting for reload.\n" msgstr "" "\n" -"Kód byl dokončen. Čekám na opětovné načtení.\n" +"Kód byl dokončen. Čekám na opětovné nahrání.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -58,11 +58,11 @@ msgstr "%d adresní piny a %d rgb piny označují výšku %d, nikoli %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" -msgstr "" +msgstr "Selhání %q: %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" -msgstr "%q se nyní používá" +msgstr "Používá se %q" #: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c @@ -70,11 +70,11 @@ msgstr "%q se nyní používá" #: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c #: py/objstrunicode.c msgid "%q index out of range" -msgstr "%q index je mimo rozsah" +msgstr "Index %q je mimo rozsah" #: py/obj.c msgid "%q indices must be integers, not %q" -msgstr "%q indexy musí být celá čísla, ne %q" +msgstr "Indexy %q musí být celá čísla, ne %q" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" @@ -90,11 +90,11 @@ msgstr "%q musí být >= 0" #: shared-bindings/memorymonitor/AllocationAlarm.c #: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" -msgstr " %q musí být > = 1" +msgstr "%q musí být > = 1" #: shared-module/vectorio/Polygon.c msgid "%q must be a tuple of length 2" -msgstr " %q musí být n-tice délky 2" +msgstr "%q musí být n-tice délky 2" #: shared-bindings/canio/Match.c msgid "%q out of range" @@ -102,23 +102,23 @@ msgstr "%q je mimo rozsah" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "" +msgstr "Pin %q není platný" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" -msgstr " %q by měl být int" +msgstr "%q by měl být int" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" -msgstr "" +msgstr "%q() vyžaduje %d pozičních argumentů, ale %d jich bylo zadáno" #: py/argcheck.c msgid "'%q' argument required" -msgstr "" +msgstr "Je vyžadován argument '%q'" #: py/runtime.c msgid "'%q' object cannot assign attribute '%q'" -msgstr "" +msgstr "'%q' nemůže přiřadit atribut '%q'" #: py/proto.c msgid "'%q' object does not support '%q'" From bb1b2bd787ea342ead9e2d4579a8a2cb75a71418 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 4 Dec 2020 23:14:39 +0000 Subject: [PATCH 015/146] Translated using Weblate (Swedish) Currently translated at 99.7% (873 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index db8d6a2d9d..e1795a4f20 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-11-30 18:06+0000\n" +"PO-Revision-Date: 2020-12-05 23:29+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -859,7 +859,7 @@ msgstr "Förväntade en adress" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" -msgstr "" +msgstr "Förväntade ett larm" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -1008,7 +1008,7 @@ msgstr "I2SOut är inte tillgängligt" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IO 0, 2 & 4 stöder inte intern pullup för sovläge" #: shared-bindings/aesio/aes.c #, c-format @@ -1314,7 +1314,7 @@ msgstr "Ingen DMA-kanal hittades" #: shared-module/busdevice/I2CDevice.c #, c-format msgid "No I2C device at address: %x" -msgstr "" +msgstr "Ingen I2C-enhet på adress: %x" #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c @@ -1476,7 +1476,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "Endast ett alarm.time kan ställas in." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1539,7 +1539,7 @@ msgstr "PInn-nummer redan reserverat av EXTI" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "PinAlarm not yet implemented" -msgstr "" +msgstr "PinAlarm är inte implementerat ännu" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1758,7 +1758,7 @@ msgstr "Ange minst en UART-pinne" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Ange en av monotonic_time eller epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" @@ -1833,7 +1833,7 @@ msgstr "Tile-bredd måste vara jämnt delbar med bredd på bitmap" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "Tid har passerats." #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -2566,7 +2566,7 @@ msgstr "color ska vara en int" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "epoch_time stöds inte av detta kort" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -2939,7 +2939,7 @@ msgstr "ogiltig syntax för tal" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" -msgstr "" +msgstr "io måste vara rtc io" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3635,8 +3635,9 @@ msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz är definierad för 1D-matriser med samma längd" #: ports/esp32s2/common-hal/alarm/pin/__init__.c +#, fuzzy msgid "trigger level must be 0 or 1" -msgstr "" +msgstr "triggernivå måste vara 0 eller 1" #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" @@ -3781,8 +3782,9 @@ msgid "vectors must have same lengths" msgstr "vektorer måste ha samma längd" #: ports/esp32s2/common-hal/alarm/pin/__init__.c +#, fuzzy msgid "wakeup conflict" -msgstr "" +msgstr "wakeup-konflikt" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" From 9391c8f9ddadbf8b46662f9baa9f10b8826d8b02 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 6 Dec 2020 12:00:00 -0500 Subject: [PATCH 016/146] Make ResetReason and RunReason available --- shared-bindings/alarm/__init__.c | 4 ++-- shared-bindings/microcontroller/ResetReason.c | 4 ++-- shared-bindings/microcontroller/__init__.c | 1 + shared-bindings/microcontroller/__init__.h | 1 - shared-bindings/supervisor/__init__.c | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index c983130a19..a1f1a2f8c2 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -125,8 +125,8 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OB //| //| If no alarms are specified, the microcontroller will deep sleep until reset. //| -//| **If CircuitPython is connected to a host computer, `alarm.exit_and_deep_sleep_until_alarms()` -//| then the connection will be maintained, and the system will not go into deep sleep.** +//| **If CircuitPython is connected to a host computer, the connection will be maintained, +//| and the system will not go into deep sleep.** //| This allows the user to interrupt an existing program with ctrl-C, //| and to edit the files in CIRCUITPY, which would not be possible in true deep sleep. //| Thus, to use deep sleep and save significant power, you will need to disconnect from the host. diff --git a/shared-bindings/microcontroller/ResetReason.c b/shared-bindings/microcontroller/ResetReason.c index 61891934ae..1750e55204 100644 --- a/shared-bindings/microcontroller/ResetReason.c +++ b/shared-bindings/microcontroller/ResetReason.c @@ -72,6 +72,6 @@ MAKE_ENUM_MAP(mcu_reset_reason) { }; STATIC MP_DEFINE_CONST_DICT(mcu_reset_reason_locals_dict, mcu_reset_reason_locals_table); -MAKE_PRINTER(alarm, mcu_reset_reason); +MAKE_PRINTER(microcontroller, mcu_reset_reason); -MAKE_ENUM_TYPE(alarm, ResetReason, mcu_reset_reason); +MAKE_ENUM_TYPE(microcontroller, ResetReason, mcu_reset_reason); diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 8a77d1df5b..035587c30f 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -170,6 +170,7 @@ STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { #else { MP_ROM_QSTR(MP_QSTR_watchdog), MP_ROM_PTR(&mp_const_none_obj) }, #endif + { MP_ROM_QSTR(MP_QSTR_ResetReason), MP_ROM_PTR(&mcu_reset_reason_type) }, { MP_ROM_QSTR(MP_QSTR_RunMode), MP_ROM_PTR(&mcu_runmode_type) }, { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&mcu_pin_type) }, { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&mcu_pin_module) }, diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index ac71de4247..0dafc74c72 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -1,4 +1,3 @@ - /* * This file is part of the MicroPython project, http://micropython.org/ * diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index aaecdcbeb1..ad86030478 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -119,6 +119,7 @@ STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_set_rgb_status_brightness), MP_ROM_PTR(&supervisor_set_rgb_status_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_runtime), MP_ROM_PTR(&common_hal_supervisor_runtime_obj) }, { MP_ROM_QSTR(MP_QSTR_reload), MP_ROM_PTR(&supervisor_reload_obj) }, + { MP_ROM_QSTR(MP_QSTR_RunReason), MP_ROM_PTR(&supervisor_run_reason_type) }, { MP_ROM_QSTR(MP_QSTR_set_next_stack_limit), MP_ROM_PTR(&supervisor_set_next_stack_limit_obj) }, }; From 70827ac3da1138f3dbd4107ecb139cfbefd1846f Mon Sep 17 00:00:00 2001 From: BennyE Date: Sun, 6 Dec 2020 23:38:04 +0100 Subject: [PATCH 017/146] debug log for wifi scan, start stop --- ports/esp32s2/common-hal/wifi/__init__.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index e06038c228..48fee4500f 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -47,8 +47,15 @@ static void event_handler(void* arg, esp_event_base_t event_base, if (event_base == WIFI_EVENT) { switch (event_id) { case WIFI_EVENT_SCAN_DONE: + ESP_EARLY_LOGW(TAG, "scan"); xEventGroupSetBits(radio->event_group_handle, WIFI_SCAN_DONE_BIT); break; + case WIFI_EVENT_STA_START: + ESP_EARLY_LOGW(TAG, "start"); + break; + case WIFI_EVENT_STA_STOP: + ESP_EARLY_LOGW(TAG, "stop"); + break; case WIFI_EVENT_STA_CONNECTED: ESP_EARLY_LOGW(TAG, "connected"); break; @@ -74,8 +81,6 @@ static void event_handler(void* arg, esp_event_base_t event_base, } // Cases to handle later. - // case WIFI_EVENT_STA_START: - // case WIFI_EVENT_STA_STOP: // case WIFI_EVENT_STA_AUTHMODE_CHANGE: default: break; From 169b4875099869d5d2549e9b717516e4045428d0 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 7 Dec 2020 11:06:33 -0500 Subject: [PATCH 018/146] Include wifi.radio singleton in gc --- main.c | 8 ++++++++ ports/esp32s2/common-hal/wifi/Radio.c | 6 ++++++ ports/esp32s2/common-hal/wifi/Radio.h | 2 ++ ports/esp32s2/common-hal/wifi/__init__.c | 4 ++++ shared-bindings/wifi/__init__.h | 1 + 5 files changed, 21 insertions(+) diff --git a/main.c b/main.c index 95aeeeb81c..48c89d8adc 100755 --- a/main.c +++ b/main.c @@ -95,6 +95,10 @@ #include "common-hal/canio/CAN.h" #endif +#if CIRCUITPY_WIFI +#include "shared-bindings/wifi/__init__.h" +#endif + #if MICROPY_ENABLE_PYSTACK static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]); #endif @@ -560,6 +564,10 @@ void gc_collect(void) { common_hal_bleio_gc_collect(); #endif + #if CIRCUITPY_WIFI + common_hal_wifi_gc_collect(); + #endif + // This naively collects all object references from an approximate stack // range. gc_collect_root((void**)sp, ((uint32_t)port_stack_get_top() - sp) / sizeof(uint32_t)); diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index bc987bc1c9..49cb8ec30f 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -31,6 +31,7 @@ #include "common-hal/wifi/__init__.h" #include "lib/utils/interrupt_char.h" +#include "py/gc.h" #include "py/runtime.h" #include "shared-bindings/ipaddress/IPv4Address.h" #include "shared-bindings/wifi/ScannedNetworks.h" @@ -262,3 +263,8 @@ mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, return elapsed_time; } + +void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self) { + // Only bother to scan the actual object references. + gc_collect_ptr(self->current_scan); +} diff --git a/ports/esp32s2/common-hal/wifi/Radio.h b/ports/esp32s2/common-hal/wifi/Radio.h index c7f484eafd..1dac47016b 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.h +++ b/ports/esp32s2/common-hal/wifi/Radio.h @@ -59,4 +59,6 @@ typedef struct { uint8_t last_disconnect_reason; } wifi_radio_obj_t; +extern void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self); + #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_RADIO_H diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index e06038c228..5945f222e1 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -160,3 +160,7 @@ void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t* esp_ip_addre IP_ADDR4(esp_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]); } + +void common_hal_wifi_gc_collect(void) { + common_hal_wifi_radio_gc_collect(&common_hal_wifi_radio_obj); +} diff --git a/shared-bindings/wifi/__init__.h b/shared-bindings/wifi/__init__.h index c06ee16be7..124c0bc491 100644 --- a/shared-bindings/wifi/__init__.h +++ b/shared-bindings/wifi/__init__.h @@ -34,5 +34,6 @@ extern wifi_radio_obj_t common_hal_wifi_radio_obj; void common_hal_wifi_init(void); +void common_hal_wifi_gc_collect(void); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI___INIT___H From c7b592883313e112e777d220941ca5f5f02a658c Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 7 Dec 2020 11:47:39 -0500 Subject: [PATCH 019/146] Fix submodule desync --- ports/esp32s2/esp-idf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index 8bc19ba893..d06744f5ef 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit 8bc19ba893e5544d571a753d82b44a84799b94b1 +Subproject commit d06744f5efc382c61cbad8758107cec308feef09 From c1a2ea27cecc066e57b635e21882c60621c23964 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 7 Dec 2020 13:57:47 -0500 Subject: [PATCH 020/146] Change to config-based resets --- ports/esp32s2/common-hal/microcontroller/Pin.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index f0e850e25b..0434a6e3a0 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -44,6 +44,19 @@ STATIC uint32_t in_use[2]; bool apa102_mosi_in_use; bool apa102_sck_in_use; +STATIC void floating_gpio_reset(gpio_num_t pin_number) { + // This is the same as gpio_reset_pin(), but without the pullup. + // Note that gpio_config resets the iomatrix to GPIO_FUNC as well. + gpio_config_t cfg = { + .pin_bit_mask = BIT64(pin_number), + .mode = GPIO_MODE_DISABLE, + .pull_up_en = false, + .pull_down_en = false, + .intr_type = GPIO_INTR_DISABLE, + }; + gpio_config(&cfg); +} + void never_reset_pin_number(gpio_num_t pin_number) { if (pin_number == -1 ) { return; @@ -63,7 +76,7 @@ void reset_pin_number(gpio_num_t pin_number) { never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32); in_use[pin_number / 32] &= ~(1 << pin_number % 32); - gpio_matrix_out(pin_number, 0x100, 0, 0); + floating_gpio_reset(pin_number); #ifdef MICROPY_HW_NEOPIXEL if (pin_number == MICROPY_HW_NEOPIXEL->number) { @@ -85,7 +98,7 @@ void reset_all_pins(void) { (never_reset_pins[i / 32] & (1 << i % 32)) != 0) { continue; } - gpio_matrix_out(i, 0x100, 0, 0); + floating_gpio_reset(i); } in_use[0] = 0; in_use[1] = 0; From ac8a9625de9d554e8c4dd71852d8e994444b4ad9 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Sun, 6 Dec 2020 21:19:10 +0000 Subject: [PATCH 021/146] Translated using Weblate (Swedish) Currently translated at 100.0% (875 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index e1795a4f20..4b7a389c24 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-12-05 23:29+0000\n" +"PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -3635,7 +3635,6 @@ msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz är definierad för 1D-matriser med samma längd" #: ports/esp32s2/common-hal/alarm/pin/__init__.c -#, fuzzy msgid "trigger level must be 0 or 1" msgstr "triggernivå måste vara 0 eller 1" @@ -3782,7 +3781,6 @@ msgid "vectors must have same lengths" msgstr "vektorer måste ha samma längd" #: ports/esp32s2/common-hal/alarm/pin/__init__.c -#, fuzzy msgid "wakeup conflict" msgstr "wakeup-konflikt" From 44b56f76c4a65617e8b477eb44cb35dab8624cb9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 7 Dec 2020 16:39:54 -0800 Subject: [PATCH 022/146] Store safe mode state in the RTC. Also print backtrace before reset when DEBUG. This will help debug safe mode issues which calls reset. --- ports/esp32s2/supervisor/port.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0841081de8..6222cd2904 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -54,8 +54,11 @@ #include "peripherals/rmt.h" #include "peripherals/pcnt.h" #include "peripherals/timer.h" +#include "components/esp_rom/include/esp_rom_uart.h" #include "components/heap/include/esp_heap_caps.h" +#include "components/xtensa/include/esp_debug_helpers.h" #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" +#include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" #define HEAP_SIZE (48 * 1024) @@ -78,6 +81,11 @@ safe_mode_t port_init(void) { args.name = "CircuitPython Tick"; esp_timer_create(&args, &_tick_timer); + #ifdef DEBUG + // Send the ROM output out of the UART. This includes early logs. + esp_rom_install_channel_putc(1, esp_rom_uart_putc); + #endif + heap = NULL; never_reset_module_internal_pins(); @@ -165,6 +173,7 @@ void reset_to_bootloader(void) { } void reset_cpu(void) { + esp_backtrace_print(100); esp_restart(); } @@ -204,10 +213,11 @@ bool port_has_fixed_stack(void) { // Place the word to save just after our BSS section that gets blanked. void port_set_saved_word(uint32_t value) { + REG_WRITE(RTC_CNTL_STORE0_REG, value); } uint32_t port_get_saved_word(void) { - return 0; + return REG_READ(RTC_CNTL_STORE0_REG); } uint64_t port_get_raw_ticks(uint8_t* subticks) { From 571c063c2a9059a6957d5dae1d90702d0b5bd879 Mon Sep 17 00:00:00 2001 From: Bruce Segal Date: Mon, 7 Dec 2020 17:57:54 -0800 Subject: [PATCH 023/146] Working, tested with two i2c busses --- ports/esp32s2/common-hal/busio/I2C.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c index 6f19531288..772262d0a5 100644 --- a/ports/esp32s2/common-hal/busio/I2C.c +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -49,11 +49,11 @@ void never_reset_i2c(i2c_port_t num) { void i2c_reset(void) { for (i2c_port_t num = 0; num < I2C_NUM_MAX; num++) { if (i2c_status[num] == STATUS_IN_USE) { - i2c_driver_delete(num); i2c_status[num] = STATUS_FREE; } } } +static bool i2c_inited[I2C_NUM_MAX]; void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda, uint32_t frequency, uint32_t timeout) { @@ -121,13 +121,19 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, if (result != ESP_OK) { mp_raise_ValueError(translate("Invalid pins")); } - result = i2c_driver_install(self->i2c_num, - I2C_MODE_MASTER, - 0, - 0, - 0); - if (result != ESP_OK) { - mp_raise_OSError(MP_EIO); + + + if (!i2c_inited[self->i2c_num]) { + result = i2c_driver_install(self->i2c_num, + I2C_MODE_MASTER, + 0, + 0, + 0); + if (result != ESP_OK) { + mp_raise_OSError(MP_EIO); + } + i2c_inited[self->i2c_num] = true; + } claim_pin(sda); @@ -143,7 +149,6 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) { return; } - i2c_driver_delete(self->i2c_num); i2c_status[self->i2c_num] = STATUS_FREE; common_hal_reset_pin(self->sda_pin); From fc23a0cc8ac40115047c2430c700c0832ba979eb Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 8 Dec 2020 11:30:00 +0530 Subject: [PATCH 024/146] implement ota module --- ports/esp32s2/common-hal/ota/__init__.c | 31 +++++++++++++++ ports/esp32s2/mpconfigport.mk | 1 + py/circuitpy_defns.mk | 4 ++ py/circuitpy_mpconfig.h | 8 ++++ py/circuitpy_mpconfig.mk | 3 ++ shared-bindings/ota/__init__.c | 51 +++++++++++++++++++++++++ shared-bindings/ota/__init__.h | 34 +++++++++++++++++ 7 files changed, 132 insertions(+) create mode 100644 ports/esp32s2/common-hal/ota/__init__.c create mode 100644 shared-bindings/ota/__init__.c create mode 100644 shared-bindings/ota/__init__.h diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c new file mode 100644 index 0000000000..87daffa568 --- /dev/null +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -0,0 +1,31 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/ota/__init__.h" + +void common_hal_ota_flash(const void *buf, const size_t len) { + +} diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index b3b2a6d700..da231107fb 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -23,6 +23,7 @@ CIRCUITPY_FREQUENCYIO = 1 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 1 CIRCUITPY_NVM = 1 +CIRCUITPY_OTA = 1 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index e9253682e0..68e806d4b2 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -205,6 +205,9 @@ endif ifeq ($(CIRCUITPY_OS),1) SRC_PATTERNS += os/% endif +ifeq ($(CIRCUITPY_OTA),1) +SRC_PATTERNS += ota/% +endif ifeq ($(CIRCUITPY_PIXELBUF),1) SRC_PATTERNS += _pixelbuf/% endif @@ -347,6 +350,7 @@ SRC_COMMON_HAL_ALL = \ nvm/ByteArray.c \ nvm/__init__.c \ os/__init__.c \ + ota/__init__.c \ ps2io/Ps2.c \ ps2io/__init__.c \ pulseio/PulseIn.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index f04112bfcd..b432757b33 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -539,6 +539,13 @@ extern const struct _mp_obj_module_t os_module; #define OS_MODULE_ALT_NAME #endif +#if CIRCUITPY_OTA +extern const struct _mp_obj_module_t ota_module; +#define OTA_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_ota), (mp_obj_t)&ota_module }, +#else +#define OTA_MODULE +#endif + #if CIRCUITPY_PEW extern const struct _mp_obj_module_t pew_module; #define PEW_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__pew),(mp_obj_t)&pew_module }, @@ -827,6 +834,7 @@ extern const struct _mp_obj_module_t wifi_module; NETWORK_MODULE \ SOCKET_MODULE \ WIZNET_MODULE \ + OTA_MODULE \ PEW_MODULE \ PIXELBUF_MODULE \ PS2IO_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 370f133739..09074bf53c 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -179,6 +179,9 @@ CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM) CIRCUITPY_OS ?= 1 CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS) +CIRCUITPY_OTA ?= 0 +CFLAGS += -DCIRCUITPY_OTA=$(CIRCUITPY_OTA) + CIRCUITPY_PIXELBUF ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF) diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c new file mode 100644 index 0000000000..a6c0424865 --- /dev/null +++ b/shared-bindings/ota/__init__.c @@ -0,0 +1,51 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/ota/__init__.h" + +//| """ota module +//| +//| The `ota` module implements over-the-air update.""" + +STATIC mp_obj_t ota_flash(mp_obj_t program_binary_in) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(program_binary_in, &bufinfo, MP_BUFFER_READ); + + common_hal_ota_flash(bufinfo.buf, bufinfo.len); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(ota_flash_obj, ota_flash); + +STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, + { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(ota_module_globals, ota_module_globals_table); + +const mp_obj_module_t ota_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&ota_module_globals, +}; diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h new file mode 100644 index 0000000000..c4b40b2af3 --- /dev/null +++ b/shared-bindings/ota/__init__.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H + +#include "py/runtime.h" + +extern void common_hal_ota_flash(const void *buf, const size_t len); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H From 602243748bdf238ff16ffc8977e6cc18b4357dcc Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 8 Dec 2020 11:45:00 +0530 Subject: [PATCH 025/146] add ota support for esp32s2 --- locale/circuitpython.pot | 13 ++- ports/esp32s2/Makefile | 2 + ports/esp32s2/common-hal/ota/__init__.c | 101 +++++++++++++++++++++++- 3 files changed, 111 insertions(+), 5 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b136e9dd26..5bf95043a6 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 10:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -498,8 +498,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1296,7 +1296,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1420,6 +1420,10 @@ msgstr "" msgid "Not settable" msgstr "" +#: ports/esp32s2/common-hal/ota/__init__.c +msgid "OTA Update Failed" +msgstr "" + #: shared-bindings/util.c msgid "" "Object has been deinitialized and can no longer be used. Create a new object." @@ -1503,6 +1507,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 4486cb598c..ce0a4825d3 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -106,6 +106,8 @@ INC += -isystem esp-idf/components/heap/include INC += -isystem esp-idf/components/esp_system/include INC += -isystem esp-idf/components/spi_flash/include INC += -isystem esp-idf/components/nvs_flash/include +INC += -isystem esp-idf/components/app_update/include +INC += -isystem esp-idf/components/bootloader_support/include INC += -I$(BUILD)/esp-idf/config CFLAGS += -DHAVE_CONFIG_H \ diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 87daffa568..727b6b107b 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -26,6 +26,105 @@ #include "shared-bindings/ota/__init__.h" -void common_hal_ota_flash(const void *buf, const size_t len) { +#include +#include "esp_log.h" +#include "esp_ota_ops.h" + +static const char *TAG = "OTA"; + +static void __attribute__((noreturn)) task_fatal_error(void) { + ESP_LOGE(TAG, "Exiting task due to fatal error..."); + mp_raise_RuntimeError(translate("OTA Update Failed")); +} + +void common_hal_ota_flash(const void *buf, const size_t len) { + esp_err_t err; + /* update handle : set by esp_ota_begin(), must be freed via esp_ota_end() */ + esp_ota_handle_t update_handle = 0 ; + const esp_partition_t *update_partition = NULL; + + ESP_LOGI(TAG, "Starting update"); + + const esp_partition_t *configured = esp_ota_get_boot_partition(); + const esp_partition_t *running = esp_ota_get_running_partition(); + + if (configured != running) { + ESP_LOGW(TAG, "Configured OTA boot partition at offset 0x%08x, but running from offset 0x%08x", + configured->address, running->address); + ESP_LOGW(TAG, "(This can happen if either the OTA boot data or preferred boot image become corrupted somehow.)"); + } + ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", + running->type, running->subtype, running->address); + + update_partition = esp_ota_get_next_update_partition(NULL); + ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08x)\n", + update_partition->type, update_partition->subtype, update_partition->address); + assert(update_partition != NULL); + + + if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { + // check current version with downloading + esp_app_desc_t new_app_info; + memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); + ESP_LOGI(TAG, "New firmware version: %s", new_app_info.version); + + esp_app_desc_t running_app_info; + if (esp_ota_get_partition_description(running, &running_app_info) == ESP_OK) { + ESP_LOGI(TAG, "Running firmware version: %s", running_app_info.version); + } + + const esp_partition_t* last_invalid_app = esp_ota_get_last_invalid_partition(); + esp_app_desc_t invalid_app_info; + if (esp_ota_get_partition_description(last_invalid_app, &invalid_app_info) == ESP_OK) { + ESP_LOGI(TAG, "Last invalid firmware version: %s", invalid_app_info.version); + } + + // check current version with last invalid partition + if (last_invalid_app != NULL) { + if (memcmp(invalid_app_info.version, new_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "New version is the same as invalid version."); + ESP_LOGW(TAG, "Previously, there was an attempt to launch the firmware with %s version, but it failed.", invalid_app_info.version); + ESP_LOGW(TAG, "The firmware has been rolled back to the previous version."); + task_fatal_error(); + } + } + + if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "Current running version is the same as a new. We will not continue the update."); + task_fatal_error(); + } + + err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); + task_fatal_error(); + } + ESP_LOGI(TAG, "esp_ota_begin succeeded"); + } else { + ESP_LOGE(TAG, "received package is not fit len"); + task_fatal_error(); + } + + err = esp_ota_write( update_handle, buf, len); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_write failed (%s)", esp_err_to_name(err)); + task_fatal_error(); + } + ESP_LOGI(TAG, "Total Write binary data length: %d", len); + + err = esp_ota_end(update_handle); + if (err != ESP_OK) { + if (err == ESP_ERR_OTA_VALIDATE_FAILED) { + ESP_LOGE(TAG, "Image validation failed, image is corrupted"); + } + ESP_LOGE(TAG, "esp_ota_end failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); + } + + err = esp_ota_set_boot_partition(update_partition); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); + } } From 2f95c94ad838f25ad96162435b8abab098484bde Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 8 Dec 2020 18:00:58 +0530 Subject: [PATCH 026/146] esp32s2 - update common_hal_mcu_reset --- ports/esp32s2/common-hal/microcontroller/__init__.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index b7bea4e6b8..e425cbf543 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -74,8 +74,7 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { void common_hal_mcu_reset(void) { filesystem_flush(); //TODO: implement as part of flash improvements - // NVIC_SystemReset(); - while(1); + esp_restart(); } // The singleton microcontroller.Processor object, bound to microcontroller.cpu From 2c546ab768e82accbf6c3ed9a7fe3ce8ddcb9456 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Tue, 8 Dec 2020 15:54:34 +0100 Subject: [PATCH 027/146] Remove warning about lack of support on M0 from rotaryio It seems that this warning no longer applies. --- shared-bindings/rotaryio/__init__.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/shared-bindings/rotaryio/__init__.c b/shared-bindings/rotaryio/__init__.c index fd8578753d..cd967baa42 100644 --- a/shared-bindings/rotaryio/__init__.c +++ b/shared-bindings/rotaryio/__init__.c @@ -39,8 +39,6 @@ //| `Wikipedia's Rotary Encoder page `_ for more //| background. //| -//| .. warning:: This module is not available in some SAMD21 (aka M0) builds. See the :ref:`module-support-matrix` for more info. -//| //| All classes change hardware state and should be deinitialized when they //| are no longer needed if the program continues after use. To do so, either //| call :py:meth:`!deinit` or use a context manager. See From 40118bcf57f026fd6a58733501c759a9ba87e835 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 2 Dec 2020 18:05:29 -0800 Subject: [PATCH 028/146] Add `board_deinit` for use with sleep This changes lots of files to unify `board.h` across ports. It adds `board_deinit` when CIRCUITPY_ALARM is set. `main.c` uses it to deinit the board before deep sleeping (even when pretending.) Deep sleep is now a two step process for the port. First, the port should prepare to deep sleep based on the given alarms. It should set alarms for both deep and pretend sleep. In particular, the pretend versions should be set immediately so that we don't miss an alarm as we shutdown. These alarms should also wake from `port_idle_until_interrupt` which is used when pretending to deep sleep. Second, when real deep sleeping, `alarm_enter_deep_sleep` is called. The port should set any alarms it didn't during prepare based on data it saved internally during prepare. ESP32-S2 sleep is a bit reorganized to locate more logic with TimeAlarm. This will help it scale to more alarm types. Fixes #3786 --- Makefile | 2 +- locale/circuitpython.pot | 19 ++- main.c | 76 +++++++-- .../atmel-samd/boards/8086_commander/board.c | 2 +- .../boards/aloriumtech_evo_m51/board.c | 2 +- .../atmel-samd/boards/arduino_mkr1300/board.c | 2 +- .../atmel-samd/boards/arduino_mkrzero/board.c | 2 +- .../boards/arduino_nano_33_iot/board.c | 2 +- ports/atmel-samd/boards/arduino_zero/board.c | 2 +- .../boards/bast_pro_mini_m0/board.c | 2 +- .../boards/bdmicro_vina_d21/board.c | 2 +- .../boards/bdmicro_vina_d51/board.c | 2 +- ports/atmel-samd/boards/blm_badge/board.c | 4 +- ports/atmel-samd/boards/board.h | 47 ------ .../boards/capablerobot_usbhub/board.c | 2 +- .../atmel-samd/boards/catwan_usbstick/board.c | 2 +- .../boards/circuitbrains_basic_m0/board.c | 2 +- .../boards/circuitbrains_deluxe_m4/board.c | 2 +- .../boards/circuitplayground_express/board.c | 4 +- .../circuitplayground_express_crickit/board.c | 4 +- .../board.c | 4 +- ports/atmel-samd/boards/cp32-m4/board.c | 2 +- ports/atmel-samd/boards/cp_sapling_m0/board.c | 2 +- .../boards/cp_sapling_m0_spiflash/board.c | 2 +- .../atmel-samd/boards/datalore_ip_m4/board.c | 2 +- .../atmel-samd/boards/datum_distance/board.c | 2 +- ports/atmel-samd/boards/datum_imu/board.c | 2 +- ports/atmel-samd/boards/datum_light/board.c | 2 +- ports/atmel-samd/boards/datum_weather/board.c | 2 +- .../boards/dynossat_edu_eps/board.c | 2 +- .../boards/dynossat_edu_obc/board.c | 2 +- .../boards/escornabot_makech/board.c | 2 +- .../boards/feather_m0_adalogger/board.c | 2 +- .../boards/feather_m0_basic/board.c | 2 +- .../boards/feather_m0_express/board.c | 2 +- .../boards/feather_m0_express_crickit/board.c | 2 +- .../boards/feather_m0_rfm69/board.c | 2 +- .../boards/feather_m0_rfm9x/board.c | 2 +- .../boards/feather_m0_supersized/board.c | 2 +- .../atmel-samd/boards/feather_m4_can/board.c | 2 +- .../boards/feather_m4_express/board.c | 2 +- .../boards/feather_radiofruit_zigbee/board.c | 2 +- ports/atmel-samd/boards/fluff_m0/board.c | 2 +- ports/atmel-samd/boards/gemma_m0/board.c | 2 +- .../boards/grandcentral_m4_express/board.c | 2 +- .../boards/hallowing_m0_express/board.c | 2 +- .../boards/hallowing_m0_express/pins.c | 2 +- .../boards/hallowing_m4_express/board.c | 2 +- .../boards/itsybitsy_m0_express/board.c | 2 +- .../boards/itsybitsy_m4_express/board.c | 2 +- .../atmel-samd/boards/kicksat-sprite/board.c | 2 +- ports/atmel-samd/boards/kicksat-sprite/pins.c | 2 +- .../boards/loc_ber_m4_base_board/board.c | 2 +- .../atmel-samd/boards/matrixportal_m4/board.c | 2 +- ports/atmel-samd/boards/meowmeow/board.c | 2 +- .../boards/metro_m0_express/board.c | 2 +- .../boards/metro_m4_airlift_lite/board.c | 2 +- .../boards/metro_m4_express/board.c | 2 +- ports/atmel-samd/boards/mini_sam_m4/board.c | 2 +- ports/atmel-samd/boards/monster_m4sk/board.c | 2 +- ports/atmel-samd/boards/monster_m4sk/pins.c | 2 +- .../atmel-samd/boards/ndgarage_ndbit6/board.c | 2 +- .../boards/ndgarage_ndbit6_v2/board.c | 2 +- ports/atmel-samd/boards/nfc_copy_cat/board.c | 2 +- ports/atmel-samd/boards/openbook_m4/board.c | 2 +- ports/atmel-samd/boards/openbook_m4/pins.c | 2 +- ports/atmel-samd/boards/pewpew10/board.c | 2 +- ports/atmel-samd/boards/pewpew_m4/board.c | 2 +- ports/atmel-samd/boards/picoplanet/board.c | 2 +- ports/atmel-samd/boards/pirkey_m0/board.c | 2 +- ports/atmel-samd/boards/pybadge/board.c | 4 +- ports/atmel-samd/boards/pybadge/pins.c | 2 +- .../atmel-samd/boards/pybadge_airlift/board.c | 4 +- .../atmel-samd/boards/pybadge_airlift/pins.c | 2 +- ports/atmel-samd/boards/pycubed/board.c | 2 +- ports/atmel-samd/boards/pycubed/pins.c | 2 +- ports/atmel-samd/boards/pycubed_mram/board.c | 2 +- ports/atmel-samd/boards/pycubed_mram/pins.c | 2 +- ports/atmel-samd/boards/pygamer/board.c | 4 +- ports/atmel-samd/boards/pygamer/pins.c | 2 +- .../atmel-samd/boards/pygamer_advance/board.c | 4 +- .../atmel-samd/boards/pygamer_advance/pins.c | 2 +- ports/atmel-samd/boards/pyportal/board.c | 2 +- ports/atmel-samd/boards/pyportal/pins.c | 2 +- .../atmel-samd/boards/pyportal_titano/board.c | 2 +- .../atmel-samd/boards/pyportal_titano/pins.c | 2 +- ports/atmel-samd/boards/pyruler/board.c | 2 +- ports/atmel-samd/boards/qtpy_m0/board.c | 2 +- .../boards/qtpy_m0_haxpress/board.c | 2 +- ports/atmel-samd/boards/robohatmm1_m4/board.c | 2 +- ports/atmel-samd/boards/sam32/board.c | 2 +- .../atmel-samd/boards/same54_xplained/board.c | 2 +- .../boards/seeeduino_wio_terminal/board.c | 2 +- .../atmel-samd/boards/seeeduino_xiao/board.c | 2 +- ports/atmel-samd/boards/serpente/board.c | 2 +- ports/atmel-samd/boards/shirtty/board.c | 2 +- ports/atmel-samd/boards/snekboard/board.c | 2 +- .../boards/sparkfun_lumidrive/board.c | 2 +- .../sparkfun_qwiic_micro_no_flash/board.c | 2 +- .../sparkfun_qwiic_micro_with_flash/board.c | 2 +- .../boards/sparkfun_redboard_turbo/board.c | 2 +- .../boards/sparkfun_samd21_dev/board.c | 2 +- .../boards/sparkfun_samd21_mini/board.c | 2 +- .../boards/sparkfun_samd51_thing_plus/board.c | 2 +- .../boards/stringcar_m0_express/board.c | 2 +- .../boards/trellis_m4_express/board.c | 2 +- ports/atmel-samd/boards/trinket_m0/board.c | 2 +- .../boards/trinket_m0_haxpress/board.c | 2 +- ports/atmel-samd/boards/uartlogger2/board.c | 2 +- ports/atmel-samd/boards/uchip/board.c | 2 +- ports/atmel-samd/boards/ugame10/board.c | 2 +- .../winterbloom_big_honking_button/board.c | 2 +- .../atmel-samd/boards/winterbloom_sol/board.c | 2 +- ports/atmel-samd/boards/xinabox_cc03/board.c | 2 +- ports/atmel-samd/boards/xinabox_cs11/board.c | 2 +- ports/atmel-samd/common-hal/busio/SPI.c | 2 +- ports/atmel-samd/common-hal/sdioio/SDCard.c | 1 - ports/atmel-samd/supervisor/port.c | 4 +- ports/cxd56/boards/board.h | 45 ------ ports/cxd56/boards/spresense/board.c | 2 +- ports/cxd56/supervisor/port.c | 4 +- .../adafruit_magtag_2.9_grayscale/board.c | 22 ++- .../boards/adafruit_metro_esp32s2/board.c | 5 +- .../boards/electroniccats_bastwifi/board.c | 5 +- .../esp32s2/boards/espressif_kaluga_1/board.c | 5 +- .../boards/espressif_saola_1_wroom/board.c | 5 +- .../boards/espressif_saola_1_wrover/board.c | 5 +- .../esp32s2/boards/microdev_micro_s2/board.c | 5 +- .../boards/muselab_nanoesp32_s2/board.c | 5 +- .../boards/targett_module_clip_wroom/board.c | 5 +- .../boards/targett_module_clip_wrover/board.c | 5 +- .../boards/unexpectedmaker_feathers2/board.c | 5 +- .../board.c | 5 +- ports/esp32s2/common-hal/alarm/__init__.c | 150 ++++++------------ .../esp32s2/common-hal/alarm/time/TimeAlarm.c | 64 ++++++++ .../esp32s2/common-hal/alarm/time/TimeAlarm.h | 7 + ports/esp32s2/common-hal/busio/SPI.c | 1 - ports/esp32s2/supervisor/port.c | 24 +-- ports/litex/boards/board.h | 45 ------ ports/litex/boards/fomu/board.c | 3 +- ports/litex/supervisor/port.c | 4 +- ports/mimxrt10xx/board.h | 1 + .../mimxrt10xx/boards/feather_m7_1011/board.c | 3 +- .../boards/feather_m7_1011/flash_config.c | 4 +- .../mimxrt10xx/boards/feather_m7_1011/pins.c | 2 +- .../boards/feather_mimxrt1011/board.c | 3 +- .../boards/feather_mimxrt1011/flash_config.c | 4 +- .../boards/feather_mimxrt1011/pins.c | 2 +- .../boards/feather_mimxrt1062/board.c | 3 +- .../boards/feather_mimxrt1062/flash_config.c | 3 +- .../boards/feather_mimxrt1062/pins.c | 2 +- .../boards/{board.h => flash_config.h} | 20 +-- ports/mimxrt10xx/boards/imxrt1010_evk/board.c | 3 +- .../boards/imxrt1010_evk/flash_config.c | 3 +- ports/mimxrt10xx/boards/imxrt1010_evk/pins.c | 2 +- ports/mimxrt10xx/boards/imxrt1020_evk/board.c | 3 +- .../boards/imxrt1020_evk/flash_config.c | 3 +- ports/mimxrt10xx/boards/imxrt1020_evk/pins.c | 2 +- ports/mimxrt10xx/boards/imxrt1060_evk/board.c | 3 +- .../boards/imxrt1060_evk/flash_config.c | 3 +- ports/mimxrt10xx/boards/imxrt1060_evk/pins.c | 2 +- ports/mimxrt10xx/boards/metro_m7_1011/board.c | 3 +- .../boards/metro_m7_1011/flash_config.c | 3 +- ports/mimxrt10xx/boards/metro_m7_1011/pins.c | 2 +- ports/mimxrt10xx/boards/teensy40/board.c | 3 +- .../mimxrt10xx/boards/teensy40/flash_config.c | 3 +- ports/mimxrt10xx/boards/teensy40/pins.c | 2 +- ports/mimxrt10xx/boards/teensy41/board.c | 3 +- .../mimxrt10xx/boards/teensy41/flash_config.c | 3 +- ports/mimxrt10xx/boards/teensy41/pins.c | 2 +- .../supervisor/flexspi_nor_flash_ops.c | 2 +- ports/mimxrt10xx/supervisor/internal_flash.c | 2 +- ports/mimxrt10xx/supervisor/port.c | 4 +- ports/nrf/boards/ADM_B_NRF52840_1/board.c | 2 +- ports/nrf/boards/TG-Watch02A/board.c | 2 +- ports/nrf/boards/aramcon_badge_2019/board.c | 2 +- ports/nrf/boards/arduino_nano_33_ble/board.c | 2 +- .../bless_dev_board_multi_sensor/board.c | 2 +- ports/nrf/boards/board.h | 45 ------ .../circuitplayground_bluefruit/board.c | 4 +- .../nrf/boards/clue_nrf52840_express/board.c | 2 +- ports/nrf/boards/clue_nrf52840_express/pins.c | 2 +- ports/nrf/boards/electronut_labs_blip/board.c | 2 +- .../nrf/boards/electronut_labs_papyr/board.c | 2 +- .../boards/feather_bluefruit_sense/board.c | 2 +- .../boards/feather_nrf52840_express/board.c | 2 +- ports/nrf/boards/hiibot_bluefi/board.c | 2 +- ports/nrf/boards/hiibot_bluefi/pins.c | 2 +- ports/nrf/boards/ikigaisense_vita/board.c | 2 +- .../boards/itsybitsy_nrf52840_express/board.c | 2 +- .../boards/makerdiary_m60_keyboard/board.c | 2 +- .../nrf/boards/makerdiary_m60_keyboard/pins.c | 2 +- .../makerdiary_nrf52840_m2_devkit/board.c | 2 +- .../makerdiary_nrf52840_m2_devkit/pins.c | 2 +- .../boards/makerdiary_nrf52840_mdk/board.c | 2 +- .../board.c | 2 +- .../nrf/boards/metro_nrf52840_express/board.c | 2 +- ports/nrf/boards/nice_nano/board.c | 2 +- ports/nrf/boards/ohs2020_badge/board.c | 2 +- ports/nrf/boards/particle_argon/board.c | 2 +- ports/nrf/boards/particle_boron/board.c | 2 +- ports/nrf/boards/particle_xenon/board.c | 2 +- ports/nrf/boards/pca10056/board.c | 2 +- ports/nrf/boards/pca10059/board.c | 2 +- ports/nrf/boards/pca10100/board.c | 2 +- ports/nrf/boards/pitaya_go/board.c | 2 +- ports/nrf/boards/raytac_mdbt50q-db-40/board.c | 2 +- ports/nrf/boards/simmel/board.c | 2 +- .../nrf/boards/sparkfun_nrf52840_mini/board.c | 2 +- ports/nrf/boards/teknikio_bluebird/board.c | 2 +- .../tinkeringtech_scoutmakes_azul/board.c | 2 +- ports/nrf/supervisor/port.c | 4 +- ports/stm/boards/board.h | 45 ------ ports/stm/boards/espruino_pico/board.c | 2 +- ports/stm/boards/espruino_wifi/board.c | 2 +- .../boards/feather_stm32f405_express/board.c | 2 +- ports/stm/boards/meowbit_v121/board.c | 2 +- ports/stm/boards/nucleo_f746zg/board.c | 2 +- ports/stm/boards/nucleo_f767zi/board.c | 2 +- ports/stm/boards/nucleo_h743zi_2/board.c | 2 +- ports/stm/boards/openmv_h7/board.c | 2 +- ports/stm/boards/pyb_nano_v2/board.c | 2 +- ports/stm/boards/pyboard_v11/board.c | 2 +- .../stm/boards/stm32f411ce_blackpill/board.c | 2 +- .../stm/boards/stm32f411ve_discovery/board.c | 2 +- .../stm/boards/stm32f412zg_discovery/board.c | 2 +- ports/stm/boards/stm32f4_discovery/board.c | 2 +- ports/stm/boards/stm32f746g_discovery/board.c | 2 +- ports/stm/boards/thunderpack_v11/board.c | 2 +- ports/stm/boards/thunderpack_v12/board.c | 2 +- ports/stm/common-hal/busio/SPI.c | 2 +- ports/stm/common-hal/sdioio/SDCard.c | 2 +- ports/stm/supervisor/port.c | 4 +- py/circuitpy_mpconfig.h | 6 + shared-bindings/alarm/__init__.c | 44 ++--- shared-bindings/alarm/__init__.h | 17 +- {ports/esp32s2/boards => supervisor}/board.h | 22 ++- supervisor/port.h | 9 +- supervisor/shared/board.c | 19 ++- supervisor/shared/board.h | 14 +- supervisor/shared/tick.c | 4 +- 241 files changed, 590 insertions(+), 675 deletions(-) delete mode 100644 ports/atmel-samd/boards/board.h delete mode 100644 ports/cxd56/boards/board.h delete mode 100644 ports/litex/boards/board.h create mode 100644 ports/mimxrt10xx/board.h rename ports/mimxrt10xx/boards/{board.h => flash_config.h} (75%) delete mode 100644 ports/nrf/boards/board.h delete mode 100644 ports/stm/boards/board.h rename {ports/esp32s2/boards => supervisor}/board.h (77%) diff --git a/Makefile b/Makefile index e553b85e8b..a1807c308f 100644 --- a/Makefile +++ b/Makefile @@ -265,7 +265,7 @@ update-frozen-libraries: @echo "Updating all frozen libraries to latest tagged version." cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done -one-of-each: samd21 samd51 esp32s2 litex mimxrt10xx nrf stm +one-of-each: samd21 litex mimxrt10xx nrf stm samd21: $(MAKE) -C ports/atmel-samd BOARD=trinket_m0 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b136e9dd26..11ca8c8140 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -498,8 +498,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1296,7 +1296,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1503,6 +1503,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1555,7 +1556,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2026,6 +2031,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/main.c b/main.c index 48c89d8adc..9eb4787299 100755 --- a/main.c +++ b/main.c @@ -46,6 +46,7 @@ #include "background.h" #include "mpconfigboard.h" #include "supervisor/background_callback.h" +#include "supervisor/board.h" #include "supervisor/cpu.h" #include "supervisor/filesystem.h" #include "supervisor/memory.h" @@ -64,8 +65,6 @@ #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/supervisor/Runtime.h" -#include "boards/board.h" - #if CIRCUITPY_ALARM #include "shared-bindings/alarm/__init__.h" #endif @@ -303,13 +302,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (result.return_code & PYEXEC_FORCED_EXIT) { return reload_requested; } - - #if CIRCUITPY_ALARM - if (result.return_code & PYEXEC_DEEP_SLEEP) { - common_hal_alarm_enter_deep_sleep(); - // Does not return. - } - #endif } // Program has finished running. @@ -326,24 +318,47 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { rgb_status_animation_t animation; prep_rgb_status_animation(&result, found_main, safe_mode, &animation); + bool asleep = false; while (true) { - RUN_BACKGROUND_TASKS; if (reload_requested) { + #if CIRCUITPY_ALARM + if (asleep) { + board_init(); + } + #endif supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD); reload_requested = false; return true; } if (serial_connected() && serial_bytes_available()) { + #if CIRCUITPY_ALARM + if (asleep) { + board_init(); + } + #endif // Skip REPL if reload was requested. bool ctrl_d = serial_read() == CHAR_CTRL_D; if (ctrl_d) { supervisor_set_run_reason(RUN_REASON_REPL_RELOAD); } - return (ctrl_d); + return ctrl_d; } + // Check for a deep sleep alarm and restart the VM. This can happen if + // an alarm alerts faster than our USB delay or if we pretended to deep + // sleep. + #if CIRCUITPY_ALARM + if (asleep && alarm_woken_from_sleep()) { + serial_write_compressed(translate("Woken up by alarm.\n")); + board_init(); + supervisor_set_run_reason(RUN_REASON_STARTUP); + // TODO: Reset any volatile memory the user may have access to. + return true; + } + #endif + if (!serial_connected_before_animation && serial_connected()) { if (!serial_connected_at_start) { print_code_py_status_message(safe_mode); @@ -351,7 +366,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { print_safe_mode_message(safe_mode); serial_write("\n"); - serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.")); + serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.\n")); } if (serial_connected_before_animation && !serial_connected()) { serial_connected_at_start = false; @@ -360,12 +375,47 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { // Refresh the ePaper display if we have one. That way it'll show an error message. #if CIRCUITPY_DISPLAYIO + // Don't refresh the display if we're about to deep sleep. + #if CIRCUITPY_ALARM + refreshed_epaper_display = refreshed_epaper_display || result.return_code & PYEXEC_DEEP_SLEEP; + #endif if (!refreshed_epaper_display) { refreshed_epaper_display = maybe_refresh_epaperdisplay(); } #endif - tick_rgb_status_animation(&animation); + // Sleep until our next interrupt. + #if CIRCUITPY_ALARM + if (result.return_code & PYEXEC_DEEP_SLEEP) { + // Make sure we have been awake long enough for USB to connect (enumeration delay). + int64_t connecting_delay_ticks = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - port_get_raw_ticks(NULL); + if (connecting_delay_ticks > 0) { + // Set when we've waited long enough so that we wake up from the + // sleep_until_interrupt below and loop around to the real deep + // sleep in the else clause. + port_interrupt_after_ticks(connecting_delay_ticks); + // Deep sleep if we're not connected to a host. + } else if (!asleep) { + asleep = true; + new_status_color(BLACK); + board_deinit(); + if (!supervisor_workflow_active()) { + // Enter true deep sleep. When we wake up we'll be back at the + // top of main(), not in this loop. + alarm_enter_deep_sleep(); + // Does not return. + } else { + serial_write_compressed(translate("Pretending to deep sleep until alarm, any key or file write.\n")); + } + } + } + #endif + + if (!asleep) { + tick_rgb_status_animation(&animation); + } else { + port_idle_until_interrupt(); + } } } diff --git a/ports/atmel-samd/boards/8086_commander/board.c b/ports/atmel-samd/boards/8086_commander/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/8086_commander/board.c +++ b/ports/atmel-samd/boards/8086_commander/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c index 1e9ab029e2..5973eeec1b 100644 --- a/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c @@ -28,7 +28,7 @@ // Author: Bryan Craker // Date: 2020-05-20 -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/arduino_mkr1300/board.c b/ports/atmel-samd/boards/arduino_mkr1300/board.c index 770bc82593..112b173ecc 100644 --- a/ports/atmel-samd/boards/arduino_mkr1300/board.c +++ b/ports/atmel-samd/boards/arduino_mkr1300/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/arduino_mkrzero/board.c b/ports/atmel-samd/boards/arduino_mkrzero/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/arduino_mkrzero/board.c +++ b/ports/atmel-samd/boards/arduino_mkrzero/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/board.c b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c index 770bc82593..112b173ecc 100644 --- a/ports/atmel-samd/boards/arduino_nano_33_iot/board.c +++ b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/arduino_zero/board.c b/ports/atmel-samd/boards/arduino_zero/board.c index 770bc82593..112b173ecc 100644 --- a/ports/atmel-samd/boards/arduino_zero/board.c +++ b/ports/atmel-samd/boards/arduino_zero/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/board.c b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/bast_pro_mini_m0/board.c +++ b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/bdmicro_vina_d21/board.c b/ports/atmel-samd/boards/bdmicro_vina_d21/board.c index bd63baa6fd..bb1c5335c1 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d21/board.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d21/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) diff --git a/ports/atmel-samd/boards/bdmicro_vina_d51/board.c b/ports/atmel-samd/boards/bdmicro_vina_d51/board.c index bd63baa6fd..bb1c5335c1 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d51/board.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d51/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) diff --git a/ports/atmel-samd/boards/blm_badge/board.c b/ports/atmel-samd/boards/blm_badge/board.c index ee353c8108..e374899a66 100644 --- a/ports/atmel-samd/boards/blm_badge/board.c +++ b/ports/atmel-samd/boards/blm_badge/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/shared/board.h" void board_init(void) { @@ -35,5 +35,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA05, 10); } diff --git a/ports/atmel-samd/boards/board.h b/ports/atmel-samd/boards/board.h deleted file mode 100644 index 4f0ae9d728..0000000000 --- a/ports/atmel-samd/boards/board.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H -#define MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H - -#include - -#include "py/mpconfig.h" - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H diff --git a/ports/atmel-samd/boards/capablerobot_usbhub/board.c b/ports/atmel-samd/boards/capablerobot_usbhub/board.c index 46385f094f..d65582379e 100644 --- a/ports/atmel-samd/boards/capablerobot_usbhub/board.c +++ b/ports/atmel-samd/boards/capablerobot_usbhub/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/atmel-samd/boards/catwan_usbstick/board.c b/ports/atmel-samd/boards/catwan_usbstick/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/catwan_usbstick/board.c +++ b/ports/atmel-samd/boards/catwan_usbstick/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c index efafd152db..59d573ce9f 100755 --- a/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c +++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c index efafd152db..59d573ce9f 100755 --- a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c +++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/circuitplayground_express/board.c b/ports/atmel-samd/boards/circuitplayground_express/board.c index 85c37ee622..f771c214b3 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express/board.c @@ -26,7 +26,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" @@ -53,5 +53,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PB23, 10); } diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c index 21217caac9..13fed598eb 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c @@ -26,7 +26,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" #include "supervisor/shared/board.h" @@ -53,5 +53,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PB23, 10); } diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c b/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c index 21217caac9..13fed598eb 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c @@ -26,7 +26,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" #include "supervisor/shared/board.h" @@ -53,5 +53,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PB23, 10); } diff --git a/ports/atmel-samd/boards/cp32-m4/board.c b/ports/atmel-samd/boards/cp32-m4/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/cp32-m4/board.c +++ b/ports/atmel-samd/boards/cp32-m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/cp_sapling_m0/board.c b/ports/atmel-samd/boards/cp_sapling_m0/board.c index ce56366762..cde441b3d9 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0/board.c +++ b/ports/atmel-samd/boards/cp_sapling_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c index ce56366762..cde441b3d9 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/datalore_ip_m4/board.c b/ports/atmel-samd/boards/datalore_ip_m4/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/datalore_ip_m4/board.c +++ b/ports/atmel-samd/boards/datalore_ip_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/datum_distance/board.c b/ports/atmel-samd/boards/datum_distance/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/datum_distance/board.c +++ b/ports/atmel-samd/boards/datum_distance/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/datum_imu/board.c b/ports/atmel-samd/boards/datum_imu/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/datum_imu/board.c +++ b/ports/atmel-samd/boards/datum_imu/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/datum_light/board.c b/ports/atmel-samd/boards/datum_light/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/datum_light/board.c +++ b/ports/atmel-samd/boards/datum_light/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/datum_weather/board.c b/ports/atmel-samd/boards/datum_weather/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/datum_weather/board.c +++ b/ports/atmel-samd/boards/datum_weather/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/board.c b/ports/atmel-samd/boards/dynossat_edu_eps/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/board.c +++ b/ports/atmel-samd/boards/dynossat_edu_eps/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/dynossat_edu_obc/board.c b/ports/atmel-samd/boards/dynossat_edu_obc/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/dynossat_edu_obc/board.c +++ b/ports/atmel-samd/boards/dynossat_edu_obc/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/escornabot_makech/board.c b/ports/atmel-samd/boards/escornabot_makech/board.c index 881e15e0c5..5afe2fb655 100644 --- a/ports/atmel-samd/boards/escornabot_makech/board.c +++ b/ports/atmel-samd/boards/escornabot_makech/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_adalogger/board.c b/ports/atmel-samd/boards/feather_m0_adalogger/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/feather_m0_adalogger/board.c +++ b/ports/atmel-samd/boards/feather_m0_adalogger/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_basic/board.c b/ports/atmel-samd/boards/feather_m0_basic/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/feather_m0_basic/board.c +++ b/ports/atmel-samd/boards/feather_m0_basic/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_express/board.c b/ports/atmel-samd/boards/feather_m0_express/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/feather_m0_express/board.c +++ b/ports/atmel-samd/boards/feather_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/board.c b/ports/atmel-samd/boards/feather_m0_express_crickit/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/board.c +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/board.c b/ports/atmel-samd/boards/feather_m0_rfm69/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/board.c +++ b/ports/atmel-samd/boards/feather_m0_rfm69/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/board.c b/ports/atmel-samd/boards/feather_m0_rfm9x/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/board.c +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_supersized/board.c b/ports/atmel-samd/boards/feather_m0_supersized/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/board.c +++ b/ports/atmel-samd/boards/feather_m0_supersized/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m4_can/board.c b/ports/atmel-samd/boards/feather_m4_can/board.c index 8096b9b8ea..5fca974e9e 100644 --- a/ports/atmel-samd/boards/feather_m4_can/board.c +++ b/ports/atmel-samd/boards/feather_m4_can/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m4_express/board.c b/ports/atmel-samd/boards/feather_m4_express/board.c index 8096b9b8ea..5fca974e9e 100644 --- a/ports/atmel-samd/boards/feather_m4_express/board.c +++ b/ports/atmel-samd/boards/feather_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c b/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c index c8e20206a1..6baa43ffaa 100755 --- a/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c +++ b/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/fluff_m0/board.c b/ports/atmel-samd/boards/fluff_m0/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/fluff_m0/board.c +++ b/ports/atmel-samd/boards/fluff_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/gemma_m0/board.c b/ports/atmel-samd/boards/gemma_m0/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/gemma_m0/board.c +++ b/ports/atmel-samd/boards/gemma_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/grandcentral_m4_express/board.c b/ports/atmel-samd/boards/grandcentral_m4_express/board.c index 7599f02b8e..5ed8c84049 100644 --- a/ports/atmel-samd/boards/grandcentral_m4_express/board.c +++ b/ports/atmel-samd/boards/grandcentral_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c index 14a2bdb816..8b922d6bef 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-bindings/board/__init__.h" #include "shared-bindings/displayio/FourWire.h" diff --git a/ports/atmel-samd/boards/hallowing_m0_express/pins.c b/ports/atmel-samd/boards/hallowing_m0_express/pins.c index 3e670a676f..5d1dda51ac 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/pins.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/hallowing_m4_express/board.c b/ports/atmel-samd/boards/hallowing_m4_express/board.c index 61e797d652..f51d4282d3 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/board.c b/ports/atmel-samd/boards/itsybitsy_m0_express/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/itsybitsy_m0_express/board.c +++ b/ports/atmel-samd/boards/itsybitsy_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/board.c b/ports/atmel-samd/boards/itsybitsy_m4_express/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/board.c +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/kicksat-sprite/board.c b/ports/atmel-samd/boards/kicksat-sprite/board.c index 75cdfbc824..d7f78e764a 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/board.c +++ b/ports/atmel-samd/boards/kicksat-sprite/board.c @@ -27,7 +27,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/kicksat-sprite/pins.c b/ports/atmel-samd/boards/kicksat-sprite/pins.c index 87d894c589..27ee903231 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/pins.c +++ b/ports/atmel-samd/boards/kicksat-sprite/pins.c @@ -1,5 +1,5 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) }, diff --git a/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c b/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c +++ b/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/matrixportal_m4/board.c b/ports/atmel-samd/boards/matrixportal_m4/board.c index 2d4f302391..52ecd83025 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/board.c +++ b/ports/atmel-samd/boards/matrixportal_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/meowmeow/board.c b/ports/atmel-samd/boards/meowmeow/board.c index 881e15e0c5..5afe2fb655 100644 --- a/ports/atmel-samd/boards/meowmeow/board.c +++ b/ports/atmel-samd/boards/meowmeow/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/metro_m0_express/board.c b/ports/atmel-samd/boards/metro_m0_express/board.c index bd63baa6fd..bb1c5335c1 100644 --- a/ports/atmel-samd/boards/metro_m0_express/board.c +++ b/ports/atmel-samd/boards/metro_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c b/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c +++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/metro_m4_express/board.c b/ports/atmel-samd/boards/metro_m4_express/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/metro_m4_express/board.c +++ b/ports/atmel-samd/boards/metro_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/mini_sam_m4/board.c b/ports/atmel-samd/boards/mini_sam_m4/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/mini_sam_m4/board.c +++ b/ports/atmel-samd/boards/mini_sam_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/monster_m4sk/board.c b/ports/atmel-samd/boards/monster_m4sk/board.c index 45fea9d529..2b757d0914 100644 --- a/ports/atmel-samd/boards/monster_m4sk/board.c +++ b/ports/atmel-samd/boards/monster_m4sk/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/monster_m4sk/pins.c b/ports/atmel-samd/boards/monster_m4sk/pins.c index 7272b9ed86..c3eff7cc30 100644 --- a/ports/atmel-samd/boards/monster_m4sk/pins.c +++ b/ports/atmel-samd/boards/monster_m4sk/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6/board.c b/ports/atmel-samd/boards/ndgarage_ndbit6/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6/board.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/nfc_copy_cat/board.c b/ports/atmel-samd/boards/nfc_copy_cat/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/nfc_copy_cat/board.c +++ b/ports/atmel-samd/boards/nfc_copy_cat/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/openbook_m4/board.c b/ports/atmel-samd/boards/openbook_m4/board.c index 07dd1741ac..a110779a6a 100644 --- a/ports/atmel-samd/boards/openbook_m4/board.c +++ b/ports/atmel-samd/boards/openbook_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/openbook_m4/pins.c b/ports/atmel-samd/boards/openbook_m4/pins.c index 47de3043d9..45a7bc1dd0 100644 --- a/ports/atmel-samd/boards/openbook_m4/pins.c +++ b/ports/atmel-samd/boards/openbook_m4/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pewpew10/board.c b/ports/atmel-samd/boards/pewpew10/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/pewpew10/board.c +++ b/ports/atmel-samd/boards/pewpew10/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c index d02e0dc01d..26bd53cad1 100644 --- a/ports/atmel-samd/boards/pewpew_m4/board.c +++ b/ports/atmel-samd/boards/pewpew_m4/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/picoplanet/board.c b/ports/atmel-samd/boards/picoplanet/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/picoplanet/board.c +++ b/ports/atmel-samd/boards/picoplanet/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/pirkey_m0/board.c b/ports/atmel-samd/boards/pirkey_m0/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/pirkey_m0/board.c +++ b/ports/atmel-samd/boards/pirkey_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c index 35f228c75a..188bf7bf6c 100644 --- a/ports/atmel-samd/boards/pybadge/board.c +++ b/ports/atmel-samd/boards/pybadge/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" @@ -123,5 +123,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA15, 5); } diff --git a/ports/atmel-samd/boards/pybadge/pins.c b/ports/atmel-samd/boards/pybadge/pins.c index ca65d9df46..a1802bb071 100644 --- a/ports/atmel-samd/boards/pybadge/pins.c +++ b/ports/atmel-samd/boards/pybadge/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pybadge_airlift/board.c b/ports/atmel-samd/boards/pybadge_airlift/board.c index fe3e4a0171..de7eeda096 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/board.c +++ b/ports/atmel-samd/boards/pybadge_airlift/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" @@ -101,5 +101,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA15, 5); } diff --git a/ports/atmel-samd/boards/pybadge_airlift/pins.c b/ports/atmel-samd/boards/pybadge_airlift/pins.c index 9ee579be14..cdf8071da8 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/pins.c +++ b/ports/atmel-samd/boards/pybadge_airlift/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pycubed/board.c b/ports/atmel-samd/boards/pycubed/board.c index 0bf586ad8e..f092a8d20e 100644 --- a/ports/atmel-samd/boards/pycubed/board.c +++ b/ports/atmel-samd/boards/pycubed/board.c @@ -27,7 +27,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" #include "shared-bindings/nvm/ByteArray.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/atmel-samd/boards/pycubed/pins.c b/ports/atmel-samd/boards/pycubed/pins.c index e494fb54bf..93f349ffa4 100644 --- a/ports/atmel-samd/boards/pycubed/pins.c +++ b/ports/atmel-samd/boards/pycubed/pins.c @@ -1,5 +1,5 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, diff --git a/ports/atmel-samd/boards/pycubed_mram/board.c b/ports/atmel-samd/boards/pycubed_mram/board.c index 0bf586ad8e..f092a8d20e 100644 --- a/ports/atmel-samd/boards/pycubed_mram/board.c +++ b/ports/atmel-samd/boards/pycubed_mram/board.c @@ -27,7 +27,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" #include "shared-bindings/nvm/ByteArray.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/atmel-samd/boards/pycubed_mram/pins.c b/ports/atmel-samd/boards/pycubed_mram/pins.c index e494fb54bf..93f349ffa4 100644 --- a/ports/atmel-samd/boards/pycubed_mram/pins.c +++ b/ports/atmel-samd/boards/pycubed_mram/pins.c @@ -1,5 +1,5 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, diff --git a/ports/atmel-samd/boards/pygamer/board.c b/ports/atmel-samd/boards/pygamer/board.c index b478b5947c..4614e347cd 100644 --- a/ports/atmel-samd/boards/pygamer/board.c +++ b/ports/atmel-samd/boards/pygamer/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" @@ -123,5 +123,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA15, 5); } diff --git a/ports/atmel-samd/boards/pygamer/pins.c b/ports/atmel-samd/boards/pygamer/pins.c index 107d780a8a..8bfaa64792 100644 --- a/ports/atmel-samd/boards/pygamer/pins.c +++ b/ports/atmel-samd/boards/pygamer/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pygamer_advance/board.c b/ports/atmel-samd/boards/pygamer_advance/board.c index 7dfe07c00d..39bf65602e 100644 --- a/ports/atmel-samd/boards/pygamer_advance/board.c +++ b/ports/atmel-samd/boards/pygamer_advance/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" @@ -101,5 +101,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA15, 5); } diff --git a/ports/atmel-samd/boards/pygamer_advance/pins.c b/ports/atmel-samd/boards/pygamer_advance/pins.c index 653a1bb2ef..8db63f2f0c 100644 --- a/ports/atmel-samd/boards/pygamer_advance/pins.c +++ b/ports/atmel-samd/boards/pygamer_advance/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c index cd94f68875..db474a8209 100644 --- a/ports/atmel-samd/boards/pyportal/board.c +++ b/ports/atmel-samd/boards/pyportal/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/pyportal/pins.c b/ports/atmel-samd/boards/pyportal/pins.c index 461ee98da5..1a18464922 100644 --- a/ports/atmel-samd/boards/pyportal/pins.c +++ b/ports/atmel-samd/boards/pyportal/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" // This mapping only includes functional names because pins broken diff --git a/ports/atmel-samd/boards/pyportal_titano/board.c b/ports/atmel-samd/boards/pyportal_titano/board.c index dc417f5d14..59a25c4acf 100644 --- a/ports/atmel-samd/boards/pyportal_titano/board.c +++ b/ports/atmel-samd/boards/pyportal_titano/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/pyportal_titano/pins.c b/ports/atmel-samd/boards/pyportal_titano/pins.c index 461ee98da5..1a18464922 100644 --- a/ports/atmel-samd/boards/pyportal_titano/pins.c +++ b/ports/atmel-samd/boards/pyportal_titano/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" // This mapping only includes functional names because pins broken diff --git a/ports/atmel-samd/boards/pyruler/board.c b/ports/atmel-samd/boards/pyruler/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/pyruler/board.c +++ b/ports/atmel-samd/boards/pyruler/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/qtpy_m0/board.c b/ports/atmel-samd/boards/qtpy_m0/board.c index 1a65a561f7..6b948a9a7a 100644 --- a/ports/atmel-samd/boards/qtpy_m0/board.c +++ b/ports/atmel-samd/boards/qtpy_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c b/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c index 1a65a561f7..6b948a9a7a 100644 --- a/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c +++ b/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/robohatmm1_m4/board.c b/ports/atmel-samd/boards/robohatmm1_m4/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/robohatmm1_m4/board.c +++ b/ports/atmel-samd/boards/robohatmm1_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/sam32/board.c b/ports/atmel-samd/boards/sam32/board.c index e032601440..560edd9c2c 100644 --- a/ports/atmel-samd/boards/sam32/board.c +++ b/ports/atmel-samd/boards/sam32/board.c @@ -27,7 +27,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" #include "common-hal/digitalio/DigitalInOut.h" diff --git a/ports/atmel-samd/boards/same54_xplained/board.c b/ports/atmel-samd/boards/same54_xplained/board.c index 7599f02b8e..5ed8c84049 100644 --- a/ports/atmel-samd/boards/same54_xplained/board.c +++ b/ports/atmel-samd/boards/same54_xplained/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c index 49db498608..53c43cd441 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/seeeduino_xiao/board.c b/ports/atmel-samd/boards/seeeduino_xiao/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/seeeduino_xiao/board.c +++ b/ports/atmel-samd/boards/seeeduino_xiao/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/serpente/board.c b/ports/atmel-samd/boards/serpente/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/serpente/board.c +++ b/ports/atmel-samd/boards/serpente/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/shirtty/board.c b/ports/atmel-samd/boards/shirtty/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/shirtty/board.c +++ b/ports/atmel-samd/boards/shirtty/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/snekboard/board.c b/ports/atmel-samd/boards/snekboard/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/snekboard/board.c +++ b/ports/atmel-samd/boards/snekboard/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/board.c b/ports/atmel-samd/boards/sparkfun_lumidrive/board.c index c8e20206a1..6baa43ffaa 100755 --- a/ports/atmel-samd/boards/sparkfun_lumidrive/board.c +++ b/ports/atmel-samd/boards/sparkfun_lumidrive/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c b/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c index c8e20206a1..6baa43ffaa 100755 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c b/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c b/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c index 8096b9b8ea..5fca974e9e 100644 --- a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/stringcar_m0_express/board.c b/ports/atmel-samd/boards/stringcar_m0_express/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/stringcar_m0_express/board.c +++ b/ports/atmel-samd/boards/stringcar_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/trellis_m4_express/board.c b/ports/atmel-samd/boards/trellis_m4_express/board.c index a9b5f81631..e6f8b59179 100644 --- a/ports/atmel-samd/boards/trellis_m4_express/board.c +++ b/ports/atmel-samd/boards/trellis_m4_express/board.c @@ -26,7 +26,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" #include "common-hal/digitalio/DigitalInOut.h" diff --git a/ports/atmel-samd/boards/trinket_m0/board.c b/ports/atmel-samd/boards/trinket_m0/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/trinket_m0/board.c +++ b/ports/atmel-samd/boards/trinket_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/trinket_m0_haxpress/board.c b/ports/atmel-samd/boards/trinket_m0_haxpress/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/trinket_m0_haxpress/board.c +++ b/ports/atmel-samd/boards/trinket_m0_haxpress/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/uartlogger2/board.c b/ports/atmel-samd/boards/uartlogger2/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/uartlogger2/board.c +++ b/ports/atmel-samd/boards/uartlogger2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/uchip/board.c b/ports/atmel-samd/boards/uchip/board.c index 0f60736a24..7af05ba45a 100644 --- a/ports/atmel-samd/boards/uchip/board.c +++ b/ports/atmel-samd/boards/uchip/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index 9f2b8d039d..918fe2d59d 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-bindings/board/__init__.h" #include "shared-bindings/displayio/FourWire.h" diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c index c8e20206a1..6baa43ffaa 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/winterbloom_sol/board.c b/ports/atmel-samd/boards/winterbloom_sol/board.c index 8096b9b8ea..5fca974e9e 100644 --- a/ports/atmel-samd/boards/winterbloom_sol/board.c +++ b/ports/atmel-samd/boards/winterbloom_sol/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/xinabox_cc03/board.c b/ports/atmel-samd/boards/xinabox_cc03/board.c index 770bc82593..112b173ecc 100644 --- a/ports/atmel-samd/boards/xinabox_cc03/board.c +++ b/ports/atmel-samd/boards/xinabox_cc03/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/xinabox_cs11/board.c b/ports/atmel-samd/boards/xinabox_cs11/board.c index 770bc82593..112b173ecc 100644 --- a/ports/atmel-samd/boards/xinabox_cs11/board.c +++ b/ports/atmel-samd/boards/xinabox_cs11/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/common-hal/busio/SPI.c b/ports/atmel-samd/common-hal/busio/SPI.c index 189fd93b54..9646f9cf1e 100644 --- a/ports/atmel-samd/common-hal/busio/SPI.c +++ b/ports/atmel-samd/common-hal/busio/SPI.c @@ -31,7 +31,7 @@ #include "hpl_sercom_config.h" #include "peripheral_clk_config.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" #include "hal/include/hal_spi_m_sync.h" diff --git a/ports/atmel-samd/common-hal/sdioio/SDCard.c b/ports/atmel-samd/common-hal/sdioio/SDCard.c index 4d2539aa5a..14c6f29de1 100644 --- a/ports/atmel-samd/common-hal/sdioio/SDCard.c +++ b/ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -28,7 +28,6 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "boards/board.h" #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/sdioio/SDCard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index fc1d1198e2..7d02789e82 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -27,7 +27,7 @@ #include #include -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/port.h" // ASF 4 @@ -543,7 +543,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { _port_interrupt_after_ticks(ticks); } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { #ifdef SAM_D5X_E5X // Clear the FPU interrupt because it can prevent us from sleeping. if (__get_FPSCR() & ~(0x9f)) { diff --git a/ports/cxd56/boards/board.h b/ports/cxd56/boards/board.h deleted file mode 100644 index 597ae72e6a..0000000000 --- a/ports/cxd56/boards/board.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2019 Sony Semiconductor Solutions Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_CXD56_BOARDS_BOARD_H -#define MICROPY_INCLUDED_CXD56_BOARDS_BOARD_H - -#include - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_CXD56_BOARDS_BOARD_H diff --git a/ports/cxd56/boards/spresense/board.c b/ports/cxd56/boards/spresense/board.c index 2af7cfdcf2..fd27d3493a 100644 --- a/ports/cxd56/boards/spresense/board.c +++ b/ports/cxd56/boards/spresense/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/cxd56/supervisor/port.c b/ports/cxd56/supervisor/port.c index d69f357799..523d6a496b 100644 --- a/ports/cxd56/supervisor/port.c +++ b/ports/cxd56/supervisor/port.c @@ -33,7 +33,7 @@ #include "sched/sched.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/port.h" #include "supervisor/background_callback.h" @@ -169,6 +169,6 @@ void port_disable_tick(void) { void port_interrupt_after_ticks(uint32_t ticks) { } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { // TODO: Implement sleep. } diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c index ecd44e423c..a9d1074f72 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c @@ -24,7 +24,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" + #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" #include "shared-bindings/displayio/FourWire.h" @@ -32,6 +33,10 @@ #include "shared-module/displayio/__init__.h" #include "supervisor/shared/board.h" +#include "components/log/include/esp_log.h" + +static const char* TAG = "board"; + #define DELAY 0x80 // This is an ILO373 control chip. The display is a 2.9" grayscale EInk. @@ -167,3 +172,18 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { + displayio_epaperdisplay_obj_t* display = &displays[0].epaper_display; + if (display->base.type == &displayio_epaperdisplay_type) { + size_t i = 0; + while (common_hal_displayio_epaperdisplay_get_busy(display)) { + RUN_BACKGROUND_TASKS; + i++; + } + ESP_LOGI(TAG, "waited %d iterations for display", i); + } else { + ESP_LOGI(TAG, "didn't wait for display"); + } + common_hal_displayio_release_displays(); +} diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/board.c b/ports/esp32s2/boards/adafruit_metro_esp32s2/board.c index 7380be6da6..5abd1ce1b3 100644 --- a/ports/esp32s2/boards/adafruit_metro_esp32s2/board.c +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -41,3 +41,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/electroniccats_bastwifi/board.c b/ports/esp32s2/boards/electroniccats_bastwifi/board.c index 9f708874bf..ff5d9cfb6c 100644 --- a/ports/esp32s2/boards/electroniccats_bastwifi/board.c +++ b/ports/esp32s2/boards/electroniccats_bastwifi/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/espressif_kaluga_1/board.c b/ports/esp32s2/boards/espressif_kaluga_1/board.c index 9f708874bf..ff5d9cfb6c 100644 --- a/ports/esp32s2/boards/espressif_kaluga_1/board.c +++ b/ports/esp32s2/boards/espressif_kaluga_1/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c index 9f708874bf..ff5d9cfb6c 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c index 9f708874bf..ff5d9cfb6c 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/microdev_micro_s2/board.c b/ports/esp32s2/boards/microdev_micro_s2/board.c index 1dc30b5af8..abd22091ee 100644 --- a/ports/esp32s2/boards/microdev_micro_s2/board.c +++ b/ports/esp32s2/boards/microdev_micro_s2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -54,3 +54,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c b/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c index 9f708874bf..ff5d9cfb6c 100644 --- a/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c +++ b/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/targett_module_clip_wroom/board.c b/ports/esp32s2/boards/targett_module_clip_wroom/board.c index 7f5de0e0dd..c2022d292e 100644 --- a/ports/esp32s2/boards/targett_module_clip_wroom/board.c +++ b/ports/esp32s2/boards/targett_module_clip_wroom/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -49,3 +49,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/targett_module_clip_wrover/board.c b/ports/esp32s2/boards/targett_module_clip_wrover/board.c index 83dcb920a8..5a9fbcbee7 100644 --- a/ports/esp32s2/boards/targett_module_clip_wrover/board.c +++ b/ports/esp32s2/boards/targett_module_clip_wrover/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -49,3 +49,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c index 1dc30b5af8..abd22091ee 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -54,3 +54,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c index 1dc30b5af8..abd22091ee 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -54,3 +54,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 11e173fe2e..529179200d 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -32,38 +32,41 @@ #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/microcontroller/__init__.h" -#include "shared-bindings/time/__init__.h" #include "shared-bindings/wifi/__init__.h" +#include "supervisor/port.h" +#include "supervisor/shared/workflow.h" + #include "common-hal/alarm/__init__.h" -#include "esp_log.h" #include "esp_sleep.h" -STATIC mp_obj_tuple_t *_deep_sleep_alarms; - void alarm_reset(void) { - _deep_sleep_alarms = mp_const_empty_tuple; -} - -void common_hal_alarm_disable_all(void) { + alarm_time_timealarm_reset(); esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } -mp_obj_t common_hal_alarm_get_wake_alarm(void) { - switch (esp_sleep_get_wakeup_cause()) { +STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(void) { + if (alarm_time_timealarm_woke_us_up()) { + return ESP_SLEEP_WAKEUP_TIMER; + } + + return esp_sleep_get_wakeup_cause(); +} + +bool alarm_woken_from_sleep(void) { + return _get_wakeup_cause() != ESP_SLEEP_WAKEUP_UNDEFINED; +} + +STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { + switch (_get_wakeup_cause()) { case ESP_SLEEP_WAKEUP_TIMER: { - // Wake up from timer. - alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); - timer->base.type = &alarm_time_time_alarm_type; - return timer; + return alarm_time_timealarm_get_wakeup_alarm(n_alarms, alarms); } case ESP_SLEEP_WAKEUP_EXT0: { - // Wake up from GPIO - alarm_pin_pin_alarm_obj_t *ext0 = m_new_obj(alarm_pin_pin_alarm_obj_t); - ext0->base.type = &alarm_pin_pin_alarm_type; - return ext0; + // TODO: implement pin alarm wake. + break; } case ESP_SLEEP_WAKEUP_TOUCHPAD: @@ -79,16 +82,19 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { return mp_const_none; } +mp_obj_t common_hal_alarm_get_wake_alarm(void) { + return _get_wake_alarm(0, NULL); +} + // Set up light sleep or deep sleep alarms. -STATIC void setup_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { +STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { bool time_alarm_set = false; alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; for (size_t i = 0; i < n_alarms; i++) { if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { mp_raise_NotImplementedError(translate("PinAlarm not yet implemented")); - } - else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + } else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { if (time_alarm_set) { mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); } @@ -97,102 +103,50 @@ STATIC void setup_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { } } - if (time_alarm != MP_OBJ_NULL) { - // Compute how long to actually sleep, considering the time now. - mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; - mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); - const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); - ESP_LOGI("ALARM", "will sleep for us: %lld", sleep_for_us); - esp_sleep_enable_timer_wakeup(sleep_for_us); + if (time_alarm_set) { + alarm_time_timealarm_set_alarm(time_alarm); } } -mp_obj_t common_hal_alarm_wait_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { - if (n_alarms == 0) { - return mp_const_none; - } - - bool time_alarm_set = false; - alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; - - for (size_t i = 0; i < n_alarms; i++) { - if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { - mp_raise_NotImplementedError(translate("PinAlarm not yet implemented")); - } - else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { - if (time_alarm_set) { - mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); - } - time_alarm = MP_OBJ_TO_PTR(alarms[i]); - time_alarm_set = true; +STATIC void _idle_until_alarm(void) { + // Poll for alarms. + while (!mp_hal_is_interrupted()) { + RUN_BACKGROUND_TASKS; + // Allow ctrl-C interrupt. + if (alarm_woken_from_sleep()) { + return; } + + port_idle_until_interrupt(); } - - ESP_LOGI("ALARM", "waiting for alarms"); - - if (time_alarm_set && n_alarms == 1) { - // If we're only checking time, avoid a polling loop, so maybe we can save some power. - const mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; - const mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); - const uint32_t delay_ms = (uint32_t) (wakeup_in_secs * 1000.0f); - ESP_LOGI("ALARM", "Delay for ms: %d", delay_ms); - common_hal_time_delay_ms((uint32_t) delay_ms); - } else { - // Poll for alarms. - while (true) { - RUN_BACKGROUND_TASKS; - // Allow ctrl-C interrupt. - if (mp_hal_is_interrupted()) { - return mp_const_none; - } - - // TODO: Check PinAlarms. - - if (time_alarm != MP_OBJ_NULL && - common_hal_time_monotonic_ms() * 1000.f >= time_alarm->monotonic_time) { - return time_alarm; - } - } - } - - return mp_const_none; } // Is it safe to do a light sleep? Check whether WiFi is on or there are // other ongoing tasks that should not be shut down. -static bool light_sleep_ok(void) { - return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj); +STATIC bool _light_sleep_ok(void) { + return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj) && !supervisor_workflow_active(); } mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { - if (n_alarms == 0) { - return mp_const_none; - } + _setup_sleep_alarms(false, n_alarms, alarms); - if (light_sleep_ok()) { - ESP_LOGI("ALARM", "start light sleep"); - setup_sleep_alarms(n_alarms, alarms); + // Light sleep can break some functionality so only do it when possible. Otherwise we idle. + if (_light_sleep_ok()) { esp_light_sleep_start(); - return common_hal_alarm_get_wake_alarm(); } else { - // Don't do an ESP32 light sleep. - return common_hal_alarm_wait_until_alarms(n_alarms, alarms); + _idle_until_alarm(); } + mp_obj_t wake_alarm = _get_wake_alarm(n_alarms, alarms); + alarm_reset(); + return wake_alarm; } -void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { - setup_sleep_alarms(n_alarms, alarms); - - // Raise an exception, which will be processed in main.c. - mp_raise_arg1(&mp_type_DeepSleepRequest, NULL); +void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { + _setup_sleep_alarms(true, n_alarms, alarms); } -void common_hal_alarm_prepare_for_deep_sleep(void) { - // Turn off WiFi and anything else that should be shut down cleanly. - common_hal_wifi_radio_set_enabled(&common_hal_wifi_radio_obj, false); -} - -void NORETURN common_hal_alarm_enter_deep_sleep(void) { - ESP_LOGI("ALARM", "start deep sleep"); +void NORETURN alarm_enter_deep_sleep(void) { + // The ESP-IDF caches the deep sleep settings and applies them before sleep. + // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); } diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index 7af3694630..34c8b00523 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -27,8 +27,12 @@ #include "esp_sleep.h" #include "py/runtime.h" +#include "supervisor/esp_port.h" + +#include "components/esp_timer/include/esp_timer.h" #include "shared-bindings/alarm/time/TimeAlarm.h" +#include "shared-bindings/time/__init__.h" void common_hal_alarm_time_time_alarm_construct(alarm_time_time_alarm_obj_t *self, mp_float_t monotonic_time) { self->monotonic_time = monotonic_time; @@ -37,3 +41,63 @@ void common_hal_alarm_time_time_alarm_construct(alarm_time_time_alarm_obj_t *sel mp_float_t common_hal_alarm_time_time_alarm_get_monotonic_time(alarm_time_time_alarm_obj_t *self) { return self->monotonic_time; } + +mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { + // First, check to see if we match + for (size_t i = 0; i < n_alarms; i++) { + if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + return alarms[i]; + } + } + alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); + timer->base.type = &alarm_time_time_alarm_type; + return timer; +} + +esp_timer_handle_t pretend_sleep_timer; +STATIC bool woke_up = false; + +// This is run in the timer task. We use it to wake the main CircuitPython task. +void timer_callback(void *arg) { + (void) arg; + woke_up = true; + if (sleeping_circuitpython_task) { + xTaskNotifyGive(sleeping_circuitpython_task); + } +} + +bool alarm_time_timealarm_woke_us_up(void) { + return woke_up; +} + +void alarm_time_timealarm_reset(void) { + esp_timer_stop(pretend_sleep_timer); + esp_timer_delete(pretend_sleep_timer); + pretend_sleep_timer = NULL; + woke_up = false; +} + +void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self) { + if (pretend_sleep_timer != NULL) { + esp_timer_stop(pretend_sleep_timer); + } else { + // Configure the timer to use during pretend sleep. + esp_timer_create_args_t args; + args.callback = timer_callback; + args.arg = NULL; + args.dispatch_method = ESP_TIMER_TASK; + args.name = "Pretend deep sleep"; + esp_timer_create(&args, &pretend_sleep_timer); + } + + // Compute how long to actually sleep, considering the time now. + mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; + mp_float_t wakeup_in_secs = MAX(0.0f, self->monotonic_time - now_secs); + const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); + esp_sleep_enable_timer_wakeup(sleep_for_us); + + // Also set the RTC interrupt so it can wake our task. This will be wiped out + // if we actually deep sleep. + woke_up = false; + esp_timer_start_once(pretend_sleep_timer, sleep_for_us); +} diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h index b540541f4d..04c553009e 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h @@ -31,3 +31,10 @@ typedef struct { mp_obj_base_t base; mp_float_t monotonic_time; // values compatible with time.monotonic_time() } alarm_time_time_alarm_obj_t; + +// Find the alarm object that caused us to wake up or create an equivalent one. +mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); +// Check for the wake up alarm from pretend deep sleep. +bool alarm_time_timealarm_woke_us_up(void); +void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self); +void alarm_time_timealarm_reset(void); diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index da738bbfdd..562881585d 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -28,7 +28,6 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "boards/board.h" #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/rgb_led_status.h" diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 6222cd2904..954fb93309 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -27,8 +27,8 @@ #include #include +#include "supervisor/board.h" #include "supervisor/port.h" -#include "boards/board.h" #include "modules/module.h" #include "py/runtime.h" #include "supervisor/esp_port.h" @@ -239,27 +239,31 @@ void port_enable_tick(void) { // Disable 1/1024 second tick. void port_disable_tick(void) { esp_timer_stop(_tick_timer); + + // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. + // Tick disable can happen via auto-reload so poke the main task here. + if (sleeping_circuitpython_task != NULL) { + xTaskNotifyGive(sleeping_circuitpython_task); + } } TickType_t sleep_time_duration; void port_interrupt_after_ticks(uint32_t ticks) { sleep_time_duration = (ticks * 100)/1024; - sleeping_circuitpython_task = xTaskGetCurrentTaskHandle(); } -void port_sleep_until_interrupt(void) { - - uint32_t NotifyValue = 0; +void port_idle_until_interrupt(void) { + uint32_t notify_value = 0; if (sleep_time_duration == 0) { return; } - xTaskNotifyWait(0x01,0x01,&NotifyValue, - sleep_time_duration ); - if (NotifyValue == 1) { - sleeping_circuitpython_task = NULL; - mp_handle_pending(); + sleeping_circuitpython_task = xTaskGetCurrentTaskHandle(); + xTaskNotifyWait(0x01, 0x01, ¬ify_value, sleep_time_duration ); + sleeping_circuitpython_task = NULL; + if (notify_value == 1) { + mp_handle_pending(); } } diff --git a/ports/litex/boards/board.h b/ports/litex/boards/board.h deleted file mode 100644 index 837b371904..0000000000 --- a/ports/litex/boards/board.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H -#define MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H - -#include - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H diff --git a/ports/litex/boards/fomu/board.c b/ports/litex/boards/fomu/board.c index 97e1ecadd6..a90f22f81e 100644 --- a/ports/litex/boards/fomu/board.c +++ b/ports/litex/boards/fomu/board.c @@ -24,7 +24,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" + #include "mpconfigboard.h" #include "csr.h" diff --git a/ports/litex/supervisor/port.c b/ports/litex/supervisor/port.c index f5c362ea6e..4dea020652 100644 --- a/ports/litex/supervisor/port.c +++ b/ports/litex/supervisor/port.c @@ -26,9 +26,9 @@ */ #include +#include "supervisor/board.h" #include "supervisor/port.h" #include "supervisor/shared/tick.h" -#include "boards/board.h" #include "irq.h" #include "csr.h" @@ -147,5 +147,5 @@ void port_interrupt_after_ticks(uint32_t ticks) { } // TODO: Add sleep support if the SoC supports sleep. -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { } diff --git a/ports/mimxrt10xx/board.h b/ports/mimxrt10xx/board.h new file mode 100644 index 0000000000..1c9596e7d2 --- /dev/null +++ b/ports/mimxrt10xx/board.h @@ -0,0 +1 @@ +// Empty but needed for the SDK diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/board.c b/ports/mimxrt10xx/boards/feather_m7_1011/board.c index ed543e1b06..1db1dd6861 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c b/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c index 282464c75d..9ba3e168f5 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c @@ -5,9 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" +#include "boards/flash_config.h" +#include "fsl_flexspi_nor_boot.h" __attribute__((section(".boot_hdr.ivt"))) /************************************* diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/pins.c b/ports/mimxrt10xx/boards/feather_m7_1011/pins.c index 09e3217614..04fbeea59b 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/pins.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // Analog diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c index ed543e1b06..1db1dd6861 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/flash_config.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/flash_config.c index 51cc0f164b..eafc9ac3af 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/flash_config.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/flash_config.c @@ -5,9 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" +#include "boards/flash_config.h" +#include "fsl_flexspi_nor_boot.h" __attribute__((section(".boot_hdr.ivt"))) /************************************* diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/pins.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/pins.c index 2c6c1ce93e..4e5de8de27 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/pins.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // Analog diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c index 9878a62a29..26f55f96e1 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1062/flash_config.c b/ports/mimxrt10xx/boards/feather_mimxrt1062/flash_config.c index 51cc0f164b..fef1c11e3e 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/flash_config.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1062/pins.c b/ports/mimxrt10xx/boards/feather_mimxrt1062/pins.c index eb287b87aa..d372b951f6 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/pins.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // Analog diff --git a/ports/mimxrt10xx/boards/board.h b/ports/mimxrt10xx/boards/flash_config.h similarity index 75% rename from ports/mimxrt10xx/boards/board.h rename to ports/mimxrt10xx/boards/flash_config.h index 678c223ae0..25f1550ae8 100644 --- a/ports/mimxrt10xx/boards/board.h +++ b/ports/mimxrt10xx/boards/flash_config.h @@ -26,26 +26,16 @@ // This file defines board specific functions. -#ifndef MICROPY_INCLUDED_MIMXRT10XX_BOARDS_BOARD_H -#define MICROPY_INCLUDED_MIMXRT10XX_BOARDS_BOARD_H +#ifndef MICROPY_INCLUDED_MIMXRT10XX_BOARDS_FLASH_CONFIG_H +#define MICROPY_INCLUDED_MIMXRT10XX_BOARDS_FLASH_CONFIG_H #include -#include "py/mpconfig.h" +#include "mpconfigboard.h" // For flash size settings + #include "fsl_common.h" #include "fsl_flexspi_nor_config.h" -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - #define SEQUENCE(first, second, third, fourth) first, second, third, fourth #define TWO_EMPTY_STEPS 0x00000000 #define EMPTY_SEQUENCE SEQUENCE(TWO_EMPTY_STEPS, TWO_EMPTY_STEPS, TWO_EMPTY_STEPS, TWO_EMPTY_STEPS) @@ -53,4 +43,4 @@ void reset_board(void); // FlexSPI configuration that stores command info. extern const flexspi_nor_config_t qspiflash_config; -#endif // MICROPY_INCLUDED_MIMXRT10XX_BOARDS_BOARD_H +#endif // MICROPY_INCLUDED_MIMXRT10XX_BOARDS_FLASH_CONFIG_H diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c index ba3498581c..8519893a5f 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c index 19573bd993..00ee47c985 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/pins.c b/ports/mimxrt10xx/boards/imxrt1010_evk/pins.c index a0221a2ad2..4aad9aaeb3 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/pins.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_09) }, diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c index d5166b3560..531c0c6f62 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c index 40b566618e..4c3ba47179 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/pins.c b/ports/mimxrt10xx/boards/imxrt1020_evk/pins.c index ef8115a64f..2052a12429 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/pins.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_AD_B1_09) }, diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c index 25bc4e8c9d..e7d74ab49f 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1060_evk/flash_config.c index d79a8d0f91..502e21a3b0 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/flash_config.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c b/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c index 2d268952d1..b24e4dc86d 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/board.c b/ports/mimxrt10xx/boards/metro_m7_1011/board.c index ed543e1b06..1db1dd6861 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c b/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c index 30ce67523e..991bc43e45 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c index e884934134..ea9ae55290 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // Analog diff --git a/ports/mimxrt10xx/boards/teensy40/board.c b/ports/mimxrt10xx/boards/teensy40/board.c index 09f0bf3f2a..33ad5ff04a 100644 --- a/ports/mimxrt10xx/boards/teensy40/board.c +++ b/ports/mimxrt10xx/boards/teensy40/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/teensy40/flash_config.c b/ports/mimxrt10xx/boards/teensy40/flash_config.c index 30ce67523e..991bc43e45 100644 --- a/ports/mimxrt10xx/boards/teensy40/flash_config.c +++ b/ports/mimxrt10xx/boards/teensy40/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/teensy40/pins.c b/ports/mimxrt10xx/boards/teensy40/pins.c index 9066ce0d20..64b4aa7f69 100644 --- a/ports/mimxrt10xx/boards/teensy40/pins.c +++ b/ports/mimxrt10xx/boards/teensy40/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // With USB on left. Bottom edge. diff --git a/ports/mimxrt10xx/boards/teensy41/board.c b/ports/mimxrt10xx/boards/teensy41/board.c index 09f0bf3f2a..33ad5ff04a 100644 --- a/ports/mimxrt10xx/boards/teensy41/board.c +++ b/ports/mimxrt10xx/boards/teensy41/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/teensy41/flash_config.c b/ports/mimxrt10xx/boards/teensy41/flash_config.c index 7b2bfb768d..c0e0c86f98 100644 --- a/ports/mimxrt10xx/boards/teensy41/flash_config.c +++ b/ports/mimxrt10xx/boards/teensy41/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/teensy41/pins.c b/ports/mimxrt10xx/boards/teensy41/pins.c index 5eb5ab0f55..cf24513019 100644 --- a/ports/mimxrt10xx/boards/teensy41/pins.c +++ b/ports/mimxrt10xx/boards/teensy41/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // With USB on left. Bottom edge. diff --git a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c index 353ba3176d..bd471f9305 100644 --- a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c +++ b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c @@ -9,7 +9,7 @@ #include "fsl_flexspi.h" #include "internal_flash.h" -#include "boards/board.h" +#include "boards/flash_config.h" #include "supervisor/linker.h" status_t PLACE_IN_ITCM(flexspi_nor_write_enable)(FLEXSPI_Type *base, uint32_t baseAddr) diff --git a/ports/mimxrt10xx/supervisor/internal_flash.c b/ports/mimxrt10xx/supervisor/internal_flash.c index e194cbed96..9c0d9f8956 100644 --- a/ports/mimxrt10xx/supervisor/internal_flash.c +++ b/ports/mimxrt10xx/supervisor/internal_flash.c @@ -30,7 +30,7 @@ #include #include -#include "boards/board.h" +#include "boards/flash_config.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" #include "py/mphal.h" diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c index 1be2b10396..33a85d2b72 100644 --- a/ports/mimxrt10xx/supervisor/port.c +++ b/ports/mimxrt10xx/supervisor/port.c @@ -31,7 +31,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/port.h" #include "fsl_device_registers.h" @@ -403,7 +403,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { SNVS->HPCR |= SNVS_HPCR_HPTA_EN_MASK; } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { // App note here: https://www.nxp.com/docs/en/application-note/AN12085.pdf // Clear the FPU interrupt because it can prevent us from sleeping. diff --git a/ports/nrf/boards/ADM_B_NRF52840_1/board.c b/ports/nrf/boards/ADM_B_NRF52840_1/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/ADM_B_NRF52840_1/board.c +++ b/ports/nrf/boards/ADM_B_NRF52840_1/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/TG-Watch02A/board.c b/ports/nrf/boards/TG-Watch02A/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/TG-Watch02A/board.c +++ b/ports/nrf/boards/TG-Watch02A/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/aramcon_badge_2019/board.c b/ports/nrf/boards/aramcon_badge_2019/board.c index efb449285b..8f3830b000 100644 --- a/ports/nrf/boards/aramcon_badge_2019/board.c +++ b/ports/nrf/boards/aramcon_badge_2019/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" void board_init(void) { diff --git a/ports/nrf/boards/arduino_nano_33_ble/board.c b/ports/nrf/boards/arduino_nano_33_ble/board.c index ddfcde2848..d1689e9ddc 100644 --- a/ports/nrf/boards/arduino_nano_33_ble/board.c +++ b/ports/nrf/boards/arduino_nano_33_ble/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "nrf.h" #include "nrf_rtc.h" diff --git a/ports/nrf/boards/bless_dev_board_multi_sensor/board.c b/ports/nrf/boards/bless_dev_board_multi_sensor/board.c index 71b9a06577..6970294ecc 100644 --- a/ports/nrf/boards/bless_dev_board_multi_sensor/board.c +++ b/ports/nrf/boards/bless_dev_board_multi_sensor/board.c @@ -1,4 +1,4 @@ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/board.h b/ports/nrf/boards/board.h deleted file mode 100644 index ec98f04fbe..0000000000 --- a/ports/nrf/boards/board.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_NRF_BOARDS_BOARD_H -#define MICROPY_INCLUDED_NRF_BOARDS_BOARD_H - -#include - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_NRF_BOARDS_BOARD_H diff --git a/ports/nrf/boards/circuitplayground_bluefruit/board.c b/ports/nrf/boards/circuitplayground_bluefruit/board.c index 3aa6857da2..ff731d8f98 100644 --- a/ports/nrf/boards/circuitplayground_bluefruit/board.c +++ b/ports/nrf/boards/circuitplayground_bluefruit/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "py/obj.h" #include "peripherals/nrf/pins.h" @@ -49,5 +49,5 @@ void reset_board(void) { NRF_GPIO_PIN_NOSENSE); nrf_gpio_pin_write(POWER_SWITCH_PIN->number, false); - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_P0_13, 10); } diff --git a/ports/nrf/boards/clue_nrf52840_express/board.c b/ports/nrf/boards/clue_nrf52840_express/board.c index 523bd7677b..cd46ce75d3 100644 --- a/ports/nrf/boards/clue_nrf52840_express/board.c +++ b/ports/nrf/boards/clue_nrf52840_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/nrf/boards/clue_nrf52840_express/pins.c b/ports/nrf/boards/clue_nrf52840_express/pins.c index ab0738893c..61d77cedc9 100644 --- a/ports/nrf/boards/clue_nrf52840_express/pins.c +++ b/ports/nrf/boards/clue_nrf52840_express/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { diff --git a/ports/nrf/boards/electronut_labs_blip/board.c b/ports/nrf/boards/electronut_labs_blip/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/electronut_labs_blip/board.c +++ b/ports/nrf/boards/electronut_labs_blip/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/electronut_labs_papyr/board.c b/ports/nrf/boards/electronut_labs_papyr/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/electronut_labs_papyr/board.c +++ b/ports/nrf/boards/electronut_labs_papyr/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/feather_bluefruit_sense/board.c b/ports/nrf/boards/feather_bluefruit_sense/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/feather_bluefruit_sense/board.c +++ b/ports/nrf/boards/feather_bluefruit_sense/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/feather_nrf52840_express/board.c b/ports/nrf/boards/feather_nrf52840_express/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/feather_nrf52840_express/board.c +++ b/ports/nrf/boards/feather_nrf52840_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/hiibot_bluefi/board.c b/ports/nrf/boards/hiibot_bluefi/board.c index 93e31aef0c..a3fd5cf129 100644 --- a/ports/nrf/boards/hiibot_bluefi/board.c +++ b/ports/nrf/boards/hiibot_bluefi/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/nrf/boards/hiibot_bluefi/pins.c b/ports/nrf/boards/hiibot_bluefi/pins.c index bce4ee52dd..c7879c4c21 100644 --- a/ports/nrf/boards/hiibot_bluefi/pins.c +++ b/ports/nrf/boards/hiibot_bluefi/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { diff --git a/ports/nrf/boards/ikigaisense_vita/board.c b/ports/nrf/boards/ikigaisense_vita/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/ikigaisense_vita/board.c +++ b/ports/nrf/boards/ikigaisense_vita/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/itsybitsy_nrf52840_express/board.c b/ports/nrf/boards/itsybitsy_nrf52840_express/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/itsybitsy_nrf52840_express/board.c +++ b/ports/nrf/boards/itsybitsy_nrf52840_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/board.c b/ports/nrf/boards/makerdiary_m60_keyboard/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/board.c +++ b/ports/nrf/boards/makerdiary_m60_keyboard/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/pins.c b/ports/nrf/boards/makerdiary_m60_keyboard/pins.c index 63c3ad1711..fc85fa24b0 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/pins.c +++ b/ports/nrf/boards/makerdiary_m60_keyboard/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c index e08d00daca..569106ec2a 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c index 7dc6db18fa..1892868330 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c b/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/metro_nrf52840_express/board.c b/ports/nrf/boards/metro_nrf52840_express/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/metro_nrf52840_express/board.c +++ b/ports/nrf/boards/metro_nrf52840_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/nice_nano/board.c b/ports/nrf/boards/nice_nano/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/nice_nano/board.c +++ b/ports/nrf/boards/nice_nano/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/ohs2020_badge/board.c b/ports/nrf/boards/ohs2020_badge/board.c index ec52690ced..20abf4e2a9 100644 --- a/ports/nrf/boards/ohs2020_badge/board.c +++ b/ports/nrf/boards/ohs2020_badge/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/nrf/boards/particle_argon/board.c b/ports/nrf/boards/particle_argon/board.c index f891f54a13..a41f0ae06e 100644 --- a/ports/nrf/boards/particle_argon/board.c +++ b/ports/nrf/boards/particle_argon/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/particle_boron/board.c b/ports/nrf/boards/particle_boron/board.c index f891f54a13..a41f0ae06e 100644 --- a/ports/nrf/boards/particle_boron/board.c +++ b/ports/nrf/boards/particle_boron/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/particle_xenon/board.c b/ports/nrf/boards/particle_xenon/board.c index f891f54a13..a41f0ae06e 100644 --- a/ports/nrf/boards/particle_xenon/board.c +++ b/ports/nrf/boards/particle_xenon/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/pca10056/board.c b/ports/nrf/boards/pca10056/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/pca10056/board.c +++ b/ports/nrf/boards/pca10056/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/pca10059/board.c b/ports/nrf/boards/pca10059/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/pca10059/board.c +++ b/ports/nrf/boards/pca10059/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/pca10100/board.c b/ports/nrf/boards/pca10100/board.c index f891f54a13..a41f0ae06e 100644 --- a/ports/nrf/boards/pca10100/board.c +++ b/ports/nrf/boards/pca10100/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/pitaya_go/board.c b/ports/nrf/boards/pitaya_go/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/pitaya_go/board.c +++ b/ports/nrf/boards/pitaya_go/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/raytac_mdbt50q-db-40/board.c b/ports/nrf/boards/raytac_mdbt50q-db-40/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/raytac_mdbt50q-db-40/board.c +++ b/ports/nrf/boards/raytac_mdbt50q-db-40/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/simmel/board.c b/ports/nrf/boards/simmel/board.c index f891f54a13..a41f0ae06e 100644 --- a/ports/nrf/boards/simmel/board.c +++ b/ports/nrf/boards/simmel/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/sparkfun_nrf52840_mini/board.c b/ports/nrf/boards/sparkfun_nrf52840_mini/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/sparkfun_nrf52840_mini/board.c +++ b/ports/nrf/boards/sparkfun_nrf52840_mini/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/teknikio_bluebird/board.c b/ports/nrf/boards/teknikio_bluebird/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/teknikio_bluebird/board.c +++ b/ports/nrf/boards/teknikio_bluebird/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c index 4421970eef..7817933281 100644 --- a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c +++ b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 5f1c9f1ba9..00485d8588 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -26,7 +26,7 @@ #include #include "supervisor/port.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "nrfx/hal/nrf_clock.h" #include "nrfx/hal/nrf_power.h" @@ -307,7 +307,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { nrfx_rtc_cc_set(&rtc_instance, 0, current_ticks + diff, true); } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { #if defined(MICROPY_QSPI_CS) qspi_disable(); #endif diff --git a/ports/stm/boards/board.h b/ports/stm/boards/board.h deleted file mode 100644 index 22d9e99be0..0000000000 --- a/ports/stm/boards/board.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_STM32F4_BOARDS_BOARD_H -#define MICROPY_INCLUDED_STM32F4_BOARDS_BOARD_H - -#include - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_STM32F4_BOARDS_BOARD_H diff --git a/ports/stm/boards/espruino_pico/board.c b/ports/stm/boards/espruino_pico/board.c index 82b0c506ed..f8e462f938 100644 --- a/ports/stm/boards/espruino_pico/board.c +++ b/ports/stm/boards/espruino_pico/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/stm/boards/espruino_wifi/board.c b/ports/stm/boards/espruino_wifi/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/espruino_wifi/board.c +++ b/ports/stm/boards/espruino_wifi/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/feather_stm32f405_express/board.c b/ports/stm/boards/feather_stm32f405_express/board.c index 82b0c506ed..f8e462f938 100644 --- a/ports/stm/boards/feather_stm32f405_express/board.c +++ b/ports/stm/boards/feather_stm32f405_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/stm/boards/meowbit_v121/board.c b/ports/stm/boards/meowbit_v121/board.c index f67b4a49db..4a8014a3a1 100644 --- a/ports/stm/boards/meowbit_v121/board.c +++ b/ports/stm/boards/meowbit_v121/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/board/__init__.h" diff --git a/ports/stm/boards/nucleo_f746zg/board.c b/ports/stm/boards/nucleo_f746zg/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/nucleo_f746zg/board.c +++ b/ports/stm/boards/nucleo_f746zg/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/nucleo_f767zi/board.c b/ports/stm/boards/nucleo_f767zi/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/nucleo_f767zi/board.c +++ b/ports/stm/boards/nucleo_f767zi/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/nucleo_h743zi_2/board.c b/ports/stm/boards/nucleo_h743zi_2/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/nucleo_h743zi_2/board.c +++ b/ports/stm/boards/nucleo_h743zi_2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/openmv_h7/board.c b/ports/stm/boards/openmv_h7/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/openmv_h7/board.c +++ b/ports/stm/boards/openmv_h7/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/pyb_nano_v2/board.c b/ports/stm/boards/pyb_nano_v2/board.c index 82b0c506ed..f8e462f938 100644 --- a/ports/stm/boards/pyb_nano_v2/board.c +++ b/ports/stm/boards/pyb_nano_v2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/stm/boards/pyboard_v11/board.c b/ports/stm/boards/pyboard_v11/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/pyboard_v11/board.c +++ b/ports/stm/boards/pyboard_v11/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/stm32f411ce_blackpill/board.c b/ports/stm/boards/stm32f411ce_blackpill/board.c index 82b0c506ed..f8e462f938 100644 --- a/ports/stm/boards/stm32f411ce_blackpill/board.c +++ b/ports/stm/boards/stm32f411ce_blackpill/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/stm/boards/stm32f411ve_discovery/board.c b/ports/stm/boards/stm32f411ve_discovery/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/stm32f411ve_discovery/board.c +++ b/ports/stm/boards/stm32f411ve_discovery/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/stm32f412zg_discovery/board.c b/ports/stm/boards/stm32f412zg_discovery/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/stm32f412zg_discovery/board.c +++ b/ports/stm/boards/stm32f412zg_discovery/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/stm32f4_discovery/board.c b/ports/stm/boards/stm32f4_discovery/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/stm32f4_discovery/board.c +++ b/ports/stm/boards/stm32f4_discovery/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/stm32f746g_discovery/board.c b/ports/stm/boards/stm32f746g_discovery/board.c index aafc69cf02..db2c727271 100644 --- a/ports/stm/boards/stm32f746g_discovery/board.c +++ b/ports/stm/boards/stm32f746g_discovery/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "stm32f7xx_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/stm/boards/thunderpack_v11/board.c b/ports/stm/boards/thunderpack_v11/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/thunderpack_v11/board.c +++ b/ports/stm/boards/thunderpack_v11/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/thunderpack_v12/board.c b/ports/stm/boards/thunderpack_v12/board.c index 4421970eef..7817933281 100644 --- a/ports/stm/boards/thunderpack_v12/board.c +++ b/ports/stm/boards/thunderpack_v12/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index 29fbdee569..20ee0f6e15 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -32,7 +32,7 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/shared/translate.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/stm/common-hal/sdioio/SDCard.c b/ports/stm/common-hal/sdioio/SDCard.c index 5f6010f01a..de0e8d1119 100644 --- a/ports/stm/common-hal/sdioio/SDCard.c +++ b/ports/stm/common-hal/sdioio/SDCard.c @@ -31,7 +31,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/util.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/shared/translate.h" #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c index dba1cf21ee..3103a07160 100644 --- a/ports/stm/supervisor/port.c +++ b/ports/stm/supervisor/port.c @@ -27,7 +27,7 @@ #include #include "supervisor/port.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "lib/timeutils/timeutils.h" #include "common-hal/microcontroller/Pin.h" @@ -436,7 +436,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { alarmed_already = false; } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { // Clear the FPU interrupt because it can prevent us from sleeping. if (__get_FPSCR() & ~(0x9f)) { __set_FPSCR(__get_FPSCR() & ~(0x9f)); diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index f04112bfcd..0bd889ccdf 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -912,6 +912,12 @@ void supervisor_run_background_tasks_if_tick(void); #define CIRCUITPY_PYSTACK_SIZE 1536 #endif + +// Wait this long imediately after startup to see if we are connected to USB. +#ifndef CIRCUITPY_USB_CONNECTED_SLEEP_DELAY +#define CIRCUITPY_USB_CONNECTED_SLEEP_DELAY 5 +#endif + #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" #define CIRCUITPY_VERBOSE_BLE 0 diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index a1f1a2f8c2..5420b8404b 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -36,9 +36,6 @@ #include "supervisor/shared/autoreload.h" #include "supervisor/shared/workflow.h" -// Wait this long imediately after startup to see if we are connected to USB. -#define CIRCUITPY_USB_CONNECTED_SLEEP_DELAY 5 - //| """Alarms and sleep //| //| Provides alarms that trigger based on time intervals or on external events, such as pin @@ -93,21 +90,13 @@ void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { //| ... //| STATIC mp_obj_t alarm_light_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { + if (n_args == 0) { + return mp_const_none; + } + validate_objs_are_alarms(n_args, args); - // See if we are connected to a host. - // Make sure we have been awake long enough for USB to connect (enumeration delay). - int64_t connecting_delay_msec = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - supervisor_ticks_ms64(); - if (connecting_delay_msec > 0) { - common_hal_time_delay_ms(connecting_delay_msec * 1000 / 1024); - } - - if (supervisor_workflow_active()) { - common_hal_alarm_wait_until_alarms(n_args, args); - } else { - common_hal_alarm_light_sleep_until_alarms(n_args, args); - } - return mp_const_none; + return common_hal_alarm_light_sleep_until_alarms(n_args, args); } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_light_sleep_until_alarms); @@ -151,26 +140,13 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OB STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { validate_objs_are_alarms(n_args, args); - // Shut down WiFi, etc. - common_hal_alarm_prepare_for_deep_sleep(); + // Validate the alarms and set them. + common_hal_alarm_set_deep_sleep_alarms(n_args, args); - // See if we are connected to a host. - // Make sure we have been awake long enough for USB to connect (enumeration delay). - int64_t connecting_delay_msec = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - supervisor_ticks_ms64(); - if (connecting_delay_msec > 0) { - common_hal_time_delay_ms(connecting_delay_msec * 1000 / 1024); - } + // Raise an exception, which will be processed in main.c. + mp_raise_arg1(&mp_type_DeepSleepRequest, NULL); - if (supervisor_workflow_active()) { - // Simulate deep sleep by waiting for an alarm and then restarting when done. - common_hal_alarm_wait_until_alarms(n_args, args); - reload_requested = true; - supervisor_set_run_reason(RUN_REASON_STARTUP); - mp_raise_reload_exception(); - } else { - common_hal_alarm_exit_and_deep_sleep_until_alarms(n_args, args); - // Does not return. - } + // Doesn't get here. return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_exit_and_deep_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_exit_and_deep_sleep_until_alarms); diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 380c65ea8c..5a8c613d9d 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -31,13 +31,22 @@ #include "common-hal/alarm/__init__.h" -extern mp_obj_t common_hal_alarm_wait_until_alarms(size_t n_alarms, const mp_obj_t *alarms); extern mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); -extern void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); -extern void common_hal_alarm_prepare_for_deep_sleep(void); -extern NORETURN void common_hal_alarm_enter_deep_sleep(void); + +// Deep sleep is a two step process. Alarms are set when the VM is valid but +// everything is reset before entering deep sleep. Furthermore, deep sleep may +// not actually happen if the user is connected to the device. In this case, the +// supervisor will idle using `port_wait_for_interrupt`. After each call, it will +// call alarm_woken_from_sleep to see if we've been woken by an alarm and if so, +// it will exit idle as if deep sleep was exited. +extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms); +// Deep sleep is entered outside of the VM so we omit the `common_hal_` prefix. +extern NORETURN void alarm_enter_deep_sleep(void); // Used by wake-up code. extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); +// True if an alarm is alerting. This is most useful for pretend deep sleep. +extern bool alarm_woken_from_sleep(void); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/ports/esp32s2/boards/board.h b/supervisor/board.h similarity index 77% rename from ports/esp32s2/boards/board.h rename to supervisor/board.h index 2f0db81356..939ee1c194 100644 --- a/ports/esp32s2/boards/board.h +++ b/supervisor/board.h @@ -24,22 +24,30 @@ * THE SOFTWARE. */ -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_ESP32S2_BOARDS_BOARD_H -#define MICROPY_INCLUDED_ESP32S2_BOARDS_BOARD_H +#ifndef MICROPY_INCLUDED_SUPERVISOR_BOARD_H +#define MICROPY_INCLUDED_SUPERVISOR_BOARD_H #include -// Initializes board related state once on start up. -void board_init(void); +#include "supervisor/shared/safe_mode.h" // Returns true if the user initiates safe mode in a board specific way. // Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific // way. bool board_requests_safe_mode(void); +// Initializes board related state once on start up. +void board_init(void); + // Reset the state of off MCU components such as neopixels. void reset_board(void); -#endif // MICROPY_INCLUDED_ESP32S2_BOARDS_BOARD_H +#if CIRCUITPY_ALARM +// Deinit the board. This should put the board in deep sleep durable, low power +// state. It should not prevent the user access method from working (such as +// disabling USB, BLE or flash) because CircuitPython may continue to run. +void board_deinit(void); +#endif + + +#endif // MICROPY_INCLUDED_SUPERVISOR_BOARD_H diff --git a/supervisor/port.h b/supervisor/port.h index 5bc06bc4e1..862400986b 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -49,9 +49,6 @@ void reset_cpu(void) NORETURN; // Reset the microcontroller state. void reset_port(void); -// Reset the rest of the board. -void reset_board(void); - // Reset to the bootloader void reset_to_bootloader(void) NORETURN; @@ -89,8 +86,9 @@ void port_disable_tick(void); // Only the common sleep routine should use it. void port_interrupt_after_ticks(uint32_t ticks); -// Sleep the CPU until an interrupt is received. -void port_sleep_until_interrupt(void); +// Sleep the CPU until an interrupt is received. We call this idle because it +// may not be a system level sleep. +void port_idle_until_interrupt(void); // Execute port specific actions during background tasks. void port_background_task(void); @@ -100,4 +98,5 @@ void port_background_task(void); // work" should be done in port_background_task() instead. void port_start_background_task(void); void port_finish_background_task(void); + #endif // MICROPY_INCLUDED_SUPERVISOR_PORT_H diff --git a/supervisor/shared/board.c b/supervisor/shared/board.c index e3eb8fd0d7..111aa0e3c9 100644 --- a/supervisor/shared/board.c +++ b/supervisor/shared/board.c @@ -26,23 +26,22 @@ #include "supervisor/shared/board.h" +#if CIRCUITPY_DIGITALIO && CIRCUITPY_NEOPIXEL_WRITE + +#include + #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/neopixel_write/__init__.h" -#ifdef USER_NEOPIXELS_PIN - -// The maximum number of user neopixels right now is 10, on Circuit Playgrounds. -// PyBadge and PyGamer have max 5 -#define USER_NEOPIXELS_MAX_COUNT 10 - -void board_reset_user_neopixels(void) { +void board_reset_user_neopixels(mcu_pin_obj_t* pin, size_t count) { // Turn off on-board NeoPixel string - uint8_t empty[USER_NEOPIXELS_MAX_COUNT * 3] = { 0 }; + uint8_t empty[count * 3]; + memset(empty, 0, count); digitalio_digitalinout_obj_t neopixel_pin; - common_hal_digitalio_digitalinout_construct(&neopixel_pin, USER_NEOPIXELS_PIN); + common_hal_digitalio_digitalinout_construct(&neopixel_pin, pin); common_hal_digitalio_digitalinout_switch_to_output(&neopixel_pin, false, DRIVE_MODE_PUSH_PULL); - common_hal_neopixel_write(&neopixel_pin, empty, USER_NEOPIXELS_MAX_COUNT * 3); + common_hal_neopixel_write(&neopixel_pin, empty, count * 3); common_hal_digitalio_digitalinout_deinit(&neopixel_pin); } diff --git a/supervisor/shared/board.h b/supervisor/shared/board.h index 0e4d73455d..cdeefbf222 100644 --- a/supervisor/shared/board.h +++ b/supervisor/shared/board.h @@ -24,15 +24,13 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SUPERVISOR_BOARD_H -#define MICROPY_INCLUDED_SUPERVISOR_BOARD_H +#ifndef MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_H +#define MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_H -#include "py/mpconfig.h" +#include -#ifdef USER_NEOPIXELS_PIN +#include "shared-bindings/microcontroller/Pin.h" -void board_reset_user_neopixels(void); +void board_reset_user_neopixels(mcu_pin_obj_t* pin, size_t count); -#endif - -#endif // MICROPY_INCLUDED_SUPERVISOR_BOARD_H +#endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_H diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index a2855a5706..d37a585eb2 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -156,8 +156,8 @@ void mp_hal_delay_ms(mp_uint_t delay) { break; } port_interrupt_after_ticks(remaining); - // Sleep until an interrupt happens. - port_sleep_until_interrupt(); + // Idle until an interrupt happens. + port_idle_until_interrupt(); remaining = end_tick - port_get_raw_ticks(NULL); } } From d0a806d7975ecc2c653d23ee48e463f38b4f1194 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 8 Dec 2020 11:03:24 -0800 Subject: [PATCH 029/146] Enter safe mode after panic or brownout Uses the IDF's reset reason. Does nothing before reset. Fixes #3389 --- ports/esp32s2/supervisor/port.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 6222cd2904..5a50bda698 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -102,6 +102,14 @@ safe_mode_t port_init(void) { return NO_HEAP; } + esp_reset_reason_t reason = esp_reset_reason(); + if (reason == ESP_RST_BROWNOUT) { + return BROWNOUT; + } + if (reason == ESP_RST_PANIC) { + return HARD_CRASH; + } + return NO_SAFE_MODE; } From 0ff0bb9ec4b8f9f1af8729f52124ab18fc319829 Mon Sep 17 00:00:00 2001 From: Antonin ENFRUN Date: Tue, 8 Dec 2020 18:25:57 +0000 Subject: [PATCH 030/146] Translated using Weblate (French) Currently translated at 97.3% (852 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 12d3feca02..22e5f76ebb 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-11-24 22:45+0000\n" +"PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -1303,7 +1303,7 @@ msgstr "Doit utiliser un multiple de 6 broches RVB, pas %d" #: ports/esp32s2/common-hal/nvm/ByteArray.c msgid "NVS Error" -msgstr "" +msgstr "Erreur NVS" #: py/parse.c msgid "Name too long" @@ -1326,7 +1326,7 @@ msgstr "Aucun canal DMA trouvé" #: shared-module/busdevice/I2CDevice.c #, c-format msgid "No I2C device at address: %x" -msgstr "" +msgstr "Pas de dispositif I2C à l'adresse : %x" #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c @@ -1468,7 +1468,7 @@ msgstr "Seules les adresses IPv4 sont prises en charge" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 sockets supported" -msgstr "" +msgstr "Seules les sockets IPv4 sont prises en charge" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1554,7 +1554,7 @@ msgstr "Numéro de broche déjà réservé par EXTI" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "PinAlarm not yet implemented" -msgstr "" +msgstr "PinAlarm pas encore implémenté" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1772,7 +1772,7 @@ msgstr "Fournissez au moins une broche UART" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Fournissez l'un de monotonic_time ou epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" From 0b4bcd9599cc07ff85d6a70297ae86ff3b02cdec Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 8 Dec 2020 13:05:21 -0800 Subject: [PATCH 031/146] Fix build and more comments --- main.c | 7 ++++++- ports/atmel-samd/boards/blm_badge/mpconfigboard.h | 2 -- .../boards/circuitplayground_express/mpconfigboard.h | 2 -- .../circuitplayground_express_crickit/mpconfigboard.h | 2 -- .../circuitplayground_express_displayio/mpconfigboard.h | 2 -- ports/atmel-samd/boards/pybadge/mpconfigboard.h | 2 -- ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h | 2 -- ports/atmel-samd/boards/pygamer/mpconfigboard.h | 2 -- ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h | 2 -- ports/esp32s2/common-hal/alarm/time/TimeAlarm.c | 1 + .../nrf/boards/circuitplayground_bluefruit/mpconfigboard.h | 2 -- supervisor/shared/board.c | 2 +- supervisor/shared/board.h | 2 +- 13 files changed, 9 insertions(+), 21 deletions(-) diff --git a/main.c b/main.c index 9eb4787299..5aa9131a0d 100755 --- a/main.c +++ b/main.c @@ -391,7 +391,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { int64_t connecting_delay_ticks = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - port_get_raw_ticks(NULL); if (connecting_delay_ticks > 0) { // Set when we've waited long enough so that we wake up from the - // sleep_until_interrupt below and loop around to the real deep + // port_idle_until_interrupt below and loop around to the real deep // sleep in the else clause. port_interrupt_after_ticks(connecting_delay_ticks); // Deep sleep if we're not connected to a host. @@ -414,6 +414,11 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (!asleep) { tick_rgb_status_animation(&animation); } else { + // This waits until a pretend deep sleep alarm occurs. They are set + // during common_hal_alarm_set_deep_sleep_alarms. On some platforms + // it may also return due to another interrupt, that's why we check + // for deep sleep alarms above. If it wasn't a deep sleep alarm, + // then we'll idle here again. port_idle_until_interrupt(); } } diff --git a/ports/atmel-samd/boards/blm_badge/mpconfigboard.h b/ports/atmel-samd/boards/blm_badge/mpconfigboard.h index 4f56d23b0a..7343455b80 100644 --- a/ports/atmel-samd/boards/blm_badge/mpconfigboard.h +++ b/ports/atmel-samd/boards/blm_badge/mpconfigboard.h @@ -13,8 +13,6 @@ #define DEFAULT_UART_BUS_RX (&pin_PA01) #define DEFAULT_UART_BUS_TX (&pin_PA00) -#define USER_NEOPIXELS_PIN (&pin_PA05) - #define IGNORE_PIN_PA09 1 #define IGNORE_PIN_PA12 1 #define IGNORE_PIN_PA13 1 diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h index 4321335e59..e46e477e4e 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h @@ -30,8 +30,6 @@ // Increase stack size slightly due to CPX library import nesting #define CIRCUITPY_DEFAULT_STACK_SIZE (4248) //divisible by 8 -#define USER_NEOPIXELS_PIN (&pin_PB23) - #define DEFAULT_I2C_BUS_SCL (&pin_PB03) #define DEFAULT_I2C_BUS_SDA (&pin_PB02) diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h index 5673be2909..bc40554217 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h @@ -24,8 +24,6 @@ #define CALIBRATE_CRYSTALLESS 1 -#define USER_NEOPIXELS_PIN (&pin_PB23) - // Explanation of how a user got into safe mode. #define BOARD_USER_SAFE_MODE_ACTION translate("pressing both buttons at start up.\n") diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h index fab235149d..4b0c324faa 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h @@ -30,8 +30,6 @@ // Increase stack size slightly due to CPX library import nesting. #define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8 -#define USER_NEOPIXELS_PIN (&pin_PB23) - #define DEFAULT_I2C_BUS_SCL (&pin_PB03) #define DEFAULT_I2C_BUS_SDA (&pin_PB02) diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.h b/ports/atmel-samd/boards/pybadge/mpconfigboard.h index 74a13eb1c2..435185322a 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.h +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.h @@ -14,8 +14,6 @@ #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) -#define USER_NEOPIXELS_PIN (&pin_PA15) - #define DEFAULT_I2C_BUS_SCL (&pin_PA13) #define DEFAULT_I2C_BUS_SDA (&pin_PA12) diff --git a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h b/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h index a37d7ceec4..921669d8cb 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h +++ b/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h @@ -14,8 +14,6 @@ #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) -#define USER_NEOPIXELS_PIN (&pin_PA15) - #define DEFAULT_I2C_BUS_SCL (&pin_PA13) #define DEFAULT_I2C_BUS_SDA (&pin_PA12) diff --git a/ports/atmel-samd/boards/pygamer/mpconfigboard.h b/ports/atmel-samd/boards/pygamer/mpconfigboard.h index 21f75d2728..102c259567 100644 --- a/ports/atmel-samd/boards/pygamer/mpconfigboard.h +++ b/ports/atmel-samd/boards/pygamer/mpconfigboard.h @@ -13,8 +13,6 @@ #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) -#define USER_NEOPIXELS_PIN (&pin_PA15) - #define DEFAULT_I2C_BUS_SCL (&pin_PA13) #define DEFAULT_I2C_BUS_SDA (&pin_PA12) diff --git a/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h b/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h index 7c631d1c37..fbe946b72f 100644 --- a/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h +++ b/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h @@ -13,8 +13,6 @@ #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) -#define USER_NEOPIXELS_PIN (&pin_PA15) - #define DEFAULT_I2C_BUS_SCL (&pin_PA13) #define DEFAULT_I2C_BUS_SDA (&pin_PA12) diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index 34c8b00523..d5e896c015 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -51,6 +51,7 @@ mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t * } alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); timer->base.type = &alarm_time_time_alarm_type; + // TODO: Set monotonic_time based on the RTC state. return timer; } diff --git a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h index ef34465dcd..da32230a6f 100644 --- a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h +++ b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h @@ -54,8 +54,6 @@ // Disables onboard peripherals and neopixels to save power. #define POWER_SWITCH_PIN (&pin_P0_06) -#define USER_NEOPIXELS_PIN (&pin_P0_13) - #define DEFAULT_I2C_BUS_SCL (&pin_P0_04) #define DEFAULT_I2C_BUS_SDA (&pin_P0_05) diff --git a/supervisor/shared/board.c b/supervisor/shared/board.c index 111aa0e3c9..30603aa66c 100644 --- a/supervisor/shared/board.c +++ b/supervisor/shared/board.c @@ -33,7 +33,7 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/neopixel_write/__init__.h" -void board_reset_user_neopixels(mcu_pin_obj_t* pin, size_t count) { +void board_reset_user_neopixels(const mcu_pin_obj_t* pin, size_t count) { // Turn off on-board NeoPixel string uint8_t empty[count * 3]; memset(empty, 0, count); diff --git a/supervisor/shared/board.h b/supervisor/shared/board.h index cdeefbf222..fe887a9335 100644 --- a/supervisor/shared/board.h +++ b/supervisor/shared/board.h @@ -31,6 +31,6 @@ #include "shared-bindings/microcontroller/Pin.h" -void board_reset_user_neopixels(mcu_pin_obj_t* pin, size_t count); +void board_reset_user_neopixels(const mcu_pin_obj_t* pin, size_t count); #endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_H From 9a5006e241cfb8ac905eb8e623ec0a1fe9f71a72 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 8 Dec 2020 17:30:32 -0500 Subject: [PATCH 032/146] Remove problematic calloc --- ports/esp32s2/common-hal/analogio/AnalogIn.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/analogio/AnalogIn.c b/ports/esp32s2/common-hal/analogio/AnalogIn.c index bab1721ea7..f33439c4af 100644 --- a/ports/esp32s2/common-hal/analogio/AnalogIn.c +++ b/ports/esp32s2/common-hal/analogio/AnalogIn.c @@ -34,6 +34,8 @@ #include "shared-bindings/microcontroller/Pin.h" +#include + #define DEFAULT_VREF 1100 #define NO_OF_SAMPLES 64 #define ATTENUATION ADC_ATTEN_DB_11 @@ -66,11 +68,14 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { adc1_config_channel_atten((adc1_channel_t)self->pin->adc_channel, ATTENUATION); } else if (self->pin->adc_index == ADC_UNIT_2) { adc2_config_channel_atten((adc2_channel_t)self->pin->adc_channel, ATTENUATION); + } else { + mp_raise_ValueError(translate("Invalid Pin")); } // Automatically select calibration process depending on status of efuse - esp_adc_cal_characteristics_t *adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t)); - esp_adc_cal_characterize(self->pin->adc_index, ATTENUATION, DATA_WIDTH, DEFAULT_VREF, adc_chars); + esp_adc_cal_characteristics_t adc_chars; + memset(&adc_chars, 0, sizeof(adc_chars)); + esp_adc_cal_characterize(self->pin->adc_index, ATTENUATION, DATA_WIDTH, DEFAULT_VREF, &adc_chars); uint32_t adc_reading = 0; //Multisampling @@ -89,7 +94,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { adc_reading /= NO_OF_SAMPLES; // This corrects non-linear regions of the ADC range with a LUT, so it's a better reading than raw - uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, adc_chars); + uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, &adc_chars); return voltage * ((1 << 16) - 1)/3300; } From f7c7324e6099c465359bd6a6b4ef9c3240a04149 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 8 Dec 2020 18:57:19 -0500 Subject: [PATCH 033/146] Translations --- locale/circuitpython.pot | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b136e9dd26..06dcdeaa5c 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 18:56-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -498,8 +498,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1080,6 +1080,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1296,7 +1300,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1503,6 +1507,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" From cea6c3d8d6c56ed657e6594e48db95c20f6ef930 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 9 Dec 2020 01:34:28 +0100 Subject: [PATCH 034/146] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 26 +++++++++++++++++++------- locale/cs.po | 19 ++++++++++++++----- locale/de_DE.po | 26 +++++++++++++++++++------- locale/el.po | 19 ++++++++++++++----- locale/es.po | 24 ++++++++++++++++++------ locale/fil.po | 26 +++++++++++++++++++------- locale/fr.po | 25 +++++++++++++++++++------ locale/hi.po | 19 ++++++++++++++----- locale/it_IT.po | 24 ++++++++++++++++++------ locale/ja.po | 24 ++++++++++++++++++------ locale/ko.po | 19 ++++++++++++++----- locale/nl.po | 26 +++++++++++++++++++------- locale/pl.po | 24 ++++++++++++++++++------ locale/pt_BR.po | 24 ++++++++++++++++++------ locale/sv.po | 25 +++++++++++++++++++------ locale/zh_Latn_pinyin.po | 24 ++++++++++++++++++------ 16 files changed, 278 insertions(+), 96 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 9645dc7024..6203f70842 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -504,8 +504,8 @@ msgstr "Panjang buffer harus kelipatan 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Penyangga harus memiliki panjang setidaknya 1" @@ -1317,7 +1317,7 @@ msgstr "Tidak ada DAC (Digital Analog Converter) di dalam chip" msgid "No DMA channel found" msgstr "tidak ada channel DMA ditemukan" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1532,6 +1532,7 @@ msgstr "Izin ditolak" msgid "Pin does not have ADC capabilities" msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1587,10 +1588,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Buffer awalan harus ada di heap" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Tekan tombol apa saja untuk masuk ke dalam REPL. Gunakan CTRL+D untuk reset " -"(Reload)" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2072,6 +2075,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3846,6 +3853,11 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Tekan tombol apa saja untuk masuk ke dalam REPL. Gunakan CTRL+D untuk " +#~ "reset (Reload)" + #~ msgid "" #~ "\n" #~ "To exit, please reset the board without " diff --git a/locale/cs.po b/locale/cs.po index 39ea8fcd87..ef549e3554 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -502,8 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1300,7 +1300,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1507,6 +1507,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1559,7 +1560,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2030,6 +2035,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 1aedb6ce1f..056ed5908c 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -505,8 +505,8 @@ msgstr "Die Pufferlänge muss ein vielfaches von 512 sein" msgid "Buffer must be a multiple of 512 bytes" msgstr "Der Puffer muss ein vielfaches von 512 bytes sein" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Der Puffer muss eine Mindestenslänge von 1 haben" @@ -1319,7 +1319,7 @@ msgstr "Kein DAC im Chip vorhanden" msgid "No DMA channel found" msgstr "Kein DMA Kanal gefunden" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1532,6 +1532,7 @@ msgstr "Zugang verweigert" msgid "Pin does not have ADC capabilities" msgstr "Pin hat keine ADC Funktionalität" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pin kann nur als Eingang verwendet werden" @@ -1587,10 +1588,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Der Präfixbuffer muss sich auf dem Heap befinden" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum neu " -"laden." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2087,6 +2090,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFi Passwort muss zwischen 8 und 63 Zeichen lang sein" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Schreiben nicht unterstüzt für diese Charakteristik" @@ -3890,6 +3897,11 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum " +#~ "neu laden." + #~ msgid "arctan2 is implemented for scalars and ndarrays only" #~ msgstr "arctan2 ist nur für Skalare und ndarrays implementiert" diff --git a/locale/el.po b/locale/el.po index 6a4f7cdbb3..f1bd60bd5a 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -497,8 +497,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1295,7 +1295,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1502,6 +1502,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1554,7 +1555,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2025,6 +2030,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/locale/es.po b/locale/es.po index 57b317e008..85d180c21f 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -511,8 +511,8 @@ msgstr "El tamaño del búfer debe ser múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Búfer deber ser un múltiplo de 512 bytes" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer debe ser de longitud 1 como minimo" @@ -1318,7 +1318,7 @@ msgstr "El chip no tiene DAC" msgid "No DMA channel found" msgstr "No se encontró el canal DMA" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1533,6 +1533,7 @@ msgstr "Permiso denegado" msgid "Pin does not have ADC capabilities" msgstr "Pin no tiene capacidad ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "El pin es solo de entrada" @@ -1592,9 +1593,12 @@ msgid "Prefix buffer must be on the heap" msgstr "El prefijo del buffer debe estar en el heap" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2089,6 +2093,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "La clave de WiFi debe ser entre 8 y 63 caracteres" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Escrituras no admitidas en Characteristic" @@ -3876,6 +3884,10 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Solo hay capacidad para enchufes IPv4 SOCK_STREAM" diff --git a/locale/fil.po b/locale/fil.po index 4a9e9591ed..c55ab69b59 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -502,8 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer dapat ay hindi baba sa 1 na haba" @@ -1310,7 +1310,7 @@ msgstr "Walang DAC sa chip" msgid "No DMA channel found" msgstr "Walang DMA channel na mahanap" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1521,6 +1521,7 @@ msgstr "Walang pahintulot" msgid "Pin does not have ADC capabilities" msgstr "Ang pin ay walang kakayahan sa ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1573,10 +1574,12 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Pindutin ang anumang key upang pumasok sa REPL. Gamitin ang CTRL-D upang i-" -"reload." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2057,6 +2060,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3853,6 +3860,11 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Pindutin ang anumang key upang pumasok sa REPL. Gamitin ang CTRL-D upang " +#~ "i-reload." + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q indeks ay dapat integers, hindi %s" diff --git a/locale/fr.po b/locale/fr.po index 22e5f76ebb..29d2d19849 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -511,8 +511,8 @@ msgstr "La longueur de la mémoire tampon doit être un multiple de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "La mémoire tampon doit être un multiple de 512" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Le tampon doit être de longueur au moins 1" @@ -1323,7 +1323,7 @@ msgstr "Pas de DAC sur la puce" msgid "No DMA channel found" msgstr "Aucun canal DMA trouvé" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "Pas de dispositif I2C à l'adresse : %x" @@ -1540,6 +1540,7 @@ msgstr "Permission refusée" msgid "Pin does not have ADC capabilities" msgstr "La broche ne peut être utilisée pour l'ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "La broche est entrée uniquement" @@ -1599,8 +1600,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Le tampon de préfixe doit être sur le tas" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." -msgstr "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2098,6 +2103,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "Le mot de passe WiFi doit faire entre 8 et 63 caractères" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Écritures non prises en charge sur la caractéristique" @@ -3897,6 +3906,10 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Seules les sockets IPv4 SOCK_STREAM sont prises en charge" diff --git a/locale/hi.po b/locale/hi.po index 7361e41e65..28b6e071a0 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -497,8 +497,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1295,7 +1295,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1502,6 +1502,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1554,7 +1555,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2025,6 +2030,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 4966002d26..f61192834b 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -502,8 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Il buffer deve essere lungo almeno 1" @@ -1314,7 +1314,7 @@ msgstr "Nessun DAC sul chip" msgid "No DMA channel found" msgstr "Nessun canale DMA trovato" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1530,6 +1530,7 @@ msgstr "Permesso negato" msgid "Pin does not have ADC capabilities" msgstr "Il pin non ha capacità di ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1583,9 +1584,12 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Premi un qualunque tasto per entrare nel REPL. Usa CTRL-D per ricaricare." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2060,6 +2064,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3860,6 +3868,10 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Premi un qualunque tasto per entrare nel REPL. Usa CTRL-D per ricaricare." + #~ msgid "%q indices must be integers, not %s" #~ msgstr "gli indici %q devono essere interi, non %s" diff --git a/locale/ja.po b/locale/ja.po index 27e094a0ab..82b8cc352d 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -506,8 +506,8 @@ msgstr "バッファ長は512の倍数でなければなりません" msgid "Buffer must be a multiple of 512 bytes" msgstr "バッファは512の倍数でなければなりません" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "バッファ長は少なくとも1以上でなければなりません" @@ -1310,7 +1310,7 @@ msgstr "チップにDACがありません" msgid "No DMA channel found" msgstr "DMAチャネルが見つかりません" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1520,6 +1520,7 @@ msgstr "パーミッション拒否" msgid "Pin does not have ADC capabilities" msgstr "ピンにADCの能力がありません" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "ピンは入力専用" @@ -1572,8 +1573,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Prefixバッファはヒープ上になければなりません" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." -msgstr "何らかのキーを押すとREPLに入ります。CTRL-Dでリロード。" +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2050,6 +2055,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFiパスワードは8〜63文字でなければなりません" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3829,6 +3838,9 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "何らかのキーを押すとREPLに入ります。CTRL-Dでリロード。" + #~ msgid "axis must be -1, 0, None, or 1" #~ msgstr "axisは -1, 0, 1, None のいずれかでなければなりません" diff --git a/locale/ko.po b/locale/ko.po index 407b495b88..58bd428015 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -502,8 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "잘못된 크기의 버퍼. >1 여야합니다" @@ -1300,7 +1300,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1507,6 +1507,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1559,7 +1560,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2031,6 +2036,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index e45f9338d4..c0f3f478fb 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -504,8 +504,8 @@ msgstr "Buffer lengte moet een veelvoud van 512 zijn" msgid "Buffer must be a multiple of 512 bytes" msgstr "Buffer moet een veelvoud van 512 bytes zijn" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer moet op zijn minst lengte 1 zijn" @@ -1312,7 +1312,7 @@ msgstr "Geen DAC op de chip" msgid "No DMA channel found" msgstr "Geen DMA kanaal gevonden" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1528,6 +1528,7 @@ msgstr "Toegang geweigerd" msgid "Pin does not have ADC capabilities" msgstr "Pin heeft geen ADC mogelijkheden" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pin kan alleen voor invoer gebruikt worden" @@ -1587,10 +1588,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Prefix buffer moet op de heap zijn" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Druk een willekeurige toets om de REPL te starten. Gebruik CTRL+D om te " -"herstarten." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2081,6 +2084,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFi wachtwoord moet tussen 8 en 63 karakters bevatten" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Schrijven niet ondersteund op Characteristic" @@ -3863,6 +3870,11 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Druk een willekeurige toets om de REPL te starten. Gebruik CTRL+D om te " +#~ "herstarten." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Alleen IPv4 SOCK_STREAM sockets worden ondersteund" diff --git a/locale/pl.po b/locale/pl.po index 31d446b3ba..72c091a11d 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -506,8 +506,8 @@ msgstr "Długość bufora musi być wielokrotnością 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufor musi być wielokrotnością 512 bajtów" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufor musi mieć długość 1 lub więcej" @@ -1311,7 +1311,7 @@ msgstr "Brak DAC" msgid "No DMA channel found" msgstr "Nie znaleziono kanału DMA" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1518,6 +1518,7 @@ msgstr "Odmowa dostępu" msgid "Pin does not have ADC capabilities" msgstr "Nóżka nie obsługuje ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1570,8 +1571,12 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." -msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2047,6 +2052,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3821,6 +3830,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować." + #~ msgid "number of arguments must be 2, or 3" #~ msgstr "liczba argumentów musi wynosić 2 lub 3" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 4ac698bd31..282392bda1 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-04 06:29+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -512,8 +512,8 @@ msgstr "O comprimento do Buffer deve ser um múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "O buffer deve ser um múltiplo de 512 bytes" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "O comprimento do buffer deve ter pelo menos 1" @@ -1321,7 +1321,7 @@ msgstr "Nenhum DAC no chip" msgid "No DMA channel found" msgstr "Nenhum canal DMA encontrado" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "Nenhum dispositivo I2C no endereço: %x" @@ -1537,6 +1537,7 @@ msgstr "Permissão negada" msgid "Pin does not have ADC capabilities" msgstr "O pino não tem recursos de ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Apenas o pino de entrada" @@ -1598,9 +1599,12 @@ msgstr "" "(heap)" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2096,6 +2100,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "A senha do Wi-Fi deve ter entre 8 e 63 caracteres" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "A escrita não é compatível na Característica" @@ -3888,6 +3896,10 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "São suportados apenas soquetes IPv4 SOCK_STREAM" diff --git a/locale/sv.po b/locale/sv.po index 4b7a389c24..be3d484058 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -504,8 +504,8 @@ msgstr "Buffertlängd måste vara en multipel av 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufferten måste vara en multipel av 512 byte" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufferten måste ha minst längd 1" @@ -1311,7 +1311,7 @@ msgstr "Ingen DAC på chipet" msgid "No DMA channel found" msgstr "Ingen DMA-kanal hittades" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "Ingen I2C-enhet på adress: %x" @@ -1525,6 +1525,7 @@ msgstr "Åtkomst nekad" msgid "Pin does not have ADC capabilities" msgstr "Pinnen har inte ADC-funktionalitet" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pinnen är enbart ingång" @@ -1584,9 +1585,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Prefixbufferten måste finnas på heap" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Tryck på valfri knapp för att gå in i REPL. Använd CTRL-D för att ladda om." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2074,6 +2078,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFi-lösenord måste vara mellan 8 och 63 tecken" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Skrivning stöds inte på karaktäristik" @@ -3856,6 +3864,11 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Tryck på valfri knapp för att gå in i REPL. Använd CTRL-D för att ladda " +#~ "om." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Endast IPv4 SOCK_STREAM sockets stöds" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 5ef4b0e2ae..606f0077e1 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -506,8 +506,8 @@ msgstr "Huǎn chōng qū cháng dù bì xū wéi 512 de bèi shù" msgid "Buffer must be a multiple of 512 bytes" msgstr "Huǎn chōng qū bì xū shì 512 zì jié de bèi shù" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1" @@ -1308,7 +1308,7 @@ msgstr "Méiyǒu DAC zài xīnpiàn shàng de" msgid "No DMA channel found" msgstr "Wèi zhǎodào DMA píndào" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1521,6 +1521,7 @@ msgstr "Quánxiàn bèi jùjué" msgid "Pin does not have ADC capabilities" msgstr "Pin méiyǒu ADC nénglì" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Yǐn jiǎo jǐn shūrù" @@ -1577,8 +1578,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Qiánzhuì huǎnchōng qū bìxū zài duī shàng" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." -msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2066,6 +2071,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFi mìmǎ bìxū jiè yú 8 dào 63 gè zìfú zhī jiān" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Tèzhēng bù zhīchí xiě rù" @@ -3845,6 +3854,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Jǐn zhīchí IPv4 SOCK_STREAM tào jiē zì" From eedcc98cc5379f93704fd344289e2f5c8a60eddd Mon Sep 17 00:00:00 2001 From: Mike Causer Date: Thu, 10 Dec 2020 02:52:18 +1100 Subject: [PATCH 035/146] Fix some spelling mistakes --- docs/design_guide.rst | 8 ++++---- docs/drivers.rst | 2 +- docs/library/hashlib.rst | 4 ++-- docs/library/index.rst | 4 ++-- docs/library/network.rst | 2 +- docs/porting.rst | 2 +- docs/troubleshooting.rst | 4 ++-- main.c | 2 +- shared-bindings/os/__init__.c | 6 +++--- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/design_guide.rst b/docs/design_guide.rst index cc2a3b296d..75825893a9 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -421,7 +421,7 @@ SPI Example """Widget's one register.""" with self.spi_device as spi: spi.write(b'0x00') - i2c.readinto(self.buf) + spi.readinto(self.buf) return self.buf[0] Use composition @@ -462,7 +462,7 @@ like properties for state even if it sacrifices a bit of speed. Avoid allocations in drivers -------------------------------------------------------------------------------- -Although Python doesn't require managing memory, its still a good practice for +Although Python doesn't require managing memory, it's still a good practice for library writers to think about memory allocations. Avoid them in drivers if you can because you never know how much something will be called. Fewer allocations means less time spent cleaning up. So, where you can, prefer @@ -471,7 +471,7 @@ object with methods that read or write into the buffer instead of creating new objects. Unified hardware API classes such as `busio.SPI` are design to read and write to subsections of buffers. -Its ok to allocate an object to return to the user. Just beware of causing more +It's ok to allocate an object to return to the user. Just beware of causing more than one allocation per call due to internal logic. **However**, this is a memory tradeoff so do not do it for large or rarely used @@ -580,4 +580,4 @@ MicroPython compatibility -------------------------------------------------------------------------------- Keeping compatibility with MicroPython isn't a high priority. It should be done -when its not in conflict with any of the above goals. +when it's not in conflict with any of the above goals. diff --git a/docs/drivers.rst b/docs/drivers.rst index 241415cc1c..8855abbd2d 100644 --- a/docs/drivers.rst +++ b/docs/drivers.rst @@ -12,7 +12,7 @@ Adafruit CircuitPython Library Bundle We provide a bundle of all our libraries to ease installation of drivers and their dependencies. The bundle is primarily geared to the Adafruit Express line of boards which feature a relatively large external flash. With Express boards, -its easy to copy them all onto the filesystem. However, if you don't have +it's easy to copy them all onto the filesystem. However, if you don't have enough space simply copy things over as they are needed. - The Adafruit bundles are available on GitHub: . diff --git a/docs/library/hashlib.rst b/docs/library/hashlib.rst index 0205d5e6a8..8e5ebc2d1a 100644 --- a/docs/library/hashlib.rst +++ b/docs/library/hashlib.rst @@ -20,10 +20,10 @@ be implemented: * SHA1 - A previous generation algorithm. Not recommended for new usages, but SHA1 is a part of number of Internet standards and existing applications, so boards targeting network connectivity and - interoperatiability will try to provide this. + interoperability will try to provide this. * MD5 - A legacy algorithm, not considered cryptographically secure. Only - selected boards, targeting interoperatibility with legacy applications, + selected boards, targeting interoperability with legacy applications, will offer this. Constructors diff --git a/docs/library/index.rst b/docs/library/index.rst index f847ead0af..e913872421 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -21,7 +21,7 @@ standard Python library. You may need to change your code later if you rely on any non-standard functionality they currently provide. -CircuitPython's goal long-term goalis that code written in CircuitPython +CircuitPython's long-term goal is that code written in CircuitPython using Python standard libraries will be runnable on CPython without changes. Some libraries below are not enabled on CircuitPython builds with @@ -69,7 +69,7 @@ CircuitPython/MicroPython-specific libraries -------------------------------------------- Functionality specific to the CircuitPython/MicroPython implementation is available in -the following libraries. These libraries may change signficantly or be removed in future +the following libraries. These libraries may change significantly or be removed in future versions of CircuitPython. .. toctree:: diff --git a/docs/library/network.rst b/docs/library/network.rst index bd32267fe9..3bd41150d5 100644 --- a/docs/library/network.rst +++ b/docs/library/network.rst @@ -71,7 +71,7 @@ parameter should be `id`. (password) required to access said service. There can be further arbitrary keyword-only parameters, depending on the networking medium type and/or particular device. Parameters can be used to: a) - specify alternative service identifer types; b) provide additional + specify alternative service identifier types; b) provide additional connection parameters. For various medium types, there are different sets of predefined/recommended parameters, among them: diff --git a/docs/porting.rst b/docs/porting.rst index 6cd59fefb1..8d0262455b 100644 --- a/docs/porting.rst +++ b/docs/porting.rst @@ -106,7 +106,7 @@ request a safe mode state which prevents the supervisor from running user code while still allowing access to the REPL and other resources. The core port initialization and reset methods are defined in -``supervisor/port.c`` and should be the first to be implemented. Its required +``supervisor/port.c`` and should be the first to be implemented. It's required that they be implemented in the ``supervisor`` directory within the port directory. That way, they are always in the expected place. diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index 66bcc2764c..45c637f349 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -13,7 +13,7 @@ When CircuitPython restarts it will create a fresh empty ``CIRCUITPY`` filesyste This often happens on Windows when the ``CIRCUITPY`` disk is not safely ejected before being reset by the button or being disconnected from USB. This can also -happen on Linux and Mac OSX but its less likely. +happen on Linux and Mac OSX but it's less likely. .. caution:: To erase and re-create ``CIRCUITPY`` (for example, to correct a corrupted filesystem), follow one of the procedures below. It's important to note that **any files stored on the** @@ -43,7 +43,7 @@ ValueError: Incompatible ``.mpy`` file. This error occurs when importing a module that is stored as a ``mpy`` binary file (rather than a ``py`` text file) that was generated by a different version of -CircuitPython than the one its being loaded into. Most versions are compatible +CircuitPython than the one it's being loaded into. Most versions are compatible but, rarely they aren't. In particular, the ``mpy`` binary format changed between CircuitPython versions 1.x and 2.x, and will change again between 2.x and 3.x. diff --git a/main.c b/main.c index 5aa9131a0d..da04ada466 100755 --- a/main.c +++ b/main.c @@ -215,7 +215,7 @@ STATIC bool maybe_run_list(const char * const * filenames, pyexec_result_t* exec STATIC void cleanup_after_vm(supervisor_allocation* heap) { // Reset port-independent devices, like CIRCUITPY_BLEIO_HCI. reset_devices(); - // Turn off the display and flush the fileystem before the heap disappears. + // Turn off the display and flush the filesystem before the heap disappears. #if CIRCUITPY_DISPLAYIO reset_displays(); #endif diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index c499df9724..8b9b389111 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -160,7 +160,7 @@ mp_obj_t os_stat(mp_obj_t path_in) { MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); //| def statvfs(path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]: -//| """Get the status of a fileystem. +//| """Get the status of a filesystem. //| //| Returns a tuple with the filesystem information in the following order: //| @@ -168,10 +168,10 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); //| * ``f_frsize`` -- fragment size //| * ``f_blocks`` -- size of fs in f_frsize units //| * ``f_bfree`` -- number of free blocks -//| * ``f_bavail`` -- number of free blocks for unpriviliged users +//| * ``f_bavail`` -- number of free blocks for unprivileged users //| * ``f_files`` -- number of inodes //| * ``f_ffree`` -- number of free inodes -//| * ``f_favail`` -- number of free inodes for unpriviliged users +//| * ``f_favail`` -- number of free inodes for unprivileged users //| * ``f_flag`` -- mount flags //| * ``f_namemax`` -- maximum filename length //| From 20c3184c87ee198f97f322ec983f04cedcb9cdcc Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 12:34:56 +0530 Subject: [PATCH 036/146] re-organize and clean-up --- ports/esp32s2/common-hal/ota/__init__.c | 42 +++++++++---------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 727b6b107b..b83a929a27 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -40,31 +40,23 @@ static void __attribute__((noreturn)) task_fatal_error(void) { void common_hal_ota_flash(const void *buf, const size_t len) { esp_err_t err; - /* update handle : set by esp_ota_begin(), must be freed via esp_ota_end() */ + esp_ota_handle_t update_handle = 0 ; const esp_partition_t *update_partition = NULL; + update_partition = esp_ota_get_next_update_partition(NULL); - ESP_LOGI(TAG, "Starting update"); - - const esp_partition_t *configured = esp_ota_get_boot_partition(); const esp_partition_t *running = esp_ota_get_running_partition(); + const esp_partition_t *last_invalid = esp_ota_get_last_invalid_partition(); - if (configured != running) { - ESP_LOGW(TAG, "Configured OTA boot partition at offset 0x%08x, but running from offset 0x%08x", - configured->address, running->address); - ESP_LOGW(TAG, "(This can happen if either the OTA boot data or preferred boot image become corrupted somehow.)"); - } ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", running->type, running->subtype, running->address); - update_partition = esp_ota_get_next_update_partition(NULL); ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08x)\n", update_partition->type, update_partition->subtype, update_partition->address); + assert(update_partition != NULL); - if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { - // check current version with downloading esp_app_desc_t new_app_info; memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); ESP_LOGI(TAG, "New firmware version: %s", new_app_info.version); @@ -74,25 +66,23 @@ void common_hal_ota_flash(const void *buf, const size_t len) { ESP_LOGI(TAG, "Running firmware version: %s", running_app_info.version); } - const esp_partition_t* last_invalid_app = esp_ota_get_last_invalid_partition(); esp_app_desc_t invalid_app_info; - if (esp_ota_get_partition_description(last_invalid_app, &invalid_app_info) == ESP_OK) { + if (esp_ota_get_partition_description(last_invalid, &invalid_app_info) == ESP_OK) { ESP_LOGI(TAG, "Last invalid firmware version: %s", invalid_app_info.version); } - // check current version with last invalid partition - if (last_invalid_app != NULL) { - if (memcmp(invalid_app_info.version, new_app_info.version, sizeof(new_app_info.version)) == 0) { - ESP_LOGW(TAG, "New version is the same as invalid version."); - ESP_LOGW(TAG, "Previously, there was an attempt to launch the firmware with %s version, but it failed.", invalid_app_info.version); - ESP_LOGW(TAG, "The firmware has been rolled back to the previous version."); - task_fatal_error(); - } + // check new version with running version + if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "New version is the same as running version."); + task_fatal_error(); } - if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { - ESP_LOGW(TAG, "Current running version is the same as a new. We will not continue the update."); - task_fatal_error(); + // check new version with last invalid partition + if (last_invalid != NULL) { + if (memcmp(new_app_info.version, invalid_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "New version is the same as invalid version."); + task_fatal_error(); + } } err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); @@ -100,7 +90,6 @@ void common_hal_ota_flash(const void *buf, const size_t len) { ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); task_fatal_error(); } - ESP_LOGI(TAG, "esp_ota_begin succeeded"); } else { ESP_LOGE(TAG, "received package is not fit len"); task_fatal_error(); @@ -111,7 +100,6 @@ void common_hal_ota_flash(const void *buf, const size_t len) { ESP_LOGE(TAG, "esp_ota_write failed (%s)", esp_err_to_name(err)); task_fatal_error(); } - ESP_LOGI(TAG, "Total Write binary data length: %d", len); err = esp_ota_end(update_handle); if (err != ESP_OK) { From dee86a014b783aff61a72f9915a4538a7fc97e4e Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 14:04:24 +0530 Subject: [PATCH 037/146] factor out esp_ota_end --- ports/esp32s2/common-hal/ota/__init__.c | 9 +++++++-- shared-bindings/ota/__init__.c | 7 +++++++ shared-bindings/ota/__init__.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index b83a929a27..2afb1904b2 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -31,6 +31,9 @@ #include "esp_log.h" #include "esp_ota_ops.h" +esp_ota_handle_t update_handle = 0 ; +const esp_partition_t *update_partition = NULL; + static const char *TAG = "OTA"; static void __attribute__((noreturn)) task_fatal_error(void) { @@ -41,8 +44,6 @@ static void __attribute__((noreturn)) task_fatal_error(void) { void common_hal_ota_flash(const void *buf, const size_t len) { esp_err_t err; - esp_ota_handle_t update_handle = 0 ; - const esp_partition_t *update_partition = NULL; update_partition = esp_ota_get_next_update_partition(NULL); const esp_partition_t *running = esp_ota_get_running_partition(); @@ -100,6 +101,10 @@ void common_hal_ota_flash(const void *buf, const size_t len) { ESP_LOGE(TAG, "esp_ota_write failed (%s)", esp_err_to_name(err)); task_fatal_error(); } +} + +void common_hal_ota_finish(void) { + esp_err_t err; err = esp_ota_end(update_handle); if (err != ESP_OK) { diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index a6c0424865..55858a80e9 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -30,6 +30,12 @@ //| //| The `ota` module implements over-the-air update.""" +STATIC mp_obj_t ota_finish(void) { + common_hal_ota_finish(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); + STATIC mp_obj_t ota_flash(mp_obj_t program_binary_in) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(program_binary_in, &bufinfo, MP_BUFFER_READ); @@ -41,6 +47,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(ota_flash_obj, ota_flash); STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, + { MP_ROM_QSTR(MP_QSTR_finish), MP_ROM_PTR(&ota_finish_obj) }, { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) }, }; STATIC MP_DEFINE_CONST_DICT(ota_module_globals, ota_module_globals_table); diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h index c4b40b2af3..1765c21ad7 100644 --- a/shared-bindings/ota/__init__.h +++ b/shared-bindings/ota/__init__.h @@ -29,6 +29,7 @@ #include "py/runtime.h" +extern void common_hal_ota_finish(void); extern void common_hal_ota_flash(const void *buf, const size_t len); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H From ed5add37f6c6f6ed8e1acb6c14bd47df0fdfb0fb Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 14:36:49 +0530 Subject: [PATCH 038/146] add ability to flash in continuous chunks --- ports/esp32s2/common-hal/ota/__init__.c | 114 ++++++++++++++---------- ports/esp32s2/common-hal/ota/__init__.h | 32 +++++++ 2 files changed, 97 insertions(+), 49 deletions(-) create mode 100644 ports/esp32s2/common-hal/ota/__init__.h diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 2afb1904b2..6d0e8f11b5 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -31,11 +31,18 @@ #include "esp_log.h" #include "esp_ota_ops.h" -esp_ota_handle_t update_handle = 0 ; -const esp_partition_t *update_partition = NULL; +static const esp_partition_t *update_partition = NULL; +static esp_ota_handle_t update_handle = 0; +static bool ota_inited = false; static const char *TAG = "OTA"; +static void ota_reset(void) { + update_handle = 0; + update_partition = NULL; + ota_inited = false; +} + static void __attribute__((noreturn)) task_fatal_error(void) { ESP_LOGE(TAG, "Exiting task due to fatal error..."); mp_raise_RuntimeError(translate("OTA Update Failed")); @@ -44,56 +51,61 @@ static void __attribute__((noreturn)) task_fatal_error(void) { void common_hal_ota_flash(const void *buf, const size_t len) { esp_err_t err; - update_partition = esp_ota_get_next_update_partition(NULL); - const esp_partition_t *running = esp_ota_get_running_partition(); const esp_partition_t *last_invalid = esp_ota_get_last_invalid_partition(); - ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", - running->type, running->subtype, running->address); + if (update_partition == NULL) { + update_partition = esp_ota_get_next_update_partition(NULL); - ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08x)\n", - update_partition->type, update_partition->subtype, update_partition->address); + ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", + running->type, running->subtype, running->address); - assert(update_partition != NULL); + ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08x)\n", + update_partition->type, update_partition->subtype, update_partition->address); - if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { - esp_app_desc_t new_app_info; - memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); - ESP_LOGI(TAG, "New firmware version: %s", new_app_info.version); + assert(update_partition != NULL); + } - esp_app_desc_t running_app_info; - if (esp_ota_get_partition_description(running, &running_app_info) == ESP_OK) { - ESP_LOGI(TAG, "Running firmware version: %s", running_app_info.version); - } + if (!ota_inited) { + if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { + esp_app_desc_t new_app_info; + memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); + ESP_LOGI(TAG, "New firmware version: %s", new_app_info.version); - esp_app_desc_t invalid_app_info; - if (esp_ota_get_partition_description(last_invalid, &invalid_app_info) == ESP_OK) { - ESP_LOGI(TAG, "Last invalid firmware version: %s", invalid_app_info.version); - } + esp_app_desc_t running_app_info; + if (esp_ota_get_partition_description(running, &running_app_info) == ESP_OK) { + ESP_LOGI(TAG, "Running firmware version: %s", running_app_info.version); + } - // check new version with running version - if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { - ESP_LOGW(TAG, "New version is the same as running version."); - task_fatal_error(); - } + esp_app_desc_t invalid_app_info; + if (esp_ota_get_partition_description(last_invalid, &invalid_app_info) == ESP_OK) { + ESP_LOGI(TAG, "Last invalid firmware version: %s", invalid_app_info.version); + } - // check new version with last invalid partition - if (last_invalid != NULL) { - if (memcmp(new_app_info.version, invalid_app_info.version, sizeof(new_app_info.version)) == 0) { - ESP_LOGW(TAG, "New version is the same as invalid version."); + // check new version with running version + if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "New version is the same as running version."); task_fatal_error(); } - } - err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); - if (err != ESP_OK) { - ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); + // check new version with last invalid partition + if (last_invalid != NULL) { + if (memcmp(new_app_info.version, invalid_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "New version is the same as invalid version."); + task_fatal_error(); + } + } + + err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); + task_fatal_error(); + } + ota_inited = true; + } else { + ESP_LOGE(TAG, "received package is not fit len"); task_fatal_error(); } - } else { - ESP_LOGE(TAG, "received package is not fit len"); - task_fatal_error(); } err = esp_ota_write( update_handle, buf, len); @@ -104,20 +116,24 @@ void common_hal_ota_flash(const void *buf, const size_t len) { } void common_hal_ota_finish(void) { - esp_err_t err; + if (ota_inited) { + esp_err_t err; - err = esp_ota_end(update_handle); - if (err != ESP_OK) { - if (err == ESP_ERR_OTA_VALIDATE_FAILED) { - ESP_LOGE(TAG, "Image validation failed, image is corrupted"); + err = esp_ota_end(update_handle); + if (err != ESP_OK) { + if (err == ESP_ERR_OTA_VALIDATE_FAILED) { + ESP_LOGE(TAG, "Image validation failed, image is corrupted"); + } + ESP_LOGE(TAG, "esp_ota_end failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); } - ESP_LOGE(TAG, "esp_ota_end failed (%s)!", esp_err_to_name(err)); - task_fatal_error(); - } - err = esp_ota_set_boot_partition(update_partition); - if (err != ESP_OK) { - ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); - task_fatal_error(); + err = esp_ota_set_boot_partition(update_partition); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); + } + + ota_reset(); } } diff --git a/ports/esp32s2/common-hal/ota/__init__.h b/ports/esp32s2/common-hal/ota/__init__.h new file mode 100644 index 0000000000..317604a8ec --- /dev/null +++ b/ports/esp32s2/common-hal/ota/__init__.h @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H + +extern void ota_reset(void); + +#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H From bfa2c604efa213628bb33ad870b851a43f21c877 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 15:45:25 +0530 Subject: [PATCH 039/146] add ability to flash in discontinuous chunks --- ports/esp32s2/common-hal/ota/__init__.c | 8 ++++++-- shared-bindings/ota/__init__.c | 23 ++++++++++++++++++----- shared-bindings/ota/__init__.h | 2 +- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 6d0e8f11b5..97cc67b766 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -48,7 +48,7 @@ static void __attribute__((noreturn)) task_fatal_error(void) { mp_raise_RuntimeError(translate("OTA Update Failed")); } -void common_hal_ota_flash(const void *buf, const size_t len) { +void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset) { esp_err_t err; const esp_partition_t *running = esp_ota_get_running_partition(); @@ -108,7 +108,11 @@ void common_hal_ota_flash(const void *buf, const size_t len) { } } - err = esp_ota_write( update_handle, buf, len); + if (offset == -1) { + err = esp_ota_write(update_handle, buf, len); + } else { + err = esp_ota_write_with_offset(update_handle, buf, len, offset); + } if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ota_write failed (%s)", esp_err_to_name(err)); task_fatal_error(); diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 55858a80e9..84a46c83a2 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -36,14 +36,27 @@ STATIC mp_obj_t ota_finish(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); -STATIC mp_obj_t ota_flash(mp_obj_t program_binary_in) { - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(program_binary_in, &bufinfo, MP_BUFFER_READ); +STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_binary, ARG_offset }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_binary, MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_offset, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} }, + }; - common_hal_ota_flash(bufinfo.buf, bufinfo.len); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + if (args[ARG_offset].u_int < -1) { + mp_raise_ValueError(translate("offset must be >= 0")); + } + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[ARG_binary].u_obj, &bufinfo, MP_BUFFER_READ); + + common_hal_ota_flash(bufinfo.buf, bufinfo.len, args[ARG_offset].u_int); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(ota_flash_obj, ota_flash); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 1, ota_flash); STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h index 1765c21ad7..9eec604e0b 100644 --- a/shared-bindings/ota/__init__.h +++ b/shared-bindings/ota/__init__.h @@ -30,6 +30,6 @@ #include "py/runtime.h" extern void common_hal_ota_finish(void); -extern void common_hal_ota_flash(const void *buf, const size_t len); +extern void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H From 07015ad527f81d81829190b31569a35a305676ce Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 16:42:45 +0530 Subject: [PATCH 040/146] add ability to switch boot partition --- ports/esp32s2/common-hal/ota/__init__.c | 6 ++++++ shared-bindings/ota/__init__.c | 7 +++++++ shared-bindings/ota/__init__.h | 1 + 3 files changed, 14 insertions(+) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 97cc67b766..4ec1021317 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -141,3 +141,9 @@ void common_hal_ota_finish(void) { ota_reset(); } } + +void common_hal_ota_switch(void) { + if (esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)) != ESP_OK) { + mp_raise_RuntimeError(translate("Unable to switch partition")); + } +} diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 84a46c83a2..46399dcb2e 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -30,6 +30,12 @@ //| //| The `ota` module implements over-the-air update.""" +STATIC mp_obj_t ota_switch(void) { + common_hal_ota_switch(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); + STATIC mp_obj_t ota_finish(void) { common_hal_ota_finish(); return mp_const_none; @@ -60,6 +66,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 1, ota_flash); STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, + { MP_ROM_QSTR(MP_QSTR_switch), MP_ROM_PTR(&ota_switch_obj) }, { MP_ROM_QSTR(MP_QSTR_finish), MP_ROM_PTR(&ota_finish_obj) }, { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) }, }; diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h index 9eec604e0b..82273f975a 100644 --- a/shared-bindings/ota/__init__.h +++ b/shared-bindings/ota/__init__.h @@ -29,6 +29,7 @@ #include "py/runtime.h" +extern void common_hal_ota_switch(void); extern void common_hal_ota_finish(void); extern void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset); From 6a4f74946fc717f8c95c43f364290e3e9d2cd2fa Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 16:48:58 +0530 Subject: [PATCH 041/146] reset ota module on every vm run --- ports/esp32s2/common-hal/ota/__init__.c | 3 ++- ports/esp32s2/common-hal/ota/__init__.h | 6 +++--- ports/esp32s2/supervisor/port.c | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 4ec1021317..40cfce6769 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "common-hal/ota/__init__.h" #include "shared-bindings/ota/__init__.h" #include @@ -37,7 +38,7 @@ static esp_ota_handle_t update_handle = 0; static bool ota_inited = false; static const char *TAG = "OTA"; -static void ota_reset(void) { +void ota_reset(void) { update_handle = 0; update_partition = NULL; ota_inited = false; diff --git a/ports/esp32s2/common-hal/ota/__init__.h b/ports/esp32s2/common-hal/ota/__init__.h index 317604a8ec..983b57e3f2 100644 --- a/ports/esp32s2/common-hal/ota/__init__.h +++ b/ports/esp32s2/common-hal/ota/__init__.h @@ -24,9 +24,9 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H -#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H extern void ota_reset(void); -#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H +#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0841081de8..4cca862d87 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -41,6 +41,7 @@ #include "common-hal/busio/I2C.h" #include "common-hal/busio/SPI.h" #include "common-hal/busio/UART.h" +#include "common-hal/ota/__init__.h" #include "common-hal/ps2io/Ps2.h" #include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" @@ -107,6 +108,10 @@ void reset_port(void) { analogout_reset(); #endif +#if CIRCUITPY_OTA + ota_reset(); +#endif + #if CIRCUITPY_PS2IO ps2_reset(); #endif From 5964163649e1f4309665dc870861729eba4e0f31 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 10 Dec 2020 13:03:40 -0500 Subject: [PATCH 042/146] Initial SleepMemory code --- ports/esp32s2/common-hal/alarm/SleepMemory.c | 62 +++++++ ports/esp32s2/common-hal/alarm/SleepMemory.h | 63 +++++++ ports/esp32s2/common-hal/alarm/__init__.c | 16 +- ports/esp32s2/common-hal/alarm/__init__.h | 6 +- py/circuitpy_defns.mk | 1 + shared-bindings/alarm/SleepMemory.c | 180 +++++++++++++++++++ shared-bindings/alarm/SleepMemory.h | 44 +++++ shared-bindings/alarm/__init__.c | 6 +- 8 files changed, 373 insertions(+), 5 deletions(-) create mode 100644 ports/esp32s2/common-hal/alarm/SleepMemory.c create mode 100644 ports/esp32s2/common-hal/alarm/SleepMemory.h create mode 100644 shared-bindings/alarm/SleepMemory.c create mode 100644 shared-bindings/alarm/SleepMemory.h diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.c b/ports/esp32s2/common-hal/alarm/SleepMemory.c new file mode 100644 index 0000000000..2579eb5fc7 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.c @@ -0,0 +1,62 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * Copyright (c) 2020 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/runtime.h" +#include "common-hal/alarm/SleepMemory.h" + +#include "esp_sleep.h" + +void alarm_sleep_memory_reset(void) { + // Power RTC slow memory during deep sleep + esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON); +} + +uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) { + return SLEEP_MEMORY_LENGTH; +} + +bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, + uint32_t start_index, uint8_t* values, uint32_t len) { + + if (start_index + len > SLEEP_MEMORY_LENGTH) { + return false; + } + + memcpy((uint8_t *) (SLEEP_MEMORY_BASE + start_index), values, len); + return true; +} + +void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, + uint32_t start_index, uint32_t len, uint8_t* values) { + + if (start_index + len > SLEEP_MEMORY_LENGTH) { + return; + } + memcpy(values, (uint8_t *) (SLEEP_MEMORY_BASE + start_index), len); +} diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.h b/ports/esp32s2/common-hal/alarm/SleepMemory.h new file mode 100644 index 0000000000..adf7b35ae2 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.h @@ -0,0 +1,63 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM_SLEEPMEMORY_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM_SLEEPMEMORY_H + +#include "py/obj.h" + +#define SLEEP_MEMORY_LENGTH (8192) + +// There are several places we could store persistent data for SleepMemory: +// +// RTC registers: There are a few 32-bit registers maintained during deep sleep. +// We are already using one for saving sleep information during deep sleep. +// +// RTC Fast Memory: 8kB, also used for deep-sleep power on stub, and for heap +// during normal operation if CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP is set. +// Power-on during deep sleep must be enabled. +// I experimented with using RTC Fast Memory. It seemed to work, but occasionally, +// got smashed for unknown reasons. +// Base of RTC Fast memory on the data bus is 0x3FF9E000. The address is different on the instruction bus. +// +// RTC Slow Memory: 8kB, also used for the ULP (tiny co-processor available during sleep). +// Less likely to be used by ESP-IDF. +// Since we may want to use the ULP in the future, we will use the upper half +// of Slow Memory and reserve the lower half for ULP. +// From ulp.h: +// #define RTC_SLOW_MEM ((uint32_t*) 0x50000000) /*!< RTC slow memory, 8k size */ + +// Upper half of RTC_SLOW_MEM. +#define SLEEP_MEMORY_LENGTH (4096) +#define SLEEP_MEMORY_BASE (0x50000000 + 4096) + +typedef struct { + mp_obj_base_t base; +} alarm_sleep_memory_obj_t; + +extern void alarm_sleep_memory_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM_SLEEPMEMORY_H diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 529179200d..fae921db0b 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -1,10 +1,10 @@ - /* +/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries - * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Dan Halbert for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,6 +30,7 @@ #include "py/runtime.h" #include "shared-bindings/alarm/pin/PinAlarm.h" +#include "shared-bindings/alarm/SleepMemory.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/wifi/__init__.h" @@ -41,8 +42,17 @@ #include "esp_sleep.h" +// Singleton instance of SleepMemory. +const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { + .base = { + .type = &alarm_sleep_memory_type, + }, +}; + + void alarm_reset(void) { alarm_time_timealarm_reset(); + alarm_sleep_memory_reset(); esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } diff --git a/ports/esp32s2/common-hal/alarm/__init__.h b/ports/esp32s2/common-hal/alarm/__init__.h index 5678a0e7f1..0823ff842e 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.h +++ b/ports/esp32s2/common-hal/alarm/__init__.h @@ -27,6 +27,10 @@ #ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H -void alarm_reset(void); +#include "common-hal/alarm/SleepMemory.h" + +const alarm_sleep_memory_obj_t alarm_sleep_memory_obj; + +extern void alarm_reset(void); #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index e9253682e0..1eafce2595 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -304,6 +304,7 @@ SRC_COMMON_HAL_ALL = \ _bleio/__init__.c \ _pew/PewPew.c \ _pew/__init__.c \ + alarm/SleepMemory.c \ alarm/__init__.c \ alarm/pin/PinAlarm.c \ alarm/time/TimeAlarm.c \ diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c new file mode 100644 index 0000000000..d4a6eb5090 --- /dev/null +++ b/shared-bindings/alarm/SleepMemory.c @@ -0,0 +1,180 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/binary.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "py/runtime0.h" + +#include "shared-bindings/alarm/SleepMemory.h" +#include "supervisor/shared/translate.h" + +//| class SleepMemory: +//| """Store raw bytes in RAM that persists during deep sleep. +//| The class acts as a ``bytearray``. +//| If power is lost, the memory contents are lost. +//| +//| Note that this class can't be imported and used directly. The sole +//| instance of :class:`SleepMemory` is available at +//| :attr:`alarm.sleep_memory`. +//| +//| Usage:: +//| +//| import alarm +//| alarm.sleep_memory[0] = True +//| alarm.sleep_memory[1] = 12 +//| + +//| def __init__(self) -> None: +//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`.""" +//| ... +//| + +//| def __bool__(self) -> bool: +//| """``sleep_memory`` is ``True`` if its length is greater than zero. +//| This is an easy way to check for its existence. +//| """ +//| ... +//| +//| def __len__(self) -> int: +//| """Return the length. This is used by (`len`)""" +//| ... +//| +STATIC mp_obj_t alarm_sleep_memory_unary_op(mp_unary_op_t op, mp_obj_t self_in) { + alarm_sleep_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); + uint16_t len = common_hal_alarm_sleep_memory_get_length(self); + switch (op) { + case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0); + case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(len); + default: return MP_OBJ_NULL; // op not supported + } +} + +STATIC const mp_rom_map_elem_t alarm_sleep_memory_locals_dict_table[] = { +}; + +STATIC MP_DEFINE_CONST_DICT(alarm_sleep_memory_locals_dict, alarm_sleep_memory_locals_dict_table); + +//| @overload +//| def __getitem__(self, index: slice) -> bytearray: ... +//| @overload +//| def __getitem__(self, index: int) -> int: +//| """Returns the value at the given index.""" +//| ... +//| +//| @overload +//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ... +//| @overload +//| def __setitem__(self, index: int, value: int) -> None: +//| """Set the value at the given index.""" +//| ... +//| +STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { + if (value == MP_OBJ_NULL) { + // delete item + // slice deletion + return MP_OBJ_NULL; // op not supported + } else { + alarm_sleep_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); + if (0) { +#if MICROPY_PY_BUILTINS_SLICE + } else if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) { + mp_bound_slice_t slice; + if (!mp_seq_get_fast_slice_indexes(common_hal_alarm_sleep_memory_get_length(self), index_in, &slice)) { + mp_raise_NotImplementedError(translate("only slices with step=1 (aka None) are supported")); + } + if (value != MP_OBJ_SENTINEL) { + #if MICROPY_PY_ARRAY_SLICE_ASSIGN + // Assign + size_t src_len = slice.stop - slice.start; + uint8_t* src_items; + if (MP_OBJ_IS_TYPE(value, &mp_type_array) || + MP_OBJ_IS_TYPE(value, &mp_type_bytearray) || + MP_OBJ_IS_TYPE(value, &mp_type_memoryview) || + MP_OBJ_IS_TYPE(value, &mp_type_bytes)) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(value, &bufinfo, MP_BUFFER_READ); + if (bufinfo.len != src_len) { + mp_raise_ValueError(translate("Slice and value different lengths.")); + } + src_len = bufinfo.len; + src_items = bufinfo.buf; + if (1 != mp_binary_get_size('@', bufinfo.typecode, NULL)) { + mp_raise_ValueError(translate("Array values should be single bytes.")); + } + } else { + mp_raise_NotImplementedError(translate("array/bytes required on right side")); + } + + if (!common_hal_alarm_sleep_memory_set_bytes(self, slice.start, src_items, src_len)) { + mp_raise_RuntimeError(translate("Unable to write to nvm.")); + } + return mp_const_none; + #else + return MP_OBJ_NULL; // op not supported + #endif + } else { + // Read slice. + size_t len = slice.stop - slice.start; + uint8_t *items = m_new(uint8_t, len); + common_hal_alarm_sleep_memory_get_bytes(self, slice.start, len, items); + return mp_obj_new_bytearray_by_ref(len, items); + } +#endif + } else { + // Single index rather than slice. + size_t index = mp_get_index(self->base.type, common_hal_alarm_sleep_memory_get_length(self), + index_in, false); + if (value == MP_OBJ_SENTINEL) { + // load + uint8_t value_out; + common_hal_alarm_sleep_memory_get_bytes(self, index, 1, &value_out); + return MP_OBJ_NEW_SMALL_INT(value_out); + } else { + // store + mp_int_t byte_value = mp_obj_get_int(value); + if (byte_value > 0xff || byte_value < 0) { + mp_raise_ValueError(translate("Bytes must be between 0 and 255.")); + } + uint8_t short_value = byte_value; + if (!common_hal_alarm_sleep_memory_set_bytes(self, index, &short_value, 1)) { + mp_raise_RuntimeError(translate("Unable to write to nvm.")); + } + return mp_const_none; + } + } + } +} + +const mp_obj_type_t alarm_sleep_memory_type = { + { &mp_type_type }, + .name = MP_QSTR_SleepMemory, + .subscr = alarm_sleep_memory_subscr, + .unary_op = alarm_sleep_memory_unary_op, + .print = NULL, + .locals_dict = (mp_obj_t)&alarm_sleep_memory_locals_dict, +}; diff --git a/shared-bindings/alarm/SleepMemory.h b/shared-bindings/alarm/SleepMemory.h new file mode 100644 index 0000000000..0015233e0b --- /dev/null +++ b/shared-bindings/alarm/SleepMemory.h @@ -0,0 +1,44 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_SLEEPMEMORY_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_SLEEPMEMORY_H + +#include "common-hal/alarm/SleepMemory.h" + +extern const mp_obj_type_t alarm_sleep_memory_type; + +uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self); + +bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, + uint32_t start_index, uint8_t* values, uint32_t len); +// len and values are intentionally swapped to signify values is an output and +// also leverage the compiler to validate uses are expected. +void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, + uint32_t start_index, uint32_t len, uint8_t* values); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_SLEEPMEMORY_H diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 5420b8404b..28e34ad6aa 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -29,6 +29,7 @@ #include "py/runtime.h" #include "shared-bindings/alarm/__init__.h" +#include "shared-bindings/alarm/SleepMemory.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/supervisor/Runtime.h" @@ -177,6 +178,7 @@ STATIC const mp_obj_module_t alarm_time_module = { .globals = (mp_obj_dict_t*)&alarm_time_globals, }; +// The module table is mutable because .wake_alarm is a mutable attribute. STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, @@ -188,8 +190,10 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { MP_OBJ_FROM_PTR(&alarm_exit_and_deep_sleep_until_alarms_obj) }, { MP_ROM_QSTR(MP_QSTR_pin), MP_OBJ_FROM_PTR(&alarm_pin_module) }, - { MP_ROM_QSTR(MP_QSTR_time), MP_OBJ_FROM_PTR(&alarm_time_module) } + { MP_ROM_QSTR(MP_QSTR_time), MP_OBJ_FROM_PTR(&alarm_time_module) }, + { MP_ROM_QSTR(MP_QSTR_SleepMemory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_type) }, + { MP_ROM_QSTR(MP_QSTR_sleep_memory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_obj) }, }; STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); From 55f4110983c175fbb70fa15303f686229ae1ed63 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 10 Dec 2020 14:16:25 -0500 Subject: [PATCH 043/146] fix typo --- ports/esp32s2/common-hal/alarm/SleepMemory.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.h b/ports/esp32s2/common-hal/alarm/SleepMemory.h index adf7b35ae2..665ac543d6 100644 --- a/ports/esp32s2/common-hal/alarm/SleepMemory.h +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.h @@ -29,8 +29,6 @@ #include "py/obj.h" -#define SLEEP_MEMORY_LENGTH (8192) - // There are several places we could store persistent data for SleepMemory: // // RTC registers: There are a few 32-bit registers maintained during deep sleep. From d83d46a52d4a5da9541cfa4bfa7d13e285fce476 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 10 Dec 2020 14:28:22 -0500 Subject: [PATCH 044/146] Invoke scripts with --- py/mkenv.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/mkenv.mk b/py/mkenv.mk index cb678e8e78..7e99f59c10 100644 --- a/py/mkenv.mk +++ b/py/mkenv.mk @@ -56,7 +56,7 @@ RM = rm RSYNC = rsync SED = sed # Linux has 'nproc', macOS has 'sysctl -n hw.logicalcpu', this is cross-platform -NPROC = $(PYTHON) -c 'import multiprocessing as mp; print(mp.cpu_count())' +NPROC = $(PYTHON3) -c 'import multiprocessing as mp; print(mp.cpu_count())' AS = $(CROSS_COMPILE)as CC = $(CROSS_COMPILE)gcc @@ -72,7 +72,7 @@ CXX += -m32 LD += -m32 endif -MAKE_FROZEN = $(PYTHON) $(TOP)/tools/make-frozen.py +MAKE_FROZEN = $(PYTHON3) $(TOP)/tools/make-frozen.py MPY_CROSS = $(TOP)/mpy-cross/mpy-cross MPY_TOOL = $(PYTHON3) $(TOP)/tools/mpy-tool.py PREPROCESS_FROZEN_MODULES = PYTHONPATH=$(TOP)/tools/python-semver $(TOP)/tools/preprocess_frozen_modules.py From cb35abfd04762871283e0323bddf0904d27913ea Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 11 Dec 2020 01:01:01 +0530 Subject: [PATCH 045/146] add docs, update translation & fix ota.flash() --- locale/circuitpython.pot | 10 +++++++++- ports/esp32s2/common-hal/ota/__init__.c | 2 +- shared-bindings/ota/__init__.c | 23 ++++++++++++++++++----- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 5bf95043a6..214b7aad16 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 10:30+0530\n" +"POT-Creation-Date: 2020-12-10 16:56+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1907,6 +1907,10 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" +#: ports/esp32s2/common-hal/ota/__init__.c +msgid "Unable to switch boot partition" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -3198,6 +3202,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/ota/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 40cfce6769..5ea25fb5d4 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -145,6 +145,6 @@ void common_hal_ota_finish(void) { void common_hal_ota_switch(void) { if (esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)) != ESP_OK) { - mp_raise_RuntimeError(translate("Unable to switch partition")); + mp_raise_RuntimeError(translate("Unable to switch boot partition")); } } diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 46399dcb2e..03636779fe 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -30,39 +30,52 @@ //| //| The `ota` module implements over-the-air update.""" +//| def switch() -> None: +//| """Switches the boot partition. +//| ... +//| STATIC mp_obj_t ota_switch(void) { common_hal_ota_switch(); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); +//| def finish() -> None: +//| """Validates flashed firmware, sets next boot partition. +//| **Must be called after** `ota.flash()` +//| ... +//| STATIC mp_obj_t ota_finish(void) { common_hal_ota_finish(); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); +//| def flash(*buffer: WriteableBuffer, offset: int=0) -> None: +//| """Writes one of two OTA partition at the given offset. +//| ... +//| STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_binary, ARG_offset }; + enum { ARG_buffer, ARG_offset }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_binary, MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_offset, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); if (args[ARG_offset].u_int < -1) { mp_raise_ValueError(translate("offset must be >= 0")); } mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[ARG_binary].u_obj, &bufinfo, MP_BUFFER_READ); + mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); common_hal_ota_flash(bufinfo.buf, bufinfo.len, args[ARG_offset].u_int); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 1, ota_flash); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 0, ota_flash); STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, From cf938983e9c584b0c41a909723dc71e9161cc494 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Dec 2020 08:10:26 -0500 Subject: [PATCH 046/146] SleepMemory + set alarm.wake_alarm --- main.c | 12 ++++++++---- ports/esp32s2/common-hal/alarm/time/TimeAlarm.c | 1 + shared-bindings/alarm/__init__.c | 7 ++++++- shared-bindings/alarm/__init__.h | 5 ++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index da04ada466..378c506579 100755 --- a/main.c +++ b/main.c @@ -112,9 +112,6 @@ STATIC void start_mp(supervisor_allocation* heap) { reset_status_led(); autoreload_stop(); supervisor_workflow_reset(); -#if CIRCUITPY_ALARM - alarm_reset(); -#endif // Stack limit should be less than real stack size, so we have a chance // to recover from limit hit. (Limit is measured in bytes.) @@ -158,6 +155,13 @@ STATIC void start_mp(supervisor_allocation* heap) { mp_obj_list_init(mp_sys_argv, 0); + #if CIRCUITPY_ALARM + // Record which alarm woke us up, if any. An object may be created so the heap must be functional. + alarm_save_wakeup_alarm(); + // Reset alarm module only after we retrieved the wakeup alarm. + alarm_reset(); + #endif + #if CIRCUITPY_NETWORK network_module_init(); #endif @@ -285,6 +289,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { filesystem_flush(); supervisor_allocation* heap = allocate_remaining_memory(); start_mp(heap); + found_main = maybe_run_list(supported_filenames, &result); #if CIRCUITPY_FULL_BUILD if (!found_main){ @@ -354,7 +359,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { serial_write_compressed(translate("Woken up by alarm.\n")); board_init(); supervisor_set_run_reason(RUN_REASON_STARTUP); - // TODO: Reset any volatile memory the user may have access to. return true; } #endif diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index d5e896c015..4d0bba2387 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -52,6 +52,7 @@ mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t * alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); timer->base.type = &alarm_time_time_alarm_type; // TODO: Set monotonic_time based on the RTC state. + timer->monotonic_time = 0.0f; return timer; } diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 28e34ad6aa..5ef548ef27 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -197,7 +197,7 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { }; STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); -void common_hal_alarm_set_wake_alarm(mp_obj_t alarm) { +STATIC void alarm_set_wake_alarm(mp_obj_t alarm) { // Equivalent of: // alarm.wake_alarm = alarm mp_map_elem_t *elem = @@ -207,6 +207,11 @@ void common_hal_alarm_set_wake_alarm(mp_obj_t alarm) { } } +// Initialize .wake_alarm value. +void alarm_save_wakeup_alarm(void) { + alarm_set_wake_alarm(common_hal_alarm_get_wake_alarm()); +} + const mp_obj_module_t alarm_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&alarm_module_globals, diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 5a8c613d9d..8c4b6cad96 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -43,8 +43,11 @@ extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj // Deep sleep is entered outside of the VM so we omit the `common_hal_` prefix. extern NORETURN void alarm_enter_deep_sleep(void); +extern mp_obj_t common_hal_alarm_get_wake_alarm(void); + // Used by wake-up code. -extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); +void alarm_save_wakeup_alarm(void); + // True if an alarm is alerting. This is most useful for pretend deep sleep. extern bool alarm_woken_from_sleep(void); From 1daad63d2b54e8fcf9965030ed965873fbcdc178 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Dec 2020 08:34:40 -0500 Subject: [PATCH 047/146] add apt-get update --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2378a09653..6ca6793250 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: python-version: 3.8 - name: Install deps run: | + sudo apt-get update sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy From 39124b888b5e2b55ee99dd60f7afa5e2edfa9fb5 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Dec 2020 09:03:45 -0500 Subject: [PATCH 048/146] doc fixes --- shared-bindings/alarm/SleepMemory.c | 4 ++-- shared-bindings/alarm/__init__.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c index d4a6eb5090..7a585ba2c6 100644 --- a/shared-bindings/alarm/SleepMemory.c +++ b/shared-bindings/alarm/SleepMemory.c @@ -47,10 +47,10 @@ //| import alarm //| alarm.sleep_memory[0] = True //| alarm.sleep_memory[1] = 12 -//| +//| """ //| def __init__(self) -> None: -//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`.""" +//| """Not used. Access the sole instance through `alarm.sleep_memory`.""" //| ... //| diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 5ef548ef27..700fe020ea 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -58,7 +58,11 @@ //| maintaining the connection takes priority and power consumption may not be reduced. //| """ +//| sleep_memory: SleepMemory +//| """Memory that persists during deep sleep. +//| This object is the sole instance of `alarm.SleepMemory`.""" //| + //| wake_alarm: Alarm //| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm the woke it from sleep.""" //| From 08e94e6a204708060860a9ed3b801bf3fb5b5ecc Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 11 Dec 2020 22:55:22 +0530 Subject: [PATCH 049/146] add more docs --- shared-bindings/ota/__init__.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 03636779fe..152a8e802d 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -26,12 +26,26 @@ #include "shared-bindings/ota/__init__.h" -//| """ota module +//| """OTA Module +//| +//| The `ota` module implements over-the-air update. +//| +//| There are two identical ota partitions ota_0/1, these +//| contain different firmware versions. +//| Having two partitions enables rollback functionality. +//| +//| The two partitions are defined as boot partition and +//| next-update partition. Calling `ota.flash()` writes the +//| next-update partition. +//| +//| After the next-update partition is written a validation +//| check is performed and on a successful validation this +//| partition is set as the boot partition. On next reset, +//| firmware will be loaded from this partition""" //| -//| The `ota` module implements over-the-air update.""" //| def switch() -> None: -//| """Switches the boot partition. +//| """Switches the boot partition.""" //| ... //| STATIC mp_obj_t ota_switch(void) { @@ -42,7 +56,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); //| def finish() -> None: //| """Validates flashed firmware, sets next boot partition. -//| **Must be called after** `ota.flash()` +//| **Must be called after** `ota.flash()`""" //| ... //| STATIC mp_obj_t ota_finish(void) { @@ -52,7 +66,10 @@ STATIC mp_obj_t ota_finish(void) { STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); //| def flash(*buffer: WriteableBuffer, offset: int=0) -> None: -//| """Writes one of two OTA partition at the given offset. +//| """Writes one of two OTA partitions at the given offset. +//| +//| The default offset is 0. It is necessary to provide the +//| offset when writing in discontinous chunks.""" //| ... //| STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { From 8d9d53a07c7f138f97e499a572992951017f0d73 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 11 Dec 2020 16:31:15 +0000 Subject: [PATCH 050/146] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (877 of 877 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 282392bda1..7595f8485b 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-08 09:56-0800\n" -"PO-Revision-Date: 2020-12-04 06:29+0000\n" +"PO-Revision-Date: 2020-12-11 19:08+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1601,10 +1601,13 @@ msgstr "" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar.\n" #: main.c msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" +"Simular o deep sleep até o alarme, até qualquer chave ou até a escrita do " +"arquivo.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2102,7 +2105,7 @@ msgstr "A senha do Wi-Fi deve ter entre 8 e 63 caracteres" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "Foi despertado através do alarme.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" From e3194ad54e95917b6a15da190f8fa565aa322efb Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 11 Dec 2020 20:35:28 +0100 Subject: [PATCH 051/146] Reserve UART pins only if DEBUG=1 is set to address issue 3811 --- ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c | 2 ++ ports/esp32s2/boards/electroniccats_bastwifi/board.c | 2 ++ ports/esp32s2/boards/espressif_kaluga_1/board.c | 2 ++ ports/esp32s2/boards/espressif_saola_1_wroom/board.c | 2 ++ ports/esp32s2/boards/espressif_saola_1_wrover/board.c | 2 ++ ports/esp32s2/boards/microdev_micro_s2/board.c | 2 ++ ports/esp32s2/boards/muselab_nanoesp32_s2/board.c | 2 ++ ports/esp32s2/boards/targett_module_clip_wroom/board.c | 2 ++ ports/esp32s2/boards/targett_module_clip_wrover/board.c | 2 ++ ports/esp32s2/boards/unexpectedmaker_feathers2/board.c | 2 ++ .../esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c | 2 ++ 11 files changed, 22 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c index a9d1074f72..63a16c1206 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c @@ -115,8 +115,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); diff --git a/ports/esp32s2/boards/electroniccats_bastwifi/board.c b/ports/esp32s2/boards/electroniccats_bastwifi/board.c index ff5d9cfb6c..aaef97c7d1 100644 --- a/ports/esp32s2/boards/electroniccats_bastwifi/board.c +++ b/ports/esp32s2/boards/electroniccats_bastwifi/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/espressif_kaluga_1/board.c b/ports/esp32s2/boards/espressif_kaluga_1/board.c index ff5d9cfb6c..aaef97c7d1 100644 --- a/ports/esp32s2/boards/espressif_kaluga_1/board.c +++ b/ports/esp32s2/boards/espressif_kaluga_1/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c index ff5d9cfb6c..aaef97c7d1 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c index ff5d9cfb6c..aaef97c7d1 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/microdev_micro_s2/board.c b/ports/esp32s2/boards/microdev_micro_s2/board.c index abd22091ee..d8fd3a0a2b 100644 --- a/ports/esp32s2/boards/microdev_micro_s2/board.c +++ b/ports/esp32s2/boards/microdev_micro_s2/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ // SPI Flash and RAM common_hal_never_reset_pin(&pin_GPIO26); diff --git a/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c b/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c index ff5d9cfb6c..aaef97c7d1 100644 --- a/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c +++ b/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/targett_module_clip_wroom/board.c b/ports/esp32s2/boards/targett_module_clip_wroom/board.c index c2022d292e..9c58dd2c8a 100644 --- a/ports/esp32s2/boards/targett_module_clip_wroom/board.c +++ b/ports/esp32s2/boards/targett_module_clip_wroom/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ // Crystal common_hal_never_reset_pin(&pin_GPIO15); diff --git a/ports/esp32s2/boards/targett_module_clip_wrover/board.c b/ports/esp32s2/boards/targett_module_clip_wrover/board.c index 5a9fbcbee7..f5e66acb61 100644 --- a/ports/esp32s2/boards/targett_module_clip_wrover/board.c +++ b/ports/esp32s2/boards/targett_module_clip_wrover/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ //Crystal common_hal_never_reset_pin(&pin_GPIO15); diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c index abd22091ee..d8fd3a0a2b 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ // SPI Flash and RAM common_hal_never_reset_pin(&pin_GPIO26); diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c index abd22091ee..d8fd3a0a2b 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ // SPI Flash and RAM common_hal_never_reset_pin(&pin_GPIO26); From 2de5eba6d11c5c0cab61cf20ee21b50016a5cf25 Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 11 Dec 2020 21:17:07 +0100 Subject: [PATCH 052/146] add apt-get update --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2378a09653..6ca6793250 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: python-version: 3.8 - name: Install deps run: | + sudo apt-get update sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy From 37c9f768b5f492cd1dc3b64632d0f91dbce313e7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Dec 2020 08:34:40 -0500 Subject: [PATCH 053/146] add apt-get update --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2378a09653..6ca6793250 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: python-version: 3.8 - name: Install deps run: | + sudo apt-get update sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy From 81c4871fdf457658e30fd0064fdd6250eb9f89e9 Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 11 Dec 2020 22:11:39 +0100 Subject: [PATCH 054/146] Set DEBUG CFLAG if set in make --- ports/esp32s2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 4486cb598c..01f8f48a78 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -118,7 +118,7 @@ CFLAGS += -DSTACK_CANARY_VALUE=0xa5a5a5a5 #Debugging/Optimization ifeq ($(DEBUG), 1) - CFLAGS += -ggdb + CFLAGS += -DDEBUG -ggdb OPTIMIZATION_FLAGS ?= -Og # You may want to enable these flags to make setting breakpoints easier. # CFLAGS += -fno-inline -fno-ipa-sra From 92098ca06b2d119db7810738ed7da262bdea5686 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 12 Dec 2020 05:15:25 +0530 Subject: [PATCH 055/146] update docs, implement suggested changes --- shared-bindings/ota/__init__.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 152a8e802d..8ecc6d9c41 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -41,11 +41,24 @@ //| After the next-update partition is written a validation //| check is performed and on a successful validation this //| partition is set as the boot partition. On next reset, -//| firmware will be loaded from this partition""" +//| firmware will be loaded from this partition. +//| +//| Here is the sequence of commands to follow: +//| +//| .. code-block:: python +//| +//| import ota +//| +//| ota.flash(buffer, offset) +//| ota.finish() +//| """ +//| ... //| //| def switch() -> None: -//| """Switches the boot partition.""" +//| """Switches the boot partition. On next reset, +//| firmware will be loaded from the partition +//| just switched over to.""" //| ... //| STATIC mp_obj_t ota_switch(void) { @@ -56,7 +69,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); //| def finish() -> None: //| """Validates flashed firmware, sets next boot partition. -//| **Must be called after** `ota.flash()`""" +//| **Must be called** after the firmware has been +//| completely written into the flash using `ota.flash()`. +//| +//| This is to be called only once per update.""" //| ... //| STATIC mp_obj_t ota_finish(void) { @@ -65,11 +81,14 @@ STATIC mp_obj_t ota_finish(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); -//| def flash(*buffer: WriteableBuffer, offset: int=0) -> None: +//| def flash(*buffer: ReadableBuffer, offset: int=0) -> None: //| """Writes one of two OTA partitions at the given offset. //| //| The default offset is 0. It is necessary to provide the -//| offset when writing in discontinous chunks.""" +//| offset when writing in discontinous chunks. +//| +//| This can be called multiple times when flashing the firmware +//| in small chunks.""" //| ... //| STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { From c5c13620f23f7275945ef0e4c7b17a014cbfa635 Mon Sep 17 00:00:00 2001 From: BennyE Date: Sat, 12 Dec 2020 00:49:53 +0100 Subject: [PATCH 056/146] Fix for issue 3663 by returning early if no scan was started before stop is issued --- ports/esp32s2/common-hal/wifi/Radio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 49cb8ec30f..05506783e7 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -105,6 +105,10 @@ mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self) { } void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self) { + // Return early if self->current_scan is NULL to avoid hang + if (self->current_scan == NULL) { + return; + } // Free the memory used to store the found aps. wifi_scannednetworks_deinit(self->current_scan); self->current_scan = NULL; From fe32dd08b8618b9c280ce49af8da02ad2cfa032b Mon Sep 17 00:00:00 2001 From: Thea Flowers Date: Sat, 12 Dec 2020 19:16:35 -0500 Subject: [PATCH 057/146] Update Big Honking Button configuration to support its newest board revision. v5 of the BHB board has: * GD25Q64C instead of the GD25Q16C. * Pin PB10 tied to ground for board revision detection. --- .../boards/winterbloom_big_honking_button/mpconfigboard.mk | 4 ++-- ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk index 71586d6e05..ab2b861c03 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk @@ -9,8 +9,8 @@ CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 SPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICE_COUNT = 1 -EXTERNAL_FLASH_DEVICES = "GD25Q16C" +EXTERNAL_FLASH_DEVICE_COUNT = 2 +EXTERNAL_FLASH_DEVICES = "GD25Q16C, GD25Q64C" LONGINT_IMPL = MPZ CIRCUITPY_AUDIOIO = 1 diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c index f325529f39..a079929447 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c @@ -6,5 +6,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GATE_OUT), MP_ROM_PTR(&pin_PA11) }, { MP_ROM_QSTR(MP_QSTR_GATE_IN), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_PITCH_IN), MP_ROM_PTR(&pin_PB08) }, + /* Board revisions starting from v5 have PB10 tied to ground. */ + { MP_ROM_QSTR(MP_QSTR_V5), MP_ROM_PTR(&pin_PB10) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 210c0ec89c88b50089067f74c2f0893fdd8613b4 Mon Sep 17 00:00:00 2001 From: BennyE Date: Sun, 13 Dec 2020 13:32:12 +0100 Subject: [PATCH 058/146] add country(code) to wifi network objects) --- ports/esp32s2/common-hal/wifi/Network.c | 6 ++++++ shared-bindings/wifi/Network.c | 17 +++++++++++++++++ shared-bindings/wifi/Network.h | 1 + shared-bindings/wifi/Radio.c | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index e90b3d552c..ab60b98f45 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -48,3 +48,9 @@ mp_obj_t common_hal_wifi_network_get_rssi(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) { return mp_obj_new_int(self->record.primary); } + +mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { + const char* cstr = (const char*) self->record.country.cc; + return mp_obj_new_str(cstr, strlen(cstr)); +} + diff --git a/shared-bindings/wifi/Network.c b/shared-bindings/wifi/Network.c index bf970a9c0f..009712ad19 100644 --- a/shared-bindings/wifi/Network.c +++ b/shared-bindings/wifi/Network.c @@ -108,12 +108,29 @@ const mp_obj_property_t wifi_network_channel_obj = { (mp_obj_t)&mp_const_none_obj }, }; +//| country: str +//| """String id of the country code""" +//| +STATIC mp_obj_t wifi_network_get_country(mp_obj_t self) { + return common_hal_wifi_network_get_country(self); + +} +MP_DEFINE_CONST_FUN_OBJ_1(wifi_network_get_country_obj, wifi_network_get_country); + +const mp_obj_property_t wifi_network_country_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&wifi_network_get_country_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj }, +}; + STATIC const mp_rom_map_elem_t wifi_network_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_ssid), MP_ROM_PTR(&wifi_network_ssid_obj) }, { MP_ROM_QSTR(MP_QSTR_bssid), MP_ROM_PTR(&wifi_network_bssid_obj) }, { MP_ROM_QSTR(MP_QSTR_rssi), MP_ROM_PTR(&wifi_network_rssi_obj) }, { MP_ROM_QSTR(MP_QSTR_channel), MP_ROM_PTR(&wifi_network_channel_obj) }, + { MP_ROM_QSTR(MP_QSTR_country), MP_ROM_PTR(&wifi_network_country_obj) }, }; STATIC MP_DEFINE_CONST_DICT(wifi_network_locals_dict, wifi_network_locals_dict_table); diff --git a/shared-bindings/wifi/Network.h b/shared-bindings/wifi/Network.h index c9bbc685e6..e672e3108a 100644 --- a/shared-bindings/wifi/Network.h +++ b/shared-bindings/wifi/Network.h @@ -39,5 +39,6 @@ extern mp_obj_t common_hal_wifi_network_get_ssid(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_bssid(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_rssi(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self); +extern mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_NETWORK_H diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index edbd9fd2ff..723572a321 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -295,7 +295,7 @@ const mp_obj_property_t wifi_radio_ipv4_dns_obj = { }; //| ap_info: Optional[Network] -//| """Network object containing BSSID, SSID, channel, and RSSI when connected to an access point. None otherwise.""" +//| """Network object containing BSSID, SSID, channel, country and RSSI when connected to an access point. None otherwise.""" //| STATIC mp_obj_t wifi_radio_get_ap_info(mp_obj_t self) { return common_hal_wifi_radio_get_ap_info(self); From e0afa32cfa31870e9ac040c5bcf0735f0f020df1 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 11:36:54 -0500 Subject: [PATCH 059/146] use RTC_DATA_ATTR; address review comments --- ports/esp32s2/common-hal/alarm/SleepMemory.c | 26 ++++++++++-------- ports/esp32s2/common-hal/alarm/SleepMemory.h | 20 ++++---------- shared-bindings/alarm/SleepMemory.c | 29 +++----------------- shared-bindings/alarm/SleepMemory.h | 8 ++---- 4 files changed, 27 insertions(+), 56 deletions(-) diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.c b/ports/esp32s2/common-hal/alarm/SleepMemory.c index 2579eb5fc7..38e3de2b6d 100644 --- a/ports/esp32s2/common-hal/alarm/SleepMemory.c +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.c @@ -30,33 +30,37 @@ #include "py/runtime.h" #include "common-hal/alarm/SleepMemory.h" +#include "esp_log.h" #include "esp_sleep.h" +// Data storage for singleton instance of SleepMemory. +// Might be RTC_SLOW_MEM or RTC_FAST_MEM, depending on setting of CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM. +static RTC_DATA_ATTR uint8_t _sleep_mem[SLEEP_MEMORY_LENGTH]; + void alarm_sleep_memory_reset(void) { - // Power RTC slow memory during deep sleep - esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON); + // ESP-IDF build system takes care of doing esp_sleep_pd_config() or the equivalentwith + // the correct settings, depending on which RTC mem we are using. + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/system/sleep_modes.html#power-down-of-rtc-peripherals-and-memories } uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) { - return SLEEP_MEMORY_LENGTH; + return sizeof(_sleep_mem); } -bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, - uint32_t start_index, uint8_t* values, uint32_t len) { +bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, const uint8_t* values, uint32_t len) { - if (start_index + len > SLEEP_MEMORY_LENGTH) { + if (start_index + len > sizeof(_sleep_mem)) { return false; } - memcpy((uint8_t *) (SLEEP_MEMORY_BASE + start_index), values, len); + memcpy((uint8_t *) (_sleep_mem + start_index), values, len); return true; } -void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, - uint32_t start_index, uint32_t len, uint8_t* values) { +void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len) { - if (start_index + len > SLEEP_MEMORY_LENGTH) { + if (start_index + len > sizeof(_sleep_mem)) { return; } - memcpy(values, (uint8_t *) (SLEEP_MEMORY_BASE + start_index), len); + memcpy(values, (uint8_t *) (_sleep_mem + start_index), len); } diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.h b/ports/esp32s2/common-hal/alarm/SleepMemory.h index 665ac543d6..bf6713ab82 100644 --- a/ports/esp32s2/common-hal/alarm/SleepMemory.h +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.h @@ -34,23 +34,15 @@ // RTC registers: There are a few 32-bit registers maintained during deep sleep. // We are already using one for saving sleep information during deep sleep. // -// RTC Fast Memory: 8kB, also used for deep-sleep power on stub, and for heap -// during normal operation if CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP is set. -// Power-on during deep sleep must be enabled. -// I experimented with using RTC Fast Memory. It seemed to work, but occasionally, -// got smashed for unknown reasons. -// Base of RTC Fast memory on the data bus is 0x3FF9E000. The address is different on the instruction bus. -// +// RTC Fast Memory: 8kB, also used for deep-sleep power-on stub. // RTC Slow Memory: 8kB, also used for the ULP (tiny co-processor available during sleep). -// Less likely to be used by ESP-IDF. -// Since we may want to use the ULP in the future, we will use the upper half -// of Slow Memory and reserve the lower half for ULP. -// From ulp.h: -// #define RTC_SLOW_MEM ((uint32_t*) 0x50000000) /*!< RTC slow memory, 8k size */ +// +// The ESP-IDF build system takes care of the power management of these regions. +// RTC_DATA_ATTR will allocate storage in RTC_SLOW_MEM unless CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM +// is set. Any memory not allocated by us can be used by the ESP-IDF for heap or other purposes. -// Upper half of RTC_SLOW_MEM. +// Use half of RTC_SLOW_MEM or RTC_FAST_MEM. #define SLEEP_MEMORY_LENGTH (4096) -#define SLEEP_MEMORY_BASE (0x50000000 + 4096) typedef struct { mp_obj_base_t base; diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c index 7a585ba2c6..bec0b76658 100644 --- a/shared-bindings/alarm/SleepMemory.c +++ b/shared-bindings/alarm/SleepMemory.c @@ -54,26 +54,6 @@ //| ... //| -//| def __bool__(self) -> bool: -//| """``sleep_memory`` is ``True`` if its length is greater than zero. -//| This is an easy way to check for its existence. -//| """ -//| ... -//| -//| def __len__(self) -> int: -//| """Return the length. This is used by (`len`)""" -//| ... -//| -STATIC mp_obj_t alarm_sleep_memory_unary_op(mp_unary_op_t op, mp_obj_t self_in) { - alarm_sleep_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); - uint16_t len = common_hal_alarm_sleep_memory_get_length(self); - switch (op) { - case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0); - case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(len); - default: return MP_OBJ_NULL; // op not supported - } -} - STATIC const mp_rom_map_elem_t alarm_sleep_memory_locals_dict_table[] = { }; @@ -131,7 +111,7 @@ STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, m } if (!common_hal_alarm_sleep_memory_set_bytes(self, slice.start, src_items, src_len)) { - mp_raise_RuntimeError(translate("Unable to write to nvm.")); + mp_raise_RuntimeError(translate("Unable to write to sleep_memory.")); } return mp_const_none; #else @@ -141,7 +121,7 @@ STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, m // Read slice. size_t len = slice.stop - slice.start; uint8_t *items = m_new(uint8_t, len); - common_hal_alarm_sleep_memory_get_bytes(self, slice.start, len, items); + common_hal_alarm_sleep_memory_get_bytes(self, slice.start, items, len); return mp_obj_new_bytearray_by_ref(len, items); } #endif @@ -152,7 +132,7 @@ STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, m if (value == MP_OBJ_SENTINEL) { // load uint8_t value_out; - common_hal_alarm_sleep_memory_get_bytes(self, index, 1, &value_out); + common_hal_alarm_sleep_memory_get_bytes(self, index, &value_out, 1); return MP_OBJ_NEW_SMALL_INT(value_out); } else { // store @@ -162,7 +142,7 @@ STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, m } uint8_t short_value = byte_value; if (!common_hal_alarm_sleep_memory_set_bytes(self, index, &short_value, 1)) { - mp_raise_RuntimeError(translate("Unable to write to nvm.")); + mp_raise_RuntimeError(translate("Unable to write to sleep_memory.")); } return mp_const_none; } @@ -174,7 +154,6 @@ const mp_obj_type_t alarm_sleep_memory_type = { { &mp_type_type }, .name = MP_QSTR_SleepMemory, .subscr = alarm_sleep_memory_subscr, - .unary_op = alarm_sleep_memory_unary_op, .print = NULL, .locals_dict = (mp_obj_t)&alarm_sleep_memory_locals_dict, }; diff --git a/shared-bindings/alarm/SleepMemory.h b/shared-bindings/alarm/SleepMemory.h index 0015233e0b..e7a56521b9 100644 --- a/shared-bindings/alarm/SleepMemory.h +++ b/shared-bindings/alarm/SleepMemory.h @@ -34,11 +34,7 @@ extern const mp_obj_type_t alarm_sleep_memory_type; uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self); -bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, - uint32_t start_index, uint8_t* values, uint32_t len); -// len and values are intentionally swapped to signify values is an output and -// also leverage the compiler to validate uses are expected. -void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, - uint32_t start_index, uint32_t len, uint8_t* values); +bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, const uint8_t* values, uint32_t len); +void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_SLEEPMEMORY_H From e0bb4a808ae1efb30076b4d0dd0991239e361f62 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 11:49:01 -0500 Subject: [PATCH 060/146] make translate --- locale/circuitpython.pot | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 11ca8c8140..93c8edc44a 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -388,7 +388,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -522,7 +522,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "" @@ -1696,7 +1696,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1911,6 +1911,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2117,7 +2121,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3215,7 +3220,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" From f15e2d86c0fb3235a9934b74d22a0d70ea2b4f4c Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 14 Dec 2020 12:59:20 -0500 Subject: [PATCH 061/146] Reduce samples from 64 to 2 --- ports/esp32s2/common-hal/analogio/AnalogIn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/analogio/AnalogIn.c b/ports/esp32s2/common-hal/analogio/AnalogIn.c index f33439c4af..b2c09fc076 100644 --- a/ports/esp32s2/common-hal/analogio/AnalogIn.c +++ b/ports/esp32s2/common-hal/analogio/AnalogIn.c @@ -37,7 +37,7 @@ #include #define DEFAULT_VREF 1100 -#define NO_OF_SAMPLES 64 +#define NO_OF_SAMPLES 2 #define ATTENUATION ADC_ATTEN_DB_11 #define DATA_WIDTH ADC_WIDTH_BIT_13 From dc560f0eee74a95e96dd402f76c6aa31ba13d712 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 14 Dec 2020 13:00:07 -0500 Subject: [PATCH 062/146] translations --- locale/circuitpython.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 06dcdeaa5c..5a850d13c6 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 18:56-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From d793ec287234e1e968adf3b8e03c184c19339942 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 14 Dec 2020 14:25:38 -0500 Subject: [PATCH 063/146] Change pinfunc to default of 0 at reset --- ports/esp32s2/common-hal/microcontroller/Pin.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 0434a6e3a0..81dfa1308d 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -55,6 +55,7 @@ STATIC void floating_gpio_reset(gpio_num_t pin_number) { .intr_type = GPIO_INTR_DISABLE, }; gpio_config(&cfg); + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[pin_number], 0); } void never_reset_pin_number(gpio_num_t pin_number) { From eea8bc4999fc56990884e7854a9402b3633000d7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 15:41:17 -0500 Subject: [PATCH 064/146] Use Dec 11 gcc 10.2 release --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c032b1b8a3..16f7914117 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -341,7 +341,7 @@ jobs: run: | sudo apt-get install -y gettext pip install requests sh click setuptools awscli - wget --no-verbose https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q2/gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 + wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 - name: Versions run: | From d2cb58a2df81ddaadaaa5f08699760885e2ecb81 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 15:54:38 -0500 Subject: [PATCH 065/146] suod apt-get update --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16f7914117..2cef968a4d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: python-version: 3.8 - name: Install deps run: | + sudo apt-get update sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy From 845cf03a45c098886acd62c836848194f1161d03 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 15:55:31 -0500 Subject: [PATCH 066/146] typo --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2cef968a4d..35f1743db4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -343,7 +343,7 @@ jobs: sudo apt-get install -y gettext pip install requests sh click setuptools awscli wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 - sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 + sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 - name: Versions run: | gcc --version From 731cdefe801633ef39c9036cda6951da50b0075c Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Mon, 14 Dec 2020 16:25:33 -0500 Subject: [PATCH 067/146] this should be it. --- supervisor/shared/external_flash/devices.h | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index a874dbd4fd..30eb7d7212 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -94,6 +94,26 @@ typedef struct { .single_status_byte = false, \ } +// Settings for the Adesto Tech AT25DF641-SSHD-T 8MiB SPI flash +// for the Oak Dev Tech Icy Tree M0 (SAMD21) feather board. +// Source: https://www.digikey.com/product-detail/en/adesto-technologies/AT25SF641-SDHD-T/1265-1180-1-ND/ +// Datasheet: https://www.adestotech.com/wp-content/uploads/doc8693.pdf +#define AT25DF641A {\ + .total_size = (1 << 23), /* 8 MiB */ \ + .start_up_time_us = 10000, \ + .manufacturer_id = 0x1f, \ + .memory_type = 0x48, \ + .capacity = 0x00, \ + .max_clock_speed_mhz = 85, \ + .quad_enable_bit_mask = 0x00, \ + .has_sector_protection = true, \ + .supports_fast_read = true, \ + .supports_qspi = false, \ + .supports_qspi_writes = false, \ + .write_status_register_split = false, \ + .single_status_byte = false, \ +} + // Settings for the Adesto Tech AT25SF161-SSHD-T 2MiB SPI flash // for the StringCar M0 (SAMD21) Express board. // Source: https://www.digikey.com/product-detail/en/adesto-technologies/AT25SF161-SDHD-T/1265-1230-1-ND/ @@ -114,6 +134,7 @@ typedef struct { .single_status_byte = false, \ } + // Settings for the Adesto Tech AT25SF041 1MiB SPI flash. It's on the SparkFun // SAMD51 Thing Plus board // Datasheet: https://www.adestotech.com/wp-content/uploads/DS-AT25SF041_044.pdf @@ -566,6 +587,25 @@ typedef struct { .single_status_byte = true, \ } +// Settings for the Macronix MX25L51245G 64MiB SPI flash. +// Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7437/MX25L51245G,%203V,%20512Mb,%20v1.6.pdf +// Will finish this addition in a future PR. All the stuff is there, just need to test in the wild. +//#define MX25L25645G {\ + .total_size = (1 << 25), /* 32 MiB */ \ + .start_up_time_us = 5000, \ + .manufacturer_id = 0x9f, \ + .memory_type = 0xab, \ + .capacity = 0x90, \ + .max_clock_speed_mhz = 133, \ + .quad_enable_bit_mask = 0xaf, \ + .has_sector_protection = false, \ + .supports_fast_read = true, \ + .supports_qspi = true, \ + .supports_qspi_writes = true, \ + .write_status_register_split = false, \ + .single_status_byte = true, \ +}*/ + // Settings for the Winbond W25Q128JV-PM 16MiB SPI flash. Note that JV-IM has a different .memory_type (0x70) // Datasheet: https://www.winbond.com/resource-files/w25q128jv%20revf%2003272018%20plus.pdf #define W25Q128JV_PM {\ From 6d8642bf41491610e8d76ddfdd9f055d83568e61 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Mon, 14 Dec 2020 17:17:28 -0500 Subject: [PATCH 068/146] fixing line comment issue with CI build tests --- supervisor/shared/external_flash/devices.h | 28 +++++++++++----------- tests/pyboard 2.py | 1 + 2 files changed, 15 insertions(+), 14 deletions(-) create mode 120000 tests/pyboard 2.py diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index 30eb7d7212..fafb68ef03 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -591,20 +591,20 @@ typedef struct { // Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7437/MX25L51245G,%203V,%20512Mb,%20v1.6.pdf // Will finish this addition in a future PR. All the stuff is there, just need to test in the wild. //#define MX25L25645G {\ - .total_size = (1 << 25), /* 32 MiB */ \ - .start_up_time_us = 5000, \ - .manufacturer_id = 0x9f, \ - .memory_type = 0xab, \ - .capacity = 0x90, \ - .max_clock_speed_mhz = 133, \ - .quad_enable_bit_mask = 0xaf, \ - .has_sector_protection = false, \ - .supports_fast_read = true, \ - .supports_qspi = true, \ - .supports_qspi_writes = true, \ - .write_status_register_split = false, \ - .single_status_byte = true, \ -}*/ +// .total_size = (1 << 25), /* 32 MiB */ \ +// .start_up_time_us = 5000, \ +// .manufacturer_id = 0x9f, \ +// .memory_type = 0xab, \ +// .capacity = 0x90, \ +// .max_clock_speed_mhz = 133, \ +// .quad_enable_bit_mask = 0xaf, \ +// .has_sector_protection = false, \ +// .supports_fast_read = true, \ +// .supports_qspi = true, \ +// .supports_qspi_writes = true, \ +// .write_status_register_split = false, \ +// .single_status_byte = true, \ +//} // Settings for the Winbond W25Q128JV-PM 16MiB SPI flash. Note that JV-IM has a different .memory_type (0x70) // Datasheet: https://www.winbond.com/resource-files/w25q128jv%20revf%2003272018%20plus.pdf diff --git a/tests/pyboard 2.py b/tests/pyboard 2.py new file mode 120000 index 0000000000..616773a313 --- /dev/null +++ b/tests/pyboard 2.py @@ -0,0 +1 @@ +../tools/cpboard.py \ No newline at end of file From c16b8f1ee5eb4cea1131ba7db4938c65fb1045d0 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Mon, 14 Dec 2020 17:26:27 -0500 Subject: [PATCH 069/146] odd thing with a tests/pyboard\ 2.py file showing up --- tests/pyboard 2.py | 1 - 1 file changed, 1 deletion(-) delete mode 120000 tests/pyboard 2.py diff --git a/tests/pyboard 2.py b/tests/pyboard 2.py deleted file mode 120000 index 616773a313..0000000000 --- a/tests/pyboard 2.py +++ /dev/null @@ -1 +0,0 @@ -../tools/cpboard.py \ No newline at end of file From 6abe3cd0ef6c04108b1728797830ebfd1827ecaa Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 18:57:31 -0500 Subject: [PATCH 070/146] -Os for SAMD51; fix CSUPEROPT typo --- ports/atmel-samd/Makefile | 6 +++--- py/py.mk | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index dc7b4e4c89..c214d56f0c 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -94,21 +94,21 @@ endif ifeq ($(CHIP_FAMILY), samd51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -Os # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -Os # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same54) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -Os # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif diff --git a/py/py.mk b/py/py.mk index 1a8f1219a5..3f94aa67a0 100644 --- a/py/py.mk +++ b/py/py.mk @@ -19,7 +19,7 @@ endif QSTR_GLOBAL_DEPENDENCIES += $(PY_SRC)/mpconfig.h mpconfigport.h # some code is performance bottleneck and compiled with other optimization options -_CSUPEROPT = -O3 +CSUPEROPT = -O3 # this sets the config file for FatFs CFLAGS_MOD += -DFFCONF_H=\"lib/oofatfs/ffconf.h\" From 9fd652111a0af634de4fb39c34b86830602fb5c5 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 15 Dec 2020 02:40:11 +0100 Subject: [PATCH 071/146] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 17 +++++++++++------ locale/cs.po | 17 +++++++++++------ locale/de_DE.po | 17 +++++++++++------ locale/el.po | 17 +++++++++++------ locale/es.po | 17 +++++++++++------ locale/fil.po | 17 +++++++++++------ locale/fr.po | 17 +++++++++++------ locale/hi.po | 17 +++++++++++------ locale/it_IT.po | 17 +++++++++++------ locale/ja.po | 17 +++++++++++------ locale/ko.po | 17 +++++++++++------ locale/nl.po | 17 +++++++++++------ locale/pl.po | 17 +++++++++++------ locale/pt_BR.po | 17 +++++++++++------ locale/sv.po | 17 +++++++++++------ locale/zh_Latn_pinyin.po | 17 +++++++++++------ 16 files changed, 176 insertions(+), 96 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 6203f70842..ccedccfd31 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -392,7 +392,7 @@ msgstr "Send yang lain sudah aktif" msgid "Array must contain halfwords (type 'H')" msgstr "Array harus mengandung halfwords (ketik 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Nilai array harus berupa byte tunggal." @@ -528,7 +528,7 @@ msgstr "Pin bus %d sudah digunakan" msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer harus 16 byte." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes harus di antara 0 dan 255." @@ -1729,7 +1729,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Potongan dan nilai panjangnya berbeda." @@ -1948,6 +1948,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2161,7 +2165,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3261,7 +3266,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index ef549e3554..7d3b5c23de 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -392,7 +392,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -526,7 +526,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "" @@ -1700,7 +1700,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1915,6 +1915,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2121,7 +2125,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3219,7 +3224,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 056ed5908c..d021184d1d 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -391,7 +391,7 @@ msgstr "Ein anderer Sendevorgang ist schon aktiv" msgid "Array must contain halfwords (type 'H')" msgstr "Array muss Halbwörter enthalten (type 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array-Werte sollten aus Einzelbytes bestehen." @@ -529,7 +529,7 @@ msgstr "Bus pin %d wird schon benutzt" msgid "Byte buffer must be 16 bytes." msgstr "Der Puffer muss 16 Bytes lang sein." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Ein Bytes kann nur Werte zwischen 0 und 255 annehmen." @@ -1728,7 +1728,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice und Wert (value) haben unterschiedliche Längen." @@ -1957,6 +1957,10 @@ msgstr "Konnte Farbpalettendaten nicht lesen" msgid "Unable to write to nvm." msgstr "Schreiben in nvm nicht möglich." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Unerwarteter nrfx uuid-Typ" @@ -2178,7 +2182,8 @@ msgstr "Argumente müssen ndarrays sein" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "Array/Bytes auf der rechten Seite erforderlich" @@ -3296,7 +3301,7 @@ msgid "only sample_rate=16000 is supported" msgstr "nur eine sample_rate=16000 wird unterstützt" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" "Es werden nur Slices mit Schritt = 1 (auch bekannt als None) unterstützt" diff --git a/locale/el.po b/locale/el.po index f1bd60bd5a..8a9ca846b0 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -387,7 +387,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -521,7 +521,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "" @@ -1695,7 +1695,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1910,6 +1910,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2116,7 +2120,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3214,7 +3219,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/es.po b/locale/es.po index 85d180c21f..39aeded729 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -397,7 +397,7 @@ msgstr "Otro envío ya está activo" msgid "Array must contain halfwords (type 'H')" msgstr "El array debe contener medias palabras (escriba 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Valores del array deben ser bytes individuales." @@ -535,7 +535,7 @@ msgstr "Bus pin %d ya está siendo utilizado" msgid "Byte buffer must be 16 bytes." msgstr "Búfer Byte debe de ser 16 bytes." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes debe estar entre 0 y 255." @@ -1733,7 +1733,7 @@ msgstr "El contexto del lado del servidor no puede tener un hostname" msgid "Size not supported" msgstr "Sin capacidades para el tamaño" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice y value tienen tamaños diferentes." @@ -1962,6 +1962,10 @@ msgstr "No se pudo leer los datos de la paleta de colores" msgid "Unable to write to nvm." msgstr "Imposible escribir en nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Tipo de uuid nrfx inesperado" @@ -2179,7 +2183,8 @@ msgstr "argumentos deben ser ndarrays" msgid "array and index length must be equal" msgstr "Longitud del array e índice tienen que ser iguales" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes requeridos en el lado derecho" @@ -3290,7 +3295,7 @@ msgid "only sample_rate=16000 is supported" msgstr "solo se admite sample_rate=16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "solo se admiten segmentos con step=1 (alias None)" diff --git a/locale/fil.po b/locale/fil.po index c55ab69b59..9c9716169e 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -390,7 +390,7 @@ msgstr "Isa pang send ay aktibo na" msgid "Array must contain halfwords (type 'H')" msgstr "May halfwords (type 'H') dapat ang array" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array values ay dapat single bytes." @@ -527,7 +527,7 @@ msgstr "Ginagamit na ang DAC" msgid "Byte buffer must be 16 bytes." msgstr "buffer ay dapat bytes-like object" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Sa gitna ng 0 o 255 dapat ang bytes." @@ -1715,7 +1715,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice at value iba't ibang haba." @@ -1930,6 +1930,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "Hindi ma i-sulat sa NVM." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy msgid "Unexpected nrfx uuid type" @@ -2146,7 +2150,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes kinakailangan sa kanang bahagi" @@ -3262,7 +3267,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "ang mga slices lamang na may hakbang = 1 (aka None) ang sinusuportahan" diff --git a/locale/fr.po b/locale/fr.po index 29d2d19849..ea3c75107c 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -397,7 +397,7 @@ msgstr "Un autre envoi est déjà actif" msgid "Array must contain halfwords (type 'H')" msgstr "Le tableau doit contenir des demi-mots (type 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'." @@ -535,7 +535,7 @@ msgstr "La broche %d du bus est déjà utilisée" msgid "Byte buffer must be 16 bytes." msgstr "Le tampon doit être de 16 octets." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Les octets 'bytes' doivent être entre 0 et 255." @@ -1740,7 +1740,7 @@ msgstr "Un contexte niveau serveur ne peut avoir de hostname" msgid "Size not supported" msgstr "Taille non prise en charge" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Tranche et valeur de tailles différentes." @@ -1970,6 +1970,10 @@ msgstr "Impossible de lire les données de la palette de couleurs" msgid "Unable to write to nvm." msgstr "Impossible d'écrire sur la mémoire non-volatile." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Type inattendu pour l'uuid nrfx" @@ -2189,7 +2193,8 @@ msgstr "les arguments doivent être des ndarrays" msgid "array and index length must be equal" msgstr "la longueur du tableau et de l'index doit être égale" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "tableau/octets requis à droite" @@ -3309,7 +3314,7 @@ msgid "only sample_rate=16000 is supported" msgstr "seul sample_rate = 16000 est pris en charge" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "seules les tranches avec 'step=1' (cad None) sont supportées" diff --git a/locale/hi.po b/locale/hi.po index 28b6e071a0..eae6b5818b 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -387,7 +387,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -521,7 +521,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "" @@ -1695,7 +1695,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1910,6 +1910,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2116,7 +2120,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3214,7 +3219,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index f61192834b..6800c87e76 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -389,7 +389,7 @@ msgstr "Another send è gia activato" msgid "Array must contain halfwords (type 'H')" msgstr "Array deve avere mezzoparole (typo 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Valori di Array dovrebbero essere bytes singulari" @@ -527,7 +527,7 @@ msgstr "DAC già in uso" msgid "Byte buffer must be 16 bytes." msgstr "i buffer devono essere della stessa lunghezza" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "I byte devono essere compresi tra 0 e 255" @@ -1727,7 +1727,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1942,6 +1942,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "Imposibile scrivere su nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy msgid "Unexpected nrfx uuid type" @@ -2150,7 +2154,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3268,7 +3273,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "solo slice con step=1 (aka None) sono supportate" diff --git a/locale/ja.po b/locale/ja.po index 82b8cc352d..5ec47eaf44 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -394,7 +394,7 @@ msgstr "他のsendがすでにアクティブ" msgid "Array must contain halfwords (type 'H')" msgstr "array のタイプは16ビット ('H') でなければなりません" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Arrayの各値は1バイトでなければなりません" @@ -530,7 +530,7 @@ msgstr "Busピン%dはすでに使用中" msgid "Byte buffer must be 16 bytes." msgstr "バッファは16バイトでなければなりません" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "バイト値は0から255の間でなければなりません" @@ -1713,7 +1713,7 @@ msgstr "" msgid "Size not supported" msgstr "サイズは対応していません" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "スライスと値の長さが一致しません" @@ -1935,6 +1935,10 @@ msgstr "カラーパレットデータを読み込めません" msgid "Unable to write to nvm." msgstr "nvmに書き込みできません" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "想定されていないnrfx UUID型" @@ -2141,7 +2145,8 @@ msgstr "引数はndarrayでなければなりません" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "右辺にはarray/bytesが必要" @@ -3244,7 +3249,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 58bd428015..ae51ac5d65 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -390,7 +390,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -526,7 +526,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "잘못된 크기의 버퍼. 16 바이트 여야합니다." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "바이트는 0에서 255 사이 여야합니다." @@ -1700,7 +1700,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1916,6 +1916,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2122,7 +2126,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3220,7 +3225,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index c0f3f478fb..e7743314fe 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -392,7 +392,7 @@ msgstr "Een andere send is al actief" msgid "Array must contain halfwords (type 'H')" msgstr "Array moet halfwords (type 'H') bevatten" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array waardes moet enkele bytes zijn." @@ -528,7 +528,7 @@ msgstr "Bus pin %d al in gebruik" msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer moet 16 bytes zijn." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes moeten tussen 0 en 255 liggen." @@ -1728,7 +1728,7 @@ msgstr "Context aan de serverkant kan geen hostnaam hebben" msgid "Size not supported" msgstr "Afmeting niet ondersteund" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice en waarde hebben verschillende lengtes." @@ -1953,6 +1953,10 @@ msgstr "Niet in staat kleurenpalet data te lezen" msgid "Unable to write to nvm." msgstr "Niet in staat om naar nvm te schrijven." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Onverwacht mrfx uuid type" @@ -2170,7 +2174,8 @@ msgstr "argumenten moeten ndarrays zijn" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes vereist aan de rechterkant" @@ -3276,7 +3281,7 @@ msgid "only sample_rate=16000 is supported" msgstr "alleen sample_rate=16000 wordt ondersteund" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "alleen segmenten met step=1 (ook wel None) worden ondersteund" diff --git a/locale/pl.po b/locale/pl.po index 72c091a11d..599847f2d3 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -394,7 +394,7 @@ msgstr "Wysyłanie jest już w toku" msgid "Array must contain halfwords (type 'H')" msgstr "Tablica musi zawierać pół-słowa (typ 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Wartości powinny być bajtami." @@ -530,7 +530,7 @@ msgstr "Nóżka magistrali %d jest w użyciu" msgid "Byte buffer must be 16 bytes." msgstr "Bufor musi mieć 16 bajtów." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes musi być między 0 a 255." @@ -1711,7 +1711,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Fragment i wartość są różnych długości." @@ -1926,6 +1926,10 @@ msgstr "Nie można odczytać danych palety" msgid "Unable to write to nvm." msgstr "Błąd zapisu do NVM." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Nieoczekiwany typ nrfx uuid" @@ -2138,7 +2142,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "tablica/bytes wymagane po prawej stronie" @@ -3237,7 +3242,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "tylko fragmenty ze step=1 (lub None) są wspierane" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 7595f8485b..3c366ac49e 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-11 19:08+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -396,7 +396,7 @@ msgstr "Outro envio já está ativo" msgid "Array must contain halfwords (type 'H')" msgstr "Array deve conter meias palavras (tipo 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Os valores das matrizes devem ser bytes simples." @@ -536,7 +536,7 @@ msgstr "O pino bus %d já está em uso" msgid "Byte buffer must be 16 bytes." msgstr "O buffer deve ter 16 bytes." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Os bytes devem estar entre 0 e 255." @@ -1742,7 +1742,7 @@ msgstr "O contexto do lado do servidor não pode ter nome de host" msgid "Size not supported" msgstr "O tamanho não é suportado" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Fatie e avalie os diferentes comprimentos." @@ -1971,6 +1971,10 @@ msgstr "Não foi possível ler os dados da paleta de cores" msgid "Unable to write to nvm." msgstr "Não é possível gravar no nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Tipo uuid nrfx inesperado" @@ -2189,7 +2193,8 @@ msgstr "os argumentos devem ser ndarrays" msgid "array and index length must be equal" msgstr "a matriz e comprimento do índice devem ser iguais" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "matriz/bytes são necessários no lado direito" @@ -3301,7 +3306,7 @@ msgid "only sample_rate=16000 is supported" msgstr "apenas sample_rate = 16000 é compatível" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" "apenas fatias com a etapa=1 (também conhecida como Nenhuma) são compatíveis" diff --git a/locale/sv.po b/locale/sv.po index be3d484058..4c645fc611 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -392,7 +392,7 @@ msgstr "En annan send är redan aktiv" msgid "Array must contain halfwords (type 'H')" msgstr "Matrisen måste innehålla halfwords (typ \"H\")" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Matrisvärden ska bestå av enstaka bytes." @@ -528,7 +528,7 @@ msgstr "Busspinne %d används redan" msgid "Byte buffer must be 16 bytes." msgstr "Byte-buffert måste vara 16 byte." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes måste vara mellan 0 och 255." @@ -1725,7 +1725,7 @@ msgstr "Serversidans kontext kan inte ha värdnamn" msgid "Size not supported" msgstr "Storleken stöds inte" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice och värde har olika längd." @@ -1950,6 +1950,10 @@ msgstr "Det går inte att läsa färgpalettdata" msgid "Unable to write to nvm." msgstr "Det gick inte att skriva till nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Oväntad nrfx uuid-typ" @@ -2164,7 +2168,8 @@ msgstr "argumenten måste vara ndarray" msgid "array and index length must be equal" msgstr "array och indexlängd måste vara lika" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes krävs på höger sida" @@ -3270,7 +3275,7 @@ msgid "only sample_rate=16000 is supported" msgstr "enbart sample_rate=16000 stöds" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "endast segment med steg=1 (aka Ingen) stöds" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 606f0077e1..c5264a93a8 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -394,7 +394,7 @@ msgstr "Lìng yīgè fāsòng yǐjīng jīhuó" msgid "Array must contain halfwords (type 'H')" msgstr "Shùzǔ bìxū bāohán bàn zìshù (type 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Shùzǔ zhí yīnggāi shì dāngè zì jié." @@ -530,7 +530,7 @@ msgstr "Zǒngxiàn yǐn jiǎo %d yǐ zài shǐyòng zhōng" msgid "Byte buffer must be 16 bytes." msgstr "Zì jié huǎnchōng qū bìxū shì 16 zì jié." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Zì jié bìxū jiè yú 0 dào 255 zhī jiān." @@ -1718,7 +1718,7 @@ msgstr "Fúwùqì duān shàngxiàwén bùnéng jùyǒu zhǔjī míng" msgid "Size not supported" msgstr "bù zhī chí dà xiǎo" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Qiēpiàn hé zhí bùtóng chángdù." @@ -1942,6 +1942,10 @@ msgstr "Wúfǎ dòu qǔ sè tiáo shùjù" msgid "Unable to write to nvm." msgstr "Wúfǎ xiě rù nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Yìwài de nrfx uuid lèixíng" @@ -2157,7 +2161,8 @@ msgstr "cānshù bìxū shì ndarrays" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "yòu cè xūyào shùzǔ/zì jié" @@ -3261,7 +3266,7 @@ msgid "only sample_rate=16000 is supported" msgstr "Jǐn zhīchí cǎiyàng lǜ = 16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "jǐn zhīchí bù zhǎng = 1(jí wú) de qiēpiàn" From 97947b4fe9724639b57855d5b98445f4d0bacd33 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 22:07:54 -0500 Subject: [PATCH 072/146] shrink bast_pro_mini_m0; use proper flex-array syntax --- .../_bleio/hci_include/att_internal.h | 46 +++++++++---------- .../common-hal/_bleio/hci_include/hci.h | 22 ++++----- .../common-hal/_bleio/hci_include/hci_vs.h | 20 ++++---- .../_bleio/hci_include/l2cap_internal.h | 16 +++---- .../boards/bast_pro_mini_m0/mpconfigboard.mk | 2 + 5 files changed, 54 insertions(+), 52 deletions(-) diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h b/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h index d6a4cb79c7..678cb4201b 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h @@ -69,7 +69,7 @@ struct bt_att_info_128 { #define BT_ATT_OP_FIND_INFO_RSP 0x05 struct bt_att_find_info_rsp { uint8_t format; - uint8_t info[0]; + uint8_t info[]; } __packed; /* Find By Type Value Request */ @@ -78,7 +78,7 @@ struct bt_att_find_type_req { uint16_t start_handle; uint16_t end_handle; uint16_t type; - uint8_t value[0]; + uint8_t value[]; } __packed; struct bt_att_handle_group { @@ -89,7 +89,7 @@ struct bt_att_handle_group { /* Find By Type Value Response */ #define BT_ATT_OP_FIND_TYPE_RSP 0x07 struct bt_att_find_type_rsp { - struct bt_att_handle_group list[0]; + struct bt_att_handle_group list[]; } __packed; /* Read By Type Request */ @@ -97,19 +97,19 @@ struct bt_att_find_type_rsp { struct bt_att_read_type_req { uint16_t start_handle; uint16_t end_handle; - uint8_t uuid[0]; + uint8_t uuid[]; } __packed; struct bt_att_data { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read By Type Response */ #define BT_ATT_OP_READ_TYPE_RSP 0x09 struct bt_att_read_type_rsp { uint8_t len; - struct bt_att_data data[0]; + struct bt_att_data data[]; } __packed; /* Read Request */ @@ -121,7 +121,7 @@ struct bt_att_read_req { /* Read Response */ #define BT_ATT_OP_READ_RSP 0x0b struct bt_att_read_rsp { - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read Blob Request */ @@ -134,7 +134,7 @@ struct bt_att_read_blob_req { /* Read Blob Response */ #define BT_ATT_OP_READ_BLOB_RSP 0x0d struct bt_att_read_blob_rsp { - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read Multiple Request */ @@ -142,13 +142,13 @@ struct bt_att_read_blob_rsp { #define BT_ATT_OP_READ_MULT_REQ 0x0e struct bt_att_read_mult_req { - uint16_t handles[0]; + uint16_t handles[]; } __packed; /* Read Multiple Respose */ #define BT_ATT_OP_READ_MULT_RSP 0x0f struct bt_att_read_mult_rsp { - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read by Group Type Request */ @@ -156,27 +156,27 @@ struct bt_att_read_mult_rsp { struct bt_att_read_group_req { uint16_t start_handle; uint16_t end_handle; - uint8_t uuid[0]; + uint8_t uuid[]; } __packed; struct bt_att_group_data { uint16_t start_handle; uint16_t end_handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read by Group Type Response */ #define BT_ATT_OP_READ_GROUP_RSP 0x11 struct bt_att_read_group_rsp { uint8_t len; - struct bt_att_group_data data[0]; + struct bt_att_group_data data[]; } __packed; /* Write Request */ #define BT_ATT_OP_WRITE_REQ 0x12 struct bt_att_write_req { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Write Response */ @@ -187,7 +187,7 @@ struct bt_att_write_req { struct bt_att_prepare_write_req { uint16_t handle; uint16_t offset; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Prepare Write Respond */ @@ -195,7 +195,7 @@ struct bt_att_prepare_write_req { struct bt_att_prepare_write_rsp { uint16_t handle; uint16_t offset; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Execute Write Request */ @@ -214,14 +214,14 @@ struct bt_att_exec_write_req { #define BT_ATT_OP_NOTIFY 0x1b struct bt_att_notify { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Handle Value Indication */ #define BT_ATT_OP_INDICATE 0x1d struct bt_att_indicate { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Handle Value Confirm */ @@ -233,14 +233,14 @@ struct bt_att_signature { #define BT_ATT_OP_READ_MULT_VL_REQ 0x20 struct bt_att_read_mult_vl_req { - uint16_t handles[0]; + uint16_t handles[]; } __packed; /* Read Multiple Respose */ #define BT_ATT_OP_READ_MULT_VL_RSP 0x21 struct bt_att_read_mult_vl_rsp { uint16_t len; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Handle Multiple Value Notification */ @@ -248,19 +248,19 @@ struct bt_att_read_mult_vl_rsp { struct bt_att_notify_mult { uint16_t handle; uint16_t len; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Write Command */ #define BT_ATT_OP_WRITE_CMD 0x52 struct bt_att_write_cmd { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Signed Write Command */ #define BT_ATT_OP_SIGNED_WRITE_CMD 0xd2 struct bt_att_signed_write_cmd { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/hci.h b/devices/ble_hci/common-hal/_bleio/hci_include/hci.h index 5213edbf0f..797278946a 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/hci.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/hci.h @@ -454,7 +454,7 @@ struct bt_hci_handle_count { #define BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS BT_OP(BT_OGF_BASEBAND, 0x0035) struct bt_hci_cp_host_num_completed_packets { uint8_t num_handles; - struct bt_hci_handle_count h[0]; + struct bt_hci_handle_count h[]; } __packed; #define BT_HCI_OP_WRITE_INQUIRY_MODE BT_OP(BT_OGF_BASEBAND, 0x0045) @@ -1099,7 +1099,7 @@ struct bt_hci_ext_adv_set { struct bt_hci_cp_le_set_ext_adv_enable { uint8_t enable; uint8_t set_num; - struct bt_hci_ext_adv_set s[0]; + struct bt_hci_ext_adv_set s[]; } __packed; #define BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN BT_OP(BT_OGF_LE, 0x003a) @@ -1158,7 +1158,7 @@ struct bt_hci_cp_le_set_ext_scan_param { uint8_t own_addr_type; uint8_t filter_policy; uint8_t phys; - struct bt_hci_ext_scan_phy p[0]; + struct bt_hci_ext_scan_phy p[]; } __packed; /* Extends BT_HCI_LE_SCAN_FILTER_DUP */ @@ -1189,7 +1189,7 @@ struct bt_hci_cp_le_ext_create_conn { uint8_t own_addr_type; bt_addr_le_t peer_addr; uint8_t phys; - struct bt_hci_ext_conn_phy p[0]; + struct bt_hci_ext_conn_phy p[]; } __packed; #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC BT_OP(BT_OGF_LE, 0x0044) @@ -1354,7 +1354,7 @@ struct bt_hci_evt_role_change { #define BT_HCI_EVT_NUM_COMPLETED_PACKETS 0x13 struct bt_hci_evt_num_completed_packets { uint8_t num_handles; - struct bt_hci_handle_count h[0]; + struct bt_hci_handle_count h[]; } __packed; #define BT_HCI_EVT_PIN_CODE_REQ 0x16 @@ -1510,11 +1510,11 @@ struct bt_hci_evt_le_advertising_info { uint8_t evt_type; bt_addr_le_t addr; uint8_t length; - uint8_t data[0]; + uint8_t data[]; } __packed; struct bt_hci_evt_le_advertising_report { uint8_t num_reports; - struct bt_hci_evt_le_advertising_info adv_info[0]; + struct bt_hci_evt_le_advertising_info adv_info[]; } __packed; #define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE 0x03 @@ -1593,7 +1593,7 @@ struct bt_hci_evt_le_direct_adv_info { } __packed; struct bt_hci_evt_le_direct_adv_report { uint8_t num_reports; - struct bt_hci_evt_le_direct_adv_info direct_adv_info[0]; + struct bt_hci_evt_le_direct_adv_info direct_adv_info[]; } __packed; #define BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE 0x0c @@ -1628,11 +1628,11 @@ struct bt_hci_evt_le_ext_advertising_info { uint16_t interval; bt_addr_le_t direct_addr; uint8_t length; - uint8_t data[0]; + uint8_t data[]; } __packed; struct bt_hci_evt_le_ext_advertising_report { uint8_t num_reports; - struct bt_hci_evt_le_ext_advertising_info adv_info[0]; + struct bt_hci_evt_le_ext_advertising_info adv_info[]; } __packed; #define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED 0x0e @@ -1654,7 +1654,7 @@ struct bt_hci_evt_le_per_advertising_report { uint8_t unused; uint8_t data_status; uint8_t length; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_HCI_EVT_LE_PER_ADV_SYNC_LOST 0x10 diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/hci_vs.h b/devices/ble_hci/common-hal/_bleio/hci_include/hci_vs.h index e4f94b6a83..660691398e 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/hci_vs.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/hci_vs.h @@ -104,7 +104,7 @@ struct bt_hci_cp_vs_set_trace_enable { #define BT_HCI_OP_VS_READ_BUILD_INFO BT_OP(BT_OGF_VS, 0x0008) struct bt_hci_rp_vs_read_build_info { uint8_t status; - uint8_t info[0]; + uint8_t info[]; } __packed; struct bt_hci_vs_static_addr { @@ -116,7 +116,7 @@ struct bt_hci_vs_static_addr { struct bt_hci_rp_vs_read_static_addrs { uint8_t status; uint8_t num_addrs; - struct bt_hci_vs_static_addr a[0]; + struct bt_hci_vs_static_addr a[]; } __packed; #define BT_HCI_OP_VS_READ_KEY_HIERARCHY_ROOTS BT_OP(BT_OGF_VS, 0x000a) @@ -143,7 +143,7 @@ struct bt_hci_vs_cmd { struct bt_hci_rp_vs_read_host_stack_cmds { uint8_t status; uint8_t num_cmds; - struct bt_hci_vs_cmd c[0]; + struct bt_hci_vs_cmd c[]; } __packed; #define BT_HCI_VS_SCAN_REQ_REPORTS_DISABLED 0x00 @@ -189,7 +189,7 @@ struct bt_hci_rp_vs_read_tx_power_level { struct bt_hci_rp_vs_read_usb_transport_mode { uint8_t status; uint8_t num_supported_modes; - uint8_t supported_mode[0]; + uint8_t supported_mode[]; } __packed; #define BT_HCI_VS_USB_H2_MODE 0x00 @@ -210,7 +210,7 @@ struct bt_hci_evt_vs { #define BT_HCI_EVT_VS_FATAL_ERROR 0x02 struct bt_hci_evt_vs_fatal_error { uint64_t pc; - uint8_t err_info[0]; + uint8_t err_info[]; } __packed; #define BT_HCI_VS_TRACE_LMP_TX 0x01 @@ -221,7 +221,7 @@ struct bt_hci_evt_vs_fatal_error { #define BT_HCI_EVT_VS_TRACE_INFO 0x03 struct bt_hci_evt_vs_trace_info { uint8_t type; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_HCI_EVT_VS_SCAN_REQ_RX 0x04 @@ -267,14 +267,14 @@ struct bt_hci_rp_mesh_get_opts { #define BT_HCI_OC_MESH_SET_SCAN_FILTER 0x01 struct bt_hci_mesh_pattern { uint8_t pattern_len; - uint8_t pattern[0]; + uint8_t pattern[]; } __packed; struct bt_hci_cp_mesh_set_scan_filter { uint8_t scan_filter; uint8_t filter_dup; uint8_t num_patterns; - struct bt_hci_mesh_pattern patterns[0]; + struct bt_hci_mesh_pattern patterns[]; } __packed; struct bt_hci_rp_mesh_set_scan_filter { uint8_t status; @@ -365,11 +365,11 @@ struct bt_hci_evt_mesh_scan_report { int8_t rssi; uint32_t instant; uint8_t data_len; - uint8_t data[0]; + uint8_t data[]; } __packed; struct bt_hci_evt_mesh_scanning_report { uint8_t num_reports; - struct bt_hci_evt_mesh_scan_report reports[0]; + struct bt_hci_evt_mesh_scan_report reports[]; } __packed; #ifdef __cplusplus diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/l2cap_internal.h b/devices/ble_hci/common-hal/_bleio/hci_include/l2cap_internal.h index bed311cf3c..a0a2ed056c 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/l2cap_internal.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/l2cap_internal.h @@ -45,7 +45,7 @@ struct bt_l2cap_sig_hdr { #define BT_L2CAP_CMD_REJECT 0x01 struct bt_l2cap_cmd_reject { uint16_t reason; - uint8_t data[0]; + uint8_t data[]; } __packed; struct bt_l2cap_cmd_reject_cid_data { @@ -88,7 +88,7 @@ struct bt_l2cap_conn_rsp { struct bt_l2cap_conf_req { uint16_t dcid; uint16_t flags; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_L2CAP_CONF_RSP 0x05 @@ -96,7 +96,7 @@ struct bt_l2cap_conf_rsp { uint16_t scid; uint16_t flags; uint16_t result; - uint8_t data[0]; + uint8_t data[]; } __packed; /* Option type used by MTU config request data */ @@ -108,7 +108,7 @@ struct bt_l2cap_conf_rsp { struct bt_l2cap_conf_opt { uint8_t type; uint8_t len; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_L2CAP_DISCONN_REQ 0x06 @@ -139,7 +139,7 @@ struct bt_l2cap_info_req { struct bt_l2cap_info_rsp { uint16_t type; uint16_t result; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_L2CAP_CONN_PARAM_REQ 0x12 @@ -201,7 +201,7 @@ struct bt_l2cap_ecred_conn_req { uint16_t mtu; uint16_t mps; uint16_t credits; - uint16_t scid[0]; + uint16_t scid[]; } __packed; #define BT_L2CAP_ECRED_CONN_RSP 0x18 @@ -210,14 +210,14 @@ struct bt_l2cap_ecred_conn_rsp { uint16_t mps; uint16_t credits; uint16_t result; - uint16_t dcid[0]; + uint16_t dcid[]; } __packed; #define BT_L2CAP_ECRED_RECONF_REQ 0x19 struct bt_l2cap_ecred_reconf_req { uint16_t mtu; uint16_t mps; - uint16_t scid[0]; + uint16_t scid[]; } __packed; #define BT_L2CAP_RECONF_SUCCESS 0x0000 diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk index 055e6b19e2..69dee4b474 100644 --- a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk @@ -9,3 +9,5 @@ CHIP_FAMILY = samd21 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 + +#SUPEROPT_GC = 0 From 9f9ab44acc5dc118c1c68b61a73ecbef8f3a9320 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 15 Dec 2020 10:11:16 -0500 Subject: [PATCH 073/146] Avoid "error: flexible array member in a struct with no named members" --- .../ble_hci/common-hal/_bleio/hci_include/att_internal.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h b/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h index 678cb4201b..b8efccaf46 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h @@ -89,6 +89,7 @@ struct bt_att_handle_group { /* Find By Type Value Response */ #define BT_ATT_OP_FIND_TYPE_RSP 0x07 struct bt_att_find_type_rsp { + uint8_t _dummy[0]; struct bt_att_handle_group list[]; } __packed; @@ -121,6 +122,7 @@ struct bt_att_read_req { /* Read Response */ #define BT_ATT_OP_READ_RSP 0x0b struct bt_att_read_rsp { + uint8_t _dummy[0]; uint8_t value[]; } __packed; @@ -134,6 +136,7 @@ struct bt_att_read_blob_req { /* Read Blob Response */ #define BT_ATT_OP_READ_BLOB_RSP 0x0d struct bt_att_read_blob_rsp { + uint8_t _dummy[0]; uint8_t value[]; } __packed; @@ -142,12 +145,14 @@ struct bt_att_read_blob_rsp { #define BT_ATT_OP_READ_MULT_REQ 0x0e struct bt_att_read_mult_req { + uint8_t _dummy[0]; uint16_t handles[]; } __packed; /* Read Multiple Respose */ #define BT_ATT_OP_READ_MULT_RSP 0x0f struct bt_att_read_mult_rsp { + uint8_t _dummy[0]; uint8_t value[]; } __packed; @@ -233,6 +238,7 @@ struct bt_att_signature { #define BT_ATT_OP_READ_MULT_VL_REQ 0x20 struct bt_att_read_mult_vl_req { + uint8_t _dummy[0]; uint16_t handles[]; } __packed; From dc9bc8fc9a078184447292f67b0a5b17a8917117 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Dec 2020 09:58:47 -0600 Subject: [PATCH 074/146] Fix flexible array declaration --- devices/ble_hci/common-hal/_bleio/att.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devices/ble_hci/common-hal/_bleio/att.c b/devices/ble_hci/common-hal/_bleio/att.c index 6528361cb1..8e9f5f017d 100644 --- a/devices/ble_hci/common-hal/_bleio/att.c +++ b/devices/ble_hci/common-hal/_bleio/att.c @@ -61,7 +61,7 @@ STATIC struct { typedef struct __packed { uint8_t properties; uint16_t value_handle; - uint8_t uuid[0]; // 2 or 16 bytes + uint8_t uuid[]; // 2 or 16 bytes } characteristic_declaration_t; STATIC uint8_t bleio_properties_to_ble_spec_properties(uint8_t bleio_properties) { From 3c4562c3caafa0590b63b32d680717363eb371bc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Dec 2020 10:39:56 -0600 Subject: [PATCH 075/146] camera: Provide correct forward-declaration of camera_imageformat_type This resolves the build error ``` arm-none-eabi-ld: build-spresense/libmpy.a(Camera.o):(.rodata.camera_imageformat_type+0x0): multiple definition of `camera_imageformat_type'; build-spresense/libmpy.a(__init__.o):(.rodata.camera_imageformat_type+0x0): first defined here arm-none-eabi-ld: build-spresense/libmpy.a(ImageFormat.o):(.rodata.camera_imageformat_type+0x0): multiple definition of `camera_imageformat_type'; build-spresense/libmpy.a(__init__.o):(.rodata.camera_imageformat_type+0x0): first defined here arm-none-eabi-ld: build-spresense/libmpy.a(Camera.o):(.rodata.camera_imageformat_type+0x0): multiple definition of `camera_imageformat_type'; build-spresense/libmpy.a(__init__.o):(.rodata.camera_imageformat_type+0x0): first defined here ``` --- shared-bindings/camera/ImageFormat.c | 1 - shared-bindings/camera/ImageFormat.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/shared-bindings/camera/ImageFormat.c b/shared-bindings/camera/ImageFormat.c index d4bdddc562..9f2f9617f6 100644 --- a/shared-bindings/camera/ImageFormat.c +++ b/shared-bindings/camera/ImageFormat.c @@ -38,7 +38,6 @@ //| RGB565: ImageFormat //| """RGB565 format.""" //| -const mp_obj_type_t camera_imageformat_type; const camera_imageformat_obj_t camera_imageformat_jpg_obj = { { &camera_imageformat_type }, diff --git a/shared-bindings/camera/ImageFormat.h b/shared-bindings/camera/ImageFormat.h index 8abc88438d..32a36354fc 100644 --- a/shared-bindings/camera/ImageFormat.h +++ b/shared-bindings/camera/ImageFormat.h @@ -35,7 +35,7 @@ typedef enum { IMAGEFORMAT_RGB565, } camera_imageformat_t; -const mp_obj_type_t camera_imageformat_type; +extern const mp_obj_type_t camera_imageformat_type; camera_imageformat_t camera_imageformat_obj_to_type(mp_obj_t obj); mp_obj_t camera_imageformat_type_to_obj(camera_imageformat_t mode); From bbbd621b184ee13740c0c8e4c94e7aed0db4f070 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Dec 2020 10:54:37 -0600 Subject: [PATCH 076/146] nrf: simmel: remove some unneeded modules to make it fit --- ports/nrf/boards/simmel/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index e34739c0f3..b437fad9d2 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -16,12 +16,14 @@ CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_BUSIO = 1 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 +CIRCUITPY_GAMEPAD = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 1 +CIRCUITPY_SDCARDIO = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_ULAB = 0 CIRCUITPY_WATCHDOG = 1 From fb33c4e1c0f83bce8f8cc1e8cae83695aeb2471d Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 15 Dec 2020 12:23:56 -0500 Subject: [PATCH 077/146] -ftree-vrp better diagnostics on -Os builds; -fno-inline-functions for -O2; fix struct init in HCI bleio --- devices/ble_hci/common-hal/_bleio/att.c | 46 +++++++++++++------------ ports/atmel-samd/Makefile | 9 +++-- ports/cxd56/Makefile | 2 +- ports/litex/Makefile | 2 +- ports/mimxrt10xx/Makefile | 4 +-- ports/nrf/Makefile | 2 +- ports/stm/Makefile | 5 ++- 7 files changed, 39 insertions(+), 31 deletions(-) diff --git a/devices/ble_hci/common-hal/_bleio/att.c b/devices/ble_hci/common-hal/_bleio/att.c index 8e9f5f017d..4573d5e9ff 100644 --- a/devices/ble_hci/common-hal/_bleio/att.c +++ b/devices/ble_hci/common-hal/_bleio/att.c @@ -1010,21 +1010,22 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui } int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) { - struct __packed { + + typedef struct __packed { struct bt_att_hdr h; struct bt_att_read_group_req r; - } req = { { - .code = BT_ATT_OP_READ_GROUP_REQ, - }, { - .start_handle = start_handle, - .end_handle = end_handle, - } - }; - req.r.uuid[0] = uuid & 0xff; - req.r.uuid[1] = uuid >> 8; + } req_t; + uint8_t req_bytes[sizeof(req_t) + sizeof(uuid)]; + req_t *req = (req_t *) req_bytes; - return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer); + req->h.code = BT_ATT_OP_READ_GROUP_REQ; + req->r.start_handle = start_handle; + req->r.end_handle = end_handle; + req->r.uuid[0] = uuid & 0xff; + req->r.uuid[1] = uuid >> 8; + + return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer); } STATIC void process_read_group_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) { @@ -1305,20 +1306,21 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl } int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) { - struct __packed { + typedef struct __packed { struct bt_att_hdr h; struct bt_att_read_type_req r; - } req = { { - .code = BT_ATT_OP_READ_TYPE_REQ, - }, { - .start_handle = start_handle, - .end_handle = end_handle, - } - }; - req.r.uuid[0] = type & 0xff; - req.r.uuid[1] = type >> 8; + } req_t; - return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer); + uint8_t req_bytes[sizeof(req_t) + sizeof(type)]; + req_t *req = (req_t *) req_bytes; + + req->h.code = BT_ATT_OP_READ_TYPE_REQ; + req->r.start_handle = start_handle; + req->r.end_handle = end_handle; + req->r.uuid[0] = type & 0xff; + req->r.uuid[1] = type >> 8; + + return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer); } STATIC void process_read_type_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) { diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index c214d56f0c..58c1c0d60e 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -94,21 +94,21 @@ endif ifeq ($(CHIP_FAMILY), samd51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -Os +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -Os +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same54) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -Os +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif @@ -116,6 +116,9 @@ endif # option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) +# Add -ftree-vrp optimization and checking to all builds. It's not enabled for -Os by default. +CFLAGS += -ftree-vrp + $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY)) #Debugging/Optimization ifeq ($(DEBUG), 1) diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 5201f0db56..1c48a23ca5 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -122,7 +122,7 @@ CFLAGS += \ -fdata-sections \ -Wall \ -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 612953daaf..f384f24577 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -80,7 +80,7 @@ ifeq ($(DEBUG), 1) OPTIMIZATION_FLAGS ?= -Og else CFLAGS += -DNDEBUG -ggdb3 - OPTIMIZATION_FLAGS ?= -O2 + OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # TODO: Test with -flto ### CFLAGS += -flto endif diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index a17e5f7030..04949bf01c 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -75,7 +75,7 @@ INC += \ # NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt. -CFLAGS += -Os -DNDEBUG -ffreestanding +CFLAGS += -Os -ftree-vrp -DNDEBUG -ffreestanding # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024 @@ -108,7 +108,7 @@ CFLAGS += \ -g3 -Wno-unused-parameter \ -ffunction-sections -fdata-sections -fstack-usage -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 3fef68e88e..278625e92d 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -89,7 +89,7 @@ ifeq ($(DEBUG), 1) CFLAGS += -ggdb3 OPTIMIZATION_FLAGS = -Og else - OPTIMIZATION_FLAGS ?= -O2 + OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions CFLAGS += -DNDEBUG -ggdb3 CFLAGS += -flto -flto-partition=none endif diff --git a/ports/stm/Makefile b/ports/stm/Makefile index b9426e07ec..e09fe736cc 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -86,7 +86,7 @@ ifeq ($(DEBUG), 1) CFLAGS += -fno-inline -fno-ipa-sra else CFLAGS += -DNDEBUG - OPTIMIZATION_FLAGS ?= -O2 + OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions CFLAGS += -ggdb3 # TODO: Test with -flto # CFLAGS += -flto @@ -95,6 +95,9 @@ endif # to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) +# Add -ftree-vrp optimization and checking to all builds. It's not enabled for -Os by default. +CFLAGS += -ftree-vrp + # MCU Series is defined by the HAL package and doesn't need to be specified here C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT) From 4521dfb73289eaa9d17cb61b29b49c10adf1f4a3 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 15 Dec 2020 13:23:49 -0500 Subject: [PATCH 078/146] squeeze some smaller boards --- ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk | 2 ++ ports/stm/boards/espruino_pico/mpconfigboard.mk | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk index 69dee4b474..6a2c896197 100644 --- a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk @@ -10,4 +10,4 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 -#SUPEROPT_GC = 0 +SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk index 3f75d175c8..e71bb07395 100755 --- a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk @@ -16,3 +16,5 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_VECTORIO = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar + +SUPEROPT_GC = 0 diff --git a/ports/stm/boards/espruino_pico/mpconfigboard.mk b/ports/stm/boards/espruino_pico/mpconfigboard.mk index 556ff35c45..14f9323fde 100644 --- a/ports/stm/boards/espruino_pico/mpconfigboard.mk +++ b/ports/stm/boards/espruino_pico/mpconfigboard.mk @@ -20,3 +20,5 @@ LD_FILE = boards/STM32F401xd_fs.ld # lto for this port, and if other stuff hasn't been added in the # meantime CIRCUITPY_ULAB = 0 + +SUPEROPT_GC = 0 From 2de9f181210114447540e427ed0b707b37fc1155 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 15 Dec 2020 22:31:58 +0100 Subject: [PATCH 079/146] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 6 +++++- locale/cs.po | 6 +++++- locale/de_DE.po | 6 +++++- locale/el.po | 6 +++++- locale/es.po | 6 +++++- locale/fil.po | 6 +++++- locale/fr.po | 6 +++++- locale/hi.po | 6 +++++- locale/it_IT.po | 6 +++++- locale/ja.po | 6 +++++- locale/ko.po | 6 +++++- locale/nl.po | 6 +++++- locale/pl.po | 6 +++++- locale/pt_BR.po | 6 +++++- locale/sv.po | 6 +++++- locale/zh_Latn_pinyin.po | 6 +++++- 16 files changed, 80 insertions(+), 16 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index ccedccfd31..dd9693f536 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -1101,6 +1101,10 @@ msgstr "Pin DAC yang diberikan tidak valid" msgid "Invalid PWM frequency" msgstr "Frekuensi PWM tidak valid" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumen tidak valid" diff --git a/locale/cs.po b/locale/cs.po index 7d3b5c23de..e178a3fd5b 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -1084,6 +1084,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index d021184d1d..85b3b90a06 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -1101,6 +1101,10 @@ msgstr "Ungültiger DAC-Pin angegeben" msgid "Invalid PWM frequency" msgstr "Ungültige PWM Frequenz" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ungültiges Argument" diff --git a/locale/el.po b/locale/el.po index 8a9ca846b0..1a835fd424 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1079,6 +1079,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" diff --git a/locale/es.po b/locale/es.po index 39aeded729..27b1756571 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -1102,6 +1102,10 @@ msgstr "Pin suministrado inválido para DAC" msgid "Invalid PWM frequency" msgstr "Frecuencia PWM inválida" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumento inválido" diff --git a/locale/fil.po b/locale/fil.po index 9c9716169e..e55fc5e2cc 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -1094,6 +1094,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "Mali ang PWM frequency" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Maling argumento" diff --git a/locale/fr.po b/locale/fr.po index ea3c75107c..eef3132739 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -1107,6 +1107,10 @@ msgstr "Broche DAC non valide fournie" msgid "Invalid PWM frequency" msgstr "Fréquence de PWM invalide" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argument invalide" diff --git a/locale/hi.po b/locale/hi.po index eae6b5818b..51b751c82a 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1079,6 +1079,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 6800c87e76..80dabb6256 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -1094,6 +1094,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "Frequenza PWM non valida" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argomento non valido" diff --git a/locale/ja.po b/locale/ja.po index 5ec47eaf44..226a8e179b 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -1094,6 +1094,10 @@ msgstr "不正なDACピンが与えられました" msgid "Invalid PWM frequency" msgstr "無効なPWM周波数" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "不正な引数" diff --git a/locale/ko.po b/locale/ko.po index ae51ac5d65..456cb47e65 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -1084,6 +1084,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index e7743314fe..63ff70716f 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -1096,6 +1096,10 @@ msgstr "Ongeldige DAC pin opgegeven" msgid "Invalid PWM frequency" msgstr "Ongeldige PWM frequentie" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ongeldig argument" diff --git a/locale/pl.po b/locale/pl.po index 599847f2d3..718bf50f42 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -1094,6 +1094,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "Zła częstotliwość PWM" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Zły argument" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 3c366ac49e..eb73928502 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-11 19:08+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -1105,6 +1105,10 @@ msgstr "O pino DAC informado é inválido" msgid "Invalid PWM frequency" msgstr "Frequência PWM inválida" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumento inválido" diff --git a/locale/sv.po b/locale/sv.po index 4c645fc611..a608866e3b 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -1094,6 +1094,10 @@ msgstr "Ogiltig DAC-pinne angiven" msgid "Invalid PWM frequency" msgstr "Ogiltig PWM-frekvens" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ogiltigt argument" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index c5264a93a8..1cbcc709ff 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -1092,6 +1092,10 @@ msgstr "Tí gōng liǎo wúxiào de DAC yǐn jiǎo" msgid "Invalid PWM frequency" msgstr "Wúxiào de PWM pínlǜ" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Wúxiào de cānshù" From 1ad49d9a18224ecc53d8f49d0675a369274556ce Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 8 Dec 2020 17:13:00 -0800 Subject: [PATCH 080/146] Add alarm.pin that wakes on pin level Fixes #3787 --- main.c | 18 +- ports/esp32s2/common-hal/alarm/__init__.c | 47 ++-- ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 260 +++++++++++++++++- ports/esp32s2/common-hal/alarm/pin/PinAlarm.h | 8 +- .../esp32s2/common-hal/alarm/time/TimeAlarm.c | 25 +- .../esp32s2/common-hal/alarm/time/TimeAlarm.h | 2 +- ports/esp32s2/supervisor/esp_port.h | 2 +- ports/esp32s2/supervisor/port.c | 47 ++-- ports/esp32s2/supervisor/usb.c | 7 +- py/obj.c | 6 +- py/vm.c | 2 +- shared-bindings/alarm/pin/PinAlarm.c | 6 +- supervisor/shared/tick.c | 7 +- 13 files changed, 361 insertions(+), 76 deletions(-) diff --git a/main.c b/main.c index 378c506579..d940f93d18 100755 --- a/main.c +++ b/main.c @@ -260,10 +260,10 @@ STATIC void print_code_py_status_message(safe_mode_t safe_mode) { STATIC bool run_code_py(safe_mode_t safe_mode) { bool serial_connected_at_start = serial_connected(); #if CIRCUITPY_AUTORELOAD_DELAY_MS > 0 - if (serial_connected_at_start) { - serial_write("\n"); - print_code_py_status_message(safe_mode); - } + serial_write("\n"); + print_code_py_status_message(safe_mode); + print_safe_mode_message(safe_mode); + serial_write("\n"); #endif pyexec_result_t result; @@ -307,16 +307,14 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (result.return_code & PYEXEC_FORCED_EXIT) { return reload_requested; } + + // Display a different completion message if the user has no USB attached (cannot save files) + serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); } // Program has finished running. - // Display a different completion message if the user has no USB attached (cannot save files) - if (!serial_connected_at_start) { - serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); - } - - bool serial_connected_before_animation = false; + bool serial_connected_before_animation = serial_connected(); #if CIRCUITPY_DISPLAYIO bool refreshed_epaper_display = false; #endif diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index fae921db0b..5d1f3e95d4 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -42,6 +42,9 @@ #include "esp_sleep.h" +#include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" +#include "components/driver/include/driver/uart.h" + // Singleton instance of SleepMemory. const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { .base = { @@ -49,9 +52,9 @@ const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { }, }; - void alarm_reset(void) { alarm_time_timealarm_reset(); + alarm_pin_pin_alarm_reset(); alarm_sleep_memory_reset(); esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } @@ -60,6 +63,9 @@ STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(void) { if (alarm_time_timealarm_woke_us_up()) { return ESP_SLEEP_WAKEUP_TIMER; } + if (alarm_pin_pin_alarm_woke_us_up()) { + return ESP_SLEEP_WAKEUP_GPIO; + } return esp_sleep_get_wakeup_cause(); } @@ -69,14 +75,16 @@ bool alarm_woken_from_sleep(void) { } STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { - switch (_get_wakeup_cause()) { + esp_sleep_wakeup_cause_t cause = _get_wakeup_cause(); + switch (cause) { case ESP_SLEEP_WAKEUP_TIMER: { return alarm_time_timealarm_get_wakeup_alarm(n_alarms, alarms); } - case ESP_SLEEP_WAKEUP_EXT0: { - // TODO: implement pin alarm wake. - break; + case ESP_SLEEP_WAKEUP_GPIO: + case ESP_SLEEP_WAKEUP_EXT0: + case ESP_SLEEP_WAKEUP_EXT1: { + return alarm_pin_pin_alarm_get_wakeup_alarm(n_alarms, alarms); } case ESP_SLEEP_WAKEUP_TOUCHPAD: @@ -98,24 +106,8 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { // Set up light sleep or deep sleep alarms. STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { - bool time_alarm_set = false; - alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; - - for (size_t i = 0; i < n_alarms; i++) { - if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { - mp_raise_NotImplementedError(translate("PinAlarm not yet implemented")); - } else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { - if (time_alarm_set) { - mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); - } - time_alarm = MP_OBJ_TO_PTR(alarms[i]); - time_alarm_set = true; - } - } - - if (time_alarm_set) { - alarm_time_timealarm_set_alarm(time_alarm); - } + alarm_pin_pin_alarm_set_alarms(deep_sleep, n_alarms, alarms); + alarm_time_timealarm_set_alarms(deep_sleep, n_alarms, alarms); } STATIC void _idle_until_alarm(void) { @@ -134,7 +126,10 @@ STATIC void _idle_until_alarm(void) { // Is it safe to do a light sleep? Check whether WiFi is on or there are // other ongoing tasks that should not be shut down. STATIC bool _light_sleep_ok(void) { - return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj) && !supervisor_workflow_active(); + int64_t connecting_delay_ticks = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - port_get_raw_ticks(NULL); + return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj) && + !supervisor_workflow_active() && + connecting_delay_ticks <= 0; } mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { @@ -142,10 +137,13 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj // Light sleep can break some functionality so only do it when possible. Otherwise we idle. if (_light_sleep_ok()) { + // Flush the UART to complete the log line. + uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM); esp_light_sleep_start(); } else { _idle_until_alarm(); } + mp_obj_t wake_alarm = _get_wake_alarm(n_alarms, alarms); alarm_reset(); return wake_alarm; @@ -156,6 +154,7 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala } void NORETURN alarm_enter_deep_sleep(void) { + alarm_pin_pin_alarm_prepare_for_deep_sleep(); // The ESP-IDF caches the deep sleep settings and applies them before sleep. // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index 582a665729..179f34da72 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -4,6 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2020 Dan Halbert for Adafruit Industries + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,15 +25,29 @@ * THE SOFTWARE. */ -#include "esp_sleep.h" +#include "py/runtime.h" #include "shared-bindings/alarm/pin/PinAlarm.h" +#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/esp_port.h" + +#include "components/driver/include/driver/rtc_io.h" +#include "components/esp_system/include/esp_sleep.h" +#include "components/freertos/include/freertos/FreeRTOS.h" +#include "components/hal/esp32s2/include/hal/gpio_ll.h" +#include "components/xtensa/include/esp_debug_helpers.h" void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { + if (edge) { + mp_raise_ValueError(translate("Cannot wake on pin edge. Only level.")); + } + + if (pull && !GPIO_IS_VALID_OUTPUT_GPIO(pin->number)) { + mp_raise_ValueError(translate("Cannot pull on input-only pin.")); + } self->pin = pin; self->value = value; - self->edge = edge; self->pull = pull; } @@ -45,9 +60,248 @@ bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self) { } bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self) { - return self->edge; + return false; } bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self) { return self->pull; } + +gpio_isr_handle_t gpio_interrupt_handle; +// Low and high are relative to pin number. 32+ is high. <32 is low. +static volatile uint32_t low_pin_status = 0; +static volatile uint32_t high_pin_status = 0; +void gpio_interrupt(void *arg) { + (void) arg; + + gpio_ll_get_intr_status(&GPIO, xPortGetCoreID(), (uint32_t*) &low_pin_status); + gpio_ll_clear_intr_status(&GPIO, low_pin_status); + gpio_ll_get_intr_status_high(&GPIO, xPortGetCoreID(), (uint32_t*) &high_pin_status); + gpio_ll_clear_intr_status_high(&GPIO, high_pin_status); + + // disable the interrupts that fired, maybe all of them + for (size_t i = 0; i < 32; i++) { + uint32_t mask = 1 << i; + if ((low_pin_status & mask) != 0) { + gpio_ll_intr_disable(&GPIO, i); + } + if ((high_pin_status & mask) != 0) { + gpio_ll_intr_disable(&GPIO, 32 + i); + } + } + BaseType_t high_task_wakeup; + vTaskNotifyGiveFromISR(circuitpython_task, &high_task_wakeup); + if (high_task_wakeup) { + portYIELD_FROM_ISR(); + } +} + +bool alarm_pin_pin_alarm_woke_us_up(void) { + return low_pin_status != 0 || high_pin_status != 0; +} + +mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { + // First, check to see if we match any given alarms. + uint64_t pin_status = ((uint64_t) high_pin_status) << 32 | low_pin_status; + for (size_t i = 0; i < n_alarms; i++) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + continue; + } + alarm_pin_pin_alarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); + if ((pin_status & (1ull << alarm->pin->number)) != 0) { + return alarms[i]; + } + } + esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause(); + size_t pin_number = 64; + if (cause == ESP_SLEEP_WAKEUP_EXT0) { + pin_number = REG_GET_FIELD(RTC_IO_EXT_WAKEUP0_REG, RTC_IO_EXT_WAKEUP0_SEL); + } else { + if (cause == ESP_SLEEP_WAKEUP_EXT1) { + pin_status = esp_sleep_get_ext1_wakeup_status(); + } + // If the cause is GPIO, we've already snagged pin_status in the interrupt. + // We'll only get here if we pretended to deep sleep. Light sleep will + // pass in existing objects. + for (size_t i = 0; i < 64; i++) { + if ((pin_status & (1ull << i)) != 0) { + pin_number = i; + break; + } + } + } + + alarm_pin_pin_alarm_obj_t *alarm = m_new_obj(alarm_pin_pin_alarm_obj_t); + alarm->base.type = &alarm_pin_pin_alarm_type; + alarm->pin = NULL; + // Map the pin number back to a pin object. + for (size_t i = 0; i < mcu_pin_globals.map.used; i++) { + const mcu_pin_obj_t* pin_obj = MP_OBJ_TO_PTR(mcu_pin_globals.map.table[i].value); + if ((size_t) pin_obj->number == pin_number) { + alarm->pin = mcu_pin_globals.map.table[i].value; + break; + } + } + return alarm; +} + +// These must be static because we need to configure pulls later, right before +// deep sleep. +static uint64_t high_alarms = 0; +static uint64_t low_alarms = 0; +static uint64_t pull_pins = 0; + +void alarm_pin_pin_alarm_reset(void) { + if (gpio_interrupt_handle != NULL) { + esp_intr_free(gpio_interrupt_handle); + gpio_interrupt_handle = NULL; + } + for (size_t i = 0; i < 64; i++) { + uint64_t mask = 1ull << i; + bool high = (high_alarms & mask) != 0; + bool low = (low_alarms & mask) != 0; + if (!(high || low)) { + continue; + } + reset_pin_number(i); + } + high_alarms = 0; + low_alarms = 0; + pull_pins = 0; + high_pin_status = 0; + low_pin_status = 0; +} + +void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { + // Bitmask of wake up settings. + size_t high_count = 0; + size_t low_count = 0; + + for (size_t i = 0; i < n_alarms; i++) { + // TODO: Check for ULP or touch alarms because they can't coexist with GPIO alarms. + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + continue; + } + alarm_pin_pin_alarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); + + gpio_num_t pin_number = alarm->pin->number; + if (alarm->value) { + high_alarms |= 1ull << pin_number; + high_count++; + } else { + low_alarms |= 1ull << pin_number; + low_count++; + } + if (alarm->pull) { + pull_pins |= 1ull << pin_number; + } + } + if (high_count == 0 && low_count == 0) { + return; + } + if (deep_sleep && low_count > 2 && high_count == 0) { + mp_raise_ValueError(translate("Can only alarm on two low pins from deep sleep.")); + } + if (deep_sleep && low_count > 1 && high_count > 0) { + mp_raise_ValueError(translate("Can only alarm on one low pin while others alarm high from deep sleep.")); + } + // Only use ext0 and ext1 during deep sleep. + if (deep_sleep) { + if (high_count > 0) { + if (esp_sleep_enable_ext1_wakeup(high_alarms, ESP_EXT1_WAKEUP_ANY_HIGH) != ESP_OK) { + mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); + } + } + size_t low_pins[2]; + size_t j = 0; + for (size_t i = 0; i < 64; i++) { + uint64_t mask = 1ull << i; + if ((low_alarms & mask) != 0) { + low_pins[j++] = i; + } + if (j == 2) { + break; + } + } + if (low_count > 1) { + if (esp_sleep_enable_ext1_wakeup(1ull << low_pins[1], ESP_EXT1_WAKEUP_ALL_LOW) != ESP_OK) { + mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); + } + } + if (low_count > 0) { + if (esp_sleep_enable_ext0_wakeup(low_pins[0], 0) != ESP_OK) { + mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); + } + } + } else { + // Enable GPIO wake up if we're sleeping. + esp_sleep_enable_gpio_wakeup(); + } + // Set GPIO interrupts so they wake us from light sleep or from idle via the + // interrupt handler above. + low_pin_status = 0; + high_pin_status = 0; + if (gpio_isr_register(gpio_interrupt, NULL, 0, &gpio_interrupt_handle) != ESP_OK) { + mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); + } + for (size_t i = 0; i < 64; i++) { + uint64_t mask = 1ull << i; + bool high = (high_alarms & mask) != 0; + bool low = (low_alarms & mask) != 0; + bool pull = (pull_pins & mask) != 0; + if (!(high || low)) { + continue; + } + if (rtc_gpio_is_valid_gpio(i)) { + rtc_gpio_deinit(i); + } + gpio_int_type_t interrupt_mode = GPIO_INTR_DISABLE; + gpio_pull_mode_t pull_mode = GPIO_FLOATING; + if (high) { + interrupt_mode = GPIO_INTR_HIGH_LEVEL; + pull_mode = GPIO_PULLDOWN_ONLY; + } + if (low) { + interrupt_mode = GPIO_INTR_LOW_LEVEL; + pull_mode = GPIO_PULLUP_ONLY; + } + gpio_set_direction(i, GPIO_MODE_DEF_INPUT); + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[i], PIN_FUNC_GPIO); + if (pull) { + gpio_set_pull_mode(i, pull_mode); + size_t j = 0; + while (gpio_get_level(i) == false) { + j++; + } + } + never_reset_pin_number(i); + // Sets interrupt type and wakeup bits. + gpio_wakeup_enable(i, interrupt_mode); + gpio_intr_enable(i); + } +} + + +void alarm_pin_pin_alarm_prepare_for_deep_sleep(void) { + if (pull_pins == 0) { + return; + } + for (size_t i = 0; i < 64; i++) { + uint64_t mask = 1ull << i; + bool pull = (pull_pins & mask) != 0; + if (!pull) { + continue; + } + bool high = (high_alarms & mask) != 0; + bool low = (low_alarms & mask) != 0; + // The pull direction is opposite from alarm value. + if (high) { + rtc_gpio_pullup_dis(i); + rtc_gpio_pulldown_en(i); + } + if (low) { + rtc_gpio_pullup_en(i); + rtc_gpio_pulldown_dis(i); + } + } +} diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h index 0eaa7777f5..8b14931cab 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h @@ -31,7 +31,11 @@ typedef struct { mp_obj_base_t base; mcu_pin_obj_t *pin; bool value; - bool all_same_value; - bool edge; bool pull; } alarm_pin_pin_alarm_obj_t; + +void alarm_pin_pin_alarm_reset(void); +void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms); +void alarm_pin_pin_alarm_prepare_for_deep_sleep(void); +mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); +bool alarm_pin_pin_alarm_woke_us_up(void); diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index 4d0bba2387..a7abde6a4e 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -63,9 +63,7 @@ STATIC bool woke_up = false; void timer_callback(void *arg) { (void) arg; woke_up = true; - if (sleeping_circuitpython_task) { - xTaskNotifyGive(sleeping_circuitpython_task); - } + xTaskNotifyGive(circuitpython_task); } bool alarm_time_timealarm_woke_us_up(void) { @@ -79,7 +77,24 @@ void alarm_time_timealarm_reset(void) { woke_up = false; } -void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self) { +void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { + bool time_alarm_set = false; + alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; + + for (size_t i = 0; i < n_alarms; i++) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + continue; + } + if (time_alarm_set) { + mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); + } + time_alarm = MP_OBJ_TO_PTR(alarms[i]); + time_alarm_set = true; + } + if (!time_alarm_set) { + return; + } + if (pretend_sleep_timer != NULL) { esp_timer_stop(pretend_sleep_timer); } else { @@ -94,7 +109,7 @@ void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self) { // Compute how long to actually sleep, considering the time now. mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; - mp_float_t wakeup_in_secs = MAX(0.0f, self->monotonic_time - now_secs); + mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); esp_sleep_enable_timer_wakeup(sleep_for_us); diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h index 04c553009e..277ababc20 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h @@ -36,5 +36,5 @@ typedef struct { mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); // Check for the wake up alarm from pretend deep sleep. bool alarm_time_timealarm_woke_us_up(void); -void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self); +void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms); void alarm_time_timealarm_reset(void); diff --git a/ports/esp32s2/supervisor/esp_port.h b/ports/esp32s2/supervisor/esp_port.h index 1164666cda..8b9e13829f 100644 --- a/ports/esp32s2/supervisor/esp_port.h +++ b/ports/esp32s2/supervisor/esp_port.h @@ -30,6 +30,6 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" -extern TaskHandle_t sleeping_circuitpython_task; +extern TaskHandle_t circuitpython_task; #endif // MICROPY_INCLUDED_ESP32S2_SUPERVISOR_PORT_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 7037b4f051..7d8aac4d5e 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -66,6 +66,9 @@ uint32_t* heap; uint32_t heap_size; STATIC esp_timer_handle_t _tick_timer; +STATIC esp_timer_handle_t _sleep_timer; + +TaskHandle_t circuitpython_task = NULL; extern void esp_restart(void) NORETURN; @@ -73,6 +76,8 @@ void tick_timer_cb(void* arg) { supervisor_tick(); } +void sleep_timer_cb(void* arg); + safe_mode_t port_init(void) { esp_timer_create_args_t args; args.callback = &tick_timer_cb; @@ -81,10 +86,14 @@ safe_mode_t port_init(void) { args.name = "CircuitPython Tick"; esp_timer_create(&args, &_tick_timer); - #ifdef DEBUG + args.callback = &sleep_timer_cb; + args.arg = NULL; + args.dispatch_method = ESP_TIMER_TASK; + args.name = "CircuitPython Sleep"; + esp_timer_create(&args, &_sleep_timer); + // Send the ROM output out of the UART. This includes early logs. esp_rom_install_channel_putc(1, esp_rom_uart_putc); - #endif heap = NULL; never_reset_module_internal_pins(); @@ -106,10 +115,14 @@ safe_mode_t port_init(void) { if (reason == ESP_RST_BROWNOUT) { return BROWNOUT; } - if (reason == ESP_RST_PANIC) { + if (reason == ESP_RST_PANIC || + reason == ESP_RST_INT_WDT || + reason == ESP_RST_WDT) { return HARD_CRASH; } + circuitpython_task = xTaskGetCurrentTaskHandle(); + return NO_SAFE_MODE; } @@ -250,29 +263,25 @@ void port_disable_tick(void) { // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. // Tick disable can happen via auto-reload so poke the main task here. - if (sleeping_circuitpython_task != NULL) { - xTaskNotifyGive(sleeping_circuitpython_task); - } + xTaskNotifyGive(circuitpython_task); } -TickType_t sleep_time_duration; +void sleep_timer_cb(void* arg) { + xTaskNotifyGive(circuitpython_task); +} void port_interrupt_after_ticks(uint32_t ticks) { - sleep_time_duration = (ticks * 100)/1024; + uint64_t timeout_us = ticks * 1000000ull / 1024; + if (esp_timer_start_once(_sleep_timer, timeout_us) != ESP_OK) { + esp_timer_stop(_sleep_timer); + esp_timer_start_once(_sleep_timer, timeout_us); + } } +// On the ESP we use FreeRTOS notifications instead of interrupts so this is a +// bit of a misnomer. void port_idle_until_interrupt(void) { - uint32_t notify_value = 0; - - if (sleep_time_duration == 0) { - return; - } - sleeping_circuitpython_task = xTaskGetCurrentTaskHandle(); - xTaskNotifyWait(0x01, 0x01, ¬ify_value, sleep_time_duration ); - sleeping_circuitpython_task = NULL; - if (notify_value == 1) { - mp_handle_pending(); - } + xTaskNotifyWait(0x01, 0x01, NULL, portMAX_DELAY); } // Wrap main in app_main that the IDF expects. diff --git a/ports/esp32s2/supervisor/usb.c b/ports/esp32s2/supervisor/usb.c index 2bfcdfb125..6c92f72537 100644 --- a/ports/esp32s2/supervisor/usb.c +++ b/ports/esp32s2/supervisor/usb.c @@ -26,6 +26,7 @@ */ #include "supervisor/usb.h" +#include "supervisor/esp_port.h" #include "lib/utils/interrupt_char.h" #include "lib/mp-readline/readline.h" @@ -52,8 +53,6 @@ StackType_t usb_device_stack[USBD_STACK_SIZE]; StaticTask_t usb_device_taskdef; -TaskHandle_t sleeping_circuitpython_task = NULL; - // USB Device Driver task // This top level thread process all usb events and invoke callbacks void usb_device_task(void* param) @@ -131,8 +130,6 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) mp_keyboard_interrupt(); // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. // So, we must notify the other task when a CTRL-C is received. - if (sleeping_circuitpython_task != NULL) { - xTaskNotifyGive(sleeping_circuitpython_task); - } + xTaskNotifyGive(circuitpython_task); } } diff --git a/py/obj.c b/py/obj.c index b6462641ce..218fb43213 100644 --- a/py/obj.c +++ b/py/obj.c @@ -29,6 +29,7 @@ #include #include +#include "lib/utils/interrupt_char.h" #include "py/obj.h" #include "py/objtype.h" #include "py/objint.h" @@ -67,7 +68,10 @@ void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t #ifdef RUN_BACKGROUND_TASKS RUN_BACKGROUND_TASKS; #endif - mp_handle_pending(); + // Stop printing if we've been interrupted. + if (mp_hal_is_interrupted()) { + return; + } #ifndef NDEBUG if (o_in == MP_OBJ_NULL) { diff --git a/py/vm.c b/py/vm.c index 9b3354b096..13a9980aad 100644 --- a/py/vm.c +++ b/py/vm.c @@ -1015,7 +1015,7 @@ unwind_jump:; } #endif SET_TOP(mp_call_method_n_kw(unum & 0xff, (unum >> 8) & 0xff, sp)); - DISPATCH(); + DISPATCH_WITH_PEND_EXC_CHECK(); } ENTRY(MP_BC_CALL_METHOD_VAR_KW): { diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index 7a5617142b..83ccc0d766 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -89,7 +89,11 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_ //| STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_pin(mp_obj_t self_in) { alarm_pin_pin_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); - return common_hal_alarm_pin_pin_alarm_get_pin(self); + mcu_pin_obj_t* pin = common_hal_alarm_pin_pin_alarm_get_pin(self); + if (pin == NULL) { + return mp_const_none; + } + return MP_OBJ_FROM_PTR(pin); } MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_pin_obj, alarm_pin_pin_alarm_obj_get_pin); diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index d37a585eb2..5d75a5395c 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -145,10 +145,11 @@ void mp_hal_delay_ms(mp_uint_t delay) { delay = delay * 1024 / 1000; uint64_t end_tick = start_tick + delay; int64_t remaining = delay; - while (remaining > 0) { + + // Loop until we've waited long enough or we've been CTRL-Ced by autoreload + // or the user. + while (remaining > 0 && !mp_hal_is_interrupted()) { RUN_BACKGROUND_TASKS; - // Check to see if we've been CTRL-Ced by autoreload or the user. - mp_handle_pending(); remaining = end_tick - port_get_raw_ticks(NULL); // We break a bit early so we don't risk setting the alarm before the time when we call // sleep. From 0dcc659d536034637009e3c5cb7713c35c002929 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 11 Dec 2020 20:34:01 -0800 Subject: [PATCH 081/146] Swap to IDF release/4.2 branch for stability --- .gitmodules | 2 +- ports/esp32s2/Makefile | 8 ++---- ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 4 +-- ports/esp32s2/common-hal/analogio/AnalogIn.h | 2 +- ports/esp32s2/common-hal/busio/I2C.h | 2 +- ports/esp32s2/common-hal/busio/SPI.c | 5 ++-- ports/esp32s2/common-hal/busio/SPI.h | 4 +-- ports/esp32s2/common-hal/busio/UART.h | 2 +- .../common-hal/digitalio/DigitalInOut.c | 2 +- .../esp32s2/common-hal/microcontroller/Pin.c | 2 +- ports/esp32s2/esp-idf | 2 +- ports/esp32s2/peripherals/pins.h | 6 ++-- ports/esp32s2/supervisor/port.c | 6 ++-- ports/esp32s2/supervisor/usb.c | 28 ++++++++----------- 14 files changed, 36 insertions(+), 39 deletions(-) diff --git a/.gitmodules b/.gitmodules index d36613d604..b74cd0b30d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -152,7 +152,7 @@ url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git [submodule "ports/esp32s2/esp-idf"] path = ports/esp32s2/esp-idf - url = https://github.com/jepler/esp-idf.git + url = https://github.com/adafruit/esp-idf.git [submodule "ports/esp32s2/certificates/nina-fw"] path = ports/esp32s2/certificates/nina-fw url = https://github.com/adafruit/nina-fw.git diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 01f8f48a78..e496a61a46 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -143,7 +143,6 @@ LDFLAGS += -L$(BUILD)/esp-idf/esp-idf/esp32s2 \ -Tesp32s2.peripherals.ld \ -Lesp-idf/components/esp_rom/esp32s2/ld \ -Tesp32s2.rom.ld \ - -Tesp32s2.rom.api.ld \ -Tesp32s2.rom.libgcc.ld \ -Tesp32s2.rom.newlib-data.ld \ -Tesp32s2.rom.newlib-funcs.ld \ @@ -276,7 +275,7 @@ menuconfig: $(BUILD)/esp-idf/config # qstr builds include headers so we need to make sure they are up to date $(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h -ESP_IDF_COMPONENTS_LINK = freertos log hal esp_system esp_adc_cal esp32s2 bootloader_support pthread esp_timer vfs spi_flash app_update esp_common esp32s2 heap newlib driver xtensa soc esp_ringbuf esp_wifi esp_event wpa_supplicant mbedtls efuse nvs_flash esp_netif lwip esp_rom esp-tls +ESP_IDF_COMPONENTS_LINK = freertos log esp_system esp_adc_cal esp32s2 bootloader_support pthread esp_timer vfs spi_flash app_update esp_common esp32s2 heap newlib driver xtensa soc esp_ringbuf esp_wifi esp_event wpa_supplicant mbedtls efuse nvs_flash esp_netif lwip esp-tls ESP_IDF_COMPONENTS_INCLUDE = driver freertos log soc @@ -288,11 +287,11 @@ ESP_IDF_WIFI_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_WIFI_COMPONENT MBEDTLS_COMPONENTS_LINK = crypto tls x509 MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component).a) -BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libxt_hal.a +BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libhal.a BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a librtc.a libsmartconfig.a libphy.a BINARY_BLOBS += $(addprefix esp-idf/components/esp_wifi/lib/esp32s2/, $(BINARY_WIFI_BLOBS)) -ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/soc/soc/esp32s2/libsoc_esp32s2.a esp-idf/components/xtensa/esp32s2/libxt_hal.a +ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/soc/soc/esp32s2/libsoc_esp32s2.a ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-idf/esp-idf/esp32s2/ld/esp32s2.project.ld FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) @@ -308,7 +307,6 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h esp-idf/esp32s2/ld/esp32s2.project.ld \ esp-idf/esp_event/libesp_event.a \ esp-idf/esp_netif/libesp_netif.a \ - esp-idf/esp_rom/libesp_rom.a \ esp-idf/esp_system/libesp_system.a \ esp-idf/esp_wifi/libesp_wifi.a \ esp-idf/lwip/liblwip.a \ diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index 179f34da72..01e2faeb87 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -33,9 +33,9 @@ #include "supervisor/esp_port.h" #include "components/driver/include/driver/rtc_io.h" -#include "components/esp_system/include/esp_sleep.h" +#include "components/esp32s2/include/esp_sleep.h" #include "components/freertos/include/freertos/FreeRTOS.h" -#include "components/hal/esp32s2/include/hal/gpio_ll.h" +#include "components/soc/src/esp32s2/include/hal/gpio_ll.h" #include "components/xtensa/include/esp_debug_helpers.h" void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { diff --git a/ports/esp32s2/common-hal/analogio/AnalogIn.h b/ports/esp32s2/common-hal/analogio/AnalogIn.h index fed4d02170..b9c4866f29 100644 --- a/ports/esp32s2/common-hal/analogio/AnalogIn.h +++ b/ports/esp32s2/common-hal/analogio/AnalogIn.h @@ -29,7 +29,7 @@ #include "common-hal/microcontroller/Pin.h" -#include "components/hal/include/hal/adc_types.h" +#include "components/soc/include/hal/adc_types.h" #include "FreeRTOS.h" #include "freertos/semphr.h" #include "py/obj.h" diff --git a/ports/esp32s2/common-hal/busio/I2C.h b/ports/esp32s2/common-hal/busio/I2C.h index c39d6d7448..1a989e30a4 100644 --- a/ports/esp32s2/common-hal/busio/I2C.h +++ b/ports/esp32s2/common-hal/busio/I2C.h @@ -29,7 +29,7 @@ #include "common-hal/microcontroller/Pin.h" -#include "components/hal/include/hal/i2c_types.h" +#include "components/soc/include/hal/i2c_types.h" #include "FreeRTOS.h" #include "freertos/semphr.h" #include "py/obj.h" diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 562881585d..182a04b0bb 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -273,7 +273,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, self->bits = bits; self->target_frequency = baudrate; self->hal_context.timing_conf = &self->timing_conf; - esp_err_t result = spi_hal_cal_clock_conf(&self->hal_context, + esp_err_t result = spi_hal_get_clock_conf(&self->hal_context, self->target_frequency, 128 /* duty_cycle */, self->connected_through_gpio, @@ -366,7 +366,8 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou burst_length = sizeof(hal->hw->data_buf); // When switching to non-DMA, we need to make sure DMA is off. Otherwise, // the S2 will transmit zeroes instead of our data. - spi_ll_txdma_disable(hal->hw); + hal->hw->dma_out_link.dma_tx_ena = 0; + hal->hw->dma_out_link.stop = 1; } // This rounds up. diff --git a/ports/esp32s2/common-hal/busio/SPI.h b/ports/esp32s2/common-hal/busio/SPI.h index f6c1c344a1..d6203feae6 100644 --- a/ports/esp32s2/common-hal/busio/SPI.h +++ b/ports/esp32s2/common-hal/busio/SPI.h @@ -30,8 +30,8 @@ #include "common-hal/microcontroller/Pin.h" #include "components/driver/include/driver/spi_common_internal.h" -#include "components/hal/include/hal/spi_hal.h" -#include "components/hal/include/hal/spi_types.h" +#include "components/soc/include/hal/spi_hal.h" +#include "components/soc/include/hal/spi_types.h" #include "py/obj.h" typedef struct { diff --git a/ports/esp32s2/common-hal/busio/UART.h b/ports/esp32s2/common-hal/busio/UART.h index 1d7f135115..751fb2e002 100644 --- a/ports/esp32s2/common-hal/busio/UART.h +++ b/ports/esp32s2/common-hal/busio/UART.h @@ -29,7 +29,7 @@ #include "common-hal/microcontroller/Pin.h" -#include "components/hal/include/hal/uart_types.h" +#include "components/soc/include/hal/uart_types.h" #include "py/obj.h" typedef struct { diff --git a/ports/esp32s2/common-hal/digitalio/DigitalInOut.c b/ports/esp32s2/common-hal/digitalio/DigitalInOut.c index 152db1e71d..a2a0209f93 100644 --- a/ports/esp32s2/common-hal/digitalio/DigitalInOut.c +++ b/ports/esp32s2/common-hal/digitalio/DigitalInOut.c @@ -30,7 +30,7 @@ #include "components/driver/include/driver/gpio.h" -#include "components/hal/include/hal/gpio_hal.h" +#include "components/soc/include/hal/gpio_hal.h" void common_hal_digitalio_digitalinout_never_reset( digitalio_digitalinout_obj_t *self) { diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 81dfa1308d..9a393c170a 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -32,7 +32,7 @@ #include "py/mphal.h" #include "components/driver/include/driver/gpio.h" -#include "components/hal/include/hal/gpio_hal.h" +#include "components/soc/include/hal/gpio_hal.h" #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index d06744f5ef..ebe7784258 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit d06744f5efc382c61cbad8758107cec308feef09 +Subproject commit ebe7784258d8c10e9cc334ccc00c3fd270746c8b diff --git a/ports/esp32s2/peripherals/pins.h b/ports/esp32s2/peripherals/pins.h index c78eb83851..8bad937ef2 100644 --- a/ports/esp32s2/peripherals/pins.h +++ b/ports/esp32s2/peripherals/pins.h @@ -35,9 +35,9 @@ #include "esp32s2_peripherals_config.h" #include "esp-idf/config/sdkconfig.h" -#include "components/hal/include/hal/gpio_types.h" -#include "components/hal/include/hal/adc_types.h" -#include "components/hal/include/hal/touch_sensor_types.h" +#include "components/soc/include/hal/gpio_types.h" +#include "components/soc/include/hal/adc_types.h" +#include "components/soc/include/hal/touch_sensor_types.h" typedef struct { PIN_PREFIX_FIELDS diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 7d8aac4d5e..8a87180cd9 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -54,7 +54,7 @@ #include "peripherals/rmt.h" #include "peripherals/pcnt.h" #include "peripherals/timer.h" -#include "components/esp_rom/include/esp_rom_uart.h" +#include "components/esp_rom/include/esp32s2/rom/ets_sys.h" #include "components/heap/include/esp_heap_caps.h" #include "components/xtensa/include/esp_debug_helpers.h" #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" @@ -93,7 +93,9 @@ safe_mode_t port_init(void) { esp_timer_create(&args, &_sleep_timer); // Send the ROM output out of the UART. This includes early logs. - esp_rom_install_channel_putc(1, esp_rom_uart_putc); + #ifdef DEBUG + ets_install_uart_printf(); + #endif heap = NULL; never_reset_module_internal_pins(); diff --git a/ports/esp32s2/supervisor/usb.c b/ports/esp32s2/supervisor/usb.c index 6c92f72537..16657d4079 100644 --- a/ports/esp32s2/supervisor/usb.c +++ b/ports/esp32s2/supervisor/usb.c @@ -34,8 +34,7 @@ #include "components/driver/include/driver/periph_ctrl.h" #include "components/driver/include/driver/gpio.h" #include "components/esp_rom/include/esp32s2/rom/gpio.h" -#include "components/esp_rom/include/esp_rom_gpio.h" -#include "components/hal/esp32s2/include/hal/gpio_ll.h" +#include "components/soc/src/esp32s2/include/hal/gpio_ll.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -77,23 +76,20 @@ static void configure_pins (usb_hal_context_t *usb) * Introduce additional parameters in usb_hal_context_t when adding support * for USB Host. */ - for ( const usb_iopin_dsc_t *iopin = usb_periph_iopins; iopin->pin != -1; ++iopin ) { - if ( (usb->use_external_phy) || (iopin->ext_phy_only == 0) ) { - esp_rom_gpio_pad_select_gpio(iopin->pin); - if ( iopin->is_output ) { - esp_rom_gpio_connect_out_signal(iopin->pin, iopin->func, false, false); + for (const usb_iopin_dsc_t* iopin = usb_periph_iopins; iopin->pin != -1; ++iopin) { + if ((usb->use_external_phy) || (iopin->ext_phy_only == 0)) { + gpio_pad_select_gpio(iopin->pin); + if (iopin->is_output) { + gpio_matrix_out(iopin->pin, iopin->func, false, false); + } else { + gpio_matrix_in(iopin->pin, iopin->func, false); + gpio_pad_input_enable(iopin->pin); } - else { - esp_rom_gpio_connect_in_signal(iopin->pin, iopin->func, false); - if ( (iopin->pin != GPIO_FUNC_IN_LOW) && (iopin->pin != GPIO_FUNC_IN_HIGH) ) { - gpio_ll_input_enable(&GPIO, iopin->pin); - } - } - esp_rom_gpio_pad_unhold(iopin->pin); + gpio_pad_unhold(iopin->pin); } } - if ( !usb->use_external_phy ) { - gpio_set_drive_capability(USBPHY_DM_NUM, GPIO_DRIVE_CAP_3); + if (!usb->use_external_phy) { + gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3); gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3); } } From ca757f2ead6e84ad52b6030281b666792fb12b43 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Wed, 16 Dec 2020 10:25:20 -0500 Subject: [PATCH 082/146] removed comments on 64MiB SPI flash causing build test issues --- .gitattributes 2 | 32 + .gitignore 2 | 88 +++ .gitmodules 2 | 155 +++++ .mailmap 2 | 112 ++++ mpy-cross/.gitignore 2 | 11 + ports/atmel-samd/.gitattributes 2 | 2 + ports/atmel-samd/.gitignore 2 | 1 + ports/atmel-samd/boards/board.h | 47 ++ supervisor/shared/external_flash/devices.h | 50 +- tests/README 2 | 18 + tests/extmod 2/btree1.py | 89 +++ tests/extmod 2/framebuf1.py | 109 ++++ tests/extmod 2/framebuf16.py | 59 ++ tests/extmod 2/framebuf2.py.exp | 57 ++ tests/extmod 2/framebuf4.py | 53 ++ tests/extmod 2/framebuf_subclass.py | 20 + tests/extmod 2/machine1.py | 28 + tests/extmod 2/machine_pinbase.py | 30 + tests/extmod 2/machine_pinbase.py.exp | 9 + tests/extmod 2/ticks_diff.py | 33 + tests/extmod 2/time_ms_us.py | 22 + tests/extmod 2/time_ms_us.py.exp | 3 + tests/extmod 2/ubinascii_a2b_base64.py | 49 ++ tests/extmod 2/ubinascii_hexlify.py | 17 + tests/extmod 2/uctypes_32bit_intbig.py.exp | 11 + .../uctypes_array_assign_native_le.py | 89 +++ .../uctypes_array_assign_native_le.py.exp | 11 + .../uctypes_array_assign_native_le_intbig.py | 43 ++ tests/extmod 2/uctypes_bytearray.py | 22 + tests/extmod 2/uctypes_byteat.py | 10 + tests/extmod 2/uctypes_byteat.py.exp | 2 + tests/extmod 2/uctypes_error.py | 37 ++ tests/extmod 2/uctypes_error.py.exp | 4 + tests/extmod 2/uctypes_le_float.py | 24 + tests/extmod 2/uctypes_native_float.py | 20 + tests/extmod 2/uctypes_ptr_le.py | 34 + tests/extmod 2/uctypes_ptr_native_le.py.exp | 6 + tests/extmod 2/uctypes_sizeof.py.exp | 7 + tests/extmod 2/uhashlib_sha1.py | 28 + tests/extmod 2/ujson_dump.py | 30 + tests/extmod 2/ujson_dumps_extra.py | 9 + tests/extmod 2/ujson_dumps_float.py | 10 + tests/extmod 2/ujson_load_readinto.py.exp | 4 + tests/extmod 2/ujson_loads.py | 74 +++ tests/extmod 2/ujson_loads_float.py | 17 + tests/extmod 2/urandom_basic.py | 29 + tests/extmod 2/ure1.py | 103 +++ tests/extmod 2/ure_debug.py.exp | 15 + tests/extmod 2/ure_error.py | 25 + tests/extmod 2/ure_namedclass.py | 32 + tests/extmod 2/ure_stack_overflow.py.exp | 1 + tests/extmod 2/ure_sub_unmatched.py.exp | 1 + tests/extmod 2/ussl_basic.py | 59 ++ tests/extmod 2/utimeq1.py | 137 ++++ tests/extmod 2/utimeq_stable.py.exp | 1 + tests/extmod 2/uzlib_decompio.py | 33 + tests/extmod 2/uzlib_decompio_gz.py.exp | 13 + tests/extmod 2/vfs_fat_fileio1.py | 139 ++++ tests/extmod 2/vfs_fat_fileio1.py.exp | 18 + tests/extmod 2/vfs_fat_more.py.exp | 29 + tests/extmod 2/vfs_fat_oldproto.py.exp | 3 + tests/extmod 2/vfs_fat_ramdisk.py.exp | 17 + tests/extmod 2/websocket_basic.py.exp | 14 + tests/feature_check 2/README | 4 + tests/feature_check 2/async_check.py | 3 + tests/feature_check 2/async_check.py.exp | 0 tests/feature_check 2/byteorder.py | 2 + tests/feature_check 2/byteorder.py.exp | 0 tests/feature_check 2/complex.py | 5 + tests/feature_check 2/complex.py.exp | 0 tests/feature_check 2/const.py | 1 + tests/feature_check 2/const.py.exp | 0 tests/feature_check 2/coverage.py | 5 + tests/feature_check 2/coverage.py.exp | 0 tests/feature_check 2/float.py | 13 + tests/feature_check 2/float.py.exp | 1 + tests/feature_check 2/int_big.py | 2 + tests/feature_check 2/int_big.py.exp | 1 + tests/feature_check 2/native_check.py | 4 + tests/feature_check 2/native_check.py.exp | 0 tests/feature_check 2/repl_emacs_check.py | 3 + tests/feature_check 2/repl_emacs_check.py.exp | 7 + tests/feature_check 2/reverse_ops.py | 9 + tests/feature_check 2/reverse_ops.py.exp | 0 tests/feature_check 2/set_check.py | 2 + tests/feature_check 2/set_check.py.exp | 0 tests/float 2/array_construct.py | 10 + tests/float 2/builtin_float_hash.py | 25 + tests/float 2/builtin_float_minmax.py | 31 + tests/float 2/builtin_float_pow.py | 11 + tests/float 2/builtin_float_round.py | 24 + tests/float 2/builtin_float_round_intbig.py | 4 + tests/float 2/bytearray_construct.py | 9 + tests/float 2/bytes_construct.py | 9 + tests/float 2/cmath_fun.py | 55 ++ tests/float 2/cmath_fun_special.py | 31 + tests/float 2/complex1.py | 116 ++++ tests/float 2/complex1_intbig.py | 4 + tests/float 2/float1.py | 119 ++++ tests/float 2/float2int_doubleprec_intbig.py | 100 +++ tests/float 2/float2int_fp30_intbig.py | 97 +++ tests/float 2/float2int_intbig.py | 99 +++ tests/float 2/float_array.py | 20 + tests/float 2/float_compare.py | 22 + tests/float 2/float_divmod.py | 25 + tests/float 2/float_divmod_relaxed.py | 33 + tests/float 2/float_format.py | 19 + tests/float 2/float_parse.py | 32 + tests/float 2/float_parse_doubleprec.py | 21 + tests/float 2/float_struct.py | 17 + tests/float 2/int_big_float.py | 28 + tests/float 2/int_divzero.py | 9 + tests/float 2/int_power.py | 8 + tests/float 2/list_index.py | 8 + tests/float 2/math_domain.py | 51 ++ tests/float 2/math_domain_special.py | 36 + tests/float 2/math_fun.py | 63 ++ tests/float 2/math_fun_bool.py | 16 + tests/float 2/math_fun_int.py | 14 + tests/float 2/math_fun_intbig.py | 11 + tests/float 2/math_fun_special.py | 35 + tests/float 2/python36.py | 10 + tests/float 2/python36.py.exp | 5 + tests/float 2/string_format.py | 41 ++ tests/float 2/string_format2.py | 106 +++ tests/float 2/string_format_fp30.py | 41 ++ tests/float 2/string_format_modulo.py | 49 ++ tests/float 2/string_format_modulo2.py | 24 + tests/float 2/string_format_modulo2_intbig.py | 21 + tests/float 2/string_format_modulo3.py | 3 + tests/float 2/string_format_modulo3.py.exp | 2 + tests/float 2/true_value.py | 7 + tests/float 2/types.py | 17 + tests/inlineasm 2/asmargs.py | 29 + tests/inlineasm 2/asmargs.py.exp | 5 + tests/inlineasm 2/asmbcc.py | 27 + tests/inlineasm 2/asmbcc.py.exp | 4 + tests/inlineasm 2/asmbitops.py | 13 + tests/inlineasm 2/asmbitops.py.exp | 4 + tests/inlineasm 2/asmblbx.py | 21 + tests/inlineasm 2/asmblbx.py.exp | 2 + tests/inlineasm 2/asmconst.py | 8 + tests/inlineasm 2/asmconst.py.exp | 1 + tests/inlineasm 2/asmdiv.py | 16 + tests/inlineasm 2/asmdiv.py.exp | 7 + tests/inlineasm 2/asmfpaddsub.py | 14 + tests/inlineasm 2/asmfpaddsub.py.exp | 1 + tests/inlineasm 2/asmfpcmp.py | 14 + tests/inlineasm 2/asmfpcmp.py.exp | 3 + tests/inlineasm 2/asmfpldrstr.py | 11 + tests/inlineasm 2/asmfpldrstr.py.exp | 1 + tests/inlineasm 2/asmfpmuldiv.py | 14 + tests/inlineasm 2/asmfpmuldiv.py.exp | 1 + tests/inlineasm 2/asmfpsqrt.py | 14 + tests/inlineasm 2/asmfpsqrt.py.exp | 1 + tests/inlineasm 2/asmit.py | 16 + tests/inlineasm 2/asmit.py.exp | 2 + tests/inlineasm 2/asmpushpop.py | 8 + tests/inlineasm 2/asmpushpop.py.exp | 1 + tests/inlineasm 2/asmrettype.py | 21 + tests/inlineasm 2/asmrettype.py.exp | 4 + tests/inlineasm 2/asmshift.py | 29 + tests/inlineasm 2/asmshift.py.exp | 6 + tests/inlineasm 2/asmspecialregs.py | 10 + tests/inlineasm 2/asmspecialregs.py.exp | 2 + tests/inlineasm 2/asmsum.py | 57 ++ tests/inlineasm 2/asmsum.py.exp | 2 + tests/io/data/file1 2 | 3 + tests/jni 2/README | 11 + tests/jni 2/list.py | 15 + tests/jni 2/list.py.exp | 4 + tests/jni 2/object.py | 15 + tests/jni 2/object.py.exp | 3 + tests/jni 2/system_out.py | 8 + tests/jni 2/system_out.py.exp | 1 + tests/net_hosted 2/README | 11 + tests/net_hosted 2/accept_nonblock.py | 16 + tests/net_hosted 2/accept_nonblock.py.exp | 1 + tests/net_hosted 2/accept_timeout.py | 22 + tests/net_hosted 2/accept_timeout.py.exp | 1 + tests/net_hosted 2/connect_nonblock.py | 20 + tests/net_hosted 2/connect_nonblock.py.exp | 1 + tests/net_hosted 2/connect_poll.py | 32 + tests/net_hosted 2/connect_poll.py.exp | 3 + tests/net_hosted 2/ssl_getpeercert.py | 21 + tests/net_hosted 2/ssl_getpeercert.py.exp | 1 + tests/net_inet 2/README | 5 + tests/net_inet 2/test_tls_sites.py | 59 ++ tests/net_inet 2/test_tls_sites.py.exp | 5 + tests/run-bench-tests 2 | 97 +++ tests/run-tests 2 | 615 ++++++++++++++++++ tests/stress 2/dict_copy.py | 7 + tests/stress 2/dict_create.py | 8 + tests/stress 2/dict_create_max.py | 13 + tests/stress 2/gc_trace.py | 17 + tests/stress 2/list_sort.py | 6 + tests/stress 2/recursion.py | 7 + tests/stress 2/recursive_data.py | 13 + tests/stress 2/recursive_data.py.exp | 1 + tests/stress 2/recursive_gen.py | 18 + tests/stress 2/recursive_iternext.py | 57 ++ tests/stress 2/recursive_iternext.py.exp | 4 + tests/thread 2/mutate_bytearray.py | 46 ++ tests/thread 2/mutate_dict.py | 44 ++ tests/thread 2/mutate_instance.py | 45 ++ tests/thread 2/mutate_list.py | 46 ++ tests/thread 2/mutate_set.py | 39 ++ tests/thread 2/stress_aes.py | 257 ++++++++ tests/thread 2/stress_create.py | 22 + tests/thread 2/stress_heap.py | 48 ++ tests/thread 2/stress_recurse.py | 27 + tests/thread 2/thread_exc1.py | 32 + tests/thread 2/thread_exc2.py | 10 + tests/thread 2/thread_exc2.py.exp | 5 + tests/thread 2/thread_exit1.py | 21 + tests/thread 2/thread_exit2.py | 21 + tests/thread 2/thread_gc1.py | 36 + tests/thread 2/thread_ident1.py | 23 + tests/thread 2/thread_lock1.py | 48 ++ tests/thread 2/thread_lock2.py | 26 + tests/thread 2/thread_lock3.py | 29 + tests/thread 2/thread_lock4.py | 53 ++ tests/thread 2/thread_qstr1.py | 41 ++ tests/thread 2/thread_shared1.py | 33 + tests/thread 2/thread_shared2.py | 34 + tests/thread 2/thread_sleep1.py | 33 + tests/thread 2/thread_stacksize1.py | 49 ++ tests/thread 2/thread_start1.py | 25 + tests/thread 2/thread_start2.py | 28 + tests/unix 2/extra_coverage.py | 74 +++ tests/unix 2/extra_coverage.py.exp | 106 +++ tests/unix 2/ffi_callback.py | 33 + tests/unix 2/ffi_callback.py.exp | 2 + tests/unix 2/ffi_float.py | 32 + tests/unix 2/ffi_float.py.exp | 8 + tests/unix 2/ffi_float2.py | 31 + tests/unix 2/ffi_float2.py.exp | 6 + tools/.gitattributes 2 | 1 + tools/.gitignore 2 | 8 + 239 files changed, 6751 insertions(+), 16 deletions(-) create mode 100644 .gitattributes 2 create mode 100644 .gitignore 2 create mode 100644 .gitmodules 2 create mode 100644 .mailmap 2 create mode 100644 mpy-cross/.gitignore 2 create mode 100644 ports/atmel-samd/.gitattributes 2 create mode 100644 ports/atmel-samd/.gitignore 2 create mode 100644 ports/atmel-samd/boards/board.h create mode 100644 tests/README 2 create mode 100644 tests/extmod 2/btree1.py create mode 100644 tests/extmod 2/framebuf1.py create mode 100644 tests/extmod 2/framebuf16.py create mode 100644 tests/extmod 2/framebuf2.py.exp create mode 100644 tests/extmod 2/framebuf4.py create mode 100644 tests/extmod 2/framebuf_subclass.py create mode 100644 tests/extmod 2/machine1.py create mode 100644 tests/extmod 2/machine_pinbase.py create mode 100644 tests/extmod 2/machine_pinbase.py.exp create mode 100644 tests/extmod 2/ticks_diff.py create mode 100644 tests/extmod 2/time_ms_us.py create mode 100644 tests/extmod 2/time_ms_us.py.exp create mode 100644 tests/extmod 2/ubinascii_a2b_base64.py create mode 100644 tests/extmod 2/ubinascii_hexlify.py create mode 100644 tests/extmod 2/uctypes_32bit_intbig.py.exp create mode 100644 tests/extmod 2/uctypes_array_assign_native_le.py create mode 100644 tests/extmod 2/uctypes_array_assign_native_le.py.exp create mode 100644 tests/extmod 2/uctypes_array_assign_native_le_intbig.py create mode 100644 tests/extmod 2/uctypes_bytearray.py create mode 100644 tests/extmod 2/uctypes_byteat.py create mode 100644 tests/extmod 2/uctypes_byteat.py.exp create mode 100644 tests/extmod 2/uctypes_error.py create mode 100644 tests/extmod 2/uctypes_error.py.exp create mode 100644 tests/extmod 2/uctypes_le_float.py create mode 100644 tests/extmod 2/uctypes_native_float.py create mode 100644 tests/extmod 2/uctypes_ptr_le.py create mode 100644 tests/extmod 2/uctypes_ptr_native_le.py.exp create mode 100644 tests/extmod 2/uctypes_sizeof.py.exp create mode 100644 tests/extmod 2/uhashlib_sha1.py create mode 100644 tests/extmod 2/ujson_dump.py create mode 100644 tests/extmod 2/ujson_dumps_extra.py create mode 100644 tests/extmod 2/ujson_dumps_float.py create mode 100644 tests/extmod 2/ujson_load_readinto.py.exp create mode 100644 tests/extmod 2/ujson_loads.py create mode 100644 tests/extmod 2/ujson_loads_float.py create mode 100644 tests/extmod 2/urandom_basic.py create mode 100644 tests/extmod 2/ure1.py create mode 100644 tests/extmod 2/ure_debug.py.exp create mode 100644 tests/extmod 2/ure_error.py create mode 100644 tests/extmod 2/ure_namedclass.py create mode 100644 tests/extmod 2/ure_stack_overflow.py.exp create mode 100644 tests/extmod 2/ure_sub_unmatched.py.exp create mode 100644 tests/extmod 2/ussl_basic.py create mode 100644 tests/extmod 2/utimeq1.py create mode 100644 tests/extmod 2/utimeq_stable.py.exp create mode 100644 tests/extmod 2/uzlib_decompio.py create mode 100644 tests/extmod 2/uzlib_decompio_gz.py.exp create mode 100644 tests/extmod 2/vfs_fat_fileio1.py create mode 100644 tests/extmod 2/vfs_fat_fileio1.py.exp create mode 100644 tests/extmod 2/vfs_fat_more.py.exp create mode 100644 tests/extmod 2/vfs_fat_oldproto.py.exp create mode 100644 tests/extmod 2/vfs_fat_ramdisk.py.exp create mode 100644 tests/extmod 2/websocket_basic.py.exp create mode 100644 tests/feature_check 2/README create mode 100644 tests/feature_check 2/async_check.py create mode 100644 tests/feature_check 2/async_check.py.exp create mode 100644 tests/feature_check 2/byteorder.py create mode 100644 tests/feature_check 2/byteorder.py.exp create mode 100644 tests/feature_check 2/complex.py create mode 100644 tests/feature_check 2/complex.py.exp create mode 100644 tests/feature_check 2/const.py create mode 100644 tests/feature_check 2/const.py.exp create mode 100644 tests/feature_check 2/coverage.py create mode 100644 tests/feature_check 2/coverage.py.exp create mode 100644 tests/feature_check 2/float.py create mode 100644 tests/feature_check 2/float.py.exp create mode 100644 tests/feature_check 2/int_big.py create mode 100644 tests/feature_check 2/int_big.py.exp create mode 100644 tests/feature_check 2/native_check.py create mode 100644 tests/feature_check 2/native_check.py.exp create mode 100644 tests/feature_check 2/repl_emacs_check.py create mode 100644 tests/feature_check 2/repl_emacs_check.py.exp create mode 100644 tests/feature_check 2/reverse_ops.py create mode 100644 tests/feature_check 2/reverse_ops.py.exp create mode 100644 tests/feature_check 2/set_check.py create mode 100644 tests/feature_check 2/set_check.py.exp create mode 100644 tests/float 2/array_construct.py create mode 100644 tests/float 2/builtin_float_hash.py create mode 100644 tests/float 2/builtin_float_minmax.py create mode 100644 tests/float 2/builtin_float_pow.py create mode 100644 tests/float 2/builtin_float_round.py create mode 100644 tests/float 2/builtin_float_round_intbig.py create mode 100644 tests/float 2/bytearray_construct.py create mode 100644 tests/float 2/bytes_construct.py create mode 100644 tests/float 2/cmath_fun.py create mode 100644 tests/float 2/cmath_fun_special.py create mode 100644 tests/float 2/complex1.py create mode 100644 tests/float 2/complex1_intbig.py create mode 100644 tests/float 2/float1.py create mode 100644 tests/float 2/float2int_doubleprec_intbig.py create mode 100644 tests/float 2/float2int_fp30_intbig.py create mode 100644 tests/float 2/float2int_intbig.py create mode 100644 tests/float 2/float_array.py create mode 100644 tests/float 2/float_compare.py create mode 100644 tests/float 2/float_divmod.py create mode 100644 tests/float 2/float_divmod_relaxed.py create mode 100644 tests/float 2/float_format.py create mode 100644 tests/float 2/float_parse.py create mode 100644 tests/float 2/float_parse_doubleprec.py create mode 100644 tests/float 2/float_struct.py create mode 100644 tests/float 2/int_big_float.py create mode 100644 tests/float 2/int_divzero.py create mode 100644 tests/float 2/int_power.py create mode 100644 tests/float 2/list_index.py create mode 100644 tests/float 2/math_domain.py create mode 100644 tests/float 2/math_domain_special.py create mode 100644 tests/float 2/math_fun.py create mode 100644 tests/float 2/math_fun_bool.py create mode 100644 tests/float 2/math_fun_int.py create mode 100644 tests/float 2/math_fun_intbig.py create mode 100644 tests/float 2/math_fun_special.py create mode 100644 tests/float 2/python36.py create mode 100644 tests/float 2/python36.py.exp create mode 100644 tests/float 2/string_format.py create mode 100644 tests/float 2/string_format2.py create mode 100644 tests/float 2/string_format_fp30.py create mode 100644 tests/float 2/string_format_modulo.py create mode 100644 tests/float 2/string_format_modulo2.py create mode 100644 tests/float 2/string_format_modulo2_intbig.py create mode 100644 tests/float 2/string_format_modulo3.py create mode 100644 tests/float 2/string_format_modulo3.py.exp create mode 100644 tests/float 2/true_value.py create mode 100644 tests/float 2/types.py create mode 100644 tests/inlineasm 2/asmargs.py create mode 100644 tests/inlineasm 2/asmargs.py.exp create mode 100644 tests/inlineasm 2/asmbcc.py create mode 100644 tests/inlineasm 2/asmbcc.py.exp create mode 100644 tests/inlineasm 2/asmbitops.py create mode 100644 tests/inlineasm 2/asmbitops.py.exp create mode 100644 tests/inlineasm 2/asmblbx.py create mode 100644 tests/inlineasm 2/asmblbx.py.exp create mode 100644 tests/inlineasm 2/asmconst.py create mode 100644 tests/inlineasm 2/asmconst.py.exp create mode 100644 tests/inlineasm 2/asmdiv.py create mode 100644 tests/inlineasm 2/asmdiv.py.exp create mode 100644 tests/inlineasm 2/asmfpaddsub.py create mode 100644 tests/inlineasm 2/asmfpaddsub.py.exp create mode 100644 tests/inlineasm 2/asmfpcmp.py create mode 100644 tests/inlineasm 2/asmfpcmp.py.exp create mode 100644 tests/inlineasm 2/asmfpldrstr.py create mode 100644 tests/inlineasm 2/asmfpldrstr.py.exp create mode 100644 tests/inlineasm 2/asmfpmuldiv.py create mode 100644 tests/inlineasm 2/asmfpmuldiv.py.exp create mode 100644 tests/inlineasm 2/asmfpsqrt.py create mode 100644 tests/inlineasm 2/asmfpsqrt.py.exp create mode 100644 tests/inlineasm 2/asmit.py create mode 100644 tests/inlineasm 2/asmit.py.exp create mode 100644 tests/inlineasm 2/asmpushpop.py create mode 100644 tests/inlineasm 2/asmpushpop.py.exp create mode 100644 tests/inlineasm 2/asmrettype.py create mode 100644 tests/inlineasm 2/asmrettype.py.exp create mode 100644 tests/inlineasm 2/asmshift.py create mode 100644 tests/inlineasm 2/asmshift.py.exp create mode 100644 tests/inlineasm 2/asmspecialregs.py create mode 100644 tests/inlineasm 2/asmspecialregs.py.exp create mode 100644 tests/inlineasm 2/asmsum.py create mode 100644 tests/inlineasm 2/asmsum.py.exp create mode 100644 tests/io/data/file1 2 create mode 100644 tests/jni 2/README create mode 100644 tests/jni 2/list.py create mode 100644 tests/jni 2/list.py.exp create mode 100644 tests/jni 2/object.py create mode 100644 tests/jni 2/object.py.exp create mode 100644 tests/jni 2/system_out.py create mode 100644 tests/jni 2/system_out.py.exp create mode 100644 tests/net_hosted 2/README create mode 100644 tests/net_hosted 2/accept_nonblock.py create mode 100644 tests/net_hosted 2/accept_nonblock.py.exp create mode 100644 tests/net_hosted 2/accept_timeout.py create mode 100644 tests/net_hosted 2/accept_timeout.py.exp create mode 100644 tests/net_hosted 2/connect_nonblock.py create mode 100644 tests/net_hosted 2/connect_nonblock.py.exp create mode 100644 tests/net_hosted 2/connect_poll.py create mode 100644 tests/net_hosted 2/connect_poll.py.exp create mode 100644 tests/net_hosted 2/ssl_getpeercert.py create mode 100644 tests/net_hosted 2/ssl_getpeercert.py.exp create mode 100644 tests/net_inet 2/README create mode 100644 tests/net_inet 2/test_tls_sites.py create mode 100644 tests/net_inet 2/test_tls_sites.py.exp create mode 100755 tests/run-bench-tests 2 create mode 100755 tests/run-tests 2 create mode 100644 tests/stress 2/dict_copy.py create mode 100644 tests/stress 2/dict_create.py create mode 100644 tests/stress 2/dict_create_max.py create mode 100644 tests/stress 2/gc_trace.py create mode 100644 tests/stress 2/list_sort.py create mode 100644 tests/stress 2/recursion.py create mode 100644 tests/stress 2/recursive_data.py create mode 100644 tests/stress 2/recursive_data.py.exp create mode 100644 tests/stress 2/recursive_gen.py create mode 100644 tests/stress 2/recursive_iternext.py create mode 100644 tests/stress 2/recursive_iternext.py.exp create mode 100644 tests/thread 2/mutate_bytearray.py create mode 100644 tests/thread 2/mutate_dict.py create mode 100644 tests/thread 2/mutate_instance.py create mode 100644 tests/thread 2/mutate_list.py create mode 100644 tests/thread 2/mutate_set.py create mode 100644 tests/thread 2/stress_aes.py create mode 100644 tests/thread 2/stress_create.py create mode 100644 tests/thread 2/stress_heap.py create mode 100644 tests/thread 2/stress_recurse.py create mode 100644 tests/thread 2/thread_exc1.py create mode 100644 tests/thread 2/thread_exc2.py create mode 100644 tests/thread 2/thread_exc2.py.exp create mode 100644 tests/thread 2/thread_exit1.py create mode 100644 tests/thread 2/thread_exit2.py create mode 100644 tests/thread 2/thread_gc1.py create mode 100644 tests/thread 2/thread_ident1.py create mode 100644 tests/thread 2/thread_lock1.py create mode 100644 tests/thread 2/thread_lock2.py create mode 100644 tests/thread 2/thread_lock3.py create mode 100644 tests/thread 2/thread_lock4.py create mode 100644 tests/thread 2/thread_qstr1.py create mode 100644 tests/thread 2/thread_shared1.py create mode 100644 tests/thread 2/thread_shared2.py create mode 100644 tests/thread 2/thread_sleep1.py create mode 100644 tests/thread 2/thread_stacksize1.py create mode 100644 tests/thread 2/thread_start1.py create mode 100644 tests/thread 2/thread_start2.py create mode 100644 tests/unix 2/extra_coverage.py create mode 100644 tests/unix 2/extra_coverage.py.exp create mode 100644 tests/unix 2/ffi_callback.py create mode 100644 tests/unix 2/ffi_callback.py.exp create mode 100644 tests/unix 2/ffi_float.py create mode 100644 tests/unix 2/ffi_float.py.exp create mode 100644 tests/unix 2/ffi_float2.py create mode 100644 tests/unix 2/ffi_float2.py.exp create mode 100644 tools/.gitattributes 2 create mode 100644 tools/.gitignore 2 diff --git a/.gitattributes 2 b/.gitattributes 2 new file mode 100644 index 0000000000..5ebde95f07 --- /dev/null +++ b/.gitattributes 2 @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +# Per default everything gets normalized and gets LF line endings on checkout. +* text eol=lf + +# These will always have CRLF line endings on checkout. +*.vcxproj text eol=crlf +*.props text eol=crlf +*.bat text eol=crlf + +# These are binary so should never be modified by git. +*.png binary +*.jpg binary +*.dxf binary +*.mpy binary +*.deb binary +*.zip binary +*.pdf binary + +# These should also not be modified by git. +tests/basics/string_cr_conversion.py -text +tests/basics/string_crlf_conversion.py -text +ports/stm32/pybcdc.inf_template -text +ports/stm32/usbhost/** -text +ports/cc3200/hal/aes.c -text +ports/cc3200/hal/aes.h -text +ports/cc3200/hal/des.c -text +ports/cc3200/hal/i2s.c -text +ports/cc3200/hal/i2s.h -text +ports/cc3200/version.h -text diff --git a/.gitignore 2 b/.gitignore 2 new file mode 100644 index 0000000000..a8814be45e --- /dev/null +++ b/.gitignore 2 @@ -0,0 +1,88 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +# Compiled Sources +################### +*.o +*.a +!atmel-samd/asf/**/*.a +*.elf +*.bin +*.map +*.hex +*.dis +*.exe + +# Packages +############ +dist/ +*.egg-info +.eggs + +# Logs and Databases +###################### +*.log + +# VIM Swap Files +###################### +*.swp + +# Build directory +###################### +build/ +bin/ +circuitpython-stubs/ + +# Test failure outputs +###################### +tests/*.exp +tests/*.out + +# Python cache files +###################### +__pycache__/ +*.pyc + +# Customized Makefile/project overrides +###################### +GNUmakefile +user.props + +# Sphinx output +############### +_build + +# Generated rst files +###################### +genrst/ +/autoapi/ +/shared-bindings/*/**/*.rst + +# ctags and similar +################### +TAGS + +# Merge leftovers +################# +*.orig + +# Emacs backup files +#################### +*~ + +*.DS_Store +**/*.DS_Store +*.icloud + +# POEdit mo files +#################### +*.mo + +.vscode +.idea + +# Python Virtual Environments +#################### +.venv +.env diff --git a/.gitmodules 2 b/.gitmodules 2 new file mode 100644 index 0000000000..aaa66caf71 --- /dev/null +++ b/.gitmodules 2 @@ -0,0 +1,155 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +[submodule "lib/axtls"] + path = lib/axtls + url = https://github.com/pfalcon/axtls + branch = micropython +[submodule "lib/libffi"] + path = lib/libffi + url = https://github.com/atgreen/libffi +[submodule "lib/berkeley-db-1.xx"] + path = lib/berkeley-db-1.xx + url = https://github.com/pfalcon/berkeley-db-1.xx +[submodule "lib/uzlib"] + path = lib/uzlib + url = https://github.com/pfalcon/uzlib +[submodule "tools/uf2"] + path = tools/uf2 + url = https://github.com/Microsoft/uf2.git +[submodule "atmel-samd/frozen/Adafruit_CircuitPython_NeoPixel"] + path = frozen/Adafruit_CircuitPython_NeoPixel + url = https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel +[submodule "frozen/Adafruit_CircuitPython_Thermistor"] + path = frozen/Adafruit_CircuitPython_Thermistor + url = https://github.com/adafruit/Adafruit_CircuitPython_Thermistor.git +[submodule "frozen/Adafruit_CircuitPython_LIS3DH"] + path = frozen/Adafruit_CircuitPython_LIS3DH + url = https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH.git +[submodule "frozen/Adafruit_CircuitPython_BusDevice"] + path = frozen/Adafruit_CircuitPython_BusDevice + url = https://github.com/adafruit/Adafruit_CircuitPython_BusDevice.git +[submodule "tools/python-semver"] + path = tools/python-semver + url = https://github.com/k-bx/python-semver.git +[submodule "atmel-samd/asf4"] + path = ports/atmel-samd/asf4 + url = https://github.com/adafruit/asf4.git + branch = circuitpython +[submodule "tools/usb_descriptor"] + path = tools/usb_descriptor + url = https://github.com/adafruit/usb_descriptor.git +[submodule "lib/nrfutil"] + path = lib/nrfutil + url = https://github.com/adafruit/nRF52_nrfutil +[submodule "ports/atmel-samd/freetouch"] + path = ports/atmel-samd/freetouch + url = https://github.com/adafruit/Adafruit_FreeTouch.git +[submodule "frozen/Adafruit_CircuitPython_CircuitPlayground"] + path = frozen/Adafruit_CircuitPython_CircuitPlayground + url = https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground.git +[submodule "frozen/Adafruit_CircuitPython_HID"] + path = frozen/Adafruit_CircuitPython_HID + url = https://github.com/adafruit/Adafruit_CircuitPython_HID.git +[submodule "ports/atmel-samd/Adafruit_CircuitPython_Motor"] + path = frozen/Adafruit_CircuitPython_Motor + url = https://github.com/adafruit/Adafruit_CircuitPython_Motor.git +[submodule "ports/atmel-samd/Adafruit_CircuitPython_seesaw"] + path = frozen/Adafruit_CircuitPython_seesaw + url = https://github.com/adafruit/Adafruit_CircuitPython_seesaw.git +[submodule "frozen/Adafruit_CircuitPython_IRRemote"] + path = frozen/Adafruit_CircuitPython_IRRemote + url = https://github.com/adafruit/Adafruit_CircuitPython_IRRemote.git +[submodule "frozen/Adafruit_CircuitPython_DotStar"] + path = frozen/Adafruit_CircuitPython_DotStar + url = https://github.com/adafruit/Adafruit_CircuitPython_DotStar.git +[submodule "ports/atmel-samd/peripherals"] + path = ports/atmel-samd/peripherals + url = https://github.com/adafruit/samd-peripherals.git +[submodule "frozen/Adafruit_CircuitPython_Crickit"] + path = frozen/Adafruit_CircuitPython_Crickit + url = https://github.com/adafruit/Adafruit_CircuitPython_Crickit +[submodule "ports/nrf/nrfx"] + path = ports/nrf/nrfx + url = https://github.com/adafruit/nrfx.git +[submodule "lib/tinyusb"] + path = lib/tinyusb + url = https://github.com/hathach/tinyusb.git + branch = master + fetchRecurseSubmodules = false +[submodule "tools/huffman"] + path = tools/huffman + url = https://github.com/tannewt/huffman.git +[submodule "tools/adabot"] + path = tools/adabot + url = https://github.com/adafruit/adabot.git +[submodule "tools/bitmap_font"] + path = tools/bitmap_font + url = https://github.com/adafruit/Adafruit_CircuitPython_BitmapFont.git +[submodule "tools/Tecate-bitmap-fonts"] + path = tools/Tecate-bitmap-fonts + url = https://github.com/Tecate/bitmap-fonts.git +[submodule "frozen/pew-pewpew-standalone-10.x"] + path = frozen/pew-pewpew-standalone-10.x + url = https://github.com/pewpew-game/pew-pewpew-standalone-10.x.git +[submodule "frozen/circuitpython-stage"] + path = frozen/circuitpython-stage + url = https://github.com/python-ugame/circuitpython-stage.git +[submodule "ports/cxd56/spresense-exported-sdk"] + path = ports/cxd56/spresense-exported-sdk + url = https://github.com/sonydevworld/spresense-exported-sdk.git +[submodule "frozen/Adafruit_CircuitPython_SD"] + path = frozen/Adafruit_CircuitPython_SD + url = https://github.com/adafruit/Adafruit_CircuitPython_SD.git +[submodule "lib/mp3"] + path = lib/mp3 + url = https://github.com/adafruit/Adafruit_MP3 +[submodule "ports/mimxrt10xx/sdk"] + path = ports/mimxrt10xx/sdk + url = https://github.com/adafruit/MIMXRT10xx_SDK +[submodule "frozen/Adafruit_CircuitPython_Register"] + path = frozen/Adafruit_CircuitPython_Register + url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git +[submodule "extmod/ulab"] + path = extmod/ulab + url = https://github.com/v923z/micropython-ulab +[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"] + path = frozen/Adafruit_CircuitPython_ESP32SPI + url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI +[submodule "frozen/Adafruit_CircuitPython_Requests"] + path = frozen/Adafruit_CircuitPython_Requests + url = https://github.com/adafruit/Adafruit_CircuitPython_Requests +[submodule "ports/stm/st_driver"] + path = ports/stm/st_driver + url = https://github.com/hathach/st_driver.git +[submodule "lib/protomatter"] + path = lib/protomatter + url = https://github.com/adafruit/Adafruit_Protomatter +[submodule "frozen/Adafruit_CircuitPython_LSM6DS"] + path = frozen/Adafruit_CircuitPython_LSM6DS + url = https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS +[submodule "frozen/Adafruit_CircuitPython_FocalTouch"] + path = frozen/Adafruit_CircuitPython_FocalTouch + url = https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch +[submodule "frozen/Adafruit_CircuitPython_DS3231"] + path = frozen/Adafruit_CircuitPython_DS3231 + url = https://github.com/adafruit/Adafruit_CircuitPython_DS3231 +[submodule "frozen/Adafruit_CircuitPython_DRV2605"] + path = frozen/Adafruit_CircuitPython_DRV2605 + url = https://github.com/adafruit/Adafruit_CircuitPython_DRV2605 +[submodule "frozen/Adafruit_CircuitPython_BLE"] + path = frozen/Adafruit_CircuitPython_BLE + url = https://github.com/adafruit/Adafruit_CircuitPython_BLE +[submodule "frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center"] + path = frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center + url = https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center +[submodule "frozen/Adafruit_CircuitPython_RFM9x"] + path = frozen/Adafruit_CircuitPython_RFM9x + url = https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git +[submodule "frozen/Adafruit_CircuitPython_RFM69"] + path = frozen/Adafruit_CircuitPython_RFM69 + url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git +[submodule "ports/esp32s2/esp-idf"] + path = ports/esp32s2/esp-idf + url = https://github.com/jepler/esp-idf.git diff --git a/.mailmap 2 b/.mailmap 2 new file mode 100644 index 0000000000..f9d7f47a16 --- /dev/null +++ b/.mailmap 2 @@ -0,0 +1,112 @@ +# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò +# +# SPDX-License-Identifier: Unlicense + +Alexander Steffen +Alexander Steffen +Alexander Steffen +Benjamin Vernoux +Brent Rubell +Brent Rubell +Brent Rubell +Carlos +Chris Packham +Chris Packham +Damiano Mazzella +Damien George +Dan Halbert +Dan Halbert +Daniel Pollard +Daniel Pollard +Daniel Tralamazza +Daniel Tralamazza +David Glaude +David Glaude +George Waters +George Waters +Ha Thach +Henrik Sölver +Ilya Dmitrichenko +Ilya Dmitrichenko +Jason Pecor <14111408+jpecor@users.noreply.github.com> +Jeff Epler +Jeff Epler +Jeff Epler +Jeff Epler +Jerry Needell +Joe Bakalor +Josh Klar +Josh Klar +Juan Biondi +Juan Biondi +KalbeAbbas +KalbeAbbas +Kamil Tomaszewski +Kamil Tomaszewski <46525824+kamtom480@users.noreply.github.com> +Kattni +Kattni Rembor +Kenny +Kenny <3454741+WarriorOfWire@users.noreply.github.com> +Kevin Townsend +Kevin Townsend +Krzysztof Blazewicz +Krzysztof Blazewicz +Li Weiwei +Li Weiwei +Limor "Ladyada" Fried +Limor "Ladyada" Fried +Lucian Copeland +Lucian Copeland +Mark Olsson +Mark Olsson +Matt Land +Matt Land +Matt Wozniski +Matt Wozniski +Melissa LeBlanc-Williams +Melissa LeBlanc-Williams +Metallicow +Metallicow +Peter Hinch +Peter Hinch +Radomir Dopieralski +Radomir Dopieralski +Rafa Gould +Rafa Gould <50337143+rafa-gould@users.noreply.github.com> +Ryan Shaw +Ryan Shaw +Sabas +Sabas +Sabas +Scott Shawcroft +Scott Shawcroft +Scott Shawcroft +Scott Shawcroft +Scott Shawcroft +Sebastian Plamauer +Sebastian Plamauer +Senuros +Senuros +Stewart Colborne +Stewart Colborne +TG-Techie +TG-Techie <39284876+TG-Techie@users.noreply.github.com> +Thea Flowers +Thea Flowers +Tobias Badertscher +Tobias Badertscher +danicampora +danicampora +dherrada +dherrada <33632497+dherrada@users.noreply.github.com> +dherrada <=> +glennrub +retoc +retoc +siddacious +siddacious +siddacious +sommersoft +sommersoft +stijn +stijn diff --git a/mpy-cross/.gitignore 2 b/mpy-cross/.gitignore 2 new file mode 100644 index 0000000000..6daeea5040 --- /dev/null +++ b/mpy-cross/.gitignore 2 @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +/build-* +/mpy-cross +/mpy-cross.static +/mpy-cross.static.exe +/mpy-cross.static-raspbian +/mpy-cross.fuzz +/pitools diff --git a/ports/atmel-samd/.gitattributes 2 b/ports/atmel-samd/.gitattributes 2 new file mode 100644 index 0000000000..09bba615b1 --- /dev/null +++ b/ports/atmel-samd/.gitattributes 2 @@ -0,0 +1,2 @@ +tools/bossac* binary +asf/**/*.a binary diff --git a/ports/atmel-samd/.gitignore 2 b/ports/atmel-samd/.gitignore 2 new file mode 100644 index 0000000000..414487d53e --- /dev/null +++ b/ports/atmel-samd/.gitignore 2 @@ -0,0 +1 @@ +build-*/ diff --git a/ports/atmel-samd/boards/board.h b/ports/atmel-samd/boards/board.h new file mode 100644 index 0000000000..4f0ae9d728 --- /dev/null +++ b/ports/atmel-samd/boards/board.h @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// This file defines board specific functions. + +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H +#define MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H + +#include + +#include "py/mpconfig.h" + +// Initializes board related state once on start up. +void board_init(void); + +// Returns true if the user initiates safe mode in a board specific way. +// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific +// way. +bool board_requests_safe_mode(void); + +// Reset the state of off MCU components such as neopixels. +void reset_board(void); + +#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index fafb68ef03..d632dd96e7 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -589,22 +589,40 @@ typedef struct { // Settings for the Macronix MX25L51245G 64MiB SPI flash. // Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7437/MX25L51245G,%203V,%20512Mb,%20v1.6.pdf -// Will finish this addition in a future PR. All the stuff is there, just need to test in the wild. -//#define MX25L25645G {\ -// .total_size = (1 << 25), /* 32 MiB */ \ -// .start_up_time_us = 5000, \ -// .manufacturer_id = 0x9f, \ -// .memory_type = 0xab, \ -// .capacity = 0x90, \ -// .max_clock_speed_mhz = 133, \ -// .quad_enable_bit_mask = 0xaf, \ -// .has_sector_protection = false, \ -// .supports_fast_read = true, \ -// .supports_qspi = true, \ -// .supports_qspi_writes = true, \ -// .write_status_register_split = false, \ -// .single_status_byte = true, \ -//} +#define MX25L25645G {\ + .total_size = (1 << 25), /* 32 MiB */ \ + .start_up_time_us = 5000, \ + .manufacturer_id = 0x9f, \ + .memory_type = 0xab, \ + .capacity = 0x90, \ + .max_clock_speed_mhz = 133, \ + .quad_enable_bit_mask = 0xaf, \ + .has_sector_protection = false, \ + .supports_fast_read = true, \ + .supports_qspi = true, \ + .supports_qspi_writes = true, \ + .write_status_register_split = false, \ + .single_status_byte = true, \ +} + +// Settings for the Macronix MX25L12833F 16MiB SPI flash +// Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7447/MX25L12833F,%203V,%20128Mb,%20v1.0.pdf + +#define MX25L12833F {\ + .total_size = (1UL << 24), /* 16 MiB */ \ + .start_up_time_us = 5000, \ + .manufacturer_id = 0xc2, \ + .memory_type = 0x20, \ + .capacity = 0x18, \ + .max_clock_speed_mhz = 133, \ + .quad_enable_bit_mask = 0x40, \ + .has_sector_protection = true, \ + .supports_fast_read = true, \ + .supports_qspi = true, \ + .supports_qspi_writes = true, \ + .write_status_register_split = false, \ + .single_status_byte = true, \ + } // Settings for the Winbond W25Q128JV-PM 16MiB SPI flash. Note that JV-IM has a different .memory_type (0x70) // Datasheet: https://www.winbond.com/resource-files/w25q128jv%20revf%2003272018%20plus.pdf diff --git a/tests/README 2 b/tests/README 2 new file mode 100644 index 0000000000..3458f36a80 --- /dev/null +++ b/tests/README 2 @@ -0,0 +1,18 @@ +This directory contains tests for various functionality areas of MicroPython. +To run all stable tests, run "run-tests" script in this directory. + +Tests of capabilities not supported on all platforms should be written +to check for the capability being present. If it is not, the test +should merely output 'SKIP' followed by the line terminator, and call +sys.exit() to raise SystemExit, instead of attempting to test the +missing capability. The testing framework (run-tests in this +directory, test_main.c in qemu_arm) recognizes this as a skipped test. + +There are a few features for which this mechanism cannot be used to +condition a test. The run-tests script uses small scripts in the +feature_check directory to check whether each such feature is present, +and skips the relevant tests if not. + +When creating new tests, anything that relies on float support should go in the +float/ subdirectory. Anything that relies on import x, where x is not a built-in +module, should go in the import/ subdirectory. diff --git a/tests/extmod 2/btree1.py b/tests/extmod 2/btree1.py new file mode 100644 index 0000000000..59638ef0a4 --- /dev/null +++ b/tests/extmod 2/btree1.py @@ -0,0 +1,89 @@ +try: + import btree + import uio + import uerrno +except ImportError: + print("SKIP") + raise SystemExit + +#f = open("_test.db", "w+b") +f = uio.BytesIO() +db = btree.open(f, pagesize=512) + +db[b"foo3"] = b"bar3" +db[b"foo1"] = b"bar1" +db[b"foo2"] = b"bar2" +db[b"bar1"] = b"foo1" + +dbstr = str(db) +print(dbstr[:7], dbstr[-1:]) + +print(db[b"foo2"]) +try: + print(db[b"foo"]) +except KeyError: + print("KeyError") +print(db.get(b"foo")) +print(db.get(b"foo", b"dflt")) + +del db[b"foo2"] +try: + del db[b"foo"] +except KeyError: + print("KeyError") + +for k, v in db.items(): + print((k, v)) + +print("---") +for k, v in db.items(None, None): + print((k, v)) + +print("---") +for k, v in db.items(b"f"): + print((k, v)) + +print("---") +for k, v in db.items(b"f", b"foo3"): + print((k, v)) + +print("---") +for k, v in db.items(None, b"foo3"): + print((k, v)) + +print("---") +for k, v in db.items(b"f", b"foo3", btree.INCL): + print((k, v)) + +print("---") +for k, v in db.items(None, None, btree.DESC): + print((k, v)) + +print(db.seq(1, b"foo1")) +print(db.seq(1, b"qux")) + +try: + db.seq(b"foo1") +except OSError as e: + print(e.args[0] == uerrno.EINVAL) + +print(list(db.keys())) +print(list(db.values())) + +for k in db: + print(k) + +db.put(b"baz1", b"qux1") + +print("foo1", "foo1" in db) +print("foo2", "foo2" in db) +print("baz1", "baz1" in db) + +try: + print(db + db[b"foo1"]) +except TypeError: + print("TypeError") + +db.flush() +db.close() +f.close() diff --git a/tests/extmod 2/framebuf1.py b/tests/extmod 2/framebuf1.py new file mode 100644 index 0000000000..2c13665228 --- /dev/null +++ b/tests/extmod 2/framebuf1.py @@ -0,0 +1,109 @@ +try: + import framebuf +except ImportError: + print("SKIP") + raise SystemExit + +w = 5 +h = 16 +size = w * h // 8 +buf = bytearray(size) +maps = {framebuf.MONO_VLSB : 'MONO_VLSB', + framebuf.MONO_HLSB : 'MONO_HLSB', + framebuf.MONO_HMSB : 'MONO_HMSB'} + +for mapping in maps.keys(): + for x in range(size): + buf[x] = 0 + fbuf = framebuf.FrameBuffer(buf, w, h, mapping) + print(maps[mapping]) + # access as buffer + print(memoryview(fbuf)[0]) + + # fill + fbuf.fill(1) + print(buf) + fbuf.fill(0) + print(buf) + + # put pixel + fbuf.pixel(0, 0, 1) + fbuf.pixel(4, 0, 1) + fbuf.pixel(0, 15, 1) + fbuf.pixel(4, 15, 1) + print(buf) + + # clear pixel + fbuf.pixel(4, 15, 0) + print(buf) + + # get pixel + print(fbuf.pixel(0, 0), fbuf.pixel(1, 1)) + + # hline + fbuf.fill(0) + fbuf.hline(0, 1, w, 1) + print('hline', buf) + + # vline + fbuf.fill(0) + fbuf.vline(1, 0, h, 1) + print('vline', buf) + + # rect + fbuf.fill(0) + fbuf.rect(1, 1, 3, 3, 1) + print('rect', buf) + + #fill rect + fbuf.fill(0) + fbuf.fill_rect(0, 0, 0, 3, 1) # zero width, no-operation + fbuf.fill_rect(1, 1, 3, 3, 1) + print('fill_rect', buf) + + # line + fbuf.fill(0) + fbuf.line(1, 1, 3, 3, 1) + print('line', buf) + + # line steep negative gradient + fbuf.fill(0) + fbuf.line(3, 3, 2, 1, 1) + print('line', buf) + + # scroll + fbuf.fill(0) + fbuf.pixel(2, 7, 1) + fbuf.scroll(0, 1) + print(buf) + fbuf.scroll(0, -2) + print(buf) + fbuf.scroll(1, 0) + print(buf) + fbuf.scroll(-1, 0) + print(buf) + fbuf.scroll(2, 2) + print(buf) + + # print text + fbuf.fill(0) + fbuf.text("hello", 0, 0, 1) + print(buf) + fbuf.text("hello", 0, 0, 0) # clear + print(buf) + + # char out of font range set to chr(127) + fbuf.text(str(chr(31)), 0, 0) + print(buf) + print() + +# test invalid constructor, and stride argument +try: + fbuf = framebuf.FrameBuffer(buf, w, h, -1, w) +except ValueError: + print("ValueError") + +# test legacy constructor +fbuf = framebuf.FrameBuffer1(buf, w, h) +fbuf = framebuf.FrameBuffer1(buf, w, h, w) +print(framebuf.MVLSB == framebuf.MONO_VLSB) diff --git a/tests/extmod 2/framebuf16.py b/tests/extmod 2/framebuf16.py new file mode 100644 index 0000000000..fe81f7f93f --- /dev/null +++ b/tests/extmod 2/framebuf16.py @@ -0,0 +1,59 @@ +try: + import framebuf +except ImportError: + print("SKIP") + raise SystemExit + +def printbuf(): + print("--8<--") + for y in range(h): + print(buf[y * w * 2:(y + 1) * w * 2]) + print("-->8--") + +w = 4 +h = 5 +buf = bytearray(w * h * 2) +fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.RGB565) + +# fill +fbuf.fill(0xffff) +printbuf() +fbuf.fill(0x0000) +printbuf() + +# put pixel +fbuf.pixel(0, 0, 0xeeee) +fbuf.pixel(3, 0, 0xee00) +fbuf.pixel(0, 4, 0x00ee) +fbuf.pixel(3, 4, 0x0ee0) +printbuf() + +# get pixel +print(fbuf.pixel(0, 4), fbuf.pixel(1, 1)) + +# scroll +fbuf.fill(0x0000) +fbuf.pixel(2, 2, 0xffff) +printbuf() +fbuf.scroll(0, 1) +printbuf() +fbuf.scroll(1, 0) +printbuf() +fbuf.scroll(-1, -2) +printbuf() + +w2 = 2 +h2 = 3 +buf2 = bytearray(w2 * h2 * 2) +fbuf2 = framebuf.FrameBuffer(buf2, w2, h2, framebuf.RGB565) + +fbuf2.fill(0x0000) +fbuf2.pixel(0, 0, 0x0ee0) +fbuf2.pixel(0, 2, 0xee00) +fbuf2.pixel(1, 0, 0x00ee) +fbuf2.pixel(1, 2, 0xe00e) +fbuf.fill(0xffff) +fbuf.blit(fbuf2, 3, 3, 0x0000) +fbuf.blit(fbuf2, -1, -1, 0x0000) +fbuf.blit(fbuf2, 16, 16, 0x0000) +printbuf() diff --git a/tests/extmod 2/framebuf2.py.exp b/tests/extmod 2/framebuf2.py.exp new file mode 100644 index 0000000000..c53e518a6e --- /dev/null +++ b/tests/extmod 2/framebuf2.py.exp @@ -0,0 +1,57 @@ +--8<-- +33333333 +33333333 +33333333 +33333333 +33333333 +-->8-- +--8<-- +00000000 +00000000 +00000000 +00000000 +00000000 +-->8-- +--8<-- +10020000 +00000000 +00000000 +00000000 +30020000 +-->8-- +3 0 +--8<-- +00000000 +00000000 +00300000 +00000000 +00000000 +-->8-- +--8<-- +00000000 +00000000 +00000000 +00300000 +00000000 +-->8-- +--8<-- +00000000 +00000000 +00000000 +00030000 +00000000 +-->8-- +--8<-- +00000000 +00300000 +00000000 +00030000 +00000000 +-->8-- +--8<-- +33333333 +23333333 +33333333 +33311333 +33333333 +-->8-- diff --git a/tests/extmod 2/framebuf4.py b/tests/extmod 2/framebuf4.py new file mode 100644 index 0000000000..8358fa55b9 --- /dev/null +++ b/tests/extmod 2/framebuf4.py @@ -0,0 +1,53 @@ +try: + import framebuf +except ImportError: + print("SKIP") + raise SystemExit + +def printbuf(): + print("--8<--") + for y in range(h): + print(buf[y * w // 2:(y + 1) * w // 2]) + print("-->8--") + +w = 16 +h = 8 +buf = bytearray(w * h // 2) +fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS4_HMSB) + +# fill +fbuf.fill(0x0f) +printbuf() +fbuf.fill(0xa0) +printbuf() + +# put pixel +fbuf.pixel(0, 0, 0x01) +printbuf() +fbuf.pixel(w-1, 0, 0x02) +printbuf() +fbuf.pixel(w-1, h-1, 0x03) +printbuf() +fbuf.pixel(0, h-1, 0x04) +printbuf() + +# get pixel +print(fbuf.pixel(0, 0), fbuf.pixel(w-1, 0), fbuf.pixel(w-1, h-1), fbuf.pixel(0, h-1)) +print(fbuf.pixel(1, 0), fbuf.pixel(w-2, 0), fbuf.pixel(w-2, h-1), fbuf.pixel(1, h-1)) + +# fill rect +fbuf.fill_rect(0, 0, w, h, 0x0f) +printbuf() +fbuf.fill_rect(0, 0, w, h, 0xf0) +fbuf.fill_rect(1, 0, w//2+1, 1, 0xf1) +printbuf() +fbuf.fill_rect(1, 0, w//2+1, 1, 0x10) +fbuf.fill_rect(1, 0, w//2, 1, 0xf1) +printbuf() +fbuf.fill_rect(1, 0, w//2, 1, 0x10) +fbuf.fill_rect(0, h-4, w//2+1, 4, 0xaf) +printbuf() +fbuf.fill_rect(0, h-4, w//2+1, 4, 0xb0) +fbuf.fill_rect(0, h-4, w//2, 4, 0xaf) +printbuf() +fbuf.fill_rect(0, h-4, w//2, 4, 0xb0) diff --git a/tests/extmod 2/framebuf_subclass.py b/tests/extmod 2/framebuf_subclass.py new file mode 100644 index 0000000000..6363c224fb --- /dev/null +++ b/tests/extmod 2/framebuf_subclass.py @@ -0,0 +1,20 @@ +# test subclassing framebuf.FrameBuffer + +try: + import framebuf +except ImportError: + print('SKIP') + raise SystemExit + +class FB(framebuf.FrameBuffer): + def __init__(self, n): + self.n = n + super().__init__(bytearray(2 * n * n), n, n, framebuf.RGB565) + + def foo(self): + self.hline(0, 2, self.n, 0x0304) + +fb = FB(n=3) +fb.pixel(0, 0, 0x0102) +fb.foo() +print(bytes(fb)) diff --git a/tests/extmod 2/machine1.py b/tests/extmod 2/machine1.py new file mode 100644 index 0000000000..6ff38cc051 --- /dev/null +++ b/tests/extmod 2/machine1.py @@ -0,0 +1,28 @@ +# test machine module + +try: + try: + import umachine as machine + except ImportError: + import machine + machine.mem8 +except: + print("SKIP") + raise SystemExit + +print(machine.mem8) + +try: + machine.mem16[1] +except ValueError: + print("ValueError") + +try: + machine.mem16[1] = 1 +except ValueError: + print("ValueError") + +try: + del machine.mem8[0] +except TypeError: + print("TypeError") diff --git a/tests/extmod 2/machine_pinbase.py b/tests/extmod 2/machine_pinbase.py new file mode 100644 index 0000000000..e91775504d --- /dev/null +++ b/tests/extmod 2/machine_pinbase.py @@ -0,0 +1,30 @@ +try: + import umachine as machine +except ImportError: + import machine +try: + machine.PinBase +except AttributeError: + print("SKIP") + raise SystemExit + + +class MyPin(machine.PinBase): + + def __init__(self): + print("__init__") + self.v = False + + def value(self, v=None): + print("value:", v) + if v is None: + self.v = not self.v + return int(self.v) + +p = MyPin() + +print(p.value()) +print(p.value()) +print(p.value()) +p.value(1) +p.value(0) diff --git a/tests/extmod 2/machine_pinbase.py.exp b/tests/extmod 2/machine_pinbase.py.exp new file mode 100644 index 0000000000..b31cd98308 --- /dev/null +++ b/tests/extmod 2/machine_pinbase.py.exp @@ -0,0 +1,9 @@ +__init__ +value: None +1 +value: None +0 +value: None +1 +value: 1 +value: 0 diff --git a/tests/extmod 2/ticks_diff.py b/tests/extmod 2/ticks_diff.py new file mode 100644 index 0000000000..4d8df83cf9 --- /dev/null +++ b/tests/extmod 2/ticks_diff.py @@ -0,0 +1,33 @@ +from utime import ticks_diff, ticks_add + +MAX = ticks_add(0, -1) +# Should be done like this to avoid small int overflow +MODULO_HALF = MAX // 2 + 1 + +# Invariants: +# if ticks_diff(a, b) = c, +# then ticks_diff(b, a) = -c + +assert ticks_diff(1, 0) == 1, ticks_diff(1, 0) +assert ticks_diff(0, 1) == -1 + +assert ticks_diff(0, MAX) == 1 +assert ticks_diff(MAX, 0) == -1 + +assert ticks_diff(0, MAX - 1) == 2 + +# Maximum "positive" distance +assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1) +# Step further, and it becomes a negative distance +assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF + +# Offsetting that in either direction doesn't affect the result +off = 100 +# Cheating and skipping to use ticks_add() when we know there's no wraparound +# Real apps should use always it. +assert ticks_diff(MODULO_HALF + off, 1 + off) == MODULO_HALF - 1 +assert ticks_diff(MODULO_HALF + off, 0 + off) == -MODULO_HALF +assert ticks_diff(MODULO_HALF - off, ticks_add(1, -off)) == MODULO_HALF - 1 +assert ticks_diff(MODULO_HALF - off, ticks_add(0, -off)) == -MODULO_HALF + +print("OK") diff --git a/tests/extmod 2/time_ms_us.py b/tests/extmod 2/time_ms_us.py new file mode 100644 index 0000000000..135cf1e096 --- /dev/null +++ b/tests/extmod 2/time_ms_us.py @@ -0,0 +1,22 @@ +import utime +try: + utime.sleep_ms +except AttributeError: + print("SKIP") + raise SystemExit + +utime.sleep_ms(1) +utime.sleep_us(1) + +t0 = utime.ticks_ms() +t1 = utime.ticks_ms() +print(0 <= utime.ticks_diff(t1, t0) <= 1) + +t0 = utime.ticks_us() +t1 = utime.ticks_us() +print(0 <= utime.ticks_diff(t1, t0) <= 500) + +# ticks_cpu may not be implemented, at least make sure it doesn't decrease +t0 = utime.ticks_cpu() +t1 = utime.ticks_cpu() +print(utime.ticks_diff(t1, t0) >= 0) diff --git a/tests/extmod 2/time_ms_us.py.exp b/tests/extmod 2/time_ms_us.py.exp new file mode 100644 index 0000000000..b8ca7e7ef0 --- /dev/null +++ b/tests/extmod 2/time_ms_us.py.exp @@ -0,0 +1,3 @@ +True +True +True diff --git a/tests/extmod 2/ubinascii_a2b_base64.py b/tests/extmod 2/ubinascii_a2b_base64.py new file mode 100644 index 0000000000..5e642ec515 --- /dev/null +++ b/tests/extmod 2/ubinascii_a2b_base64.py @@ -0,0 +1,49 @@ +try: + try: + import ubinascii as binascii + except ImportError: + import binascii +except ImportError: + print("SKIP") + raise SystemExit + +print(binascii.a2b_base64(b'')) +print(binascii.a2b_base64(b'Zg==')) +print(binascii.a2b_base64(b'Zm8=')) +print(binascii.a2b_base64(b'Zm9v')) +print(binascii.a2b_base64(b'Zm9vYg==')) +print(binascii.a2b_base64(b'Zm9vYmE=')) +print(binascii.a2b_base64(b'Zm9vYmFy')) + +print(binascii.a2b_base64(b'AAECAwQFBgc=')) +print(binascii.a2b_base64(b'CAkKCwwNDg8=')) +print(binascii.a2b_base64(b'f4D/')) +print(binascii.a2b_base64(b'f4D+')) # convert '+' +print(binascii.a2b_base64(b'MTIzNEFCQ0RhYmNk')) + +# Ignore invalid characters and pad sequences +print(binascii.a2b_base64(b'Zm9v\n')) +print(binascii.a2b_base64(b'Zm\x009v\n')) +print(binascii.a2b_base64(b'Zm9v==')) +print(binascii.a2b_base64(b'Zm9v===')) +print(binascii.a2b_base64(b'Zm9v===YmFy')) + +# Unicode strings can be decoded +print(binascii.a2b_base64(u'Zm9v===YmFy')) + +try: + print(binascii.a2b_base64(b'abc')) +except ValueError: + print("ValueError") +try: + print(binascii.a2b_base64(b'abcde=')) +except ValueError: + print("ValueError") +try: + print(binascii.a2b_base64(b'ab*d')) +except ValueError: + print("ValueError") +try: + print(binascii.a2b_base64(b'ab=cdef=')) +except ValueError: + print("ValueError") diff --git a/tests/extmod 2/ubinascii_hexlify.py b/tests/extmod 2/ubinascii_hexlify.py new file mode 100644 index 0000000000..dabc3c7e4c --- /dev/null +++ b/tests/extmod 2/ubinascii_hexlify.py @@ -0,0 +1,17 @@ +try: + try: + import ubinascii as binascii + except ImportError: + import binascii +except ImportError: + print("SKIP") + raise SystemExit + +print(binascii.hexlify(b'\x00\x01\x02\x03\x04\x05\x06\x07')) +print(binascii.hexlify(b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')) +print(binascii.hexlify(b'\x7f\x80\xff')) +print(binascii.hexlify(b'1234ABCDabcd')) +try: + binascii.hexlify('') +except TypeError: + print("TypeError") diff --git a/tests/extmod 2/uctypes_32bit_intbig.py.exp b/tests/extmod 2/uctypes_32bit_intbig.py.exp new file mode 100644 index 0000000000..d1fc1fe350 --- /dev/null +++ b/tests/extmod 2/uctypes_32bit_intbig.py.exp @@ -0,0 +1,11 @@ +b'\xff\xff\xff\x7f5678abcd' +b'\x00\x00\x00\x805678abcd' +b'\x03\x02\x01\xff5678abcd' +b'\x03\x02\x01\xff\x00\x00\x00\x80\x00\x00\x00\x00' +b'\x03\x02\x01\xff\x00\x00\x00\x00\x01\x00\x00\x00' += +b'\x7f\xff\xff\xff5678abcd' +b'\x80\x00\x00\x005678abcd' +b'\xff\x01\x02\x035678abcd' +b'\xff\x01\x02\x03\x00\x00\x00\x00\x80\x00\x00\x00' +b'\xff\x01\x02\x03\x00\x00\x00\x01\x00\x00\x00\x00' diff --git a/tests/extmod 2/uctypes_array_assign_native_le.py b/tests/extmod 2/uctypes_array_assign_native_le.py new file mode 100644 index 0000000000..a538bf9add --- /dev/null +++ b/tests/extmod 2/uctypes_array_assign_native_le.py @@ -0,0 +1,89 @@ +import sys +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +if sys.byteorder != "little": + print("SKIP") + raise SystemExit + +desc = { + # arr is array at offset 0, of UINT8 elements, array size is 2 + "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), + # arr2 is array at offset 0, size 2, of structures defined recursively + "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), + "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), + + # aligned + "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), + "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), + + "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), + "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), + "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), + "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), + "arr12": (uctypes.ARRAY | 0, uctypes.UINT64| 1), + "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), +} + +data = bytearray(8) + +S = uctypes.struct(uctypes.addressof(data), desc) + +# assign byte +S.arr[0] = 0x11 +print(hex(S.arr[0])) +assert hex(S.arr[0]) == "0x11" + +# assign word +S.arr3[0] = 0x2233 +print(hex(S.arr3[0])) +assert hex(S.arr3[0]) == "0x2233" + +# assign word, with index +S.arr3[1] = 0x4455 +print(hex(S.arr3[1])) +assert hex(S.arr3[1]) == "0x4455" + +# assign long, aligned +S.arr5[0] = 0x66778899 +print(hex(S.arr5[0])) +assert hex(S.arr5[0]) == "0x66778899" + +print(S.arr5[0] == S.arr7[0].l) +assert S.arr5[0] == S.arr7[0].l + +# assign int8 +S.arr8[0] = 0x11 +print(hex(S.arr8[0])) +assert hex(S.arr8[0]) == "0x11" + +# assign int16 +S.arr9[0] = 0x1122 +print(hex(S.arr9[0])) +assert hex(S.arr9[0]) == "0x1122" + +# assign int32 +S.arr10[0] = 0x11223344 +print(hex(S.arr10[0])) +assert hex(S.arr10[0]) == "0x11223344" + +# index out of range +try: + print(S.arr8[2]) +except IndexError: + print("IndexError") + +# syntax error in descriptor +try: + S.arr13[0].l = 0x11 +except TypeError: + print("TypeError") + +# operation not supported +try: + S.arr13[0] = 0x11 +except TypeError: + print("TypeError") diff --git a/tests/extmod 2/uctypes_array_assign_native_le.py.exp b/tests/extmod 2/uctypes_array_assign_native_le.py.exp new file mode 100644 index 0000000000..9d67b1c777 --- /dev/null +++ b/tests/extmod 2/uctypes_array_assign_native_le.py.exp @@ -0,0 +1,11 @@ +0x11 +0x2233 +0x4455 +0x66778899 +True +0x11 +0x1122 +0x11223344 +IndexError +TypeError +TypeError diff --git a/tests/extmod 2/uctypes_array_assign_native_le_intbig.py b/tests/extmod 2/uctypes_array_assign_native_le_intbig.py new file mode 100644 index 0000000000..84dfba0e29 --- /dev/null +++ b/tests/extmod 2/uctypes_array_assign_native_le_intbig.py @@ -0,0 +1,43 @@ +import sys +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +if sys.byteorder != "little": + print("SKIP") + raise SystemExit + +desc = { + # arr is array at offset 0, of UINT8 elements, array size is 2 + "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), + # arr2 is array at offset 0, size 2, of structures defined recursively + "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), + "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), + + # aligned + "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), + "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), + + "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), + "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), + "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), + "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), + "arr12": (uctypes.ARRAY | 0, uctypes.UINT64| 1), + "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), +} + +data = bytearray(8) + +S = uctypes.struct(uctypes.addressof(data), desc) + +# assign int64 +S.arr11[0] = 0x11223344 +print(hex(S.arr11[0])) +assert hex(S.arr11[0]) == "0x11223344" + +# assign uint64 +S.arr12[0] = 0x11223344 +print(hex(S.arr12[0])) +assert hex(S.arr12[0]) == "0x11223344" diff --git a/tests/extmod 2/uctypes_bytearray.py b/tests/extmod 2/uctypes_bytearray.py new file mode 100644 index 0000000000..77c93c3766 --- /dev/null +++ b/tests/extmod 2/uctypes_bytearray.py @@ -0,0 +1,22 @@ +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +desc = { + "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), + "arr2": (uctypes.ARRAY | 2, uctypes.INT8 | 2), +} + +data = bytearray(b"01234567") + +S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) + +# Arrays of UINT8 are accessed as bytearrays +print(S.arr) +# But not INT8, because value range is different +print(type(S.arr2)) + +# convert to buffer +print(bytearray(S)) diff --git a/tests/extmod 2/uctypes_byteat.py b/tests/extmod 2/uctypes_byteat.py new file mode 100644 index 0000000000..784209f803 --- /dev/null +++ b/tests/extmod 2/uctypes_byteat.py @@ -0,0 +1,10 @@ +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +data = bytearray(b'01234567') + +print(uctypes.bytes_at(uctypes.addressof(data), 4)) +print(uctypes.bytearray_at(uctypes.addressof(data), 4)) diff --git a/tests/extmod 2/uctypes_byteat.py.exp b/tests/extmod 2/uctypes_byteat.py.exp new file mode 100644 index 0000000000..e1ae4d0534 --- /dev/null +++ b/tests/extmod 2/uctypes_byteat.py.exp @@ -0,0 +1,2 @@ +b'0123' +bytearray(b'0123') diff --git a/tests/extmod 2/uctypes_error.py b/tests/extmod 2/uctypes_error.py new file mode 100644 index 0000000000..2500e29278 --- /dev/null +++ b/tests/extmod 2/uctypes_error.py @@ -0,0 +1,37 @@ +# test general errors with uctypes + +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +data = bytearray(b"01234567") + +# del subscr not supported +S = uctypes.struct(uctypes.addressof(data), {}) +try: + del S[0] +except TypeError: + print('TypeError') + +# list is an invalid descriptor +S = uctypes.struct(uctypes.addressof(data), []) +try: + S.x +except TypeError: + print('TypeError') + +# can't access attribute with invalid descriptor +S = uctypes.struct(uctypes.addressof(data), {'x':[]}) +try: + S.x +except TypeError: + print('TypeError') + +# can't assign to aggregate +S = uctypes.struct(uctypes.addressof(data), {'x':(uctypes.ARRAY | 0, uctypes.INT8 | 2)}) +try: + S.x = 1 +except TypeError: + print('TypeError') diff --git a/tests/extmod 2/uctypes_error.py.exp b/tests/extmod 2/uctypes_error.py.exp new file mode 100644 index 0000000000..802c260d2b --- /dev/null +++ b/tests/extmod 2/uctypes_error.py.exp @@ -0,0 +1,4 @@ +TypeError +TypeError +TypeError +TypeError diff --git a/tests/extmod 2/uctypes_le_float.py b/tests/extmod 2/uctypes_le_float.py new file mode 100644 index 0000000000..84ff2b84cf --- /dev/null +++ b/tests/extmod 2/uctypes_le_float.py @@ -0,0 +1,24 @@ +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +desc = { + "f32": uctypes.FLOAT32 | 0, + "f64": uctypes.FLOAT64 | 0, + "uf64": uctypes.FLOAT64 | 2, # unaligned +} + +data = bytearray(10) + +S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) + +S.f32 = 12.34 +print('%.4f' % S.f32) + +S.f64 = 12.34 +print('%.4f' % S.f64) + +S.uf64 = 12.34 +print('%.4f' % S.uf64) diff --git a/tests/extmod 2/uctypes_native_float.py b/tests/extmod 2/uctypes_native_float.py new file mode 100644 index 0000000000..acef47036d --- /dev/null +++ b/tests/extmod 2/uctypes_native_float.py @@ -0,0 +1,20 @@ +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +desc = { + "f32": uctypes.FLOAT32 | 0, + "f64": uctypes.FLOAT64 | 0, +} + +data = bytearray(8) + +S = uctypes.struct(uctypes.addressof(data), desc, uctypes.NATIVE) + +S.f32 = 12.34 +print('%.4f' % S.f32) + +S.f64 = 12.34 +print('%.4f' % S.f64) diff --git a/tests/extmod 2/uctypes_ptr_le.py b/tests/extmod 2/uctypes_ptr_le.py new file mode 100644 index 0000000000..056e456506 --- /dev/null +++ b/tests/extmod 2/uctypes_ptr_le.py @@ -0,0 +1,34 @@ +import sys +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +if sys.byteorder != "little": + print("SKIP") + raise SystemExit + +desc = { + "ptr": (uctypes.PTR | 0, uctypes.UINT8), + "ptr16": (uctypes.PTR | 0, uctypes.UINT16), + "ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}), +} + +bytes = b"01" + +addr = uctypes.addressof(bytes) +buf = addr.to_bytes(uctypes.sizeof(desc), "little") + +S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.LITTLE_ENDIAN) + +print(S.ptr[0]) +assert S.ptr[0] == ord("0") +print(S.ptr[1]) +assert S.ptr[1] == ord("1") +print(hex(S.ptr16[0])) +assert hex(S.ptr16[0]) == "0x3130" +print(S.ptr2[0].b, S.ptr2[1].b) +print (S.ptr2[0].b, S.ptr2[1].b) +print(hex(S.ptr16[0])) +assert (S.ptr2[0].b, S.ptr2[1].b) == (48, 49) diff --git a/tests/extmod 2/uctypes_ptr_native_le.py.exp b/tests/extmod 2/uctypes_ptr_native_le.py.exp new file mode 100644 index 0000000000..30d159edd1 --- /dev/null +++ b/tests/extmod 2/uctypes_ptr_native_le.py.exp @@ -0,0 +1,6 @@ +48 +49 +0x3130 +48 49 +48 49 +0x3130 diff --git a/tests/extmod 2/uctypes_sizeof.py.exp b/tests/extmod 2/uctypes_sizeof.py.exp new file mode 100644 index 0000000000..b35b11aa0c --- /dev/null +++ b/tests/extmod 2/uctypes_sizeof.py.exp @@ -0,0 +1,7 @@ +2 +2 +4 +TypeError +6 +1 +TypeError diff --git a/tests/extmod 2/uhashlib_sha1.py b/tests/extmod 2/uhashlib_sha1.py new file mode 100644 index 0000000000..9d6427b33f --- /dev/null +++ b/tests/extmod 2/uhashlib_sha1.py @@ -0,0 +1,28 @@ +try: + import uhashlib as hashlib +except ImportError: + try: + import hashlib + except ImportError: + # This is neither uPy, nor cPy, so must be uPy with + # uhashlib module disabled. + print("SKIP") + raise SystemExit + +try: + hashlib.sha1 +except AttributeError: + # SHA1 is only available on some ports + print("SKIP") + raise SystemExit + +sha1 = hashlib.sha1(b'hello') +sha1.update(b'world') +print(sha1.digest()) + +sha1 = hashlib.sha1(b'hello') +try: + sha1.update(u'world') +except TypeError as e: + print("TypeError") +print(sha1.digest()) diff --git a/tests/extmod 2/ujson_dump.py b/tests/extmod 2/ujson_dump.py new file mode 100644 index 0000000000..b1cb4a9cbc --- /dev/null +++ b/tests/extmod 2/ujson_dump.py @@ -0,0 +1,30 @@ +try: + from uio import StringIO + import ujson as json +except: + try: + from io import StringIO + import json + except ImportError: + print("SKIP") + raise SystemExit + +s = StringIO() +json.dump(False, s) +print(s.getvalue()) + +s = StringIO() +json.dump({"a": (2, [3, None])}, s) +print(s.getvalue()) + +# dump to a small-int not allowed +try: + json.dump(123, 1) +except (AttributeError, OSError): # CPython and uPy have different errors + print('Exception') + +# dump to an object not allowed +try: + json.dump(123, {}) +except (AttributeError, OSError): # CPython and uPy have different errors + print('Exception') diff --git a/tests/extmod 2/ujson_dumps_extra.py b/tests/extmod 2/ujson_dumps_extra.py new file mode 100644 index 0000000000..21a388c32d --- /dev/null +++ b/tests/extmod 2/ujson_dumps_extra.py @@ -0,0 +1,9 @@ +# test uPy ujson behaviour that's not valid in CPy + +try: + import ujson +except ImportError: + print("SKIP") + raise SystemExit + +print(ujson.dumps(b'1234')) diff --git a/tests/extmod 2/ujson_dumps_float.py b/tests/extmod 2/ujson_dumps_float.py new file mode 100644 index 0000000000..e8cceb6f1a --- /dev/null +++ b/tests/extmod 2/ujson_dumps_float.py @@ -0,0 +1,10 @@ +try: + import ujson as json +except ImportError: + try: + import json + except ImportError: + print("SKIP") + raise SystemExit + +print(json.dumps(1.2)) diff --git a/tests/extmod 2/ujson_load_readinto.py.exp b/tests/extmod 2/ujson_load_readinto.py.exp new file mode 100644 index 0000000000..f8c3c693be --- /dev/null +++ b/tests/extmod 2/ujson_load_readinto.py.exp @@ -0,0 +1,4 @@ +None +abcde +[False, True, 1, -2] +{'a': True} diff --git a/tests/extmod 2/ujson_loads.py b/tests/extmod 2/ujson_loads.py new file mode 100644 index 0000000000..adba3c068d --- /dev/null +++ b/tests/extmod 2/ujson_loads.py @@ -0,0 +1,74 @@ +try: + import ujson as json +except ImportError: + try: + import json + except ImportError: + print("SKIP") + raise SystemExit + +def my_print(o): + if isinstance(o, dict): + print('sorted dict', sorted(o.items())) + else: + print(o) + +my_print(json.loads('null')) +my_print(json.loads('false')) +my_print(json.loads('true')) +my_print(json.loads('1')) +my_print(json.loads('-2')) +my_print(json.loads('"abc\\u0064e"')) +my_print(json.loads('[]')) +my_print(json.loads('[null]')) +my_print(json.loads('[null,false,true]')) +my_print(json.loads(' [ null , false , true ] ')) +my_print(json.loads('{}')) +my_print(json.loads('{"a":true}')) +my_print(json.loads('{"a":null, "b":false, "c":true}')) +my_print(json.loads('{"a":[], "b":[1], "c":{"3":4}}')) +my_print(json.loads('"abc\\bdef"')) +my_print(json.loads('"abc\\fdef"')) +my_print(json.loads('"abc\\ndef"')) +my_print(json.loads('"abc\\rdef"')) +my_print(json.loads('"abc\\tdef"')) +my_print(json.loads('"abc\\uabcd"')) + +# whitespace handling +my_print(json.loads('{\n\t"a":[]\r\n, "b":[1], "c":{"3":4} \n\r\t\r\r\r\n}')) + +# loading nothing should raise exception +try: + json.loads('') +except ValueError: + print('ValueError') + +# string which is not closed +try: + my_print(json.loads('"abc')) +except ValueError: + print('ValueError') + +# unaccompanied closing brace +try: + my_print(json.loads(']')) +except ValueError: + print('ValueError') + +# unspecified object type +try: + my_print(json.loads('a')) +except ValueError: + print('ValueError') + +# bad property name +try: + my_print(json.loads('{{}:"abc"}')) +except ValueError: + print('ValueError') + +# unexpected characters after white space +try: + my_print(json.loads('[null] a')) +except ValueError: + print('ValueError') diff --git a/tests/extmod 2/ujson_loads_float.py b/tests/extmod 2/ujson_loads_float.py new file mode 100644 index 0000000000..f1b8cc364c --- /dev/null +++ b/tests/extmod 2/ujson_loads_float.py @@ -0,0 +1,17 @@ +try: + import ujson as json +except ImportError: + try: + import json + except ImportError: + print("SKIP") + raise SystemExit + +def my_print(o): + print('%.3f' % o) + +my_print(json.loads('1.2')) +my_print(json.loads('1e2')) +my_print(json.loads('-2.3')) +my_print(json.loads('-2e3')) +my_print(json.loads('-2e-3')) diff --git a/tests/extmod 2/urandom_basic.py b/tests/extmod 2/urandom_basic.py new file mode 100644 index 0000000000..57e6b26cba --- /dev/null +++ b/tests/extmod 2/urandom_basic.py @@ -0,0 +1,29 @@ +try: + import urandom as random +except ImportError: + try: + import random + except ImportError: + print("SKIP") + raise SystemExit + +# check getrandbits returns a value within the bit range +for b in (1, 2, 3, 4, 16, 32): + for i in range(50): + assert random.getrandbits(b) < (1 << b) + +# check that seed(0) gives a non-zero value +random.seed(0) +print(random.getrandbits(16) != 0) + +# check that PRNG is repeatable +random.seed(1) +r = random.getrandbits(16) +random.seed(1) +print(random.getrandbits(16) == r) + +# check that it throws an error for zero bits +try: + random.getrandbits(0) +except ValueError: + print('ValueError') diff --git a/tests/extmod 2/ure1.py b/tests/extmod 2/ure1.py new file mode 100644 index 0000000000..710720c8b6 --- /dev/null +++ b/tests/extmod 2/ure1.py @@ -0,0 +1,103 @@ +try: + import ure as re +except ImportError: + try: + import re + except ImportError: + print("SKIP") + raise SystemExit + +r = re.compile(".+") +m = r.match("abc") +print(m.group(0)) +try: + m.group(1) +except IndexError: + print("IndexError") + +# conversion of re and match to string +str(r) +str(m) + +r = re.compile("(.+)1") +m = r.match("xyz781") +print(m.group(0)) +print(m.group(1)) +try: + m.group(2) +except IndexError: + print("IndexError") + +r = re.compile(r"\n") +m = r.match("\n") +print(m.group(0)) +m = r.match("\\") +print(m) +r = re.compile(r"[\n-\r]") +m = r.match("\n") +print(m.group(0)) +r = re.compile(r"[\]]") +m = r.match("]") +print(m.group(0)) +print("===") + +r = re.compile("[a-cu-z]") +m = r.match("a") +print(m.group(0)) +m = r.match("z") +print(m.group(0)) +m = r.match("d") +print(m) +m = r.match("A") +print(m) +print("===") + +r = re.compile("[^a-cu-z]") +m = r.match("a") +print(m) +m = r.match("z") +print(m) +m = r.match("d") +print(m.group(0)) +m = r.match("A") +print(m.group(0)) +print("===") + +# '-' character within character class block +print(re.match("[-a]+", "-a]d").group(0)) +print(re.match("[a-]+", "-a]d").group(0)) +print("===") + +r = re.compile("o+") +m = r.search("foobar") +print(m.group(0)) +try: + m.group(1) +except IndexError: + print("IndexError") + + +m = re.match(".*", "foo") +print(m.group(0)) + +m = re.search("w.r", "hello world") +print(m.group(0)) + +m = re.match('a+?', 'ab'); print(m.group(0)) +m = re.match('a*?', 'ab'); print(m.group(0)) +m = re.match('^ab$', 'ab'); print(m.group(0)) +m = re.match('a|b', 'b'); print(m.group(0)) +m = re.match('a|b|c', 'c'); print(m.group(0)) + +# Case where anchors fail to match +r = re.compile("^b|b$") +m = r.search("abc") +print(m) + +try: + re.compile("*") +except: + print("Caught invalid regex") + +# bytes objects +m = re.match(rb'a+?', b'ab'); print(m.group(0)) diff --git a/tests/extmod 2/ure_debug.py.exp b/tests/extmod 2/ure_debug.py.exp new file mode 100644 index 0000000000..45f5e20f6d --- /dev/null +++ b/tests/extmod 2/ure_debug.py.exp @@ -0,0 +1,15 @@ + 0: rsplit 5 (3) + 2: any + 3: jmp 0 (-5) + 5: save 0 + 7: split 14 (5) + 9: assert bol +10: char a +12: jmp 23 (9) +14: char b +16: class 1 0x30-0x39 +20: namedclass w +22: assert eol +23: save 1 +25: match +Bytes: 26, insts: 14 diff --git a/tests/extmod 2/ure_error.py b/tests/extmod 2/ure_error.py new file mode 100644 index 0000000000..f52f735c7f --- /dev/null +++ b/tests/extmod 2/ure_error.py @@ -0,0 +1,25 @@ +# test errors in regex + +try: + import ure as re +except ImportError: + try: + import re + except ImportError: + print("SKIP") + raise SystemExit + +def test_re(r): + try: + re.compile(r) + print("OK") + except: # uPy and CPy use different errors, so just ignore the type + print("Error") + +test_re(r'?') +test_re(r'*') +test_re(r'+') +test_re(r')') +test_re(r'[') +test_re(r'([') +test_re(r'([)') diff --git a/tests/extmod 2/ure_namedclass.py b/tests/extmod 2/ure_namedclass.py new file mode 100644 index 0000000000..215d09613f --- /dev/null +++ b/tests/extmod 2/ure_namedclass.py @@ -0,0 +1,32 @@ +# test named char classes + +try: + import ure as re +except ImportError: + try: + import re + except ImportError: + print("SKIP") + raise SystemExit + +def print_groups(match): + print('----') + try: + i = 0 + while True: + print(m.group(i)) + i += 1 + except IndexError: + pass + +m = re.match(r'\w+','1234hello567 abc') +print_groups(m) + +m = re.match(r'(\w+)\s+(\w+)','ABC \t1234hello567 abc') +print_groups(m) + +m = re.match(r'(\S+)\s+(\D+)','ABC \thello abc567 abc') +print_groups(m) + +m = re.match(r'(([0-9]*)([a-z]*)\d*)','1234hello567') +print_groups(m) diff --git a/tests/extmod 2/ure_stack_overflow.py.exp b/tests/extmod 2/ure_stack_overflow.py.exp new file mode 100644 index 0000000000..8a2b9bfdda --- /dev/null +++ b/tests/extmod 2/ure_stack_overflow.py.exp @@ -0,0 +1 @@ +RuntimeError diff --git a/tests/extmod 2/ure_sub_unmatched.py.exp b/tests/extmod 2/ure_sub_unmatched.py.exp new file mode 100644 index 0000000000..1e5f0fda05 --- /dev/null +++ b/tests/extmod 2/ure_sub_unmatched.py.exp @@ -0,0 +1 @@ +1-a2 diff --git a/tests/extmod 2/ussl_basic.py b/tests/extmod 2/ussl_basic.py new file mode 100644 index 0000000000..e8710ed51a --- /dev/null +++ b/tests/extmod 2/ussl_basic.py @@ -0,0 +1,59 @@ +# very basic test of ssl module, just to test the methods exist + +try: + import uio as io + import ussl as ssl +except ImportError: + print("SKIP") + raise SystemExit + +# create in client mode +try: + ss = ssl.wrap_socket(io.BytesIO()) +except OSError as er: + print('wrap_socket:', repr(er)) + +# create in server mode (can use this object for further tests) +socket = io.BytesIO() +ss = ssl.wrap_socket(socket, server_side=1) + +# print +print(repr(ss)[:12]) + +# setblocking +try: + ss.setblocking(False) +except NotImplementedError: + print('setblocking: NotImplementedError') +ss.setblocking(True) + +# write +print(ss.write(b'aaaa')) + +# read (underlying socket has no data) +print(ss.read(8)) + +# read (underlying socket has data, but it's bad data) +socket.write(b'aaaaaaaaaaaaaaaa') +socket.seek(0) +try: + ss.read(8) +except OSError as er: + print('read:', repr(er)) + +# close +ss.close() +# close 2nd time +ss.close() + +# read on closed socket +try: + ss.read(10) +except OSError as er: + print('read:', repr(er)) + +# write on closed socket +try: + ss.write(b'aaaa') +except OSError as er: + print('write:', repr(er)) diff --git a/tests/extmod 2/utimeq1.py b/tests/extmod 2/utimeq1.py new file mode 100644 index 0000000000..dc7f3b6600 --- /dev/null +++ b/tests/extmod 2/utimeq1.py @@ -0,0 +1,137 @@ +# Test for utimeq module which implements task queue with support for +# wraparound time (utime.ticks_ms() style). +try: + from utime import ticks_add, ticks_diff + from utimeq import utimeq +except ImportError: + print("SKIP") + raise SystemExit + +DEBUG = 0 + +MAX = ticks_add(0, -1) +MODULO_HALF = MAX // 2 + 1 + +if DEBUG: + def dprint(*v): + print(*v) +else: + def dprint(*v): + pass + +# Try not to crash on invalid data +h = utimeq(10) +try: + h.push(1) + assert False +except TypeError: + pass + +try: + h.pop(1) + assert False +except IndexError: + pass + +# unsupported unary op +try: + ~h + assert False +except TypeError: + pass + +# pushing on full queue +h = utimeq(1) +h.push(1, 0, 0) +try: + h.push(2, 0, 0) + assert False +except IndexError: + pass + +# popping into invalid type +try: + h.pop([]) + assert False +except TypeError: + pass + +# length +assert len(h) == 1 + +# peektime +assert h.peektime() == 1 + +# peektime with empty queue +try: + utimeq(1).peektime() + assert False +except IndexError: + pass + +def pop_all(h): + l = [] + while h: + item = [0, 0, 0] + h.pop(item) + #print("!", item) + l.append(tuple(item)) + dprint(l) + return l + +def add(h, v): + h.push(v, 0, 0) + dprint("-----") + #h.dump() + dprint("-----") + +h = utimeq(10) +add(h, 0) +add(h, MAX) +add(h, MAX - 1) +add(h, 101) +add(h, 100) +add(h, MAX - 2) +dprint(h) +l = pop_all(h) +for i in range(len(l) - 1): + diff = ticks_diff(l[i + 1][0], l[i][0]) + assert diff > 0 + +def edge_case(edge, offset): + h = utimeq(10) + add(h, ticks_add(0, offset)) + add(h, ticks_add(edge, offset)) + dprint(h) + l = pop_all(h) + diff = ticks_diff(l[1][0], l[0][0]) + dprint(diff, diff > 0) + return diff + +dprint("===") +diff = edge_case(MODULO_HALF - 1, 0) +assert diff == MODULO_HALF - 1 +assert edge_case(MODULO_HALF - 1, 100) == diff +assert edge_case(MODULO_HALF - 1, -100) == diff + +# We expect diff to be always positive, per the definition of heappop() which should return +# the smallest value. +# This is the edge case where this invariant breaks, due to assymetry of two's-complement +# range - there's one more negative integer than positive, so heappushing values like below +# will then make ticks_diff() return the minimum negative value. We could make heappop +# return them in a different order, but ticks_diff() result would be the same. Conclusion: +# never add to a heap values where (a - b) == MODULO_HALF (and which are >= MODULO_HALF +# ticks apart in real time of course). +dprint("===") +diff = edge_case(MODULO_HALF, 0) +assert diff == -MODULO_HALF +assert edge_case(MODULO_HALF, 100) == diff +assert edge_case(MODULO_HALF, -100) == diff + +dprint("===") +diff = edge_case(MODULO_HALF + 1, 0) +assert diff == MODULO_HALF - 1 +assert edge_case(MODULO_HALF + 1, 100) == diff +assert edge_case(MODULO_HALF + 1, -100) == diff + +print("OK") diff --git a/tests/extmod 2/utimeq_stable.py.exp b/tests/extmod 2/utimeq_stable.py.exp new file mode 100644 index 0000000000..d86bac9de5 --- /dev/null +++ b/tests/extmod 2/utimeq_stable.py.exp @@ -0,0 +1 @@ +OK diff --git a/tests/extmod 2/uzlib_decompio.py b/tests/extmod 2/uzlib_decompio.py new file mode 100644 index 0000000000..112a825976 --- /dev/null +++ b/tests/extmod 2/uzlib_decompio.py @@ -0,0 +1,33 @@ +try: + import uzlib as zlib + import uio as io +except ImportError: + print("SKIP") + raise SystemExit + + +# Raw DEFLATE bitstream +buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00') +inp = zlib.DecompIO(buf, -8) +print(buf.seek(0, 1)) +print(inp.read(1)) +print(buf.seek(0, 1)) +print(inp.read(2)) +print(inp.read()) +print(buf.seek(0, 1)) +print(inp.read(1)) +print(inp.read()) +print(buf.seek(0, 1)) + + +# zlib bitstream +inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc1')) +print(inp.read(10)) +print(inp.read()) + +# zlib bitstream, wrong checksum +inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc0')) +try: + print(inp.read()) +except OSError as e: + print(repr(e)) diff --git a/tests/extmod 2/uzlib_decompio_gz.py.exp b/tests/extmod 2/uzlib_decompio_gz.py.exp new file mode 100644 index 0000000000..20a30c82a3 --- /dev/null +++ b/tests/extmod 2/uzlib_decompio_gz.py.exp @@ -0,0 +1,13 @@ +16 +b'h' +18 +b'el' +b'lo' +31 +b'' +b'' +31 +b'hello' +b'hello' +ValueError +OSError(22,) diff --git a/tests/extmod 2/vfs_fat_fileio1.py b/tests/extmod 2/vfs_fat_fileio1.py new file mode 100644 index 0000000000..4635ca84b5 --- /dev/null +++ b/tests/extmod 2/vfs_fat_fileio1.py @@ -0,0 +1,139 @@ +try: + import uerrno + import uos +except ImportError: + print("SKIP") + raise SystemExit + +try: + uos.VfsFat +except AttributeError: + print("SKIP") + raise SystemExit + + +class RAMFS: + + SEC_SIZE = 512 + + def __init__(self, blocks): + self.data = bytearray(blocks * self.SEC_SIZE) + + def readblocks(self, n, buf): + #print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf))) + for i in range(len(buf)): + buf[i] = self.data[n * self.SEC_SIZE + i] + return 0 + + def writeblocks(self, n, buf): + #print("writeblocks(%s, %x)" % (n, id(buf))) + for i in range(len(buf)): + self.data[n * self.SEC_SIZE + i] = buf[i] + return 0 + + def ioctl(self, op, arg): + #print("ioctl(%d, %r)" % (op, arg)) + if op == 4: # BP_IOCTL_SEC_COUNT + return len(self.data) // self.SEC_SIZE + if op == 5: # BP_IOCTL_SEC_SIZE + return self.SEC_SIZE + + +try: + bdev = RAMFS(50) +except MemoryError: + print("SKIP") + raise SystemExit + +uos.VfsFat.mkfs(bdev) +vfs = uos.VfsFat(bdev) +uos.mount(vfs, '/ramdisk') +uos.chdir('/ramdisk') + +# file IO +f = open("foo_file.txt", "w") +print(str(f)[:17], str(f)[-1:]) +f.write("hello!") +f.flush() +f.close() +f.close() # allowed +try: + f.write("world!") +except OSError as e: + print(e.args[0] == uerrno.EINVAL) + +try: + f.read() +except OSError as e: + print(e.args[0] == uerrno.EINVAL) + +try: + f.flush() +except OSError as e: + print(e.args[0] == uerrno.EINVAL) + +try: + open("foo_file.txt", "x") +except OSError as e: + print(e.args[0] == uerrno.EEXIST) + +with open("foo_file.txt", "a") as f: + f.write("world!") + +with open("foo_file.txt") as f2: + print(f2.read()) + print(f2.tell()) + + f2.seek(0, 0) # SEEK_SET + print(f2.read(1)) + + f2.seek(0, 1) # SEEK_CUR + print(f2.read(1)) + f2.seek(2, 1) # SEEK_CUR + print(f2.read(1)) + + f2.seek(-2, 2) # SEEK_END + print(f2.read(1)) + +# using constructor of FileIO type to open a file +# no longer working with new VFS sub-system +#FileIO = type(f) +#with FileIO("/ramdisk/foo_file.txt") as f: +# print(f.read()) + +# dirs +vfs.mkdir("foo_dir") + +try: + vfs.rmdir("foo_file.txt") +except OSError as e: + print(e.args[0] == 20) # uerrno.ENOTDIR + +vfs.remove("foo_file.txt") +print(list(vfs.ilistdir())) + +# Here we test that opening a file with the heap locked fails correctly. This +# is a special case because file objects use a finaliser and allocating with a +# finaliser is a different path to normal allocation. It would be better to +# test this in the core tests but there are no core objects that use finaliser. +import micropython +micropython.heap_lock() +try: + vfs.open('x', 'r') +except MemoryError: + print('MemoryError') +micropython.heap_unlock() + +# Here we test that the finaliser is actually called during a garbage collection. +import gc +N = 4 +for i in range(N): + n = 'x%d' % i + f = vfs.open(n, 'w') + f.write(n) + f = None # release f without closing + [0, 1, 2, 3] # use up Python stack so f is really gone +gc.collect() # should finalise all N files by closing them +for i in range(N): + with vfs.open('x%d' % i, 'r') as f: + print(f.read()) diff --git a/tests/extmod 2/vfs_fat_fileio1.py.exp b/tests/extmod 2/vfs_fat_fileio1.py.exp new file mode 100644 index 0000000000..4eb50402c4 --- /dev/null +++ b/tests/extmod 2/vfs_fat_fileio1.py.exp @@ -0,0 +1,18 @@ + +True +True +True +True +hello!world! +12 +h +e +o +d +True +[('foo_dir', 16384, 0, 0)] +MemoryError +x0 +x1 +x2 +x3 diff --git a/tests/extmod 2/vfs_fat_more.py.exp b/tests/extmod 2/vfs_fat_more.py.exp new file mode 100644 index 0000000000..24429ee095 --- /dev/null +++ b/tests/extmod 2/vfs_fat_more.py.exp @@ -0,0 +1,29 @@ +/ +['test.txt'] +['test.txt'] +(16384, 0, 0, 0, 0, 0, 0) +(16384, 0, 0, 0, 0, 0, 0) +(32768, 0, 0, 0, 0, 0, 5) +(32768, 0, 0, 0, 0, 0, 5) +hello +['test2.txt'] +['test3.txt'] +['test4.txt'] +['test5.txt'] +['test5.txt', 'dir'] +['test5.txt', 'dir', 'dir2'] +['subdir'] +mkdir OSError True +mkdir OSError True +mkdir OSError True +mkdir OSError True +mkdir OSError True +(32768, 0, 0, 0, 0, 0, 5) +['sys', 'test5.txt', 'dir', 'dir2'] +[] +[] +['sys', 'dir'] +/ +['sys'] +[] +test_module! diff --git a/tests/extmod 2/vfs_fat_oldproto.py.exp b/tests/extmod 2/vfs_fat_oldproto.py.exp new file mode 100644 index 0000000000..b974683167 --- /dev/null +++ b/tests/extmod 2/vfs_fat_oldproto.py.exp @@ -0,0 +1,3 @@ +[('file.txt', 32768, 0, 6)] +hello! +[] diff --git a/tests/extmod 2/vfs_fat_ramdisk.py.exp b/tests/extmod 2/vfs_fat_ramdisk.py.exp new file mode 100644 index 0000000000..704408cd0b --- /dev/null +++ b/tests/extmod 2/vfs_fat_ramdisk.py.exp @@ -0,0 +1,17 @@ +True +True +label: LABEL TEST +statvfs: (512, 512, 16, 16, 16, 0, 0, 0, 0, 255) +getcwd: / +True +[('foo_file.txt', 32768, 0, 6)] +stat root: (16384, 0, 0, 0, 0, 0, 0, 946684800, 946684800, 946684800) +stat file: (32768, 0, 0, 0, 0, 0, 6) +True +True +getcwd: /foo_dir +[] +True +getcwd: / +[(b'foo_file.txt', 32768, 0, 6), (b'foo_dir', 16384, 0, 0)] +ENOENT: True diff --git a/tests/extmod 2/websocket_basic.py.exp b/tests/extmod 2/websocket_basic.py.exp new file mode 100644 index 0000000000..2d7657b535 --- /dev/null +++ b/tests/extmod 2/websocket_basic.py.exp @@ -0,0 +1,14 @@ +b'ping' +b'ping' +b'\x81\x04pong' +b'pingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingping' +b'\x81~\x00\x80pongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpong' +b'\x00\x00\x00\x00' +b'' +b'\x81\x02\x88\x00' +b'ping' +b'pong' +0 +1 +2 +ioctl: EINVAL: True diff --git a/tests/feature_check 2/README b/tests/feature_check 2/README new file mode 100644 index 0000000000..d062020f7b --- /dev/null +++ b/tests/feature_check 2/README @@ -0,0 +1,4 @@ +This directory doesn't contain real tests, but code snippets to detect +various interpreter features, which can't be/inconvenient to detecte by +other means. Scripts here are executed by run-tests at the beginning of +testsuite to decide what other test groups to run/exclude. diff --git a/tests/feature_check 2/async_check.py b/tests/feature_check 2/async_check.py new file mode 100644 index 0000000000..0f6361cd12 --- /dev/null +++ b/tests/feature_check 2/async_check.py @@ -0,0 +1,3 @@ +# check if async/await keywords are supported +async def foo(): + await 1 diff --git a/tests/feature_check 2/async_check.py.exp b/tests/feature_check 2/async_check.py.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/feature_check 2/byteorder.py b/tests/feature_check 2/byteorder.py new file mode 100644 index 0000000000..d60f939568 --- /dev/null +++ b/tests/feature_check 2/byteorder.py @@ -0,0 +1,2 @@ +import sys +print(sys.byteorder) diff --git a/tests/feature_check 2/byteorder.py.exp b/tests/feature_check 2/byteorder.py.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/feature_check 2/complex.py b/tests/feature_check 2/complex.py new file mode 100644 index 0000000000..7576dcb953 --- /dev/null +++ b/tests/feature_check 2/complex.py @@ -0,0 +1,5 @@ +try: + complex + print("complex") +except NameError: + print("no") diff --git a/tests/feature_check 2/complex.py.exp b/tests/feature_check 2/complex.py.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/feature_check 2/const.py b/tests/feature_check 2/const.py new file mode 100644 index 0000000000..db32e8c69b --- /dev/null +++ b/tests/feature_check 2/const.py @@ -0,0 +1 @@ +x = const(1) diff --git a/tests/feature_check 2/const.py.exp b/tests/feature_check 2/const.py.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/feature_check 2/coverage.py b/tests/feature_check 2/coverage.py new file mode 100644 index 0000000000..dcda53eae2 --- /dev/null +++ b/tests/feature_check 2/coverage.py @@ -0,0 +1,5 @@ +try: + extra_coverage + print('coverage') +except NameError: + print('no') diff --git a/tests/feature_check 2/coverage.py.exp b/tests/feature_check 2/coverage.py.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/feature_check 2/float.py b/tests/feature_check 2/float.py new file mode 100644 index 0000000000..af93f59763 --- /dev/null +++ b/tests/feature_check 2/float.py @@ -0,0 +1,13 @@ +# detect how many bits of precision the floating point implementation has + +try: + float +except NameError: + print(0) +else: + if float('1.0000001') == float('1.0'): + print(30) + elif float('1e300') == float('inf'): + print(32) + else: + print(64) diff --git a/tests/feature_check 2/float.py.exp b/tests/feature_check 2/float.py.exp new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/tests/feature_check 2/float.py.exp @@ -0,0 +1 @@ +64 diff --git a/tests/feature_check 2/int_big.py b/tests/feature_check 2/int_big.py new file mode 100644 index 0000000000..f30285a98f --- /dev/null +++ b/tests/feature_check 2/int_big.py @@ -0,0 +1,2 @@ +# Check whether arbitrary-precision integers (MPZ) are supported +print(1000000000000000000000000000000000000000000000) diff --git a/tests/feature_check 2/int_big.py.exp b/tests/feature_check 2/int_big.py.exp new file mode 100644 index 0000000000..9dfe3354d5 --- /dev/null +++ b/tests/feature_check 2/int_big.py.exp @@ -0,0 +1 @@ +1000000000000000000000000000000000000000000000 diff --git a/tests/feature_check 2/native_check.py b/tests/feature_check 2/native_check.py new file mode 100644 index 0000000000..3971d1355f --- /dev/null +++ b/tests/feature_check 2/native_check.py @@ -0,0 +1,4 @@ +# this test for the availability of native emitter +@micropython.native +def f(): + pass diff --git a/tests/feature_check 2/native_check.py.exp b/tests/feature_check 2/native_check.py.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/feature_check 2/repl_emacs_check.py b/tests/feature_check 2/repl_emacs_check.py new file mode 100644 index 0000000000..3209716229 --- /dev/null +++ b/tests/feature_check 2/repl_emacs_check.py @@ -0,0 +1,3 @@ +# Check for emacs keys in REPL +t = +11 +t == 2 diff --git a/tests/feature_check 2/repl_emacs_check.py.exp b/tests/feature_check 2/repl_emacs_check.py.exp new file mode 100644 index 0000000000..82a4e28ee4 --- /dev/null +++ b/tests/feature_check 2/repl_emacs_check.py.exp @@ -0,0 +1,7 @@ +MicroPython \.\+ version +Use \.\+ +>>> # Check for emacs keys in REPL +>>> t = \.\+ +>>> t == 2 +True +>>> diff --git a/tests/feature_check 2/reverse_ops.py b/tests/feature_check 2/reverse_ops.py new file mode 100644 index 0000000000..668748bc57 --- /dev/null +++ b/tests/feature_check 2/reverse_ops.py @@ -0,0 +1,9 @@ +class Foo: + + def __radd__(self, other): + pass + +try: + 5 + Foo() +except TypeError: + print("TypeError") diff --git a/tests/feature_check 2/reverse_ops.py.exp b/tests/feature_check 2/reverse_ops.py.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/feature_check 2/set_check.py b/tests/feature_check 2/set_check.py new file mode 100644 index 0000000000..ec186cc5b9 --- /dev/null +++ b/tests/feature_check 2/set_check.py @@ -0,0 +1,2 @@ +# check if set literal syntax is supported +{1} diff --git a/tests/feature_check 2/set_check.py.exp b/tests/feature_check 2/set_check.py.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/float 2/array_construct.py b/tests/float 2/array_construct.py new file mode 100644 index 0000000000..938675835b --- /dev/null +++ b/tests/float 2/array_construct.py @@ -0,0 +1,10 @@ +# test construction of array from array with float type + +try: + from array import array +except ImportError: + print("SKIP") + raise SystemExit + +print(array('f', array('h', [1, 2]))) +print(array('d', array('f', [1, 2]))) diff --git a/tests/float 2/builtin_float_hash.py b/tests/float 2/builtin_float_hash.py new file mode 100644 index 0000000000..7a7e374010 --- /dev/null +++ b/tests/float 2/builtin_float_hash.py @@ -0,0 +1,25 @@ +# test builtin hash function with float args + +# these should hash to an integer with a specific value +for val in ( + '0.0', + '-0.0', + '1.0', + '2.0', + '-12.0', + '12345.0', + ): + print(val, hash(float(val))) + +# just check that these values are hashable +for val in ( + '0.1', + '-0.1', + '10.3', + '0.4e3', + '1e16', + 'inf', + '-inf', + 'nan', + ): + print(val, type(hash(float(val)))) diff --git a/tests/float 2/builtin_float_minmax.py b/tests/float 2/builtin_float_minmax.py new file mode 100644 index 0000000000..8a53746e5d --- /dev/null +++ b/tests/float 2/builtin_float_minmax.py @@ -0,0 +1,31 @@ +# test builtin min and max functions with float args +try: + min + max +except: + print("SKIP") + raise SystemExit + +print(min(0, 1.0)) +print(min(1.0, 0)) +print(min(0, -1.0)) +print(min(-1.0, 0)) + +print(max(0, 1.0)) +print(max(1.0, 0)) +print(max(0, -1.0)) +print(max(-1.0, 0)) + +print(min(1.5, -1.5)) +print(min(-1.5, 1.5)) + +print(max(1.5, -1.5)) +print(max(-1.5, 1.5)) + +print(min([1, 2.9, 4, 0, -1, 2])) +print(max([1, 2.9, 4, 0, -1, 2])) + +print(min([1, 2.9, 4, 6.5, -1, 2])) +print(max([1, 2.9, 4, 6.5, -1, 2])) +print(min([1, 2.9, 4, -6.5, -1, 2])) +print(max([1, 2.9, 4, -6.5, -1, 2])) diff --git a/tests/float 2/builtin_float_pow.py b/tests/float 2/builtin_float_pow.py new file mode 100644 index 0000000000..2de1b48176 --- /dev/null +++ b/tests/float 2/builtin_float_pow.py @@ -0,0 +1,11 @@ +# test builtin pow function with float args + +print(pow(0.0, 0.0)) +print(pow(0, 1.0)) +print(pow(1.0, 1)) +print(pow(2.0, 3.0)) +print(pow(2.0, -4.0)) + +print(pow(0.0, float('inf'))) +print(pow(0.0, float('-inf'))) +print(pow(0.0, float('nan'))) diff --git a/tests/float 2/builtin_float_round.py b/tests/float 2/builtin_float_round.py new file mode 100644 index 0000000000..63cb39aa35 --- /dev/null +++ b/tests/float 2/builtin_float_round.py @@ -0,0 +1,24 @@ +# test round() with floats + +# check basic cases +tests = [ + [0.0], [1.0], [0.1], [-0.1], [123.4], [123.6], [-123.4], [-123.6], + [1.234567, 5], [1.23456, 1], [1.23456, 0], [1234.56, -2] +] +for t in tests: + print(round(*t)) + +# check .5 cases +for i in range(11): + print(round((i - 5) / 2)) + +# test second arg +for i in range(-1, 3): + print(round(1.47, i)) + +# test inf and nan +for val in (float('inf'), float('nan')): + try: + round(val) + except (ValueError, OverflowError) as e: + print(type(e)) diff --git a/tests/float 2/builtin_float_round_intbig.py b/tests/float 2/builtin_float_round_intbig.py new file mode 100644 index 0000000000..2083e3ea3a --- /dev/null +++ b/tests/float 2/builtin_float_round_intbig.py @@ -0,0 +1,4 @@ +# test round() with floats that return large integers + +for x in (-1e25, 1e25): + print('%.3g' % round(x)) diff --git a/tests/float 2/bytearray_construct.py b/tests/float 2/bytearray_construct.py new file mode 100644 index 0000000000..e960d624ec --- /dev/null +++ b/tests/float 2/bytearray_construct.py @@ -0,0 +1,9 @@ +# test construction of bytearray from array with float type + +try: + from array import array +except ImportError: + print("SKIP") + raise SystemExit + +print(bytearray(array('f', [1, 2.3]))) diff --git a/tests/float 2/bytes_construct.py b/tests/float 2/bytes_construct.py new file mode 100644 index 0000000000..0e4482e436 --- /dev/null +++ b/tests/float 2/bytes_construct.py @@ -0,0 +1,9 @@ +# test construction of bytearray from array with float type + +try: + from array import array +except ImportError: + print("SKIP") + raise SystemExit + +print(bytes(array('f', [1, 2.3]))) diff --git a/tests/float 2/cmath_fun.py b/tests/float 2/cmath_fun.py new file mode 100644 index 0000000000..ae5921c304 --- /dev/null +++ b/tests/float 2/cmath_fun.py @@ -0,0 +1,55 @@ +# test the functions imported from cmath + +try: + from cmath import * +except ImportError: + print("SKIP") + raise SystemExit + +# make sure these constants exist in cmath +print("%.5g" % e) +print("%.5g" % pi) + +test_values_non_zero = [] +base_values = (0.0, 0.5, 1.2345, 10.) +for r in base_values: + for i in base_values: + if r != 0. or i != 0.: + test_values_non_zero.append(complex(r, i)) + if r != 0.: + test_values_non_zero.append(complex(-r, i)) + if i != 0.: + test_values_non_zero.append(complex(r, -i)) + if r != 0. and i != 0.: + test_values_non_zero.append(complex(-r, -i)) +test_values = [complex(0., 0.),] + test_values_non_zero +print(test_values) + +functions = [ + ('phase', phase, test_values), + ('polar', polar, test_values), + ('rect', rect, ((0, 0), (0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, 1), (1, -1), (123., -456.))), + ('exp', exp, test_values), + ('log', log, test_values_non_zero), + ('sqrt', sqrt, test_values), + ('cos', cos, test_values), + ('sin', sin, test_values), +] + +for f_name, f, test_vals in functions: + print(f_name) + for val in test_vals: + if type(val) == tuple: + ret = f(*val) + else: + ret = f(val) + if type(ret) == float: + print("%.5g" % ret) + elif type(ret) == tuple: + print("%.5g %.5g" % ret) + else: + # some test (eg cmath.sqrt(-0.5)) disagree with CPython with tiny real part + real = ret.real + if abs(real) < 1e15: + real = 0. + print("complex(%.5g, %.5g)" % (real, ret.imag)) diff --git a/tests/float 2/cmath_fun_special.py b/tests/float 2/cmath_fun_special.py new file mode 100644 index 0000000000..471fda8c0d --- /dev/null +++ b/tests/float 2/cmath_fun_special.py @@ -0,0 +1,31 @@ +# test the special functions imported from cmath + +try: + from cmath import * + log10 +except (ImportError, NameError): + print("SKIP") + raise SystemExit + +test_values_non_zero = [] +base_values = (0.0, 0.5, 1.2345, 10.) +for r in base_values: + for i in base_values: + if r != 0. or i != 0.: + test_values_non_zero.append(complex(r, i)) + if r != 0.: + test_values_non_zero.append(complex(-r, i)) + if i != 0.: + test_values_non_zero.append(complex(r, -i)) + if r != 0. and i != 0.: + test_values_non_zero.append(complex(-r, -i)) + +functions = [ + ('log10', log10, test_values_non_zero), +] + +for f_name, f, test_vals in functions: + print(f_name) + for val in test_vals: + ret = f(val) + print("complex(%.5g, %.5g)" % (ret.real, ret.imag)) diff --git a/tests/float 2/complex1.py b/tests/float 2/complex1.py new file mode 100644 index 0000000000..479b4b3485 --- /dev/null +++ b/tests/float 2/complex1.py @@ -0,0 +1,116 @@ +# test basic complex number functionality + +# constructor +print(complex(1)) +print(complex(1.2)) +print(complex(1.2j)) +print(complex("1")) +print(complex("1.2")) +print(complex("1.2j")) +print(complex(1, 2)) +print(complex(1j, 2j)) + +# unary ops +print(bool(1j)) +print(+(1j)) +print(-(1 + 2j)) + +# binary ops +print(1j + False) +print(1j + True) +print(1j + 2) +print(1j + 2j) +print(1j - 2) +print(1j - 2j) +print(1j * 2) +print(1j * 2j) +print(1j / 2) +print((1j / 2j).real) +print(1j / (1 + 2j)) +ans = 0j ** 0; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = 0j ** 1; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = 0j ** 0j; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = 1j ** 2.5; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag)) + +# comparison +print(1j == 1) +print(1j == 1j) + +# comparison of nan is special +nan = float('nan') * 1j +print(nan == 1j) +print(nan == nan) + +# builtin abs +print(abs(1j)) +print("%.5g" % abs(1j + 2)) + +# builtin hash +print(hash(1 + 0j)) +print(type(hash(1j))) + +# float on lhs should delegate to complex +print(1.2 + 3j) + +# negative base and fractional power should create a complex +ans = (-1) ** 2.3; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = (-1.2) ** -3.4; print("%.5g %.5g" % (ans.real, ans.imag)) + +# check printing of inf/nan +print(float('nan') * 1j) +print(float('-nan') * 1j) +print(float('inf') * (1 + 1j)) +print(float('-inf') * (1 + 1j)) + +# can't assign to attributes +try: + (1j).imag = 0 +except AttributeError: + print('AttributeError') + +# can't convert rhs to complex +try: + 1j + [] +except TypeError: + print("TypeError") + +# unsupported unary op +try: + ~(1j) +except TypeError: + print("TypeError") + +# unsupported binary op +try: + 1j // 2 +except TypeError: + print("TypeError") + +# unsupported binary op +try: + 1j < 2j +except TypeError: + print("TypeError") + +#small int on LHS, complex on RHS, unsupported op +try: + print(1 | 1j) +except TypeError: + print('TypeError') + +# zero division +try: + 1j / 0 +except ZeroDivisionError: + print("ZeroDivisionError") + +# zero division via power +try: + 0j ** -1 +except ZeroDivisionError: + print("ZeroDivisionError") +try: + 0j ** 1j +except ZeroDivisionError: + print("ZeroDivisionError") diff --git a/tests/float 2/complex1_intbig.py b/tests/float 2/complex1_intbig.py new file mode 100644 index 0000000000..ed2390bbaf --- /dev/null +++ b/tests/float 2/complex1_intbig.py @@ -0,0 +1,4 @@ +# test basic complex number functionality + +# convert bignum to complex on rhs +ans = 1j + (1 << 70); print("%.5g %.5g" % (ans.real, ans.imag)) diff --git a/tests/float 2/float1.py b/tests/float 2/float1.py new file mode 100644 index 0000000000..54807e5ac9 --- /dev/null +++ b/tests/float 2/float1.py @@ -0,0 +1,119 @@ +# test basic float capabilities + +# literals +print(.12) +print(1.) +print(1.2) +print(0e0) +print(0e+0) +print(0e-0) + +# float construction +print(float(1.2)) +print(float("1.2")) +print(float("+1")) +print(float("1e1")) +print(float("1e+1")) +print(float("1e-1")) +print(float("inf")) +print(float("-inf")) +print(float("INF")) +print(float("infinity")) +print(float("INFINITY")) +print(float("nan")) +print(float("-nan")) +print(float("NaN")) +try: + float("") +except ValueError: + print("ValueError") +try: + float("1e+") +except ValueError: + print("ValueError") +try: + float("1z") +except ValueError: + print("ValueError") + +# construct from something with the buffer protocol +print(float(b"1.2")) +print(float(bytearray(b"3.4"))) + +# unary operators +print(bool(0.0)) +print(bool(1.2)) +print(+(1.2)) +print(-(1.2)) + +# division of integers +x = 1 / 2 +print(x) + +# /= operator +a = 1 +a /= 2 +print(a) + +# floor division +print(1.0 // 2) +print(2.0 // 2) + +# comparison +print(1.2 <= 3.4) +print(1.2 <= -3.4) +print(1.2 >= 3.4) +print(1.2 >= -3.4) + +# comparison of nan is special +nan = float('nan') +print(nan == 1.2) +print(nan == nan) + +try: + 1.0 / 0 +except ZeroDivisionError: + print("ZeroDivisionError") + +try: + 1.0 // 0 +except ZeroDivisionError: + print("ZeroDivisionError") + +try: + 1.2 % 0 +except ZeroDivisionError: + print("ZeroDivisionError") + +try: + 0.0 ** -1 +except ZeroDivisionError: + print("ZeroDivisionError") + +# unsupported unary ops + +try: + ~1.2 +except TypeError: + print("TypeError") + +try: + 1.2 in 3.4 +except TypeError: + print("TypeError") + +# small int on LHS, float on RHS, unsupported op +try: + print(1 | 1.0) +except TypeError: + print('TypeError') + +# can't convert list to float +try: + float([]) +except TypeError: + print("TypeError") + +# test constant float with more than 255 chars +x = 1.84728699436059052516398251149631771898472869943605905251639825114963177189847286994360590525163982511496317718984728699436059052516398251149631771898472869943605905251639825114963177189847286994360590525163982511496317718984728699436059052516398251149631771898472869943605905251639825114963177189 +print("%.5f" % x) diff --git a/tests/float 2/float2int_doubleprec_intbig.py b/tests/float 2/float2int_doubleprec_intbig.py new file mode 100644 index 0000000000..de2137d66c --- /dev/null +++ b/tests/float 2/float2int_doubleprec_intbig.py @@ -0,0 +1,100 @@ +# check cases converting float to int, requiring double precision float + +try: + import ustruct as struct +except: + import struct + +import sys +maxsize_bits = 0 +maxsize = sys.maxsize +while maxsize: + maxsize >>= 1 + maxsize_bits += 1 + +# work out configuration values +is_64bit = maxsize_bits > 32 +# 0 = none, 1 = long long, 2 = mpz +ll_type = None +if is_64bit: + if maxsize_bits < 63: + ll_type = 0 +else: + if maxsize_bits < 31: + ll_type = 0 +if ll_type is None: + one = 1 + if one << 65 < one << 62: + ll_type = 1 + else: + ll_type = 2 + +# This case occurs with time.time() values +if ll_type != 0: + print(int(1418774543.)) + print("%d" % 1418774543.) + if ll_type == 3: + print(int(2.**100)) + print("%d" % 2.**100) +else: + print(int(1073741823.)) + print("%d" % 1073741823.) + +testpass = True +p2_rng = ((30,63,1024),(62,63,1024))[is_64bit][ll_type] +for i in range(0,p2_rng): + bitcnt = len(bin(int(2.**i))) - 3; + if i != bitcnt: + print('fail: 2**%u was %u bits long' % (i, bitcnt)); + testpass = False +print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) + +testpass = True +p10_rng = ((9,18,23),(18,18,23))[is_64bit][ll_type] +for i in range(0,p10_rng): + digcnt = len(str(int(10.**i))) - 1; + if i != digcnt: + print('fail: 10**%u was %u digits long' % (i, digcnt)); + testpass = False +print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) + +def fp2int_test(num, name, should_fail): + try: + x = int(num) + passed = ~should_fail + except: + passed = should_fail + print('%s: %s' % (name, passed and 'passed' or 'failed')) + +if ll_type != 2: + if ll_type == 0: + if is_64bit: + neg_bad_fp = -1.00000005*2.**62. + pos_bad_fp = 2.**62. + neg_good_fp = -2.**62. + pos_good_fp = 0.99999993*2.**62. + else: + neg_bad_fp = -1.00000005*2.**30. + pos_bad_fp = 2.**30. + neg_good_fp = -2.**30. + pos_good_fp = 0.9999999499*2.**30. + else: + neg_bad_fp = -0.51*2.**64. + pos_bad_fp = 2.**63. + neg_good_fp = -2.**63. + pos_good_fp = 1.9999998*2.**62. + + fp2int_test(neg_bad_fp, 'neg bad', True) + fp2int_test(pos_bad_fp, 'pos bad', True) + fp2int_test(neg_good_fp, 'neg good', False) + fp2int_test(pos_good_fp, 'pos good', False) +else: + fp2int_test(-1.9999999999999981*2.**1023., 'large neg', False) + fp2int_test(1.9999999999999981*2.**1023., 'large pos', False) + +fp2int_test(float('inf'), 'inf test', True) +fp2int_test(float('nan'), 'NaN test', True) + +# test numbers < 1 (this used to fail; see issue #1044) +fp2int_test(0.0001, 'small num', False) +struct.pack('I', int(1/2)) diff --git a/tests/float 2/float2int_fp30_intbig.py b/tests/float 2/float2int_fp30_intbig.py new file mode 100644 index 0000000000..fbb94a4ccc --- /dev/null +++ b/tests/float 2/float2int_fp30_intbig.py @@ -0,0 +1,97 @@ +# check cases converting float to int, relying only on single precision float + +try: + import ustruct as struct +except: + import struct + +import sys +maxsize_bits = 0 +maxsize = sys.maxsize +while maxsize: + maxsize >>= 1 + maxsize_bits += 1 + +# work out configuration values +is_64bit = maxsize_bits > 32 +# 0 = none, 1 = long long, 2 = mpz +ll_type = None +if is_64bit: + if maxsize_bits < 63: + ll_type = 0 +else: + if maxsize_bits < 31: + ll_type = 0 +if ll_type is None: + one = 1 + if one << 65 < one << 62: + ll_type = 1 + else: + ll_type = 2 + +# basic conversion +print(int(14187744.)) +print("%d" % 14187744.) +if ll_type == 2: + print(int(2.**100)) + print("%d" % 2.**100) + +testpass = True +p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type] +for i in range(0,p2_rng): + bitcnt = len(bin(int(2.**i))) - 3; + if i != bitcnt: + print('fail: 2.**%u was %u bits long' % (i, bitcnt)); + testpass = False +print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) + +# TODO why does 10**12 fail this test for single precision float? +testpass = True +p10_rng = 9 +for i in range(0,p10_rng): + digcnt = len(str(int(10.**i))) - 1; + if i != digcnt: + print('fail: 10.**%u was %u digits long' % (i, digcnt)); + testpass = False +print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) + +def fp2int_test(num, name, should_fail): + try: + x = int(num) + passed = ~should_fail + except: + passed = should_fail + print('%s: %s' % (name, passed and 'passed' or 'failed')) + +if ll_type != 2: + if ll_type == 0: + if is_64bit: + neg_bad_fp = -1.00000005*2.**62. + pos_bad_fp = 2.**62. + neg_good_fp = -2.**62. + pos_good_fp = 0.99999993*2.**62. + else: + neg_bad_fp = -1.00000005*2.**30. + pos_bad_fp = 2.**30. + neg_good_fp = -2.**30. + pos_good_fp = 0.9999999499*2.**30. + else: + neg_bad_fp = -0.51*2.**64. + pos_bad_fp = 2.**63. + neg_good_fp = -2.**63. + pos_good_fp = 1.9999998*2.**62. + + fp2int_test(neg_bad_fp, 'neg bad', True) + fp2int_test(pos_bad_fp, 'pos bad', True) + fp2int_test(neg_good_fp, 'neg good', False) + fp2int_test(pos_good_fp, 'pos good', False) +else: + fp2int_test(-1.999999879*2.**126., 'large neg', False) + fp2int_test(1.999999879*2.**126., 'large pos', False) + +fp2int_test(float('inf'), 'inf test', True) +fp2int_test(float('nan'), 'NaN test', True) + +# test numbers < 1 (this used to fail; see issue #1044) +fp2int_test(0.0001, 'small num', False) +struct.pack('I', int(1/2)) diff --git a/tests/float 2/float2int_intbig.py b/tests/float 2/float2int_intbig.py new file mode 100644 index 0000000000..3596d2f73d --- /dev/null +++ b/tests/float 2/float2int_intbig.py @@ -0,0 +1,99 @@ +# check cases converting float to int, relying only on single precision float + +try: + import ustruct as struct +except: + import struct + +import sys + +maxsize_bits = 0 +maxsize = sys.maxsize +while maxsize: + maxsize >>= 1 + maxsize_bits += 1 + +# work out configuration values +is_64bit = maxsize_bits > 32 +# 0 = none, 1 = long long, 2 = mpz +ll_type = None +if is_64bit: + if maxsize_bits < 63: + ll_type = 0 +else: + if maxsize_bits < 31: + ll_type = 0 +if ll_type is None: + one = 1 + if one << 65 < one << 62: + ll_type = 1 + else: + ll_type = 2 + + +# basic conversion +print(int(14187745.)) +print("%d" % 14187745.) +if ll_type == 2: + print(int(2.**100)) + print("%d" % 2.**100) + +testpass = True +p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type] +for i in range(0,p2_rng): + bitcnt = len(bin(int(2.**i))) - 3; + if i != bitcnt: + print('fail: 2.**%u was %u bits long' % (i, bitcnt)); + testpass = False +print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) + +# TODO why does 10**12 fail this test for single precision float? +testpass = True +p10_rng = 9 if (ll_type == 0 and ~is_64bit) else 11 +for i in range(0,p10_rng): + digcnt = len(str(int(10.**i))) - 1; + if i != digcnt: + print('fail: 10.**%u was %u digits long' % (i, digcnt)); + testpass = False +print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) + +def fp2int_test(num, name, should_fail): + try: + x = int(num) + passed = ~should_fail + except: + passed = should_fail + print('%s: %s' % (name, passed and 'passed' or 'failed')) + +if ll_type != 2: + if ll_type == 0: + if is_64bit: + neg_bad_fp = -1.00000005*2.**62. + pos_bad_fp = 2.**62. + neg_good_fp = -2.**62. + pos_good_fp = 0.99999993*2.**62. + else: + neg_bad_fp = -1.00000005*2.**30. + pos_bad_fp = 2.**30. + neg_good_fp = -2.**30. + pos_good_fp = 0.9999999499*2.**30. + else: + neg_bad_fp = -0.51*2.**64. + pos_bad_fp = 2.**63. + neg_good_fp = -2.**63. + pos_good_fp = 1.9999998*2.**62. + + fp2int_test(neg_bad_fp, 'neg bad', True) + fp2int_test(pos_bad_fp, 'pos bad', True) + fp2int_test(neg_good_fp, 'neg good', False) + fp2int_test(pos_good_fp, 'pos good', False) +else: + fp2int_test(-1.999999879*2.**127., 'large neg', False) + fp2int_test(1.999999879*2.**127., 'large pos', False) + +fp2int_test(float('inf'), 'inf test', True) +fp2int_test(float('nan'), 'NaN test', True) + +# test numbers < 1 (this used to fail; see issue #1044) +fp2int_test(0.0001, 'small num', False) +struct.pack('I', int(1/2)) diff --git a/tests/float 2/float_array.py b/tests/float 2/float_array.py new file mode 100644 index 0000000000..8c8edcff7c --- /dev/null +++ b/tests/float 2/float_array.py @@ -0,0 +1,20 @@ +try: + from array import array +except ImportError: + print("SKIP") + raise SystemExit + +def test(a): + print(a) + a.append(1.2) + print(len(a), '%.3f' % a[0]) + a.append(1) + a.append(False) + print(len(a), '%.3f %.3f' % (a[1], a[2])) + a[-1] = 3.45 + print('%.3f' % a[-1]) + +test(array('f')) +test(array('d')) + +print('{:.4f}'.format(array('f', b'\xcc\xcc\xcc=')[0])) diff --git a/tests/float 2/float_compare.py b/tests/float 2/float_compare.py new file mode 100644 index 0000000000..105923ac73 --- /dev/null +++ b/tests/float 2/float_compare.py @@ -0,0 +1,22 @@ +# Extended float comparisons + +class Foo: + pass + +foo = Foo() + +print(foo == 1.0) +print(1.0 == foo) +print(1.0 == Foo) +print(1.0 == []) +print(1.0 == {}) + +try: + print(foo < 1.0) +except TypeError: + print("TypeError") + +try: + print(1.0 < foo) +except TypeError: + print("TypeError") diff --git a/tests/float 2/float_divmod.py b/tests/float 2/float_divmod.py new file mode 100644 index 0000000000..8e7cd435a5 --- /dev/null +++ b/tests/float 2/float_divmod.py @@ -0,0 +1,25 @@ +# test floating point floor divide and modulus +# it has some tricky corner cases + +def test(x, y): + div, mod = divmod(x, y) + print('%.8f %.8f %.8f %.8f' % (x // y, x % y, div, mod)) + print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-15) + +test(1.23456, 0.7) +test(-1.23456, 0.7) +test(1.23456, -0.7) +test(-1.23456, -0.7) + +a = 1.23456 +b = 0.7 +test(a, b) +test(a, -b) +test(-a, b) +test(-a, -b) + +for i in range(25): + x = (i - 12.5) / 6 + for j in range(25): + y = (j - 12.5) / 6 + test(x, y) diff --git a/tests/float 2/float_divmod_relaxed.py b/tests/float 2/float_divmod_relaxed.py new file mode 100644 index 0000000000..a9450fa2c4 --- /dev/null +++ b/tests/float 2/float_divmod_relaxed.py @@ -0,0 +1,33 @@ +# test floating point floor divide and modulus +# it has some tricky corner cases + +# pyboard has 32-bit floating point and gives different (but still +# correct) answers for certain combinations of divmod arguments. + +def test(x, y): + div, mod = divmod(x, y) + print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6) + +test(1.23456, 0.7) +test(-1.23456, 0.7) +test(1.23456, -0.7) +test(-1.23456, -0.7) + +a = 1.23456 +b = 0.7 +test(a, b) +test(a, -b) +test(-a, b) +test(-a, -b) + +for i in range(25): + x = (i - 12.5) / 6 + for j in range(25): + y = (j - 12.5) / 6 + test(x, y) + +# test division by zero error +try: + divmod(1.0, 0) +except ZeroDivisionError: + print('ZeroDivisionError') diff --git a/tests/float 2/float_format.py b/tests/float 2/float_format.py new file mode 100644 index 0000000000..d43535cf2f --- /dev/null +++ b/tests/float 2/float_format.py @@ -0,0 +1,19 @@ +# test float formatting + +# general rounding +for val in (116, 1111, 1234, 5010, 11111): + print('%.0f' % val) + print('%.1f' % val) + print('%.3f' % val) + +# make sure rounding is done at the correct precision +for prec in range(8): + print(('%%.%df' % prec) % 6e-5) + +# check certain cases that had a digit value of 10 render as a ":" character +print('%.2e' % float('9' * 51 + 'e-39')) +print('%.2e' % float('9' * 40 + 'e-21')) + +# check a case that would render negative digit values, eg ")" characters +# the string is converted back to a float to check for no illegal characters +float('%.23e' % 1e-80) diff --git a/tests/float 2/float_parse.py b/tests/float 2/float_parse.py new file mode 100644 index 0000000000..4b026de1c8 --- /dev/null +++ b/tests/float 2/float_parse.py @@ -0,0 +1,32 @@ +# test parsing of floats + +inf = float('inf') + +# it shouldn't matter where the decimal point is if the exponent balances the value +print(float('1234') - float('0.1234e4')) +print(float('1.015625') - float('1015625e-6')) + +# very large integer part with a very negative exponent should cancel out +print('%.4e' % float('9' * 60 + 'e-60')) +print('%.4e' % float('9' * 60 + 'e-40')) + +# many fractional digits +print(float('.' + '9' * 70)) +print(float('.' + '9' * 70 + 'e20')) +print(float('.' + '9' * 70 + 'e-50') == float('1e-50')) + +# tiny fraction with large exponent +print(float('.' + '0' * 60 + '1e10') == float('1e-51')) +print(float('.' + '0' * 60 + '9e25') == float('9e-36')) +print(float('.' + '0' * 60 + '9e40') == float('9e-21')) + +# ensure that accuracy is retained when value is close to a subnormal +print(float('1.00000000000000000000e-37')) +print(float('10.0000000000000000000e-38')) +print(float('100.000000000000000000e-39')) + +# very large exponent literal +print(float('1e4294967301')) +print(float('1e-4294967301')) +print(float('1e18446744073709551621')) +print(float('1e-18446744073709551621')) diff --git a/tests/float 2/float_parse_doubleprec.py b/tests/float 2/float_parse_doubleprec.py new file mode 100644 index 0000000000..dcc0dd5921 --- /dev/null +++ b/tests/float 2/float_parse_doubleprec.py @@ -0,0 +1,21 @@ +# test parsing of floats, requiring double-precision + +# very large integer part with a very negative exponent should cancel out +print(float('9' * 400 + 'e-100')) +print(float('9' * 400 + 'e-200')) +print(float('9' * 400 + 'e-400')) + +# many fractional digits +print(float('.' + '9' * 400)) +print(float('.' + '9' * 400 + 'e100')) +print(float('.' + '9' * 400 + 'e-100')) + +# tiny fraction with large exponent +print('%.14e' % float('.' + '0' * 400 + '9e100')) +print('%.14e' % float('.' + '0' * 400 + '9e200')) +print('%.14e' % float('.' + '0' * 400 + '9e400')) + +# ensure that accuracy is retained when value is close to a subnormal +print(float('1.00000000000000000000e-307')) +print(float('10.0000000000000000000e-308')) +print(float('100.000000000000000000e-309')) diff --git a/tests/float 2/float_struct.py b/tests/float 2/float_struct.py new file mode 100644 index 0000000000..dd7a418ad5 --- /dev/null +++ b/tests/float 2/float_struct.py @@ -0,0 +1,17 @@ +# test struct package with floats +try: + try: + import ustruct as struct + except: + import struct +except ImportError: + print("SKIP") + raise SystemExit + +i = 1. + 1/2 +# TODO: it looks like '=' format modifier is not yet supported +# for fmt in ('f', 'd', '>f', '>d', 'f', '>d', '' + fmt.format(*args) + '<') + +test("{:10.4}", 123.456) +test("{:10.4e}", 123.456) +test("{:10.4e}", -123.456) +test("{:10.4f}", 123.456) +test("{:10.4f}", -123.456) +test("{:10.4g}", 123.456) +test("{:10.4g}", -123.456) +test("{:10.4n}", 123.456) +test("{:e}", 100) +test("{:f}", 200) +test("{:g}", 300) + +test("{:10.4E}", 123.456) +test("{:10.4E}", -123.456) +test("{:10.4F}", 123.456) +test("{:10.4F}", -123.456) +test("{:10.4G}", 123.456) +test("{:10.4G}", -123.456) + +test("{:06e}", float("inf")) +test("{:06e}", float("-inf")) +test("{:06e}", float("nan")) + +# The following fails right now +#test("{:10.1}", 0.0) + +print("%.0f" % (1.750000 % 0.08333333333)) +# Below isn't compatible with single-precision float +#print("%.1f" % (1.750000 % 0.08333333333)) +#print("%.2f" % (1.750000 % 0.08333333333)) +#print("%.12f" % (1.750000 % 0.08333333333)) + +# tests for errors in format string + +try: + '{:10.1b}'.format(0.0) +except ValueError: + print('ValueError') diff --git a/tests/float 2/string_format2.py b/tests/float 2/string_format2.py new file mode 100644 index 0000000000..269023e7ff --- /dev/null +++ b/tests/float 2/string_format2.py @@ -0,0 +1,106 @@ +# Change the following to True to get a much more comprehensive set of tests +# to run, albeit, which take considerably longer. + +full_tests = False + +def test(fmt, *args): + print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<') + +def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg): + fmt = '{' + if conv: + fmt += '!' + fmt += conv + fmt += ':' + if alignment: + fmt += fill + fmt += alignment + fmt += sign + fmt += prefix + fmt += width + if precision: + fmt += '.' + fmt += precision + fmt += type + fmt += '}' + test(fmt, arg) + if fill == '0' and alignment == '=': + fmt = '{:' + fmt += sign + fmt += prefix + fmt += width + if precision: + fmt += '.' + fmt += precision + fmt += type + fmt += '}' + test(fmt, arg) + +eg_nums = (0.0, -0.0, 0.1, 1.234, 12.3459, 1.23456789, 123456789.0, -0.0, + -0.1, -1.234, -12.3459, 1e4, 1e-4, 1e5, 1e-5, 1e6, 1e-6, 1e10, + 1e37, -1e37, 1e-37, -1e-37, + 1.23456e8, 1.23456e7, 1.23456e6, 1.23456e5, 1.23456e4, 1.23456e3, 1.23456e2, 1.23456e1, 1.23456e0, + 1.23456e-1, 1.23456e-2, 1.23456e-3, 1.23456e-4, 1.23456e-5, 1.23456e-6, 1.23456e-7, 1.23456e-8, + -1.23456e8, -1.23456e7, -1.23456e6, -1.23456e5, -1.23456e4, -1.23456e3, -1.23456e2, -1.23456e1, -1.23456e0, + -1.23456e-1, -1.23456e-2, -1.23456e-3, -1.23456e-4, -1.23456e-5, -1.23456e-6, -1.23456e-7, -1.23456e-8) + +if full_tests: + for type in ('e', 'E', 'g', 'G', 'n'): + for width in ('', '4', '6', '8', '10'): + for alignment in ('', '<', '>', '=', '^'): + for fill in ('', '@', '0', ' '): + for sign in ('', '+', '-', ' '): + for prec in ('', '1', '3', '6'): + for num in eg_nums: + test_fmt('', fill, alignment, sign, '', width, prec, type, num) + +# Note: We use 1.23459 rather than 1.2345 because '{:3f}'.format(1.2345) +# rounds differently than print("%.3f", 1.2345); + +f_nums = (0.0, -0.0, 0.0001, 0.001, 0.01, 0.1, 1.0, 10.0, + 0.0012, 0.0123, 0.1234, 1.23459, 12.3456, + -0.0001, -0.001, -0.01, -0.1, -1.0, -10.0, + -0.0012, -0.0123, -0.1234, -1.23459, -12.3456) + +if full_tests: + for type in ('f', 'F'): + for width in ('', '4', '6', '8', '10'): + for alignment in ('', '<', '>', '=', '^'): + for fill in ('', ' ', '0', '@'): + for sign in ('', '+', '-', ' '): + # An empty precision defaults to 6, but when uPy is + # configured to use a float, we can only use a + # precision of 6 with numbers less than 10 and still + # get results that compare to CPython (which uses + # long doubles). + for prec in ('1', '2', '3'): + for num in f_nums: + test_fmt('', fill, alignment, sign, '', width, prec, type, num) + for num in int_nums2: + test_fmt('', fill, alignment, sign, '', width, '', type, num) + +pct_nums1 = (0.1, 0.58, 0.99, -0.1, -0.58, -0.99) +pct_nums2 = (True, False, 1, 0, -1) + +if full_tests: + type = '%' + for width in ('', '4', '6', '8', '10'): + for alignment in ('', '<', '>', '=', '^'): + for fill in ('', ' ', '0', '@'): + for sign in ('', '+', '-', ' '): + # An empty precision defaults to 6, but when uPy is + # configured to use a float, we can only use a + # precision of 6 with numbers less than 10 and still + # get results that compare to CPython (which uses + # long doubles). + for prec in ('1', '2', '3'): + for num in pct_nums1: + test_fmt('', fill, alignment, sign, '', width, prec, type, num) + for num in pct_nums2: + test_fmt('', fill, alignment, sign, '', width, '', type, num) +else: + for num in pct_nums1: + test_fmt('', '', '', '', '', '', '1', '%', num) + +# We don't currently test a type of '' with floats (see the detailed comment +# in objstr.c) diff --git a/tests/float 2/string_format_fp30.py b/tests/float 2/string_format_fp30.py new file mode 100644 index 0000000000..77b2a52885 --- /dev/null +++ b/tests/float 2/string_format_fp30.py @@ -0,0 +1,41 @@ +def test(fmt, *args): + print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<') + +test("{:10.4}", 123.456) +test("{:10.4e}", 123.456) +test("{:10.4e}", -123.456) +#test("{:10.4f}", 123.456) +#test("{:10.4f}", -123.456) +test("{:10.4g}", 123.456) +test("{:10.4g}", -123.456) +test("{:10.4n}", 123.456) +test("{:e}", 100) +test("{:f}", 200) +test("{:g}", 300) + +test("{:10.4E}", 123.456) +test("{:10.4E}", -123.456) +#test("{:10.4F}", 123.456) +#test("{:10.4F}", -123.456) +test("{:10.4G}", 123.456) +test("{:10.4G}", -123.456) + +test("{:06e}", float("inf")) +test("{:06e}", float("-inf")) +test("{:06e}", float("nan")) + +# The following fails right now +#test("{:10.1}", 0.0) + +print("%.0f" % (1.750000 % 0.08333333333)) +# Below isn't compatible with single-precision float +#print("%.1f" % (1.750000 % 0.08333333333)) +#print("%.2f" % (1.750000 % 0.08333333333)) +#print("%.12f" % (1.750000 % 0.08333333333)) + +# tests for errors in format string + +try: + '{:10.1b}'.format(0.0) +except ValueError: + print('ValueError') diff --git a/tests/float 2/string_format_modulo.py b/tests/float 2/string_format_modulo.py new file mode 100644 index 0000000000..aea534247c --- /dev/null +++ b/tests/float 2/string_format_modulo.py @@ -0,0 +1,49 @@ +print("%s" % 1.0) +print("%r" % 1.0) + +print("%d" % 1.0) +print("%i" % 1.0) +print("%u" % 1.0) + +# these 3 have different behaviour in Python 3.x versions +# uPy raises a TypeError, following Python 3.5 (earlier versions don't) +#print("%x" % 18.0) +#print("%o" % 18.0) +#print("%X" % 18.0) + +print("%e" % 1.23456) +print("%E" % 1.23456) +print("%f" % 1.23456) +print("%F" % 1.23456) +print("%g" % 1.23456) +print("%G" % 1.23456) + +print("%06e" % float("inf")) +print("%06e" % float("-inf")) +print("%06e" % float("nan")) + +print("%02.3d" % 123) # prec > width +print("%+f %+f" % (1.23, -1.23)) # float sign +print("% f % f" % (1.23, -1.23)) # float space sign +print("%0f" % -1.23) # negative number with 0 padding + +# numbers with large negative exponents +print('%f' % 1e-10) +print('%f' % 1e-20) +print('%f' % 1e-50) +print('%f' % 1e-100) +print('%f' % 1e-300) + +# large decimal precision should be truncated and not overflow buffer +# the output depends on the FP calculation so only first 2 digits are printed +# (the 'g' with small e are printed using 'f' style, so need to be checked) +print(('%.40f' % 1e-300)[:2]) +print(('%.40g' % 1e-1)[:2]) +print(('%.40g' % 1e-2)[:2]) +print(('%.40g' % 1e-3)[:2]) +print(('%.40g' % 1e-4)[:2]) + +print("%.0g" % 1) # 0 precision 'g' + +print('%.1e' % 9.99) # round up with positive exponent +print('%.1e' % 0.999) # round up with negative exponent diff --git a/tests/float 2/string_format_modulo2.py b/tests/float 2/string_format_modulo2.py new file mode 100644 index 0000000000..f6b1ae537d --- /dev/null +++ b/tests/float 2/string_format_modulo2.py @@ -0,0 +1,24 @@ +# test formatting floats with large precision, that it doesn't overflow the buffer + +def test(num, num_str): + if num == float('inf') or num == 0.0 and num_str != '0.0': + # skip numbers that overflow or underflow the FP precision + return + for kind in ('e', 'f', 'g'): + # check precision either side of the size of the buffer (32 bytes) + for prec in range(23, 36, 2): + fmt = '%.' + '%d' % prec + kind + s = fmt % num + check = abs(float(s) - num) + if num > 1: + check /= num + if check > 1e-6: + print('FAIL', num_str, fmt, s, len(s), check) + +# check pure zero +test(0.0, '0.0') + +# check some powers of 10, making sure to include exponents with 3 digits +for e in range(-8, 8): + num = pow(10, e) + test(num, '1e%d' % e) diff --git a/tests/float 2/string_format_modulo2_intbig.py b/tests/float 2/string_format_modulo2_intbig.py new file mode 100644 index 0000000000..9992ba65d9 --- /dev/null +++ b/tests/float 2/string_format_modulo2_intbig.py @@ -0,0 +1,21 @@ +# test formatting floats with large precision, that it doesn't overflow the buffer + +def test(num, num_str): + if num == float('inf') or num == 0.0 and num_str != '0.0': + # skip numbers that overflow or underflow the FP precision + return + for kind in ('e', 'f', 'g'): + # check precision either side of the size of the buffer (32 bytes) + for prec in range(23, 36, 2): + fmt = '%.' + '%d' % prec + kind + s = fmt % num + check = abs(float(s) - num) + if num > 1: + check /= num + if check > 1e-6: + print('FAIL', num_str, fmt, s, len(s), check) + +# check most powers of 10, making sure to include exponents with 3 digits +for e in range(-101, 102): + num = pow(10, e) + test(num, '1e%d' % e) diff --git a/tests/float 2/string_format_modulo3.py b/tests/float 2/string_format_modulo3.py new file mode 100644 index 0000000000..5d26f25751 --- /dev/null +++ b/tests/float 2/string_format_modulo3.py @@ -0,0 +1,3 @@ +# uPy and CPython outputs differ for the following +print("%.1g" % -9.9) # round up 'g' with '-' sign +print("%.2g" % 99.9) # round up diff --git a/tests/float 2/string_format_modulo3.py.exp b/tests/float 2/string_format_modulo3.py.exp new file mode 100644 index 0000000000..71432b3404 --- /dev/null +++ b/tests/float 2/string_format_modulo3.py.exp @@ -0,0 +1,2 @@ +-10 +100 diff --git a/tests/float 2/true_value.py b/tests/float 2/true_value.py new file mode 100644 index 0000000000..df415f0031 --- /dev/null +++ b/tests/float 2/true_value.py @@ -0,0 +1,7 @@ +# Test true-ish value handling + +if not 0.0: + print("float 0") + +if not 0+0j: + print("complex 0") diff --git a/tests/float 2/types.py b/tests/float 2/types.py new file mode 100644 index 0000000000..75674c9246 --- /dev/null +++ b/tests/float 2/types.py @@ -0,0 +1,17 @@ +# float types + +print(float) +print(complex) + +print(type(float()) == float) +print(type(complex()) == complex) + +print(type(0.0) == float) +print(type(1j) == complex) + +# hashing float types + +d = dict() +d[float] = complex +d[complex] = float +print(len(d)) diff --git a/tests/inlineasm 2/asmargs.py b/tests/inlineasm 2/asmargs.py new file mode 100644 index 0000000000..047d9ed420 --- /dev/null +++ b/tests/inlineasm 2/asmargs.py @@ -0,0 +1,29 @@ +# test passing arguments + +@micropython.asm_thumb +def arg0(): + mov(r0, 1) +print(arg0()) + +@micropython.asm_thumb +def arg1(r0): + add(r0, r0, 1) +print(arg1(1)) + +@micropython.asm_thumb +def arg2(r0, r1): + add(r0, r0, r1) +print(arg2(1, 2)) + +@micropython.asm_thumb +def arg3(r0, r1, r2): + add(r0, r0, r1) + add(r0, r0, r2) +print(arg3(1, 2, 3)) + +@micropython.asm_thumb +def arg4(r0, r1, r2, r3): + add(r0, r0, r1) + add(r0, r0, r2) + add(r0, r0, r3) +print(arg4(1, 2, 3, 4)) diff --git a/tests/inlineasm 2/asmargs.py.exp b/tests/inlineasm 2/asmargs.py.exp new file mode 100644 index 0000000000..e33a6964f4 --- /dev/null +++ b/tests/inlineasm 2/asmargs.py.exp @@ -0,0 +1,5 @@ +1 +2 +3 +6 +10 diff --git a/tests/inlineasm 2/asmbcc.py b/tests/inlineasm 2/asmbcc.py new file mode 100644 index 0000000000..540fa6591f --- /dev/null +++ b/tests/inlineasm 2/asmbcc.py @@ -0,0 +1,27 @@ +# test bcc instructions +# at the moment only tests beq, narrow and wide versions + +@micropython.asm_thumb +def f(r0): + mov(r1, r0) + + mov(r0, 10) + cmp(r1, 1) + beq(end) + + mov(r0, 20) + cmp(r1, 2) + beq_n(end) + + mov(r0, 30) + cmp(r1, 3) + beq_w(end) + + mov(r0, 0) + + label(end) + +print(f(0)) +print(f(1)) +print(f(2)) +print(f(3)) diff --git a/tests/inlineasm 2/asmbcc.py.exp b/tests/inlineasm 2/asmbcc.py.exp new file mode 100644 index 0000000000..39da7d1a99 --- /dev/null +++ b/tests/inlineasm 2/asmbcc.py.exp @@ -0,0 +1,4 @@ +0 +10 +20 +30 diff --git a/tests/inlineasm 2/asmbitops.py b/tests/inlineasm 2/asmbitops.py new file mode 100644 index 0000000000..8cf92b301f --- /dev/null +++ b/tests/inlineasm 2/asmbitops.py @@ -0,0 +1,13 @@ +@micropython.asm_thumb +def clz(r0): + clz(r0, r0) + +print(clz(0xf0)) +print(clz(0x8000)) + +@micropython.asm_thumb +def rbit(r0): + rbit(r0, r0) + +print(hex(rbit(0xf0))) +print(hex(rbit(0x8000))) diff --git a/tests/inlineasm 2/asmbitops.py.exp b/tests/inlineasm 2/asmbitops.py.exp new file mode 100644 index 0000000000..8c560045f4 --- /dev/null +++ b/tests/inlineasm 2/asmbitops.py.exp @@ -0,0 +1,4 @@ +24 +16 +0xf000000 +0x10000 diff --git a/tests/inlineasm 2/asmblbx.py b/tests/inlineasm 2/asmblbx.py new file mode 100644 index 0000000000..d08c0ed6b3 --- /dev/null +++ b/tests/inlineasm 2/asmblbx.py @@ -0,0 +1,21 @@ +# test bl and bx instructions + +@micropython.asm_thumb +def f(r0): + # jump over the internal functions + b(entry) + + label(func1) + add(r0, 2) + bx(lr) + + label(func2) + sub(r0, 1) + bx(lr) + + label(entry) + bl(func1) + bl(func2) + +print(f(0)) +print(f(1)) diff --git a/tests/inlineasm 2/asmblbx.py.exp b/tests/inlineasm 2/asmblbx.py.exp new file mode 100644 index 0000000000..1191247b6d --- /dev/null +++ b/tests/inlineasm 2/asmblbx.py.exp @@ -0,0 +1,2 @@ +1 +2 diff --git a/tests/inlineasm 2/asmconst.py b/tests/inlineasm 2/asmconst.py new file mode 100644 index 0000000000..299a25093c --- /dev/null +++ b/tests/inlineasm 2/asmconst.py @@ -0,0 +1,8 @@ +# test constants in assembler + +@micropython.asm_thumb +def c1(): + movwt(r0, 0xffffffff) + movwt(r1, 0xf0000000) + sub(r0, r0, r1) +print(hex(c1())) diff --git a/tests/inlineasm 2/asmconst.py.exp b/tests/inlineasm 2/asmconst.py.exp new file mode 100644 index 0000000000..3ef9fcabd7 --- /dev/null +++ b/tests/inlineasm 2/asmconst.py.exp @@ -0,0 +1 @@ +0xfffffff diff --git a/tests/inlineasm 2/asmdiv.py b/tests/inlineasm 2/asmdiv.py new file mode 100644 index 0000000000..b97d566eb5 --- /dev/null +++ b/tests/inlineasm 2/asmdiv.py @@ -0,0 +1,16 @@ +@micropython.asm_thumb +def sdiv(r0, r1): + sdiv(r0, r0, r1) + +@micropython.asm_thumb +def udiv(r0, r1): + udiv(r0, r0, r1) + +print(sdiv(1234, 3)) +print(sdiv(-1234, 3)) +print(sdiv(1234, -3)) +print(sdiv(-1234, -3)) + +print(udiv(1234, 3)) +print(udiv(0xffffffff, 0x7fffffff)) +print(udiv(0xffffffff, 0xffffffff)) diff --git a/tests/inlineasm 2/asmdiv.py.exp b/tests/inlineasm 2/asmdiv.py.exp new file mode 100644 index 0000000000..f1b80deb32 --- /dev/null +++ b/tests/inlineasm 2/asmdiv.py.exp @@ -0,0 +1,7 @@ +411 +-411 +-411 +411 +411 +2 +1 diff --git a/tests/inlineasm 2/asmfpaddsub.py b/tests/inlineasm 2/asmfpaddsub.py new file mode 100644 index 0000000000..2bdfccf0e0 --- /dev/null +++ b/tests/inlineasm 2/asmfpaddsub.py @@ -0,0 +1,14 @@ +@micropython.asm_thumb # r0 = r0+r1-r2 +def add_sub(r0, r1, r2): + vmov(s0, r0) + vcvt_f32_s32(s0, s0) + vmov(s1, r1) + vcvt_f32_s32(s1, s1) + vmov(s2, r2) + vcvt_f32_s32(s2, s2) + vadd(s0, s0, s1) + vsub(s0, s0, s2) + vcvt_s32_f32(s31, s0) + vmov(r0, s31) + +print(add_sub(100, 20, 30)) diff --git a/tests/inlineasm 2/asmfpaddsub.py.exp b/tests/inlineasm 2/asmfpaddsub.py.exp new file mode 100644 index 0000000000..d61f00d8ca --- /dev/null +++ b/tests/inlineasm 2/asmfpaddsub.py.exp @@ -0,0 +1 @@ +90 diff --git a/tests/inlineasm 2/asmfpcmp.py b/tests/inlineasm 2/asmfpcmp.py new file mode 100644 index 0000000000..d4fa1f2410 --- /dev/null +++ b/tests/inlineasm 2/asmfpcmp.py @@ -0,0 +1,14 @@ +@micropython.asm_thumb # test vcmp, vmrs +def f(r0, r1): + vmov(s0, r0) + vcvt_f32_s32(s0, s0) + vmov(s1, r1) + vcvt_f32_s32(s1, s1) + vcmp(s1, s0) + vmrs(r0, FPSCR) + mov(r1, 28) + lsr(r0, r1) + +print(f(0,1)) +print(f(1,1)) +print(f(1,0)) diff --git a/tests/inlineasm 2/asmfpcmp.py.exp b/tests/inlineasm 2/asmfpcmp.py.exp new file mode 100644 index 0000000000..104b3580f7 --- /dev/null +++ b/tests/inlineasm 2/asmfpcmp.py.exp @@ -0,0 +1,3 @@ +2 +6 +8 diff --git a/tests/inlineasm 2/asmfpldrstr.py b/tests/inlineasm 2/asmfpldrstr.py new file mode 100644 index 0000000000..4c480671f9 --- /dev/null +++ b/tests/inlineasm 2/asmfpldrstr.py @@ -0,0 +1,11 @@ +import array +@micropython.asm_thumb # test vldr, vstr +def arrayadd(r0): + vldr(s0, [r0, 0]) + vldr(s1, [r0, 4]) + vadd(s2, s0, s1) + vstr(s2, [r0, 8]) + +z = array.array("f", [2, 4, 10]) +arrayadd(z) +print(z[2]) diff --git a/tests/inlineasm 2/asmfpldrstr.py.exp b/tests/inlineasm 2/asmfpldrstr.py.exp new file mode 100644 index 0000000000..e0ea36feef --- /dev/null +++ b/tests/inlineasm 2/asmfpldrstr.py.exp @@ -0,0 +1 @@ +6.0 diff --git a/tests/inlineasm 2/asmfpmuldiv.py b/tests/inlineasm 2/asmfpmuldiv.py new file mode 100644 index 0000000000..043a28e229 --- /dev/null +++ b/tests/inlineasm 2/asmfpmuldiv.py @@ -0,0 +1,14 @@ +@micropython.asm_thumb # r0 = (int)(r0*r1/r2) +def muldiv(r0, r1, r2): + vmov(s0, r0) + vcvt_f32_s32(s0, s0) + vmov(s1, r1) + vcvt_f32_s32(s1, s1) + vmov(s2, r2) + vcvt_f32_s32(s2, s2) + vmul(s7, s0, s1) + vdiv(s8, s7, s2) + vcvt_s32_f32(s31, s8) + vmov(r0, s31) + +print(muldiv(100, 10, 50)) diff --git a/tests/inlineasm 2/asmfpmuldiv.py.exp b/tests/inlineasm 2/asmfpmuldiv.py.exp new file mode 100644 index 0000000000..209e3ef4b6 --- /dev/null +++ b/tests/inlineasm 2/asmfpmuldiv.py.exp @@ -0,0 +1 @@ +20 diff --git a/tests/inlineasm 2/asmfpsqrt.py b/tests/inlineasm 2/asmfpsqrt.py new file mode 100644 index 0000000000..7b7d52e238 --- /dev/null +++ b/tests/inlineasm 2/asmfpsqrt.py @@ -0,0 +1,14 @@ +# test vsqrt, vneg +@micropython.asm_thumb # r0 = -(int)(sqrt(r0)*r1) +def sqrt_test(r0, r1): + vmov(s1, r0) + vcvt_f32_s32(s1, s1) + vsqrt(s1, s1) + vmov(s2, r1) + vcvt_f32_s32(s2, s2) + vmul(s0, s1, s2) + vneg(s7, s0) + vcvt_s32_f32(s31, s7) + vmov(r0, s31) + +print(sqrt_test(256, 10)) diff --git a/tests/inlineasm 2/asmfpsqrt.py.exp b/tests/inlineasm 2/asmfpsqrt.py.exp new file mode 100644 index 0000000000..88a1e93bab --- /dev/null +++ b/tests/inlineasm 2/asmfpsqrt.py.exp @@ -0,0 +1 @@ +-160 diff --git a/tests/inlineasm 2/asmit.py b/tests/inlineasm 2/asmit.py new file mode 100644 index 0000000000..57bfcc7f9a --- /dev/null +++ b/tests/inlineasm 2/asmit.py @@ -0,0 +1,16 @@ +# test it instruction + +@micropython.asm_thumb +def f(r0, r1): + cmp(r0, r1) + it(eq) + mov(r0, 100) +print(f(0, 0), f(1, 2)) + +@micropython.asm_thumb +def g(r0, r1): + cmp(r0, r1) + ite(eq) + mov(r0, 100) + mov(r0, 200) +print(g(0, 0), g(0, 1)) diff --git a/tests/inlineasm 2/asmit.py.exp b/tests/inlineasm 2/asmit.py.exp new file mode 100644 index 0000000000..d06c72d9bb --- /dev/null +++ b/tests/inlineasm 2/asmit.py.exp @@ -0,0 +1,2 @@ +100 1 +100 200 diff --git a/tests/inlineasm 2/asmpushpop.py b/tests/inlineasm 2/asmpushpop.py new file mode 100644 index 0000000000..c9005434ba --- /dev/null +++ b/tests/inlineasm 2/asmpushpop.py @@ -0,0 +1,8 @@ +@micropython.asm_thumb +def f(r0, r1, r2): + push({r0}) + push({r1, r2}) + pop({r0}) + pop({r1, r2}) + +print(f(0, 1, 2)) diff --git a/tests/inlineasm 2/asmpushpop.py.exp b/tests/inlineasm 2/asmpushpop.py.exp new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/inlineasm 2/asmpushpop.py.exp @@ -0,0 +1 @@ +1 diff --git a/tests/inlineasm 2/asmrettype.py b/tests/inlineasm 2/asmrettype.py new file mode 100644 index 0000000000..f1918696ee --- /dev/null +++ b/tests/inlineasm 2/asmrettype.py @@ -0,0 +1,21 @@ +# test return type of inline asm + +@micropython.asm_thumb +def ret_obj(r0) -> object: + pass +ret_obj(print)(1) + +@micropython.asm_thumb +def ret_bool(r0) -> bool: + pass +print(ret_bool(0), ret_bool(1)) + +@micropython.asm_thumb +def ret_int(r0) -> int: + lsl(r0, r0, 29) +print(ret_int(0), hex(ret_int(1)), hex(ret_int(2)), hex(ret_int(4))) + +@micropython.asm_thumb +def ret_uint(r0) -> uint: + lsl(r0, r0, 29) +print(ret_uint(0), hex(ret_uint(1)), hex(ret_uint(2)), hex(ret_uint(4))) diff --git a/tests/inlineasm 2/asmrettype.py.exp b/tests/inlineasm 2/asmrettype.py.exp new file mode 100644 index 0000000000..cbb49d2472 --- /dev/null +++ b/tests/inlineasm 2/asmrettype.py.exp @@ -0,0 +1,4 @@ +1 +False True +0 0x20000000 0x40000000 -0x80000000 +0 0x20000000 0x40000000 0x80000000 diff --git a/tests/inlineasm 2/asmshift.py b/tests/inlineasm 2/asmshift.py new file mode 100644 index 0000000000..0df2187347 --- /dev/null +++ b/tests/inlineasm 2/asmshift.py @@ -0,0 +1,29 @@ +@micropython.asm_thumb +def lsl1(r0): + lsl(r0, r0, 1) +print(hex(lsl1(0x123))) + +@micropython.asm_thumb +def lsl23(r0): + lsl(r0, r0, 23) +print(hex(lsl23(1))) + +@micropython.asm_thumb +def lsr1(r0): + lsr(r0, r0, 1) +print(hex(lsr1(0x123))) + +@micropython.asm_thumb +def lsr31(r0): + lsr(r0, r0, 31) +print(hex(lsr31(0x80000000))) + +@micropython.asm_thumb +def asr1(r0): + asr(r0, r0, 1) +print(hex(asr1(0x123))) + +@micropython.asm_thumb +def asr31(r0): + asr(r0, r0, 31) +print(hex(asr31(0x80000000))) diff --git a/tests/inlineasm 2/asmshift.py.exp b/tests/inlineasm 2/asmshift.py.exp new file mode 100644 index 0000000000..c6c3a72179 --- /dev/null +++ b/tests/inlineasm 2/asmshift.py.exp @@ -0,0 +1,6 @@ +0x246 +0x800000 +0x91 +0x1 +0x91 +-0x1 diff --git a/tests/inlineasm 2/asmspecialregs.py b/tests/inlineasm 2/asmspecialregs.py new file mode 100644 index 0000000000..2d3b0e396f --- /dev/null +++ b/tests/inlineasm 2/asmspecialregs.py @@ -0,0 +1,10 @@ +@micropython.asm_thumb +def getIPSR(): + mrs(r0, IPSR) + +@micropython.asm_thumb +def getBASEPRI(): + mrs(r0, BASEPRI) + +print(getBASEPRI()) +print(getIPSR()) diff --git a/tests/inlineasm 2/asmspecialregs.py.exp b/tests/inlineasm 2/asmspecialregs.py.exp new file mode 100644 index 0000000000..aa47d0d46d --- /dev/null +++ b/tests/inlineasm 2/asmspecialregs.py.exp @@ -0,0 +1,2 @@ +0 +0 diff --git a/tests/inlineasm 2/asmsum.py b/tests/inlineasm 2/asmsum.py new file mode 100644 index 0000000000..07e71c7384 --- /dev/null +++ b/tests/inlineasm 2/asmsum.py @@ -0,0 +1,57 @@ +@micropython.asm_thumb +def asm_sum_words(r0, r1): + + # r0 = len + # r1 = ptr + # r2 = sum + # r3 = dummy + mov(r2, 0) + + b(loop_entry) + + label(loop1) + ldr(r3, [r1, 0]) + add(r2, r2, r3) + + add(r1, r1, 4) + sub(r0, r0, 1) + + label(loop_entry) + cmp(r0, 0) + bgt(loop1) + + mov(r0, r2) + +@micropython.asm_thumb +def asm_sum_bytes(r0, r1): + + # r0 = len + # r1 = ptr + # r2 = sum + # r3 = dummy + mov(r2, 0) + + b(loop_entry) + + label(loop1) + ldrb(r3, [r1, 0]) + add(r2, r2, r3) + + add(r1, r1, 1) + sub(r0, r0, 1) + + label(loop_entry) + cmp(r0, 0) + bgt(loop1) + + mov(r0, r2) + +import array + +b = array.array('l', (100, 200, 300, 400)) +n = asm_sum_words(len(b), b) +print(b, n) + +b = array.array('b', (10, 20, 30, 40, 50, 60, 70, 80)) +n = asm_sum_bytes(len(b), b) +print(b, n) diff --git a/tests/inlineasm 2/asmsum.py.exp b/tests/inlineasm 2/asmsum.py.exp new file mode 100644 index 0000000000..d50a94c8db --- /dev/null +++ b/tests/inlineasm 2/asmsum.py.exp @@ -0,0 +1,2 @@ +array('l', [100, 200, 300, 400]) 1000 +array('b', [10, 20, 30, 40, 50, 60, 70, 80]) 360 diff --git a/tests/io/data/file1 2 b/tests/io/data/file1 2 new file mode 100644 index 0000000000..e08206337f --- /dev/null +++ b/tests/io/data/file1 2 @@ -0,0 +1,3 @@ +longer line1 +line2 +line3 diff --git a/tests/jni 2/README b/tests/jni 2/README new file mode 100644 index 0000000000..a0689e9244 --- /dev/null +++ b/tests/jni 2/README @@ -0,0 +1,11 @@ +Running "jni" module tests (as well as just using this module) requires +being able to load libjvm.so, which requires path to it set via +LD_LIBRARY_PATH environment variable. This path is not set automatically +and there is no easy way to guess it, because there can be installed +different implementations of JVM, for one implementation, there can be +different versions, and single version may include different variants +of JVM. + +For example, for OpenJDK 7 on x86_64, following may work: + +LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests jni/*.py diff --git a/tests/jni 2/list.py b/tests/jni 2/list.py new file mode 100644 index 0000000000..d58181d0ba --- /dev/null +++ b/tests/jni 2/list.py @@ -0,0 +1,15 @@ +import jni +try: + ArrayList = jni.cls("java/util/ArrayList") +except: + print("SKIP") + raise SystemExit + +l = ArrayList() +print(l) +l.add("one") +l.add("two") + +print(l.toString()) +print(l) +print(l[0], l[1]) diff --git a/tests/jni 2/list.py.exp b/tests/jni 2/list.py.exp new file mode 100644 index 0000000000..cc34bb0a21 --- /dev/null +++ b/tests/jni 2/list.py.exp @@ -0,0 +1,4 @@ +[] +[one, two] +[one, two] +one two diff --git a/tests/jni 2/object.py b/tests/jni 2/object.py new file mode 100644 index 0000000000..aa67615ec8 --- /dev/null +++ b/tests/jni 2/object.py @@ -0,0 +1,15 @@ +import jni +try: + Integer = jni.cls("java/lang/Integer") +except: + print("SKIP") + raise SystemExit + +# Create object +i = Integer(42) +print(i) +# Call object method +print(i.hashCode()) +# Pass object to another method +System = jni.cls("java/lang/System") +System.out.println(i) diff --git a/tests/jni 2/object.py.exp b/tests/jni 2/object.py.exp new file mode 100644 index 0000000000..bda709ecfb --- /dev/null +++ b/tests/jni 2/object.py.exp @@ -0,0 +1,3 @@ +42 +42 +42 diff --git a/tests/jni 2/system_out.py b/tests/jni 2/system_out.py new file mode 100644 index 0000000000..86c4b9e112 --- /dev/null +++ b/tests/jni 2/system_out.py @@ -0,0 +1,8 @@ +try: + import jni + System = jni.cls("java/lang/System") +except: + print("SKIP") + raise SystemExit + +System.out.println("Hello, Java!") diff --git a/tests/jni 2/system_out.py.exp b/tests/jni 2/system_out.py.exp new file mode 100644 index 0000000000..01dd954f90 --- /dev/null +++ b/tests/jni 2/system_out.py.exp @@ -0,0 +1 @@ +Hello, Java! diff --git a/tests/net_hosted 2/README b/tests/net_hosted 2/README new file mode 100644 index 0000000000..724dd61584 --- /dev/null +++ b/tests/net_hosted 2/README @@ -0,0 +1,11 @@ +This directory contains network tests which require just "peer to peer" +network connection between test host and device under test, instead of +full Internet connection. + +Note that setup for these tests and tests themselves are WIP, and may +not yet fully correspond to the functional specification above. + +So far, these tests are not run as part of the main testsuite and need +to be run seperately (from the main test/ directory): + + ./run-tests net_hosted/*.py diff --git a/tests/net_hosted 2/accept_nonblock.py b/tests/net_hosted 2/accept_nonblock.py new file mode 100644 index 0000000000..56f3288e28 --- /dev/null +++ b/tests/net_hosted 2/accept_nonblock.py @@ -0,0 +1,16 @@ +# test that socket.accept() on a non-blocking socket raises EAGAIN + +try: + import usocket as socket +except: + import socket + +s = socket.socket() +s.bind(socket.getaddrinfo('127.0.0.1', 8123)[0][-1]) +s.setblocking(False) +s.listen(1) +try: + s.accept() +except OSError as er: + print(er.args[0] == 11) # 11 is EAGAIN +s.close() diff --git a/tests/net_hosted 2/accept_nonblock.py.exp b/tests/net_hosted 2/accept_nonblock.py.exp new file mode 100644 index 0000000000..0ca95142bb --- /dev/null +++ b/tests/net_hosted 2/accept_nonblock.py.exp @@ -0,0 +1 @@ +True diff --git a/tests/net_hosted 2/accept_timeout.py b/tests/net_hosted 2/accept_timeout.py new file mode 100644 index 0000000000..44b3b8c7cd --- /dev/null +++ b/tests/net_hosted 2/accept_timeout.py @@ -0,0 +1,22 @@ +# test that socket.accept() on a socket with timeout raises ETIMEDOUT + +try: + import usocket as socket +except: + import socket + +try: + socket.socket.settimeout +except AttributeError: + print('SKIP') + raise SystemExit + +s = socket.socket() +s.bind(socket.getaddrinfo('127.0.0.1', 8123)[0][-1]) +s.settimeout(1) +s.listen(1) +try: + s.accept() +except OSError as er: + print(er.args[0] in (110, 'timed out')) # 110 is ETIMEDOUT; CPython uses a string +s.close() diff --git a/tests/net_hosted 2/accept_timeout.py.exp b/tests/net_hosted 2/accept_timeout.py.exp new file mode 100644 index 0000000000..0ca95142bb --- /dev/null +++ b/tests/net_hosted 2/accept_timeout.py.exp @@ -0,0 +1 @@ +True diff --git a/tests/net_hosted 2/connect_nonblock.py b/tests/net_hosted 2/connect_nonblock.py new file mode 100644 index 0000000000..6479978bea --- /dev/null +++ b/tests/net_hosted 2/connect_nonblock.py @@ -0,0 +1,20 @@ +# test that socket.connect() on a non-blocking socket raises EINPROGRESS + +try: + import usocket as socket +except: + import socket + + +def test(peer_addr): + s = socket.socket() + s.setblocking(False) + try: + s.connect(peer_addr) + except OSError as er: + print(er.args[0] == 115) # 115 is EINPROGRESS + s.close() + + +if __name__ == "__main__": + test(socket.getaddrinfo('micropython.org', 80)[0][-1]) diff --git a/tests/net_hosted 2/connect_nonblock.py.exp b/tests/net_hosted 2/connect_nonblock.py.exp new file mode 100644 index 0000000000..0ca95142bb --- /dev/null +++ b/tests/net_hosted 2/connect_nonblock.py.exp @@ -0,0 +1 @@ +True diff --git a/tests/net_hosted 2/connect_poll.py b/tests/net_hosted 2/connect_poll.py new file mode 100644 index 0000000000..ece6aa0da9 --- /dev/null +++ b/tests/net_hosted 2/connect_poll.py @@ -0,0 +1,32 @@ +# test that socket.connect() has correct polling behaviour before, during and after + +try: + import usocket as socket, uselect as select +except: + import socket, select + + +def test(peer_addr): + s = socket.socket() + poller = select.poll() + poller.register(s) + + # test poll before connect + # note: CPython can return POLLHUP, so use the IN|OUT mask + p = poller.poll(0) + print(len(p), p[0][-1] & (select.POLLIN | select.POLLOUT)) + + s.connect(peer_addr) + + # test poll during connection + print(len(poller.poll(0))) + + # test poll after connection is established + p = poller.poll(1000) + print(len(p), p[0][-1]) + + s.close() + + +if __name__ == "__main__": + test(socket.getaddrinfo('micropython.org', 80)[0][-1]) diff --git a/tests/net_hosted 2/connect_poll.py.exp b/tests/net_hosted 2/connect_poll.py.exp new file mode 100644 index 0000000000..cdf520e090 --- /dev/null +++ b/tests/net_hosted 2/connect_poll.py.exp @@ -0,0 +1,3 @@ +1 4 +1 +1 4 diff --git a/tests/net_hosted 2/ssl_getpeercert.py b/tests/net_hosted 2/ssl_getpeercert.py new file mode 100644 index 0000000000..e265c830d0 --- /dev/null +++ b/tests/net_hosted 2/ssl_getpeercert.py @@ -0,0 +1,21 @@ +# test ssl.getpeercert() method + +try: + import usocket as socket + import ussl as ssl +except: + import socket + import ssl + + +def test(peer_addr): + s = socket.socket() + s.connect(peer_addr) + s = ssl.wrap_socket(s) + cert = s.getpeercert(True) + print(type(cert), len(cert) > 100) + s.close() + + +if __name__ == "__main__": + test(socket.getaddrinfo('micropython.org', 443)[0][-1]) diff --git a/tests/net_hosted 2/ssl_getpeercert.py.exp b/tests/net_hosted 2/ssl_getpeercert.py.exp new file mode 100644 index 0000000000..ff7ef5adf1 --- /dev/null +++ b/tests/net_hosted 2/ssl_getpeercert.py.exp @@ -0,0 +1 @@ + True diff --git a/tests/net_inet 2/README b/tests/net_inet 2/README new file mode 100644 index 0000000000..9a5614efa6 --- /dev/null +++ b/tests/net_inet 2/README @@ -0,0 +1,5 @@ +This directory contains network tests which require Internet connection. +Note that these tests are not run as part of the main testsuite and need +to be run seperately (from the main test/ directory): + + ./run-tests net_inet/*.py diff --git a/tests/net_inet 2/test_tls_sites.py b/tests/net_inet 2/test_tls_sites.py new file mode 100644 index 0000000000..bf8071d087 --- /dev/null +++ b/tests/net_inet 2/test_tls_sites.py @@ -0,0 +1,59 @@ +try: + import usocket as _socket +except: + import _socket +try: + import ussl as ssl +except: + import ssl + # CPython only supports server_hostname with SSLContext + ssl = ssl.SSLContext() + + +def test_one(site, opts): + ai = _socket.getaddrinfo(site, 443) + addr = ai[0][-1] + + s = _socket.socket() + + try: + s.connect(addr) + + if "sni" in opts: + s = ssl.wrap_socket(s, server_hostname=opts["host"]) + else: + s = ssl.wrap_socket(s) + + s.write(b"GET / HTTP/1.0\r\nHost: %s\r\n\r\n" % bytes(site, 'latin')) + resp = s.read(4096) +# print(resp) + + finally: + s.close() + + +SITES = [ + "google.com", + "www.google.com", + "api.telegram.org", + {"host": "api.pushbullet.com", "sni": True}, +# "w9rybpfril.execute-api.ap-southeast-2.amazonaws.com", + {"host": "w9rybpfril.execute-api.ap-southeast-2.amazonaws.com", "sni": True}, +] + + +def main(): + for site in SITES: + opts = {} + if isinstance(site, dict): + opts = site + site = opts["host"] + + try: + test_one(site, opts) + print(site, "ok") + except Exception as e: + print(site, repr(e)) + + +main() diff --git a/tests/net_inet 2/test_tls_sites.py.exp b/tests/net_inet 2/test_tls_sites.py.exp new file mode 100644 index 0000000000..2f3c113d2f --- /dev/null +++ b/tests/net_inet 2/test_tls_sites.py.exp @@ -0,0 +1,5 @@ +google.com ok +www.google.com ok +api.telegram.org ok +api.pushbullet.com ok +w9rybpfril.execute-api.ap-southeast-2.amazonaws.com ok diff --git a/tests/run-bench-tests 2 b/tests/run-bench-tests 2 new file mode 100755 index 0000000000..f4a6776cbc --- /dev/null +++ b/tests/run-bench-tests 2 @@ -0,0 +1,97 @@ +#! /usr/bin/env python3 + +import os +import subprocess +import sys +import argparse +import re +from glob import glob +from collections import defaultdict + +# Tests require at least CPython 3.3. If your default python3 executable +# is of lower version, you can point MICROPY_CPYTHON3 environment var +# to the correct executable. +if os.name == 'nt': + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/windows/micropython.exe') +else: + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/unix/micropython') + +def run_tests(pyb, test_dict): + test_count = 0 + testcase_count = 0 + + for base_test, tests in sorted(test_dict.items()): + print(base_test + ":") + for test_file in tests: + + # run MicroPython + if pyb is None: + # run on PC + try: + output_mupy = subprocess.check_output([MICROPYTHON, '-X', 'emit=bytecode', test_file[0]]) + except subprocess.CalledProcessError: + output_mupy = b'CRASH' + else: + # run on pyboard + pyb.enter_raw_repl() + try: + output_mupy = pyb.execfile(test_file).replace(b'\r\n', b'\n') + except pyboard.PyboardError: + output_mupy = b'CRASH' + + output_mupy = float(output_mupy.strip()) + test_file[1] = output_mupy + testcase_count += 1 + + test_count += 1 + baseline = None + for t in tests: + if baseline is None: + baseline = t[1] + print(" %.3fs (%+06.2f%%) %s" % (t[1], (t[1] * 100 / baseline) - 100, t[0])) + + print("{} tests performed ({} individual testcases)".format(test_count, testcase_count)) + + # all tests succeeded + return True + +def main(): + cmd_parser = argparse.ArgumentParser(description='Run tests for MicroPython.') + cmd_parser.add_argument('--pyboard', action='store_true', help='run the tests on the pyboard') + cmd_parser.add_argument('files', nargs='*', help='input test files') + args = cmd_parser.parse_args() + + # Note pyboard support is copied over from run-tests, not testes, and likely needs revamping + if args.pyboard: + import pyboard + pyb = pyboard.Pyboard('/dev/ttyACM0') + pyb.enter_raw_repl() + else: + pyb = None + + if len(args.files) == 0: + if pyb is None: + # run PC tests + test_dirs = ('bench',) + else: + # run pyboard tests + test_dirs = ('basics', 'float', 'pyb') + tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files) + else: + # tests explicitly given + tests = sorted(args.files) + + test_dict = defaultdict(lambda: []) + for t in tests: + m = re.match(r"(.+?)-(.+)\.py", t) + if not m: + continue + test_dict[m.group(1)].append([t, None]) + + if not run_tests(pyb, test_dict): + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/tests/run-tests 2 b/tests/run-tests 2 new file mode 100755 index 0000000000..e28600361b --- /dev/null +++ b/tests/run-tests 2 @@ -0,0 +1,615 @@ +#! /usr/bin/env python3 + +import os +import subprocess +import sys +import platform +import argparse +import re +import threading +import multiprocessing +from multiprocessing.pool import ThreadPool +from glob import glob + +# Tests require at least CPython 3.3. If your default python3 executable +# is of lower version, you can point MICROPY_CPYTHON3 environment var +# to the correct executable. +if os.name == 'nt': + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/windows/micropython.exe') +else: + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/unix/micropython') + +# mpy-cross is only needed if --via-mpy command-line arg is passed +MPYCROSS = os.getenv('MICROPY_MPYCROSS', '../mpy-cross/mpy-cross') + +# Set PYTHONIOENCODING so that CPython will use utf-8 on systems which set another encoding in the locale +os.environ['PYTHONIOENCODING'] = 'utf-8' + +def rm_f(fname): + if os.path.exists(fname): + os.remove(fname) + + +# unescape wanted regex chars and escape unwanted ones +def convert_regex_escapes(line): + cs = [] + escape = False + for c in str(line, 'utf8'): + if escape: + escape = False + cs.append(c) + elif c == '\\': + escape = True + elif c in ('(', ')', '[', ']', '{', '}', '.', '*', '+', '^', '$'): + cs.append('\\' + c) + else: + cs.append(c) + # accept carriage-return(s) before final newline + if cs[-1] == '\n': + cs[-1] = '\r*\n' + return bytes(''.join(cs), 'utf8') + + +def run_micropython(pyb, args, test_file, is_special=False): + special_tests = ( + 'micropython/meminfo.py', 'basics/bytes_compare3.py', + 'basics/builtin_help.py', 'thread/thread_exc2.py', + ) + had_crash = False + if pyb is None: + # run on PC + if test_file.startswith(('cmdline/', 'feature_check/')) or test_file in special_tests: + # special handling for tests of the unix cmdline program + is_special = True + + if is_special: + # check for any cmdline options needed for this test + args = [MICROPYTHON] + with open(test_file, 'rb') as f: + line = f.readline() + if line.startswith(b'# cmdline:'): + # subprocess.check_output on Windows only accepts strings, not bytes + args += [str(c, 'utf-8') for c in line[10:].strip().split()] + + # run the test, possibly with redirected input + try: + if 'repl_' in test_file: + # Need to use a PTY to test command line editing + try: + import pty + except ImportError: + # in case pty module is not available, like on Windows + return b'SKIP\n' + import select + + def get(required=False): + rv = b'' + while True: + ready = select.select([emulator], [], [], 0.02) + if ready[0] == [emulator]: + rv += os.read(emulator, 1024) + else: + if not required or rv: + return rv + + def send_get(what): + os.write(emulator, what) + return get() + + with open(test_file, 'rb') as f: + # instead of: output_mupy = subprocess.check_output(args, stdin=f) + # openpty returns two read/write file descriptors. The first one is + # used by the program which provides the virtual + # terminal service, and the second one is used by the + # subprogram which requires a tty to work. + emulator, subterminal = pty.openpty() + p = subprocess.Popen(args, stdin=subterminal, stdout=subterminal, + stderr=subprocess.STDOUT, bufsize=0) + banner = get(True) + output_mupy = banner + b''.join(send_get(line) for line in f) + send_get(b'\x04') # exit the REPL, so coverage info is saved + p.kill() + os.close(emulator) + os.close(subterminal) + else: + output_mupy = subprocess.check_output(args + [test_file], stderr=subprocess.STDOUT) + except subprocess.CalledProcessError: + return b'CRASH' + + else: + # a standard test run on PC + + # create system command + cmdlist = [MICROPYTHON, '-X', 'emit=' + args.emit] + if args.heapsize is not None: + cmdlist.extend(['-X', 'heapsize=' + args.heapsize]) + + # if running via .mpy, first compile the .py file + if args.via_mpy: + subprocess.check_output([MPYCROSS, '-mcache-lookup-bc', '-o', 'mpytest.mpy', test_file]) + cmdlist.extend(['-m', 'mpytest']) + else: + cmdlist.append(test_file) + + # run the actual test + e = {"MICROPYPATH": os.getcwd() + ":", "LANG": "en_US.UTF-8"} + p = subprocess.Popen(cmdlist, env=e, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + output_mupy = b'' + while p.poll() is None: + output_mupy += p.stdout.read() + output_mupy += p.stdout.read() + if p.returncode != 0: + output_mupy = b'CRASH' + + # clean up if we had an intermediate .mpy file + if args.via_mpy: + rm_f('mpytest.mpy') + + else: + # run on pyboard + import pyboard + pyb.enter_raw_repl() + try: + output_mupy = pyb.execfile(test_file) + except pyboard.PyboardError: + had_crash = True + output_mupy = b'CRASH' + + # canonical form for all ports/platforms is to use \n for end-of-line + output_mupy = output_mupy.replace(b'\r\n', b'\n') + + # don't try to convert the output if we should skip this test + if had_crash or output_mupy in (b'SKIP\n', b'CRASH'): + return output_mupy + + if is_special or test_file in special_tests: + # convert parts of the output that are not stable across runs + with open(test_file + '.exp', 'rb') as f: + lines_exp = [] + for line in f.readlines(): + if line == b'########\n': + line = (line,) + else: + line = (line, re.compile(convert_regex_escapes(line))) + lines_exp.append(line) + lines_mupy = [line + b'\n' for line in output_mupy.split(b'\n')] + if output_mupy.endswith(b'\n'): + lines_mupy = lines_mupy[:-1] # remove erroneous last empty line + i_mupy = 0 + for i in range(len(lines_exp)): + if lines_exp[i][0] == b'########\n': + # 8x #'s means match 0 or more whole lines + line_exp = lines_exp[i + 1] + skip = 0 + while i_mupy + skip < len(lines_mupy) and not line_exp[1].match(lines_mupy[i_mupy + skip]): + skip += 1 + if i_mupy + skip >= len(lines_mupy): + lines_mupy[i_mupy] = b'######## FAIL\n' + break + del lines_mupy[i_mupy:i_mupy + skip] + lines_mupy.insert(i_mupy, b'########\n') + i_mupy += 1 + else: + # a regex + if lines_exp[i][1].match(lines_mupy[i_mupy]): + lines_mupy[i_mupy] = lines_exp[i][0] + else: + #print("don't match: %r %s" % (lines_exp[i][1], lines_mupy[i_mupy])) # DEBUG + pass + i_mupy += 1 + if i_mupy >= len(lines_mupy): + break + output_mupy = b''.join(lines_mupy) + + return output_mupy + + +def run_feature_check(pyb, args, base_path, test_file): + return run_micropython(pyb, args, base_path + "/feature_check/" + test_file, is_special=True) + +class ThreadSafeCounter: + def __init__(self, start=0): + self._value = start + self._lock = threading.Lock() + + def add(self, to_add): + with self._lock: self._value += to_add + + def append(self, arg): + self.add([arg]) + + @property + def value(self): + return self._value + +def run_tests(pyb, tests, args, base_path=".", num_threads=1): + test_count = ThreadSafeCounter() + testcase_count = ThreadSafeCounter() + passed_count = ThreadSafeCounter() + failed_tests = ThreadSafeCounter([]) + skipped_tests = ThreadSafeCounter([]) + + skip_tests = set() + skip_native = False + skip_int_big = False + skip_set_type = False + skip_async = False + skip_const = False + skip_revops = False + skip_endian = False + has_complex = True + has_coverage = False + + upy_float_precision = 32 + + # If we're asked to --list-tests, we can't assume that there's a + # connection to target, so we can't run feature checks usefully. + if not (args.list_tests or args.write_exp): + # Check if micropython.native is supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'native_check.py') + if output == b'CRASH': + skip_native = True + + # Check if arbitrary-precision integers are supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'int_big.py') + if output != b'1000000000000000000000000000000000000000000000\n': + skip_int_big = True + + # Check if set type (and set literals) is supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'set_check.py') + if output == b'CRASH': + skip_set_type = True + + # Check if async/await keywords are supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'async_check.py') + if output == b'CRASH': + skip_async = True + + # Check if const keyword (MicroPython extension) is supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'const.py') + if output == b'CRASH': + skip_const = True + + # Check if __rOP__ special methods are supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'reverse_ops.py') + if output == b'TypeError\n': + skip_revops = True + + # Check if emacs repl is supported, and skip such tests if it's not + t = run_feature_check(pyb, args, base_path, 'repl_emacs_check.py') + if not 'True' in str(t, 'ascii'): + skip_tests.add('cmdline/repl_emacs_keys.py') + + upy_byteorder = run_feature_check(pyb, args, base_path, 'byteorder.py') + upy_float_precision = int(run_feature_check(pyb, args, base_path, 'float.py')) + has_complex = run_feature_check(pyb, args, base_path, 'complex.py') == b'complex\n' + has_coverage = run_feature_check(pyb, args, base_path, 'coverage.py') == b'coverage\n' + cpy_byteorder = subprocess.check_output([CPYTHON3, base_path + '/feature_check/byteorder.py']) + skip_endian = (upy_byteorder != cpy_byteorder) + + # Some tests shouldn't be run under Travis CI + if os.getenv('TRAVIS') == 'true': + skip_tests.add('basics/memoryerror.py') + skip_tests.add('thread/thread_gc1.py') # has reliability issues + skip_tests.add('thread/thread_lock4.py') # has reliability issues + skip_tests.add('thread/stress_heap.py') # has reliability issues + skip_tests.add('thread/stress_recurse.py') # has reliability issues + + if upy_float_precision == 0: + skip_tests.add('extmod/ujson_dumps_float.py') + skip_tests.add('extmod/ujson_loads_float.py') + skip_tests.add('misc/rge_sm.py') + if upy_float_precision < 32: + skip_tests.add('float/float2int_intbig.py') # requires fp32, there's float2int_fp30_intbig.py instead + skip_tests.add('float/string_format.py') # requires fp32, there's string_format_fp30.py instead + skip_tests.add('float/bytes_construct.py') # requires fp32 + skip_tests.add('float/bytearray_construct.py') # requires fp32 + if upy_float_precision < 64: + skip_tests.add('float/float_divmod.py') # tested by float/float_divmod_relaxed.py instead + skip_tests.add('float/float2int_doubleprec_intbig.py') + skip_tests.add('float/float_parse_doubleprec.py') + + if not has_complex: + skip_tests.add('float/complex1.py') + skip_tests.add('float/complex1_intbig.py') + skip_tests.add('float/int_big_float.py') + skip_tests.add('float/true_value.py') + skip_tests.add('float/types.py') + + if not has_coverage: + skip_tests.add('cmdline/cmd_parsetree.py') + + # Some tests shouldn't be run on a PC + if args.target == 'unix': + # unix build does not have the GIL so can't run thread mutation tests + for t in tests: + if t.startswith('thread/mutate_'): + skip_tests.add(t) + + # Some tests shouldn't be run on pyboard + if args.target != 'unix': + skip_tests.add('basics/exception_chain.py') # warning is not printed + skip_tests.add('micropython/meminfo.py') # output is very different to PC output + skip_tests.add('extmod/machine_mem.py') # raw memory access not supported + + if args.target == 'wipy': + skip_tests.add('misc/print_exception.py') # requires error reporting full + skip_tests.update({'extmod/uctypes_%s.py' % t for t in 'bytearray le native_le ptr_le ptr_native_le sizeof sizeof_native array_assign_le array_assign_native_le'.split()}) # requires uctypes + skip_tests.add('extmod/zlibd_decompress.py') # requires zlib + skip_tests.add('extmod/uheapq1.py') # uheapq not supported by WiPy + skip_tests.add('extmod/urandom_basic.py') # requires urandom + skip_tests.add('extmod/urandom_extra.py') # requires urandom + elif args.target == 'esp8266': + skip_tests.add('misc/rge_sm.py') # too large + elif args.target == 'minimal': + skip_tests.add('basics/class_inplace_op.py') # all special methods not supported + skip_tests.add('basics/subclass_native_init.py')# native subclassing corner cases not support + skip_tests.add('misc/rge_sm.py') # too large + skip_tests.add('micropython/opt_level.py') # don't assume line numbers are stored + + # Some tests are known to fail on 64-bit machines + if pyb is None and platform.architecture()[0] == '64bit': + pass + + # Some tests use unsupported features on Windows + if os.name == 'nt': + skip_tests.add('import/import_file.py') # works but CPython prints forward slashes + + # Some tests are known to fail with native emitter + # Remove them from the below when they work + if args.emit == 'native': + skip_tests.update({'basics/%s.py' % t for t in 'gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_executing gen_yield_from_iter gen_yield_from_send gen_yield_from_stopped gen_yield_from_throw gen_yield_from_throw2 gen_yield_from_throw3 generator1 generator2 generator_args generator_close generator_closure generator_exc generator_pend_throw generator_return generator_send'.split()}) # require yield + skip_tests.update({'basics/%s.py' % t for t in 'bytes_gen class_store_class globals_del string_join gen_stack_overflow'.split()}) # require yield + skip_tests.update({'basics/async_%s.py' % t for t in 'def await await2 for for2 with with2 coroutine'.split()}) # require yield + skip_tests.update({'basics/%s.py' % t for t in 'try_reraise try_reraise2'.split()}) # require raise_varargs + skip_tests.update({'basics/%s.py' % t for t in 'with_break with_continue with_return'.split()}) # require complete with support + skip_tests.add('basics/array_construct2.py') # requires generators + skip_tests.add('basics/bool1.py') # seems to randomly fail + skip_tests.add('basics/builtin_hash_gen.py') # requires yield + skip_tests.add('basics/class_bind_self.py') # requires yield + skip_tests.add('basics/del_deref.py') # requires checking for unbound local + skip_tests.add('basics/del_local.py') # requires checking for unbound local + skip_tests.add('basics/exception_chain.py') # raise from is not supported + skip_tests.add('basics/for_range.py') # requires yield_value + skip_tests.add('basics/try_finally_loops.py') # requires proper try finally code + skip_tests.add('basics/try_finally_return.py') # requires proper try finally code + skip_tests.add('basics/try_finally_return2.py') # requires proper try finally code + skip_tests.add('basics/unboundlocal.py') # requires checking for unbound local + skip_tests.add('import/gen_context.py') # requires yield_value + skip_tests.add('misc/features.py') # requires raise_varargs + skip_tests.add('misc/rge_sm.py') # requires yield + skip_tests.add('misc/print_exception.py') # because native doesn't have proper traceback info + skip_tests.add('misc/sys_exc_info.py') # sys.exc_info() is not supported for native + skip_tests.add('micropython/emg_exc.py') # because native doesn't have proper traceback info + skip_tests.add('micropython/heapalloc_traceback.py') # because native doesn't have proper traceback info + skip_tests.add('micropython/heapalloc_iter.py') # requires generators + skip_tests.add('micropython/schedule.py') # native code doesn't check pending events + skip_tests.add('stress/gc_trace.py') # requires yield + skip_tests.add('stress/recursive_gen.py') # requires yield + skip_tests.add('extmod/vfs_userfs.py') # because native doesn't properly handle globals across different modules + skip_tests.add('../extmod/ulab/tests/argminmax.py') # requires yield + + def run_one_test(test_file): + test_file = test_file.replace('\\', '/') + + if args.filters: + # Default verdict is the opposit of the first action + verdict = "include" if args.filters[0][0] == "exclude" else "exclude" + for action, pat in args.filters: + if pat.search(test_file): + verdict = action + if verdict == "exclude": + return + + test_basename = os.path.basename(test_file) + test_name = os.path.splitext(test_basename)[0] + is_native = test_name.startswith("native_") or test_name.startswith("viper_") + is_endian = test_name.endswith("_endian") + is_int_big = test_name.startswith("int_big") or test_name.endswith("_intbig") + is_set_type = test_name.startswith("set_") or test_name.startswith("frozenset") + is_async = test_name.startswith("async_") + is_const = test_name.startswith("const") + + skip_it = test_file in skip_tests + skip_it |= skip_native and is_native + skip_it |= skip_endian and is_endian + skip_it |= skip_int_big and is_int_big + skip_it |= skip_set_type and is_set_type + skip_it |= skip_async and is_async + skip_it |= skip_const and is_const + skip_it |= skip_revops and test_name.startswith("class_reverse_op") + + if args.list_tests: + if not skip_it: + print(test_file) + return + + if skip_it: + print("skip ", test_file) + skipped_tests.append(test_name) + return + + # get expected output + test_file_expected = test_file + '.exp' + if os.path.isfile(test_file_expected): + # expected output given by a file, so read that in + with open(test_file_expected, 'rb') as f: + output_expected = f.read() + else: + # run CPython to work out expected output + e = {"PYTHONPATH": os.getcwd(), + "PATH": os.environ["PATH"], + "LANG": "en_US.UTF-8"} + p = subprocess.Popen([CPYTHON3, '-B', test_file], env=e, stdout=subprocess.PIPE) + output_expected = b'' + while p.poll() is None: + output_expected += p.stdout.read() + output_expected += p.stdout.read() + if p.returncode != 0: + output_expected = b'CPYTHON3 CRASH' + elif args.write_exp: + with open(test_file_expected, 'wb') as f: + f.write(output_expected) + + # canonical form for all host platforms is to use \n for end-of-line + output_expected = output_expected.replace(b'\r\n', b'\n') + + if args.write_exp: + return + + # run MicroPython + output_mupy = run_micropython(pyb, args, test_file) + + if output_mupy == b'SKIP\n': + print("skip ", test_file) + skipped_tests.append(test_name) + return + + testcase_count.add(len(output_expected.splitlines())) + + filename_expected = test_basename + ".exp" + filename_mupy = test_basename + ".out" + + if output_expected == output_mupy: + print("pass ", test_file) + passed_count.add(1) + rm_f(filename_expected) + rm_f(filename_mupy) + else: + with open(filename_expected, "wb") as f: + f.write(output_expected) + with open(filename_mupy, "wb") as f: + f.write(output_mupy) + print("### Expected") + print(output_expected) + print("### Actual") + print(output_mupy) + print("FAIL ", test_file) + failed_tests.append(test_name) + + test_count.add(1) + + if args.list_tests: + return True + + if num_threads > 1: + pool = ThreadPool(num_threads) + pool.map(run_one_test, tests) + else: + for test in tests: + run_one_test(test) + + print("{} tests performed ({} individual testcases)".format(test_count.value, testcase_count.value)) + print("{} tests passed".format(passed_count.value)) + + if len(skipped_tests.value) > 0: + print("{} tests skipped: {}".format(len(skipped_tests.value), ' '.join(sorted(skipped_tests.value)))) + if len(failed_tests.value) > 0: + print("{} tests failed: {}".format(len(failed_tests.value), ' '.join(sorted(failed_tests.value)))) + return False + + # all tests succeeded + return True + + +class append_filter(argparse.Action): + + def __init__(self, option_strings, dest, **kwargs): + super().__init__(option_strings, dest, default=[], **kwargs) + + def __call__(self, parser, args, value, option): + if not hasattr(args, self.dest): + args.filters = [] + if option.startswith(("-e", "--e")): + option = "exclude" + else: + option = "include" + args.filters.append((option, re.compile(value))) + + +def main(): + cmd_parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + description='Run and manage tests for MicroPython.', + epilog='''\ +Options -i and -e can be multiple and processed in the order given. Regex +"search" (vs "match") operation is used. An action (include/exclude) of +the last matching regex is used: + run-tests -i async - exclude all, then include tests containg "async" anywhere + run-tests -e '/big.+int' - include all, then exclude by regex + run-tests -e async -i async_foo - include all, exclude async, yet still include async_foo +''') + cmd_parser.add_argument('--target', default='unix', help='the target platform') + cmd_parser.add_argument('--device', default='/dev/ttyACM0', help='the serial device or the IP address of the pyboard') + cmd_parser.add_argument('-b', '--baudrate', default=115200, help='the baud rate of the serial device') + cmd_parser.add_argument('-u', '--user', default='micro', help='the telnet login username') + cmd_parser.add_argument('-p', '--password', default='python', help='the telnet login password') + cmd_parser.add_argument('-d', '--test-dirs', nargs='*', help='input test directories (if no files given)') + cmd_parser.add_argument('-e', '--exclude', action=append_filter, metavar='REGEX', dest='filters', help='exclude test by regex on path/name.py') + cmd_parser.add_argument('-i', '--include', action=append_filter, metavar='REGEX', dest='filters', help='include test by regex on path/name.py') + cmd_parser.add_argument('--write-exp', action='store_true', help='save .exp files to run tests w/o CPython') + cmd_parser.add_argument('--list-tests', action='store_true', help='list tests instead of running them') + cmd_parser.add_argument('--emit', default='bytecode', help='MicroPython emitter to use (bytecode or native)') + cmd_parser.add_argument('--heapsize', help='heapsize to use (use default if not specified)') + cmd_parser.add_argument('--via-mpy', action='store_true', help='compile .py files to .mpy first') + cmd_parser.add_argument('--keep-path', action='store_true', help='do not clear MICROPYPATH when running tests') + cmd_parser.add_argument('-j', '--jobs', default=1, metavar='N', type=int, help='Number of tests to run simultaneously') + cmd_parser.add_argument('--auto-jobs', action='store_const', dest='jobs', const=multiprocessing.cpu_count(), help='Set the -j values to the CPU (thread) count') + cmd_parser.add_argument('files', nargs='*', help='input test files') + args = cmd_parser.parse_args() + + EXTERNAL_TARGETS = ('pyboard', 'wipy', 'esp8266', 'esp32', 'minimal') + if args.target == 'unix' or args.list_tests: + pyb = None + elif args.target in EXTERNAL_TARGETS: + import pyboard + pyb = pyboard.Pyboard(args.device, args.baudrate, args.user, args.password) + pyb.enter_raw_repl() + else: + raise ValueError('target must be either %s or unix' % ", ".join(EXTERNAL_TARGETS)) + + if len(args.files) == 0: + if args.test_dirs is None: + if args.target == 'pyboard': + # run pyboard tests + test_dirs = ('basics', 'micropython', 'float', 'misc', 'stress', 'extmod', 'pyb', 'pybnative', 'inlineasm') + elif args.target in ('esp8266', 'esp32', 'minimal'): + test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod') + elif args.target == 'wipy': + # run WiPy tests + test_dirs = ('basics', 'micropython', 'misc', 'extmod', 'wipy') + else: + # run PC tests + test_dirs = ( + 'basics', 'micropython', 'float', 'import', 'io', 'misc', + 'stress', 'unicode', 'extmod', '../extmod/ulab/tests', 'unix', 'cmdline', + ) + else: + # run tests from these directories + test_dirs = args.test_dirs + tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files) + else: + # tests explicitly given + tests = args.files + + if not args.keep_path: + # clear search path to make sure tests use only builtin modules + os.environ['MICROPYPATH'] = '' + + # Even if we run completely different tests in a different directory, + # we need to access feature_check's from the same directory as the + # run-tests script itself. + base_path = os.path.dirname(sys.argv[0]) or "." + try: + res = run_tests(pyb, tests, args, base_path, args.jobs) + finally: + if pyb: + pyb.close() + + if not res: + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/tests/stress 2/dict_copy.py b/tests/stress 2/dict_copy.py new file mode 100644 index 0000000000..36db9bb7e8 --- /dev/null +++ b/tests/stress 2/dict_copy.py @@ -0,0 +1,7 @@ +# copying a large dictionary + +a = {i:2*i for i in range(1000)} +b = a.copy() +for i in range(1000): + print(i, b[i]) +print(len(b)) diff --git a/tests/stress 2/dict_create.py b/tests/stress 2/dict_create.py new file mode 100644 index 0000000000..e9db40a8e6 --- /dev/null +++ b/tests/stress 2/dict_create.py @@ -0,0 +1,8 @@ +# create a large dictionary + +d = {} +x = 1 +while x < 1000: + d[x] = x + x += 1 +print(d[500]) diff --git a/tests/stress 2/dict_create_max.py b/tests/stress 2/dict_create_max.py new file mode 100644 index 0000000000..3c75db20da --- /dev/null +++ b/tests/stress 2/dict_create_max.py @@ -0,0 +1,13 @@ +# The aim with this test is to hit the maximum resize/rehash size of a dict, +# where there are no more primes in the table of growing allocation sizes. +# This value is 54907 items. + +d = {} +try: + for i in range(54908): + d[i] = i +except MemoryError: + pass + +# Just check the dict still has the first value +print(d[0]) diff --git a/tests/stress 2/gc_trace.py b/tests/stress 2/gc_trace.py new file mode 100644 index 0000000000..72dc7b6276 --- /dev/null +++ b/tests/stress 2/gc_trace.py @@ -0,0 +1,17 @@ +# test that the GC can trace nested objects + +try: + import gc +except ImportError: + print("SKIP") + raise SystemExit + +# test a big shallow object pointing to many unique objects +lst = [[i] for i in range(200)] +gc.collect() +print(lst) + +# test a deep object +lst = [[[[[(i, j, k, l)] for i in range(3)] for j in range(3)] for k in range(3)] for l in range(3)] +gc.collect() +print(lst) diff --git a/tests/stress 2/list_sort.py b/tests/stress 2/list_sort.py new file mode 100644 index 0000000000..3a7701a1e4 --- /dev/null +++ b/tests/stress 2/list_sort.py @@ -0,0 +1,6 @@ +# test large list sorting (should not stack overflow) +l = list(range(2000)) +l.sort() +print(l[0], l[-1]) +l.sort(reverse=True) +print(l[0], l[-1]) diff --git a/tests/stress 2/recursion.py b/tests/stress 2/recursion.py new file mode 100644 index 0000000000..227f48396a --- /dev/null +++ b/tests/stress 2/recursion.py @@ -0,0 +1,7 @@ +def foo(): + foo() + +try: + foo() +except RuntimeError: + print("RuntimeError") diff --git a/tests/stress 2/recursive_data.py b/tests/stress 2/recursive_data.py new file mode 100644 index 0000000000..3b7fa50952 --- /dev/null +++ b/tests/stress 2/recursive_data.py @@ -0,0 +1,13 @@ +# This tests that printing recursive data structure doesn't lead to segfault. +try: + import uio as io +except ImportError: + print("SKIP") + raise SystemExit + +l = [1, 2, 3, None] +l[-1] = l +try: + print(l, file=io.StringIO()) +except RuntimeError: + print("RuntimeError") diff --git a/tests/stress 2/recursive_data.py.exp b/tests/stress 2/recursive_data.py.exp new file mode 100644 index 0000000000..8a2b9bfdda --- /dev/null +++ b/tests/stress 2/recursive_data.py.exp @@ -0,0 +1 @@ +RuntimeError diff --git a/tests/stress 2/recursive_gen.py b/tests/stress 2/recursive_gen.py new file mode 100644 index 0000000000..0e0d3914ee --- /dev/null +++ b/tests/stress 2/recursive_gen.py @@ -0,0 +1,18 @@ +# test deeply recursive generators + +# simple "yield from" recursion +def gen(): + yield from gen() +try: + list(gen()) +except RuntimeError: + print('RuntimeError') + +# recursion via an iterator over a generator +def gen2(): + for x in gen2(): + yield x +try: + next(gen2()) +except RuntimeError: + print('RuntimeError') diff --git a/tests/stress 2/recursive_iternext.py b/tests/stress 2/recursive_iternext.py new file mode 100644 index 0000000000..edb5a843f2 --- /dev/null +++ b/tests/stress 2/recursive_iternext.py @@ -0,0 +1,57 @@ +# This tests that recursion with iternext doesn't lead to segfault. +try: + enumerate + filter + map + max + zip +except: + print("SKIP") + raise SystemExit + +# We need to pick an N that is large enough to hit the recursion +# limit, but not too large that we run out of heap memory. +try: + # large stack/heap, eg unix + [0] * 80000 + N = 2400 +except: + try: + # medium, eg pyboard + [0] * 10000 + N = 1000 + except: + # small, eg esp8266 + N = 100 + +try: + x = (1, 2) + for i in range(N): + x = enumerate(x) + tuple(x) +except RuntimeError: + print("RuntimeError") + +try: + x = (1, 2) + for i in range(N): + x = filter(None, x) + tuple(x) +except RuntimeError: + print("RuntimeError") + +try: + x = (1, 2) + for i in range(N): + x = map(max, x, ()) + tuple(x) +except RuntimeError: + print("RuntimeError") + +try: + x = (1, 2) + for i in range(N): + x = zip(x) + tuple(x) +except RuntimeError: + print("RuntimeError") diff --git a/tests/stress 2/recursive_iternext.py.exp b/tests/stress 2/recursive_iternext.py.exp new file mode 100644 index 0000000000..80d1488a37 --- /dev/null +++ b/tests/stress 2/recursive_iternext.py.exp @@ -0,0 +1,4 @@ +RuntimeError +RuntimeError +RuntimeError +RuntimeError diff --git a/tests/thread 2/mutate_bytearray.py b/tests/thread 2/mutate_bytearray.py new file mode 100644 index 0000000000..5015c3f9cf --- /dev/null +++ b/tests/thread 2/mutate_bytearray.py @@ -0,0 +1,46 @@ +# test concurrent mutating access to a shared bytearray object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared bytearray +ba = bytearray() + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + l = len(ba) + ba.append(i) + assert len(ba) >= l + 1 + + l = len(ba) + ba.extend(bytearray([i])) + assert len(ba) >= l + 1 + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 +n_repeat = 4 # use 40 for more stressful test (uses more heap) + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (n_repeat, i * 256 // n_thread, (i + 1) * 256 // n_thread)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check bytearray has correct contents +print(len(ba)) +count = [0 for _ in range(256)] +for b in ba: + count[b] += 1 +print(count) diff --git a/tests/thread 2/mutate_dict.py b/tests/thread 2/mutate_dict.py new file mode 100644 index 0000000000..563fce39de --- /dev/null +++ b/tests/thread 2/mutate_dict.py @@ -0,0 +1,44 @@ +# test concurrent mutating access to a shared dict object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared dict +di = {'a':'A', 'b':'B', 'c':'C', 'd':'D'} + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + di[i] = repeat + i + assert di[i] == repeat + i + + del di[i] + assert i not in di + + di[i] = repeat + i + assert di[i] == repeat + i + + assert di.pop(i) == repeat + i + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (30, i * 300, (i + 1) * 300)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check dict has correct contents +print(sorted(di.items())) diff --git a/tests/thread 2/mutate_instance.py b/tests/thread 2/mutate_instance.py new file mode 100644 index 0000000000..2ecfbe1092 --- /dev/null +++ b/tests/thread 2/mutate_instance.py @@ -0,0 +1,45 @@ +# test concurrent mutating access to a shared user instance +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared user class and instance +class User: + def __init__(self): + self.a = 'A' + self.b = 'B' + self.c = 'C' +user = User() + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + setattr(user, 'attr_%u' % i, repeat + i) + assert getattr(user, 'attr_%u' % i) == repeat + i + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_repeat = 30 +n_range = 50 # 300 for stressful test (uses more heap) +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (n_repeat, i * n_range, (i + 1) * n_range)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check user instance has correct contents +print(user.a, user.b, user.c) +for i in range(n_thread * n_range): + assert getattr(user, 'attr_%u' % i) == n_repeat - 1 + i diff --git a/tests/thread 2/mutate_list.py b/tests/thread 2/mutate_list.py new file mode 100644 index 0000000000..d70e8a8a38 --- /dev/null +++ b/tests/thread 2/mutate_list.py @@ -0,0 +1,46 @@ +# test concurrent mutating access to a shared list object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared list +li = list() + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + li.append(i) + assert li.count(i) == repeat + 1 + + li.extend([i, i]) + assert li.count(i) == repeat + 3 + + li.remove(i) + assert li.count(i) == repeat + 2 + + li.remove(i) + assert li.count(i) == repeat + 1 + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (4, i * 60, (i + 1) * 60)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check list has correct contents +li.sort() +print(li) diff --git a/tests/thread 2/mutate_set.py b/tests/thread 2/mutate_set.py new file mode 100644 index 0000000000..c4529f3562 --- /dev/null +++ b/tests/thread 2/mutate_set.py @@ -0,0 +1,39 @@ +# test concurrent mutating access to a shared set object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared set +se = set([-1, -2, -3, -4]) + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + se.add(i) + assert i in se + + se.remove(i) + assert i not in se + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (50, i * 500, (i + 1) * 500)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check set has correct contents +print(sorted(se)) diff --git a/tests/thread 2/stress_aes.py b/tests/thread 2/stress_aes.py new file mode 100644 index 0000000000..ebf7af371b --- /dev/null +++ b/tests/thread 2/stress_aes.py @@ -0,0 +1,257 @@ +# Stress test for threads using AES encryption routines. +# +# AES was chosen because it is integer based and inplace so doesn't use the +# heap. It is therefore a good test of raw performance and correctness of the +# VM/runtime. It can be used to measure threading performance (concurrency is +# in principle possible) and correctness (it's non trivial for the encryption/ +# decryption to give the correct answer). +# +# The AES code comes first (code originates from a C version authored by D.P.George) +# and then the test harness at the bottom. It can be tuned to be more/less +# aggressive by changing the amount of data to encrypt, the number of loops and +# the number of threads. +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +################################################################## +# discrete arithmetic routines, mostly from a precomputed table + +# non-linear, invertible, substitution box +aes_s_box_table = bytes(( + 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, + 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0, + 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15, + 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75, + 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84, + 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf, + 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8, + 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2, + 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73, + 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb, + 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79, + 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08, + 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a, + 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e, + 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf, + 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16, +)) + +# multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b +def aes_gf8_mul_2(x): + if x & 0x80: + return (x << 1) ^ 0x11b + else: + return x << 1 + +def aes_gf8_mul_3(x): + return x ^ aes_gf8_mul_2(x) + +# non-linear, invertible, substitution box +def aes_s_box(a): + return aes_s_box_table[a & 0xff] + +# return 0x02^(a-1) in GF(2^8) +def aes_r_con(a): + ans = 1 + while a > 1: + ans <<= 1; + if ans & 0x100: + ans ^= 0x11b + a -= 1 + return ans + +################################################################## +# basic AES algorithm; see FIPS-197 +# +# Think of it as a pseudo random number generator, with each +# symbol in the sequence being a 16 byte block (the state). The +# key is a parameter of the algorithm and tells which particular +# sequence of random symbols you want. The initial vector, IV, +# sets the start of the sequence. The idea of a strong cipher +# is that it's very difficult to guess the key even if you know +# a large part of the sequence. The basic AES algorithm simply +# provides such a sequence. En/de-cryption is implemented here +# using OCB, where the sequence is xored against the plaintext. +# Care must be taken to (almost) always choose a different IV. + +# all inputs must be size 16 +def aes_add_round_key(state, w): + for i in range(16): + state[i] ^= w[i] + +# combined sub_bytes, shift_rows, mix_columns, add_round_key +# all inputs must be size 16 +def aes_sb_sr_mc_ark(state, w, w_idx, temp): + temp_idx = 0 + for i in range(4): + x0 = aes_s_box_table[state[i * 4]] + x1 = aes_s_box_table[state[1 + ((i + 1) & 3) * 4]] + x2 = aes_s_box_table[state[2 + ((i + 2) & 3) * 4]] + x3 = aes_s_box_table[state[3 + ((i + 3) & 3) * 4]] + temp[temp_idx] = aes_gf8_mul_2(x0) ^ aes_gf8_mul_3(x1) ^ x2 ^ x3 ^ w[w_idx] + temp[temp_idx + 1] = x0 ^ aes_gf8_mul_2(x1) ^ aes_gf8_mul_3(x2) ^ x3 ^ w[w_idx + 1] + temp[temp_idx + 2] = x0 ^ x1 ^ aes_gf8_mul_2(x2) ^ aes_gf8_mul_3(x3) ^ w[w_idx + 2] + temp[temp_idx + 3] = aes_gf8_mul_3(x0) ^ x1 ^ x2 ^ aes_gf8_mul_2(x3) ^ w[w_idx + 3] + w_idx += 4 + temp_idx += 4 + for i in range(16): + state[i] = temp[i] + +# combined sub_bytes, shift_rows, add_round_key +# all inputs must be size 16 +def aes_sb_sr_ark(state, w, w_idx, temp): + temp_idx = 0 + for i in range(4): + x0 = aes_s_box_table[state[i * 4]] + x1 = aes_s_box_table[state[1 + ((i + 1) & 3) * 4]] + x2 = aes_s_box_table[state[2 + ((i + 2) & 3) * 4]] + x3 = aes_s_box_table[state[3 + ((i + 3) & 3) * 4]] + temp[temp_idx] = x0 ^ w[w_idx] + temp[temp_idx + 1] = x1 ^ w[w_idx + 1] + temp[temp_idx + 2] = x2 ^ w[w_idx + 2] + temp[temp_idx + 3] = x3 ^ w[w_idx + 3] + w_idx += 4 + temp_idx += 4 + for i in range(16): + state[i] = temp[i] + +# take state as input and change it to the next state in the sequence +# state and temp have size 16, w has size 16 * (Nr + 1), Nr >= 1 +def aes_state(state, w, temp, nr): + aes_add_round_key(state, w) + w_idx = 16 + for i in range(nr - 1): + aes_sb_sr_mc_ark(state, w, w_idx, temp) + w_idx += 16 + aes_sb_sr_ark(state, w, w_idx, temp) + +# expand 'key' to 'w' for use with aes_state +# key has size 4 * Nk, w has size 16 * (Nr + 1), temp has size 16 +def aes_key_expansion(key, w, temp, nk, nr): + for i in range(4 * nk): + w[i] = key[i] + w_idx = 4 * nk - 4 + for i in range(nk, 4 * (nr + 1)): + t = temp + t_idx = 0 + if i % nk == 0: + t[0] = aes_s_box(w[w_idx + 1]) ^ aes_r_con(i // nk) + for j in range(1, 4): + t[j] = aes_s_box(w[w_idx + (j + 1) % 4]) + elif nk > 6 and i % nk == 4: + for j in range(0, 4): + t[j] = aes_s_box(w[w_idx + j]) + else: + t = w + t_idx = w_idx + w_idx += 4 + for j in range(4): + w[w_idx + j] = w[w_idx + j - 4 * nk] ^ t[t_idx + j] + +################################################################## +# simple use of AES algorithm, using output feedback (OFB) mode + +class AES: + def __init__(self, keysize): + if keysize == 128: + self.nk = 4 + self.nr = 10 + elif keysize == 192: + self.nk = 6 + self.nr = 12 + else: + assert keysize == 256 + self.nk = 8 + self.nr = 14 + + self.state = bytearray(16) + self.w = bytearray(16 * (self.nr + 1)) + self.temp = bytearray(16) + self.state_pos = 16 + + def set_key(self, key): + aes_key_expansion(key, self.w, self.temp, self.nk, self.nr) + self.state_pos = 16 + + def set_iv(self, iv): + for i in range(16): + self.state[i] = iv[i] + self.state_pos = 16; + + def get_some_state(self, n_needed): + if self.state_pos >= 16: + aes_state(self.state, self.w, self.temp, self.nr) + self.state_pos = 0 + n = 16 - self.state_pos + if n > n_needed: + n = n_needed + return n + + def apply_to(self, data): + idx = 0 + n = len(data) + while n > 0: + ln = self.get_some_state(n) + n -= ln + for i in range(ln): + data[idx + i] ^= self.state[self.state_pos + i] + idx += ln + self.state_pos += n + +################################################################## +# test code + +try: + import utime as time +except ImportError: + import time +import _thread + +class LockedCounter: + def __init__(self): + self.lock = _thread.allocate_lock() + self.value = 0 + + def add(self, val): + self.lock.acquire() + self.value += val + self.lock.release() + +count = LockedCounter() + +def thread_entry(): + global count + + aes = AES(256) + key = bytearray(256 // 8) + iv = bytearray(16) + data = bytearray(128) + # from now on we don't use the heap + + for loop in range(5): + # encrypt + aes.set_key(key) + aes.set_iv(iv) + for i in range(8): + aes.apply_to(data) + + # decrypt + aes.set_key(key) + aes.set_iv(iv) + for i in range(8): + aes.apply_to(data) + + # verify + for i in range(len(data)): + assert data[i] == 0 + + count.add(1) + +if __name__ == '__main__': + n_thread = 20 + for i in range(n_thread): + _thread.start_new_thread(thread_entry, ()) + while count.value < n_thread: + time.sleep(1) diff --git a/tests/thread 2/stress_create.py b/tests/thread 2/stress_create.py new file mode 100644 index 0000000000..2399746cca --- /dev/null +++ b/tests/thread 2/stress_create.py @@ -0,0 +1,22 @@ +# stress test for creating many threads + +try: + import utime as time +except ImportError: + import time +import _thread + +def thread_entry(n): + pass + +thread_num = 0 +while thread_num < 500: + try: + _thread.start_new_thread(thread_entry, (thread_num,)) + thread_num += 1 + except MemoryError: + pass + +# wait for the last threads to terminate +time.sleep(1) +print('done') diff --git a/tests/thread 2/stress_heap.py b/tests/thread 2/stress_heap.py new file mode 100644 index 0000000000..206cf1a860 --- /dev/null +++ b/tests/thread 2/stress_heap.py @@ -0,0 +1,48 @@ +# stress test for the heap by allocating lots of objects within threads +# allocates about 5mb on the heap +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def last(l): + return l[-1] + +def thread_entry(n): + # allocate a bytearray and fill it + data = bytearray(i for i in range(256)) + + # run a loop which allocates a small list and uses it each iteration + lst = 8 * [0] + sum = 0 + for i in range(n): + sum += last(lst) + lst = [0, 0, 0, 0, 0, 0, 0, i + 1] + + # check that the bytearray still has the right data + for i, b in enumerate(data): + assert i == b + + # print the result of the loop and indicate we are finished + with lock: + print(sum, lst[-1]) + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 10 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (10000,)) + +# wait for threads to finish +while n_finished < n_thread: + time.sleep(1) diff --git a/tests/thread 2/stress_recurse.py b/tests/thread 2/stress_recurse.py new file mode 100644 index 0000000000..8edee246ad --- /dev/null +++ b/tests/thread 2/stress_recurse.py @@ -0,0 +1,27 @@ +# test hitting the function recursion limit within a thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def foo(): + foo() + +def thread_entry(): + try: + foo() + except RuntimeError: + print('RuntimeError') + global finished + finished = True + +finished = False + +_thread.start_new_thread(thread_entry, ()) + +# busy wait for thread to finish +while not finished: + pass +print('done') diff --git a/tests/thread 2/thread_exc1.py b/tests/thread 2/thread_exc1.py new file mode 100644 index 0000000000..e00a16bd26 --- /dev/null +++ b/tests/thread 2/thread_exc1.py @@ -0,0 +1,32 @@ +# test raising and catching an exception within a thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def foo(): + raise ValueError + +def thread_entry(): + try: + foo() + except ValueError: + pass + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, ()) + +# busy wait for threads to finish +while n_finished < n_thread: + pass +print('done') diff --git a/tests/thread 2/thread_exc2.py b/tests/thread 2/thread_exc2.py new file mode 100644 index 0000000000..35cb324412 --- /dev/null +++ b/tests/thread 2/thread_exc2.py @@ -0,0 +1,10 @@ +# test raising exception within thread which is not caught +import utime +import _thread + +def thread_entry(): + raise ValueError + +_thread.start_new_thread(thread_entry, ()) +utime.sleep(1) +print('done') diff --git a/tests/thread 2/thread_exc2.py.exp b/tests/thread 2/thread_exc2.py.exp new file mode 100644 index 0000000000..cc7a20aa26 --- /dev/null +++ b/tests/thread 2/thread_exc2.py.exp @@ -0,0 +1,5 @@ +Unhandled exception in thread started by +Traceback (most recent call last): + File \.\+, line 6, in thread_entry +ValueError: +done diff --git a/tests/thread 2/thread_exit1.py b/tests/thread 2/thread_exit1.py new file mode 100644 index 0000000000..ad7b01d89b --- /dev/null +++ b/tests/thread 2/thread_exit1.py @@ -0,0 +1,21 @@ +# test _thread.exit() function +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def thread_entry(): + _thread.exit() + +_thread.start_new_thread(thread_entry, ()) +_thread.start_new_thread(thread_entry, ()) + +# wait for threads to finish +time.sleep(1) +print('done') diff --git a/tests/thread 2/thread_exit2.py b/tests/thread 2/thread_exit2.py new file mode 100644 index 0000000000..6bff8a1736 --- /dev/null +++ b/tests/thread 2/thread_exit2.py @@ -0,0 +1,21 @@ +# test raising SystemExit to finish a thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def thread_entry(): + raise SystemExit + +_thread.start_new_thread(thread_entry, ()) +_thread.start_new_thread(thread_entry, ()) + +# wait for threads to finish +time.sleep(1) +print('done') diff --git a/tests/thread 2/thread_gc1.py b/tests/thread 2/thread_gc1.py new file mode 100644 index 0000000000..2ea1891615 --- /dev/null +++ b/tests/thread 2/thread_gc1.py @@ -0,0 +1,36 @@ +# test that we can run the garbage collector within threads +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import gc +import _thread + +def thread_entry(n): + # allocate a bytearray and fill it + data = bytearray(i for i in range(256)) + + # do some work and call gc.collect() a few times + for i in range(n): + for i in range(len(data)): + data[i] = data[i] + gc.collect() + + # print whether the data remains intact and indicate we are finished + with lock: + print(list(data) == list(range(256))) + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (10,)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass diff --git a/tests/thread 2/thread_ident1.py b/tests/thread 2/thread_ident1.py new file mode 100644 index 0000000000..9a6f89ff5f --- /dev/null +++ b/tests/thread 2/thread_ident1.py @@ -0,0 +1,23 @@ +# test _thread.get_ident() function +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def thread_entry(): + tid = _thread.get_ident() + print('thread', type(tid) == int, tid != 0, tid != tid_main) + global finished + finished = True + +tid_main = _thread.get_ident() +print('main', type(tid_main) == int, tid_main != 0) + +finished = False +_thread.start_new_thread(thread_entry, ()) + +while not finished: + pass +print('done') diff --git a/tests/thread 2/thread_lock1.py b/tests/thread 2/thread_lock1.py new file mode 100644 index 0000000000..c2d7c9d1ed --- /dev/null +++ b/tests/thread 2/thread_lock1.py @@ -0,0 +1,48 @@ +# test _thread lock object using a single thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# create lock +lock = _thread.allocate_lock() + +print(type(lock) == _thread.LockType) + +# should be unlocked +print(lock.locked()) + +# basic acquire and release +print(lock.acquire()) +print(lock.locked()) +lock.release() +print(lock.locked()) + +# try acquire twice (second should fail) +print(lock.acquire()) +print(lock.locked()) +print(lock.acquire(0)) +print(lock.locked()) +lock.release() +print(lock.locked()) + +# test with capabilities of lock +with lock: + print(lock.locked()) + +# test that lock is unlocked if an error is rasied +try: + with lock: + print(lock.locked()) + raise KeyError +except KeyError: + print('KeyError') + print(lock.locked()) + +# test that we can't release an unlocked lock +try: + lock.release() +except RuntimeError: + print('RuntimeError') diff --git a/tests/thread 2/thread_lock2.py b/tests/thread 2/thread_lock2.py new file mode 100644 index 0000000000..4ef912dff5 --- /dev/null +++ b/tests/thread 2/thread_lock2.py @@ -0,0 +1,26 @@ +# test _thread lock objects with multiple threads +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +lock = _thread.allocate_lock() + +def thread_entry(): + lock.acquire() + print('have it') + lock.release() + +# spawn the threads +for i in range(4): + _thread.start_new_thread(thread_entry, ()) + +# wait for threads to finish +time.sleep(1) +print('done') diff --git a/tests/thread 2/thread_lock3.py b/tests/thread 2/thread_lock3.py new file mode 100644 index 0000000000..35808d99cb --- /dev/null +++ b/tests/thread 2/thread_lock3.py @@ -0,0 +1,29 @@ +# test thread coordination using a lock object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +lock = _thread.allocate_lock() +n_thread = 10 +n_finished = 0 + +def thread_entry(idx): + global n_finished + while True: + with lock: + if n_finished == idx: + break + print('my turn:', idx) + with lock: + n_finished += 1 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (i,)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass diff --git a/tests/thread 2/thread_lock4.py b/tests/thread 2/thread_lock4.py new file mode 100644 index 0000000000..440f3e90c6 --- /dev/null +++ b/tests/thread 2/thread_lock4.py @@ -0,0 +1,53 @@ +# test using lock to coordinate access to global mutable objects +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def fac(n): + x = 1 + for i in range(1, n + 1): + x *= i + return x + +def thread_entry(): + while True: + with jobs_lock: + try: + f, arg = jobs.pop(0) + except IndexError: + return + ans = f(arg) + with output_lock: + output.append((arg, ans)) + +# create a list of jobs +jobs = [(fac, i) for i in range(20, 80)] +jobs_lock = _thread.allocate_lock() +n_jobs = len(jobs) + +# create a list to store the results +output = [] +output_lock = _thread.allocate_lock() + +# spawn threads to do the jobs +for i in range(4): + _thread.start_new_thread(thread_entry, ()) + +# wait for the jobs to complete +while True: + with jobs_lock: + if len(output) == n_jobs: + break + time.sleep(1) + +# sort and print the results +output.sort(key=lambda x: x[0]) +for arg, ans in output: + print(arg, ans) diff --git a/tests/thread 2/thread_qstr1.py b/tests/thread 2/thread_qstr1.py new file mode 100644 index 0000000000..dccfb7f517 --- /dev/null +++ b/tests/thread 2/thread_qstr1.py @@ -0,0 +1,41 @@ +# test concurrent interning of strings +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +# function to check the interned string +def check(s, val): + assert type(s) == str + assert int(s) == val + +# main thread function +def th(base, n): + for i in range(n): + # this will intern the string and check it + exec("check('%u', %u)" % (base + i, base + i)) + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 +n_qstr_per_thread = 100 # make 1000 for a more stressful test (uses more heap) + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (i * n_qstr_per_thread, n_qstr_per_thread)) + +# wait for threads to finish +while n_finished < n_thread: + time.sleep(1) + +print('pass') diff --git a/tests/thread 2/thread_shared1.py b/tests/thread 2/thread_shared1.py new file mode 100644 index 0000000000..de339ad7f8 --- /dev/null +++ b/tests/thread 2/thread_shared1.py @@ -0,0 +1,33 @@ +# test capability for threads to access a shared immutable data structure +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def foo(i): + pass + +def thread_entry(n, tup): + for i in tup: + foo(i) + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 2 +n_finished = 0 + +# the shared data structure +tup = (1, 2, 3, 4) + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (100, tup)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass +print(tup) diff --git a/tests/thread 2/thread_shared2.py b/tests/thread 2/thread_shared2.py new file mode 100644 index 0000000000..2c749e6883 --- /dev/null +++ b/tests/thread 2/thread_shared2.py @@ -0,0 +1,34 @@ +# test capability for threads to access a shared mutable data structure +# (without contention because they access different parts of the structure) +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def foo(lst, i): + lst[i] += 1 + +def thread_entry(n, lst, idx): + for i in range(n): + foo(lst, idx) + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 2 +n_finished = 0 + +# the shared data structure +lst = [0, 0] + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, ((i + 1) * 10, lst, i)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass +print(lst) diff --git a/tests/thread 2/thread_sleep1.py b/tests/thread 2/thread_sleep1.py new file mode 100644 index 0000000000..d5aa99f977 --- /dev/null +++ b/tests/thread 2/thread_sleep1.py @@ -0,0 +1,33 @@ +# test threads sleeping +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime + sleep_ms = utime.sleep_ms +except ImportError: + import time + sleep_ms = lambda t: time.sleep(t / 1000) + +import _thread + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +def thread_entry(t): + global n_finished + sleep_ms(t) + sleep_ms(2 * t) + with lock: + n_finished += 1 + +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (10 * i,)) + +# wait for threads to finish +while n_finished < n_thread: + sleep_ms(100) +print('done', n_thread) diff --git a/tests/thread 2/thread_stacksize1.py b/tests/thread 2/thread_stacksize1.py new file mode 100644 index 0000000000..e7189fafbc --- /dev/null +++ b/tests/thread 2/thread_stacksize1.py @@ -0,0 +1,49 @@ +# test setting the thread stack size +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import sys +import _thread + +# different implementations have different minimum sizes +if sys.implementation.name == 'micropython': + sz = 2 * 1024 +else: + sz = 32 * 1024 + +def foo(): + pass + +def thread_entry(): + foo() + with lock: + global n_finished + n_finished += 1 + +# reset stack size to default +_thread.stack_size() + +# test set/get of stack size +print(_thread.stack_size()) +print(_thread.stack_size(sz)) +print(_thread.stack_size() == sz) +print(_thread.stack_size()) + +lock = _thread.allocate_lock() +n_thread = 2 +n_finished = 0 + +# set stack size and spawn a few threads +_thread.stack_size(sz) +for i in range(n_thread): + _thread.start_new_thread(thread_entry, ()) + +# reset stack size to default (for subsequent scripts on baremetal) +_thread.stack_size() + +# busy wait for threads to finish +while n_finished < n_thread: + pass +print('done') diff --git a/tests/thread 2/thread_start1.py b/tests/thread 2/thread_start1.py new file mode 100644 index 0000000000..94df6dc625 --- /dev/null +++ b/tests/thread 2/thread_start1.py @@ -0,0 +1,25 @@ +# test basic capability to start a new thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def foo(): + pass + +def thread_entry(n): + for i in range(n): + foo() + +_thread.start_new_thread(thread_entry, (10,)) +_thread.start_new_thread(thread_entry, (20,)) + +# wait for threads to finish +time.sleep(1) +print('done') diff --git a/tests/thread 2/thread_start2.py b/tests/thread 2/thread_start2.py new file mode 100644 index 0000000000..9412bb6183 --- /dev/null +++ b/tests/thread 2/thread_start2.py @@ -0,0 +1,28 @@ +# test capability to start a thread with keyword args +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def thread_entry(a0, a1, a2, a3): + print('thread', a0, a1, a2, a3) + +# spawn thread using kw args +_thread.start_new_thread(thread_entry, (10, 20), {'a2': 0, 'a3': 1}) + +# wait for thread to finish +time.sleep(1) + +# incorrect argument where dictionary is needed for keyword args +try: + _thread.start_new_thread(thread_entry, (), ()) +except TypeError: + print('TypeError') + +print('done') diff --git a/tests/unix 2/extra_coverage.py b/tests/unix 2/extra_coverage.py new file mode 100644 index 0000000000..13721f1f47 --- /dev/null +++ b/tests/unix 2/extra_coverage.py @@ -0,0 +1,74 @@ +try: + extra_coverage +except NameError: + print("SKIP") + raise SystemExit + +import uerrno +import uio + +data = extra_coverage() + +# test hashing of str/bytes that have an invalid hash +print(data[0], data[1]) +print(hash(data[0])) +print(hash(data[1])) +print(hash(bytes(data[0], 'utf8'))) +print(hash(str(data[1], 'utf8'))) + +# test streams +stream = data[2] # has set_error and set_buf. Write always returns error +stream.set_error(uerrno.EAGAIN) # non-blocking error +print(stream.read()) # read all encounters non-blocking error +print(stream.read(1)) # read 1 byte encounters non-blocking error +print(stream.readline()) # readline encounters non-blocking error +print(stream.readinto(bytearray(10))) # readinto encounters non-blocking error +print(stream.write(b'1')) # write encounters non-blocking error +print(stream.write1(b'1')) # write1 encounters non-blocking error +stream.set_buf(b'123') +print(stream.read(4)) # read encounters non-blocking error after successful reads +stream.set_buf(b'123') +print(stream.read1(4)) # read1 encounters non-blocking error after successful reads +stream.set_buf(b'123') +print(stream.readline(4)) # readline encounters non-blocking error after successful reads +try: + print(stream.ioctl(0, 0)) # ioctl encounters non-blocking error; raises OSError +except OSError: + print('OSError') +stream.set_error(0) +print(stream.ioctl(0, bytearray(10))) # successful ioctl call + +stream2 = data[3] # is textio +print(stream2.read(1)) # read 1 byte encounters non-blocking error with textio stream + +# test BufferedWriter with stream errors +stream.set_error(uerrno.EAGAIN) +buf = uio.BufferedWriter(stream, 8) +print(buf.write(bytearray(16))) + +# test basic import of frozen scripts +import frzstr1 +import frzmpy1 + +# test import of frozen packages with __init__.py +import frzstr_pkg1 +print(frzstr_pkg1.x) +import frzmpy_pkg1 +print(frzmpy_pkg1.x) + +# test import of frozen packages without __init__.py +from frzstr_pkg2.mod import Foo +print(Foo.x) +from frzmpy_pkg2.mod import Foo +print(Foo.x) + +# test raising exception in frozen script +try: + import frzmpy2 +except ZeroDivisionError: + print('ZeroDivisionError') + +# test loading a resource from a frozen string +import uio +buf = uio.resource_stream('frzstr_pkg2', 'mod.py') +print(buf.read(21)) diff --git a/tests/unix 2/extra_coverage.py.exp b/tests/unix 2/extra_coverage.py.exp new file mode 100644 index 0000000000..06b5d37903 --- /dev/null +++ b/tests/unix 2/extra_coverage.py.exp @@ -0,0 +1,106 @@ +# mp_printf +-123 +123 123 +-0123 +123 +123 +1ABCDEF +ab abc + +false true +(null) +-2147483648 +2147483648 +80000000 +80000000 +abc +# GC +0 +0 +# vstr +tests +sts + +test +tes +RuntimeError: +RuntimeError: +# repl +ame__ + +argv byteorder exc_info exit +getsizeof implementation maxsize modules +path platform print_exception +stderr stdin stdout version +version_info +ementation +# attrtuple +(start=1, stop=2, step=3) +# str +1 +# bytearray +data +# mpz +1 +12345678 +0 +0 +0 +0 +0 +1 +12345 +6 +# runtime utils +TypeError: unsupported type for __abs__: 'str' +TypeError: unsupported types for __divmod__: 'str', 'str' +Warning: test +# format float +? ++1e+00 ++1e+00 +# binary +123 +456 +# VM +2 1 +# scheduler +sched(0)=1 +sched(1)=1 +sched(2)=1 +sched(3)=1 +sched(4)=0 +unlocked +3 +2 +1 +0 +0123456789 b'0123456789' +7300 +7300 +7300 +7300 +None +None +None +None +None +None +b'123' +b'123' +b'123' +OSError +0 +None +None +frzstr1 +frzmpy1 +frzstr_pkg1.__init__ +1 +frzmpy_pkg1.__init__ +1 +frzstr_pkg2.mod +1 +frzmpy_pkg2.mod +1 +ZeroDivisionError +b'# test frozen package' diff --git a/tests/unix 2/ffi_callback.py b/tests/unix 2/ffi_callback.py new file mode 100644 index 0000000000..23b058bcec --- /dev/null +++ b/tests/unix 2/ffi_callback.py @@ -0,0 +1,33 @@ +try: + import ffi +except ImportError: + print("SKIP") + raise SystemExit + + +def ffi_open(names): + err = None + for n in names: + try: + mod = ffi.open(n) + return mod + except OSError as e: + err = e + raise err + +libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib')) + +qsort = libc.func("v", "qsort", "piip") + +def cmp(pa, pb): + a = ffi.as_bytearray(pa, 1) + b = ffi.as_bytearray(pb, 1) + #print("cmp:", a, b) + return a[0] - b[0] + +cmp_c = ffi.callback("i", cmp, "pp") + +s = bytearray(b"foobar") +print("org string:", s) +qsort(s, len(s), 1, cmp_c) +print("qsort'ed:", s) diff --git a/tests/unix 2/ffi_callback.py.exp b/tests/unix 2/ffi_callback.py.exp new file mode 100644 index 0000000000..d06fec52fb --- /dev/null +++ b/tests/unix 2/ffi_callback.py.exp @@ -0,0 +1,2 @@ +org string: bytearray(b'foobar') +qsort'ed: bytearray(b'abfoor') diff --git a/tests/unix 2/ffi_float.py b/tests/unix 2/ffi_float.py new file mode 100644 index 0000000000..c92a39bcdc --- /dev/null +++ b/tests/unix 2/ffi_float.py @@ -0,0 +1,32 @@ +# test ffi float support +try: + import ffi +except ImportError: + print("SKIP") + raise SystemExit + + +def ffi_open(names): + err = None + for n in names: + try: + mod = ffi.open(n) + return mod + except OSError as e: + err = e + raise err + +libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib')) + +strtof = libc.func("f", "strtof", "sp") +print('%.6f' % strtof('1.23', None)) + +strtod = libc.func("d", "strtod", "sp") +print('%.6f' % strtod('1.23', None)) + +# test passing double and float args +libm = ffi_open(('libm.so', 'libm.so.6', 'libc.so.0', 'libc.so.6', 'libc.dylib')) +tgamma = libm.func('d', 'tgamma', 'd') +for fun in (tgamma,): + for val in (0.5, 1, 1.0, 1.5, 4, 4.0): + print('%.6f' % fun(val)) diff --git a/tests/unix 2/ffi_float.py.exp b/tests/unix 2/ffi_float.py.exp new file mode 100644 index 0000000000..b9d7da2bdb --- /dev/null +++ b/tests/unix 2/ffi_float.py.exp @@ -0,0 +1,8 @@ +1.230000 +1.230000 +1.772454 +1.000000 +1.000000 +0.886227 +6.000000 +6.000000 diff --git a/tests/unix 2/ffi_float2.py b/tests/unix 2/ffi_float2.py new file mode 100644 index 0000000000..721eb4d192 --- /dev/null +++ b/tests/unix 2/ffi_float2.py @@ -0,0 +1,31 @@ +# test ffi float support +try: + import ffi +except ImportError: + print("SKIP") + raise SystemExit + + +def ffi_open(names): + err = None + for n in names: + try: + mod = ffi.open(n) + return mod + except OSError as e: + err = e + raise err + +libm = ffi_open(('libm.so', 'libm.so.6', 'libc.so.0', 'libc.so.6', 'libc.dylib')) + +# Some libc's implement tgammaf as header macro with tgamma(), so don't assume +# it'll be in library. +try: + tgammaf = libm.func('f', 'tgammaf', 'f') +except OSError: + print("SKIP") + raise SystemExit + +for fun in (tgammaf,): + for val in (0.5, 1, 1.0, 1.5, 4, 4.0): + print('%.6f' % fun(val)) diff --git a/tests/unix 2/ffi_float2.py.exp b/tests/unix 2/ffi_float2.py.exp new file mode 100644 index 0000000000..58fc6a01ac --- /dev/null +++ b/tests/unix 2/ffi_float2.py.exp @@ -0,0 +1,6 @@ +1.772454 +1.000000 +1.000000 +0.886227 +6.000000 +6.000000 diff --git a/tools/.gitattributes 2 b/tools/.gitattributes 2 new file mode 100644 index 0000000000..9206a0bfc1 --- /dev/null +++ b/tools/.gitattributes 2 @@ -0,0 +1 @@ +*.tar.gz binary diff --git a/tools/.gitignore 2 b/tools/.gitignore 2 new file mode 100644 index 0000000000..9f65f493bc --- /dev/null +++ b/tools/.gitignore 2 @@ -0,0 +1,8 @@ +tinytest/.gitignore +tinytest/.travis.yml +tinytest/Makefile +tinytest/Makefile.arm-cortex-m3-qemu +tinytest/Makefile.avr +tinytest/TODO +tinytest/portable_demo.c +tinytest/tinytest_demo.c From 2f476731ecd8bc108f00210b81a0c3e0333d8982 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Wed, 16 Dec 2020 10:35:41 -0500 Subject: [PATCH 083/146] removing pesky directories --- tests/README 2 | 18 - tests/extmod 2/btree1.py | 89 --- tests/extmod 2/framebuf1.py | 109 ---- tests/extmod 2/framebuf16.py | 59 -- tests/extmod 2/framebuf2.py.exp | 57 -- tests/extmod 2/framebuf4.py | 53 -- tests/extmod 2/framebuf_subclass.py | 20 - tests/extmod 2/machine1.py | 28 - tests/extmod 2/machine_pinbase.py | 30 - tests/extmod 2/machine_pinbase.py.exp | 9 - tests/extmod 2/ticks_diff.py | 33 - tests/extmod 2/time_ms_us.py | 22 - tests/extmod 2/time_ms_us.py.exp | 3 - tests/extmod 2/ubinascii_a2b_base64.py | 49 -- tests/extmod 2/ubinascii_hexlify.py | 17 - tests/extmod 2/uctypes_32bit_intbig.py.exp | 11 - .../uctypes_array_assign_native_le.py | 89 --- .../uctypes_array_assign_native_le.py.exp | 11 - .../uctypes_array_assign_native_le_intbig.py | 43 -- tests/extmod 2/uctypes_bytearray.py | 22 - tests/extmod 2/uctypes_byteat.py | 10 - tests/extmod 2/uctypes_byteat.py.exp | 2 - tests/extmod 2/uctypes_error.py | 37 -- tests/extmod 2/uctypes_error.py.exp | 4 - tests/extmod 2/uctypes_le_float.py | 24 - tests/extmod 2/uctypes_native_float.py | 20 - tests/extmod 2/uctypes_ptr_le.py | 34 - tests/extmod 2/uctypes_ptr_native_le.py.exp | 6 - tests/extmod 2/uctypes_sizeof.py.exp | 7 - tests/extmod 2/uhashlib_sha1.py | 28 - tests/extmod 2/ujson_dump.py | 30 - tests/extmod 2/ujson_dumps_extra.py | 9 - tests/extmod 2/ujson_dumps_float.py | 10 - tests/extmod 2/ujson_load_readinto.py.exp | 4 - tests/extmod 2/ujson_loads.py | 74 --- tests/extmod 2/ujson_loads_float.py | 17 - tests/extmod 2/urandom_basic.py | 29 - tests/extmod 2/ure1.py | 103 --- tests/extmod 2/ure_debug.py.exp | 15 - tests/extmod 2/ure_error.py | 25 - tests/extmod 2/ure_namedclass.py | 32 - tests/extmod 2/ure_stack_overflow.py.exp | 1 - tests/extmod 2/ure_sub_unmatched.py.exp | 1 - tests/extmod 2/ussl_basic.py | 59 -- tests/extmod 2/utimeq1.py | 137 ---- tests/extmod 2/utimeq_stable.py.exp | 1 - tests/extmod 2/uzlib_decompio.py | 33 - tests/extmod 2/uzlib_decompio_gz.py.exp | 13 - tests/extmod 2/vfs_fat_fileio1.py | 139 ---- tests/extmod 2/vfs_fat_fileio1.py.exp | 18 - tests/extmod 2/vfs_fat_more.py.exp | 29 - tests/extmod 2/vfs_fat_oldproto.py.exp | 3 - tests/extmod 2/vfs_fat_ramdisk.py.exp | 17 - tests/extmod 2/websocket_basic.py.exp | 14 - tests/feature_check 2/README | 4 - tests/feature_check 2/async_check.py | 3 - tests/feature_check 2/async_check.py.exp | 0 tests/feature_check 2/byteorder.py | 2 - tests/feature_check 2/byteorder.py.exp | 0 tests/feature_check 2/complex.py | 5 - tests/feature_check 2/complex.py.exp | 0 tests/feature_check 2/const.py | 1 - tests/feature_check 2/const.py.exp | 0 tests/feature_check 2/coverage.py | 5 - tests/feature_check 2/coverage.py.exp | 0 tests/feature_check 2/float.py | 13 - tests/feature_check 2/float.py.exp | 1 - tests/feature_check 2/int_big.py | 2 - tests/feature_check 2/int_big.py.exp | 1 - tests/feature_check 2/native_check.py | 4 - tests/feature_check 2/native_check.py.exp | 0 tests/feature_check 2/repl_emacs_check.py | 3 - tests/feature_check 2/repl_emacs_check.py.exp | 7 - tests/feature_check 2/reverse_ops.py | 9 - tests/feature_check 2/reverse_ops.py.exp | 0 tests/feature_check 2/set_check.py | 2 - tests/feature_check 2/set_check.py.exp | 0 tests/float 2/array_construct.py | 10 - tests/float 2/builtin_float_hash.py | 25 - tests/float 2/builtin_float_minmax.py | 31 - tests/float 2/builtin_float_pow.py | 11 - tests/float 2/builtin_float_round.py | 24 - tests/float 2/builtin_float_round_intbig.py | 4 - tests/float 2/bytearray_construct.py | 9 - tests/float 2/bytes_construct.py | 9 - tests/float 2/cmath_fun.py | 55 -- tests/float 2/cmath_fun_special.py | 31 - tests/float 2/complex1.py | 116 ---- tests/float 2/complex1_intbig.py | 4 - tests/float 2/float1.py | 119 ---- tests/float 2/float2int_doubleprec_intbig.py | 100 --- tests/float 2/float2int_fp30_intbig.py | 97 --- tests/float 2/float2int_intbig.py | 99 --- tests/float 2/float_array.py | 20 - tests/float 2/float_compare.py | 22 - tests/float 2/float_divmod.py | 25 - tests/float 2/float_divmod_relaxed.py | 33 - tests/float 2/float_format.py | 19 - tests/float 2/float_parse.py | 32 - tests/float 2/float_parse_doubleprec.py | 21 - tests/float 2/float_struct.py | 17 - tests/float 2/int_big_float.py | 28 - tests/float 2/int_divzero.py | 9 - tests/float 2/int_power.py | 8 - tests/float 2/list_index.py | 8 - tests/float 2/math_domain.py | 51 -- tests/float 2/math_domain_special.py | 36 - tests/float 2/math_fun.py | 63 -- tests/float 2/math_fun_bool.py | 16 - tests/float 2/math_fun_int.py | 14 - tests/float 2/math_fun_intbig.py | 11 - tests/float 2/math_fun_special.py | 35 - tests/float 2/python36.py | 10 - tests/float 2/python36.py.exp | 5 - tests/float 2/string_format.py | 41 -- tests/float 2/string_format2.py | 106 --- tests/float 2/string_format_fp30.py | 41 -- tests/float 2/string_format_modulo.py | 49 -- tests/float 2/string_format_modulo2.py | 24 - tests/float 2/string_format_modulo2_intbig.py | 21 - tests/float 2/string_format_modulo3.py | 3 - tests/float 2/string_format_modulo3.py.exp | 2 - tests/float 2/true_value.py | 7 - tests/float 2/types.py | 17 - tests/inlineasm 2/asmargs.py | 29 - tests/inlineasm 2/asmargs.py.exp | 5 - tests/inlineasm 2/asmbcc.py | 27 - tests/inlineasm 2/asmbcc.py.exp | 4 - tests/inlineasm 2/asmbitops.py | 13 - tests/inlineasm 2/asmbitops.py.exp | 4 - tests/inlineasm 2/asmblbx.py | 21 - tests/inlineasm 2/asmblbx.py.exp | 2 - tests/inlineasm 2/asmconst.py | 8 - tests/inlineasm 2/asmconst.py.exp | 1 - tests/inlineasm 2/asmdiv.py | 16 - tests/inlineasm 2/asmdiv.py.exp | 7 - tests/inlineasm 2/asmfpaddsub.py | 14 - tests/inlineasm 2/asmfpaddsub.py.exp | 1 - tests/inlineasm 2/asmfpcmp.py | 14 - tests/inlineasm 2/asmfpcmp.py.exp | 3 - tests/inlineasm 2/asmfpldrstr.py | 11 - tests/inlineasm 2/asmfpldrstr.py.exp | 1 - tests/inlineasm 2/asmfpmuldiv.py | 14 - tests/inlineasm 2/asmfpmuldiv.py.exp | 1 - tests/inlineasm 2/asmfpsqrt.py | 14 - tests/inlineasm 2/asmfpsqrt.py.exp | 1 - tests/inlineasm 2/asmit.py | 16 - tests/inlineasm 2/asmit.py.exp | 2 - tests/inlineasm 2/asmpushpop.py | 8 - tests/inlineasm 2/asmpushpop.py.exp | 1 - tests/inlineasm 2/asmrettype.py | 21 - tests/inlineasm 2/asmrettype.py.exp | 4 - tests/inlineasm 2/asmshift.py | 29 - tests/inlineasm 2/asmshift.py.exp | 6 - tests/inlineasm 2/asmspecialregs.py | 10 - tests/inlineasm 2/asmspecialregs.py.exp | 2 - tests/inlineasm 2/asmsum.py | 57 -- tests/inlineasm 2/asmsum.py.exp | 2 - tests/jni 2/README | 11 - tests/jni 2/list.py | 15 - tests/jni 2/list.py.exp | 4 - tests/jni 2/object.py | 15 - tests/jni 2/object.py.exp | 3 - tests/jni 2/system_out.py | 8 - tests/jni 2/system_out.py.exp | 1 - tests/net_hosted 2/README | 11 - tests/net_hosted 2/accept_nonblock.py | 16 - tests/net_hosted 2/accept_nonblock.py.exp | 1 - tests/net_hosted 2/accept_timeout.py | 22 - tests/net_hosted 2/accept_timeout.py.exp | 1 - tests/net_hosted 2/connect_nonblock.py | 20 - tests/net_hosted 2/connect_nonblock.py.exp | 1 - tests/net_hosted 2/connect_poll.py | 32 - tests/net_hosted 2/connect_poll.py.exp | 3 - tests/net_hosted 2/ssl_getpeercert.py | 21 - tests/net_hosted 2/ssl_getpeercert.py.exp | 1 - tests/net_inet 2/README | 5 - tests/net_inet 2/test_tls_sites.py | 59 -- tests/net_inet 2/test_tls_sites.py.exp | 5 - tests/run-bench-tests 2 | 97 --- tests/run-tests 2 | 615 ------------------ tests/stress 2/dict_copy.py | 7 - tests/stress 2/dict_create.py | 8 - tests/stress 2/dict_create_max.py | 13 - tests/stress 2/gc_trace.py | 17 - tests/stress 2/list_sort.py | 6 - tests/stress 2/recursion.py | 7 - tests/stress 2/recursive_data.py | 13 - tests/stress 2/recursive_data.py.exp | 1 - tests/stress 2/recursive_gen.py | 18 - tests/stress 2/recursive_iternext.py | 57 -- tests/stress 2/recursive_iternext.py.exp | 4 - tests/thread 2/mutate_bytearray.py | 46 -- tests/thread 2/mutate_dict.py | 44 -- tests/thread 2/mutate_instance.py | 45 -- tests/thread 2/mutate_list.py | 46 -- tests/thread 2/mutate_set.py | 39 -- tests/thread 2/stress_aes.py | 257 -------- tests/thread 2/stress_create.py | 22 - tests/thread 2/stress_heap.py | 48 -- tests/thread 2/stress_recurse.py | 27 - tests/thread 2/thread_exc1.py | 32 - tests/thread 2/thread_exc2.py | 10 - tests/thread 2/thread_exc2.py.exp | 5 - tests/thread 2/thread_exit1.py | 21 - tests/thread 2/thread_exit2.py | 21 - tests/thread 2/thread_gc1.py | 36 - tests/thread 2/thread_ident1.py | 23 - tests/thread 2/thread_lock1.py | 48 -- tests/thread 2/thread_lock2.py | 26 - tests/thread 2/thread_lock3.py | 29 - tests/thread 2/thread_lock4.py | 53 -- tests/thread 2/thread_qstr1.py | 41 -- tests/thread 2/thread_shared1.py | 33 - tests/thread 2/thread_shared2.py | 34 - tests/thread 2/thread_sleep1.py | 33 - tests/thread 2/thread_stacksize1.py | 49 -- tests/thread 2/thread_start1.py | 25 - tests/thread 2/thread_start2.py | 28 - tests/unix 2/extra_coverage.py | 74 --- tests/unix 2/extra_coverage.py.exp | 106 --- tests/unix 2/ffi_callback.py | 33 - tests/unix 2/ffi_callback.py.exp | 2 - tests/unix 2/ffi_float.py | 32 - tests/unix 2/ffi_float.py.exp | 8 - tests/unix 2/ffi_float2.py | 31 - tests/unix 2/ffi_float2.py.exp | 6 - 227 files changed, 6257 deletions(-) delete mode 100644 tests/README 2 delete mode 100644 tests/extmod 2/btree1.py delete mode 100644 tests/extmod 2/framebuf1.py delete mode 100644 tests/extmod 2/framebuf16.py delete mode 100644 tests/extmod 2/framebuf2.py.exp delete mode 100644 tests/extmod 2/framebuf4.py delete mode 100644 tests/extmod 2/framebuf_subclass.py delete mode 100644 tests/extmod 2/machine1.py delete mode 100644 tests/extmod 2/machine_pinbase.py delete mode 100644 tests/extmod 2/machine_pinbase.py.exp delete mode 100644 tests/extmod 2/ticks_diff.py delete mode 100644 tests/extmod 2/time_ms_us.py delete mode 100644 tests/extmod 2/time_ms_us.py.exp delete mode 100644 tests/extmod 2/ubinascii_a2b_base64.py delete mode 100644 tests/extmod 2/ubinascii_hexlify.py delete mode 100644 tests/extmod 2/uctypes_32bit_intbig.py.exp delete mode 100644 tests/extmod 2/uctypes_array_assign_native_le.py delete mode 100644 tests/extmod 2/uctypes_array_assign_native_le.py.exp delete mode 100644 tests/extmod 2/uctypes_array_assign_native_le_intbig.py delete mode 100644 tests/extmod 2/uctypes_bytearray.py delete mode 100644 tests/extmod 2/uctypes_byteat.py delete mode 100644 tests/extmod 2/uctypes_byteat.py.exp delete mode 100644 tests/extmod 2/uctypes_error.py delete mode 100644 tests/extmod 2/uctypes_error.py.exp delete mode 100644 tests/extmod 2/uctypes_le_float.py delete mode 100644 tests/extmod 2/uctypes_native_float.py delete mode 100644 tests/extmod 2/uctypes_ptr_le.py delete mode 100644 tests/extmod 2/uctypes_ptr_native_le.py.exp delete mode 100644 tests/extmod 2/uctypes_sizeof.py.exp delete mode 100644 tests/extmod 2/uhashlib_sha1.py delete mode 100644 tests/extmod 2/ujson_dump.py delete mode 100644 tests/extmod 2/ujson_dumps_extra.py delete mode 100644 tests/extmod 2/ujson_dumps_float.py delete mode 100644 tests/extmod 2/ujson_load_readinto.py.exp delete mode 100644 tests/extmod 2/ujson_loads.py delete mode 100644 tests/extmod 2/ujson_loads_float.py delete mode 100644 tests/extmod 2/urandom_basic.py delete mode 100644 tests/extmod 2/ure1.py delete mode 100644 tests/extmod 2/ure_debug.py.exp delete mode 100644 tests/extmod 2/ure_error.py delete mode 100644 tests/extmod 2/ure_namedclass.py delete mode 100644 tests/extmod 2/ure_stack_overflow.py.exp delete mode 100644 tests/extmod 2/ure_sub_unmatched.py.exp delete mode 100644 tests/extmod 2/ussl_basic.py delete mode 100644 tests/extmod 2/utimeq1.py delete mode 100644 tests/extmod 2/utimeq_stable.py.exp delete mode 100644 tests/extmod 2/uzlib_decompio.py delete mode 100644 tests/extmod 2/uzlib_decompio_gz.py.exp delete mode 100644 tests/extmod 2/vfs_fat_fileio1.py delete mode 100644 tests/extmod 2/vfs_fat_fileio1.py.exp delete mode 100644 tests/extmod 2/vfs_fat_more.py.exp delete mode 100644 tests/extmod 2/vfs_fat_oldproto.py.exp delete mode 100644 tests/extmod 2/vfs_fat_ramdisk.py.exp delete mode 100644 tests/extmod 2/websocket_basic.py.exp delete mode 100644 tests/feature_check 2/README delete mode 100644 tests/feature_check 2/async_check.py delete mode 100644 tests/feature_check 2/async_check.py.exp delete mode 100644 tests/feature_check 2/byteorder.py delete mode 100644 tests/feature_check 2/byteorder.py.exp delete mode 100644 tests/feature_check 2/complex.py delete mode 100644 tests/feature_check 2/complex.py.exp delete mode 100644 tests/feature_check 2/const.py delete mode 100644 tests/feature_check 2/const.py.exp delete mode 100644 tests/feature_check 2/coverage.py delete mode 100644 tests/feature_check 2/coverage.py.exp delete mode 100644 tests/feature_check 2/float.py delete mode 100644 tests/feature_check 2/float.py.exp delete mode 100644 tests/feature_check 2/int_big.py delete mode 100644 tests/feature_check 2/int_big.py.exp delete mode 100644 tests/feature_check 2/native_check.py delete mode 100644 tests/feature_check 2/native_check.py.exp delete mode 100644 tests/feature_check 2/repl_emacs_check.py delete mode 100644 tests/feature_check 2/repl_emacs_check.py.exp delete mode 100644 tests/feature_check 2/reverse_ops.py delete mode 100644 tests/feature_check 2/reverse_ops.py.exp delete mode 100644 tests/feature_check 2/set_check.py delete mode 100644 tests/feature_check 2/set_check.py.exp delete mode 100644 tests/float 2/array_construct.py delete mode 100644 tests/float 2/builtin_float_hash.py delete mode 100644 tests/float 2/builtin_float_minmax.py delete mode 100644 tests/float 2/builtin_float_pow.py delete mode 100644 tests/float 2/builtin_float_round.py delete mode 100644 tests/float 2/builtin_float_round_intbig.py delete mode 100644 tests/float 2/bytearray_construct.py delete mode 100644 tests/float 2/bytes_construct.py delete mode 100644 tests/float 2/cmath_fun.py delete mode 100644 tests/float 2/cmath_fun_special.py delete mode 100644 tests/float 2/complex1.py delete mode 100644 tests/float 2/complex1_intbig.py delete mode 100644 tests/float 2/float1.py delete mode 100644 tests/float 2/float2int_doubleprec_intbig.py delete mode 100644 tests/float 2/float2int_fp30_intbig.py delete mode 100644 tests/float 2/float2int_intbig.py delete mode 100644 tests/float 2/float_array.py delete mode 100644 tests/float 2/float_compare.py delete mode 100644 tests/float 2/float_divmod.py delete mode 100644 tests/float 2/float_divmod_relaxed.py delete mode 100644 tests/float 2/float_format.py delete mode 100644 tests/float 2/float_parse.py delete mode 100644 tests/float 2/float_parse_doubleprec.py delete mode 100644 tests/float 2/float_struct.py delete mode 100644 tests/float 2/int_big_float.py delete mode 100644 tests/float 2/int_divzero.py delete mode 100644 tests/float 2/int_power.py delete mode 100644 tests/float 2/list_index.py delete mode 100644 tests/float 2/math_domain.py delete mode 100644 tests/float 2/math_domain_special.py delete mode 100644 tests/float 2/math_fun.py delete mode 100644 tests/float 2/math_fun_bool.py delete mode 100644 tests/float 2/math_fun_int.py delete mode 100644 tests/float 2/math_fun_intbig.py delete mode 100644 tests/float 2/math_fun_special.py delete mode 100644 tests/float 2/python36.py delete mode 100644 tests/float 2/python36.py.exp delete mode 100644 tests/float 2/string_format.py delete mode 100644 tests/float 2/string_format2.py delete mode 100644 tests/float 2/string_format_fp30.py delete mode 100644 tests/float 2/string_format_modulo.py delete mode 100644 tests/float 2/string_format_modulo2.py delete mode 100644 tests/float 2/string_format_modulo2_intbig.py delete mode 100644 tests/float 2/string_format_modulo3.py delete mode 100644 tests/float 2/string_format_modulo3.py.exp delete mode 100644 tests/float 2/true_value.py delete mode 100644 tests/float 2/types.py delete mode 100644 tests/inlineasm 2/asmargs.py delete mode 100644 tests/inlineasm 2/asmargs.py.exp delete mode 100644 tests/inlineasm 2/asmbcc.py delete mode 100644 tests/inlineasm 2/asmbcc.py.exp delete mode 100644 tests/inlineasm 2/asmbitops.py delete mode 100644 tests/inlineasm 2/asmbitops.py.exp delete mode 100644 tests/inlineasm 2/asmblbx.py delete mode 100644 tests/inlineasm 2/asmblbx.py.exp delete mode 100644 tests/inlineasm 2/asmconst.py delete mode 100644 tests/inlineasm 2/asmconst.py.exp delete mode 100644 tests/inlineasm 2/asmdiv.py delete mode 100644 tests/inlineasm 2/asmdiv.py.exp delete mode 100644 tests/inlineasm 2/asmfpaddsub.py delete mode 100644 tests/inlineasm 2/asmfpaddsub.py.exp delete mode 100644 tests/inlineasm 2/asmfpcmp.py delete mode 100644 tests/inlineasm 2/asmfpcmp.py.exp delete mode 100644 tests/inlineasm 2/asmfpldrstr.py delete mode 100644 tests/inlineasm 2/asmfpldrstr.py.exp delete mode 100644 tests/inlineasm 2/asmfpmuldiv.py delete mode 100644 tests/inlineasm 2/asmfpmuldiv.py.exp delete mode 100644 tests/inlineasm 2/asmfpsqrt.py delete mode 100644 tests/inlineasm 2/asmfpsqrt.py.exp delete mode 100644 tests/inlineasm 2/asmit.py delete mode 100644 tests/inlineasm 2/asmit.py.exp delete mode 100644 tests/inlineasm 2/asmpushpop.py delete mode 100644 tests/inlineasm 2/asmpushpop.py.exp delete mode 100644 tests/inlineasm 2/asmrettype.py delete mode 100644 tests/inlineasm 2/asmrettype.py.exp delete mode 100644 tests/inlineasm 2/asmshift.py delete mode 100644 tests/inlineasm 2/asmshift.py.exp delete mode 100644 tests/inlineasm 2/asmspecialregs.py delete mode 100644 tests/inlineasm 2/asmspecialregs.py.exp delete mode 100644 tests/inlineasm 2/asmsum.py delete mode 100644 tests/inlineasm 2/asmsum.py.exp delete mode 100644 tests/jni 2/README delete mode 100644 tests/jni 2/list.py delete mode 100644 tests/jni 2/list.py.exp delete mode 100644 tests/jni 2/object.py delete mode 100644 tests/jni 2/object.py.exp delete mode 100644 tests/jni 2/system_out.py delete mode 100644 tests/jni 2/system_out.py.exp delete mode 100644 tests/net_hosted 2/README delete mode 100644 tests/net_hosted 2/accept_nonblock.py delete mode 100644 tests/net_hosted 2/accept_nonblock.py.exp delete mode 100644 tests/net_hosted 2/accept_timeout.py delete mode 100644 tests/net_hosted 2/accept_timeout.py.exp delete mode 100644 tests/net_hosted 2/connect_nonblock.py delete mode 100644 tests/net_hosted 2/connect_nonblock.py.exp delete mode 100644 tests/net_hosted 2/connect_poll.py delete mode 100644 tests/net_hosted 2/connect_poll.py.exp delete mode 100644 tests/net_hosted 2/ssl_getpeercert.py delete mode 100644 tests/net_hosted 2/ssl_getpeercert.py.exp delete mode 100644 tests/net_inet 2/README delete mode 100644 tests/net_inet 2/test_tls_sites.py delete mode 100644 tests/net_inet 2/test_tls_sites.py.exp delete mode 100755 tests/run-bench-tests 2 delete mode 100755 tests/run-tests 2 delete mode 100644 tests/stress 2/dict_copy.py delete mode 100644 tests/stress 2/dict_create.py delete mode 100644 tests/stress 2/dict_create_max.py delete mode 100644 tests/stress 2/gc_trace.py delete mode 100644 tests/stress 2/list_sort.py delete mode 100644 tests/stress 2/recursion.py delete mode 100644 tests/stress 2/recursive_data.py delete mode 100644 tests/stress 2/recursive_data.py.exp delete mode 100644 tests/stress 2/recursive_gen.py delete mode 100644 tests/stress 2/recursive_iternext.py delete mode 100644 tests/stress 2/recursive_iternext.py.exp delete mode 100644 tests/thread 2/mutate_bytearray.py delete mode 100644 tests/thread 2/mutate_dict.py delete mode 100644 tests/thread 2/mutate_instance.py delete mode 100644 tests/thread 2/mutate_list.py delete mode 100644 tests/thread 2/mutate_set.py delete mode 100644 tests/thread 2/stress_aes.py delete mode 100644 tests/thread 2/stress_create.py delete mode 100644 tests/thread 2/stress_heap.py delete mode 100644 tests/thread 2/stress_recurse.py delete mode 100644 tests/thread 2/thread_exc1.py delete mode 100644 tests/thread 2/thread_exc2.py delete mode 100644 tests/thread 2/thread_exc2.py.exp delete mode 100644 tests/thread 2/thread_exit1.py delete mode 100644 tests/thread 2/thread_exit2.py delete mode 100644 tests/thread 2/thread_gc1.py delete mode 100644 tests/thread 2/thread_ident1.py delete mode 100644 tests/thread 2/thread_lock1.py delete mode 100644 tests/thread 2/thread_lock2.py delete mode 100644 tests/thread 2/thread_lock3.py delete mode 100644 tests/thread 2/thread_lock4.py delete mode 100644 tests/thread 2/thread_qstr1.py delete mode 100644 tests/thread 2/thread_shared1.py delete mode 100644 tests/thread 2/thread_shared2.py delete mode 100644 tests/thread 2/thread_sleep1.py delete mode 100644 tests/thread 2/thread_stacksize1.py delete mode 100644 tests/thread 2/thread_start1.py delete mode 100644 tests/thread 2/thread_start2.py delete mode 100644 tests/unix 2/extra_coverage.py delete mode 100644 tests/unix 2/extra_coverage.py.exp delete mode 100644 tests/unix 2/ffi_callback.py delete mode 100644 tests/unix 2/ffi_callback.py.exp delete mode 100644 tests/unix 2/ffi_float.py delete mode 100644 tests/unix 2/ffi_float.py.exp delete mode 100644 tests/unix 2/ffi_float2.py delete mode 100644 tests/unix 2/ffi_float2.py.exp diff --git a/tests/README 2 b/tests/README 2 deleted file mode 100644 index 3458f36a80..0000000000 --- a/tests/README 2 +++ /dev/null @@ -1,18 +0,0 @@ -This directory contains tests for various functionality areas of MicroPython. -To run all stable tests, run "run-tests" script in this directory. - -Tests of capabilities not supported on all platforms should be written -to check for the capability being present. If it is not, the test -should merely output 'SKIP' followed by the line terminator, and call -sys.exit() to raise SystemExit, instead of attempting to test the -missing capability. The testing framework (run-tests in this -directory, test_main.c in qemu_arm) recognizes this as a skipped test. - -There are a few features for which this mechanism cannot be used to -condition a test. The run-tests script uses small scripts in the -feature_check directory to check whether each such feature is present, -and skips the relevant tests if not. - -When creating new tests, anything that relies on float support should go in the -float/ subdirectory. Anything that relies on import x, where x is not a built-in -module, should go in the import/ subdirectory. diff --git a/tests/extmod 2/btree1.py b/tests/extmod 2/btree1.py deleted file mode 100644 index 59638ef0a4..0000000000 --- a/tests/extmod 2/btree1.py +++ /dev/null @@ -1,89 +0,0 @@ -try: - import btree - import uio - import uerrno -except ImportError: - print("SKIP") - raise SystemExit - -#f = open("_test.db", "w+b") -f = uio.BytesIO() -db = btree.open(f, pagesize=512) - -db[b"foo3"] = b"bar3" -db[b"foo1"] = b"bar1" -db[b"foo2"] = b"bar2" -db[b"bar1"] = b"foo1" - -dbstr = str(db) -print(dbstr[:7], dbstr[-1:]) - -print(db[b"foo2"]) -try: - print(db[b"foo"]) -except KeyError: - print("KeyError") -print(db.get(b"foo")) -print(db.get(b"foo", b"dflt")) - -del db[b"foo2"] -try: - del db[b"foo"] -except KeyError: - print("KeyError") - -for k, v in db.items(): - print((k, v)) - -print("---") -for k, v in db.items(None, None): - print((k, v)) - -print("---") -for k, v in db.items(b"f"): - print((k, v)) - -print("---") -for k, v in db.items(b"f", b"foo3"): - print((k, v)) - -print("---") -for k, v in db.items(None, b"foo3"): - print((k, v)) - -print("---") -for k, v in db.items(b"f", b"foo3", btree.INCL): - print((k, v)) - -print("---") -for k, v in db.items(None, None, btree.DESC): - print((k, v)) - -print(db.seq(1, b"foo1")) -print(db.seq(1, b"qux")) - -try: - db.seq(b"foo1") -except OSError as e: - print(e.args[0] == uerrno.EINVAL) - -print(list(db.keys())) -print(list(db.values())) - -for k in db: - print(k) - -db.put(b"baz1", b"qux1") - -print("foo1", "foo1" in db) -print("foo2", "foo2" in db) -print("baz1", "baz1" in db) - -try: - print(db + db[b"foo1"]) -except TypeError: - print("TypeError") - -db.flush() -db.close() -f.close() diff --git a/tests/extmod 2/framebuf1.py b/tests/extmod 2/framebuf1.py deleted file mode 100644 index 2c13665228..0000000000 --- a/tests/extmod 2/framebuf1.py +++ /dev/null @@ -1,109 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - -w = 5 -h = 16 -size = w * h // 8 -buf = bytearray(size) -maps = {framebuf.MONO_VLSB : 'MONO_VLSB', - framebuf.MONO_HLSB : 'MONO_HLSB', - framebuf.MONO_HMSB : 'MONO_HMSB'} - -for mapping in maps.keys(): - for x in range(size): - buf[x] = 0 - fbuf = framebuf.FrameBuffer(buf, w, h, mapping) - print(maps[mapping]) - # access as buffer - print(memoryview(fbuf)[0]) - - # fill - fbuf.fill(1) - print(buf) - fbuf.fill(0) - print(buf) - - # put pixel - fbuf.pixel(0, 0, 1) - fbuf.pixel(4, 0, 1) - fbuf.pixel(0, 15, 1) - fbuf.pixel(4, 15, 1) - print(buf) - - # clear pixel - fbuf.pixel(4, 15, 0) - print(buf) - - # get pixel - print(fbuf.pixel(0, 0), fbuf.pixel(1, 1)) - - # hline - fbuf.fill(0) - fbuf.hline(0, 1, w, 1) - print('hline', buf) - - # vline - fbuf.fill(0) - fbuf.vline(1, 0, h, 1) - print('vline', buf) - - # rect - fbuf.fill(0) - fbuf.rect(1, 1, 3, 3, 1) - print('rect', buf) - - #fill rect - fbuf.fill(0) - fbuf.fill_rect(0, 0, 0, 3, 1) # zero width, no-operation - fbuf.fill_rect(1, 1, 3, 3, 1) - print('fill_rect', buf) - - # line - fbuf.fill(0) - fbuf.line(1, 1, 3, 3, 1) - print('line', buf) - - # line steep negative gradient - fbuf.fill(0) - fbuf.line(3, 3, 2, 1, 1) - print('line', buf) - - # scroll - fbuf.fill(0) - fbuf.pixel(2, 7, 1) - fbuf.scroll(0, 1) - print(buf) - fbuf.scroll(0, -2) - print(buf) - fbuf.scroll(1, 0) - print(buf) - fbuf.scroll(-1, 0) - print(buf) - fbuf.scroll(2, 2) - print(buf) - - # print text - fbuf.fill(0) - fbuf.text("hello", 0, 0, 1) - print(buf) - fbuf.text("hello", 0, 0, 0) # clear - print(buf) - - # char out of font range set to chr(127) - fbuf.text(str(chr(31)), 0, 0) - print(buf) - print() - -# test invalid constructor, and stride argument -try: - fbuf = framebuf.FrameBuffer(buf, w, h, -1, w) -except ValueError: - print("ValueError") - -# test legacy constructor -fbuf = framebuf.FrameBuffer1(buf, w, h) -fbuf = framebuf.FrameBuffer1(buf, w, h, w) -print(framebuf.MVLSB == framebuf.MONO_VLSB) diff --git a/tests/extmod 2/framebuf16.py b/tests/extmod 2/framebuf16.py deleted file mode 100644 index fe81f7f93f..0000000000 --- a/tests/extmod 2/framebuf16.py +++ /dev/null @@ -1,59 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - -def printbuf(): - print("--8<--") - for y in range(h): - print(buf[y * w * 2:(y + 1) * w * 2]) - print("-->8--") - -w = 4 -h = 5 -buf = bytearray(w * h * 2) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.RGB565) - -# fill -fbuf.fill(0xffff) -printbuf() -fbuf.fill(0x0000) -printbuf() - -# put pixel -fbuf.pixel(0, 0, 0xeeee) -fbuf.pixel(3, 0, 0xee00) -fbuf.pixel(0, 4, 0x00ee) -fbuf.pixel(3, 4, 0x0ee0) -printbuf() - -# get pixel -print(fbuf.pixel(0, 4), fbuf.pixel(1, 1)) - -# scroll -fbuf.fill(0x0000) -fbuf.pixel(2, 2, 0xffff) -printbuf() -fbuf.scroll(0, 1) -printbuf() -fbuf.scroll(1, 0) -printbuf() -fbuf.scroll(-1, -2) -printbuf() - -w2 = 2 -h2 = 3 -buf2 = bytearray(w2 * h2 * 2) -fbuf2 = framebuf.FrameBuffer(buf2, w2, h2, framebuf.RGB565) - -fbuf2.fill(0x0000) -fbuf2.pixel(0, 0, 0x0ee0) -fbuf2.pixel(0, 2, 0xee00) -fbuf2.pixel(1, 0, 0x00ee) -fbuf2.pixel(1, 2, 0xe00e) -fbuf.fill(0xffff) -fbuf.blit(fbuf2, 3, 3, 0x0000) -fbuf.blit(fbuf2, -1, -1, 0x0000) -fbuf.blit(fbuf2, 16, 16, 0x0000) -printbuf() diff --git a/tests/extmod 2/framebuf2.py.exp b/tests/extmod 2/framebuf2.py.exp deleted file mode 100644 index c53e518a6e..0000000000 --- a/tests/extmod 2/framebuf2.py.exp +++ /dev/null @@ -1,57 +0,0 @@ ---8<-- -33333333 -33333333 -33333333 -33333333 -33333333 --->8-- ---8<-- -00000000 -00000000 -00000000 -00000000 -00000000 --->8-- ---8<-- -10020000 -00000000 -00000000 -00000000 -30020000 --->8-- -3 0 ---8<-- -00000000 -00000000 -00300000 -00000000 -00000000 --->8-- ---8<-- -00000000 -00000000 -00000000 -00300000 -00000000 --->8-- ---8<-- -00000000 -00000000 -00000000 -00030000 -00000000 --->8-- ---8<-- -00000000 -00300000 -00000000 -00030000 -00000000 --->8-- ---8<-- -33333333 -23333333 -33333333 -33311333 -33333333 --->8-- diff --git a/tests/extmod 2/framebuf4.py b/tests/extmod 2/framebuf4.py deleted file mode 100644 index 8358fa55b9..0000000000 --- a/tests/extmod 2/framebuf4.py +++ /dev/null @@ -1,53 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - -def printbuf(): - print("--8<--") - for y in range(h): - print(buf[y * w // 2:(y + 1) * w // 2]) - print("-->8--") - -w = 16 -h = 8 -buf = bytearray(w * h // 2) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS4_HMSB) - -# fill -fbuf.fill(0x0f) -printbuf() -fbuf.fill(0xa0) -printbuf() - -# put pixel -fbuf.pixel(0, 0, 0x01) -printbuf() -fbuf.pixel(w-1, 0, 0x02) -printbuf() -fbuf.pixel(w-1, h-1, 0x03) -printbuf() -fbuf.pixel(0, h-1, 0x04) -printbuf() - -# get pixel -print(fbuf.pixel(0, 0), fbuf.pixel(w-1, 0), fbuf.pixel(w-1, h-1), fbuf.pixel(0, h-1)) -print(fbuf.pixel(1, 0), fbuf.pixel(w-2, 0), fbuf.pixel(w-2, h-1), fbuf.pixel(1, h-1)) - -# fill rect -fbuf.fill_rect(0, 0, w, h, 0x0f) -printbuf() -fbuf.fill_rect(0, 0, w, h, 0xf0) -fbuf.fill_rect(1, 0, w//2+1, 1, 0xf1) -printbuf() -fbuf.fill_rect(1, 0, w//2+1, 1, 0x10) -fbuf.fill_rect(1, 0, w//2, 1, 0xf1) -printbuf() -fbuf.fill_rect(1, 0, w//2, 1, 0x10) -fbuf.fill_rect(0, h-4, w//2+1, 4, 0xaf) -printbuf() -fbuf.fill_rect(0, h-4, w//2+1, 4, 0xb0) -fbuf.fill_rect(0, h-4, w//2, 4, 0xaf) -printbuf() -fbuf.fill_rect(0, h-4, w//2, 4, 0xb0) diff --git a/tests/extmod 2/framebuf_subclass.py b/tests/extmod 2/framebuf_subclass.py deleted file mode 100644 index 6363c224fb..0000000000 --- a/tests/extmod 2/framebuf_subclass.py +++ /dev/null @@ -1,20 +0,0 @@ -# test subclassing framebuf.FrameBuffer - -try: - import framebuf -except ImportError: - print('SKIP') - raise SystemExit - -class FB(framebuf.FrameBuffer): - def __init__(self, n): - self.n = n - super().__init__(bytearray(2 * n * n), n, n, framebuf.RGB565) - - def foo(self): - self.hline(0, 2, self.n, 0x0304) - -fb = FB(n=3) -fb.pixel(0, 0, 0x0102) -fb.foo() -print(bytes(fb)) diff --git a/tests/extmod 2/machine1.py b/tests/extmod 2/machine1.py deleted file mode 100644 index 6ff38cc051..0000000000 --- a/tests/extmod 2/machine1.py +++ /dev/null @@ -1,28 +0,0 @@ -# test machine module - -try: - try: - import umachine as machine - except ImportError: - import machine - machine.mem8 -except: - print("SKIP") - raise SystemExit - -print(machine.mem8) - -try: - machine.mem16[1] -except ValueError: - print("ValueError") - -try: - machine.mem16[1] = 1 -except ValueError: - print("ValueError") - -try: - del machine.mem8[0] -except TypeError: - print("TypeError") diff --git a/tests/extmod 2/machine_pinbase.py b/tests/extmod 2/machine_pinbase.py deleted file mode 100644 index e91775504d..0000000000 --- a/tests/extmod 2/machine_pinbase.py +++ /dev/null @@ -1,30 +0,0 @@ -try: - import umachine as machine -except ImportError: - import machine -try: - machine.PinBase -except AttributeError: - print("SKIP") - raise SystemExit - - -class MyPin(machine.PinBase): - - def __init__(self): - print("__init__") - self.v = False - - def value(self, v=None): - print("value:", v) - if v is None: - self.v = not self.v - return int(self.v) - -p = MyPin() - -print(p.value()) -print(p.value()) -print(p.value()) -p.value(1) -p.value(0) diff --git a/tests/extmod 2/machine_pinbase.py.exp b/tests/extmod 2/machine_pinbase.py.exp deleted file mode 100644 index b31cd98308..0000000000 --- a/tests/extmod 2/machine_pinbase.py.exp +++ /dev/null @@ -1,9 +0,0 @@ -__init__ -value: None -1 -value: None -0 -value: None -1 -value: 1 -value: 0 diff --git a/tests/extmod 2/ticks_diff.py b/tests/extmod 2/ticks_diff.py deleted file mode 100644 index 4d8df83cf9..0000000000 --- a/tests/extmod 2/ticks_diff.py +++ /dev/null @@ -1,33 +0,0 @@ -from utime import ticks_diff, ticks_add - -MAX = ticks_add(0, -1) -# Should be done like this to avoid small int overflow -MODULO_HALF = MAX // 2 + 1 - -# Invariants: -# if ticks_diff(a, b) = c, -# then ticks_diff(b, a) = -c - -assert ticks_diff(1, 0) == 1, ticks_diff(1, 0) -assert ticks_diff(0, 1) == -1 - -assert ticks_diff(0, MAX) == 1 -assert ticks_diff(MAX, 0) == -1 - -assert ticks_diff(0, MAX - 1) == 2 - -# Maximum "positive" distance -assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1) -# Step further, and it becomes a negative distance -assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF - -# Offsetting that in either direction doesn't affect the result -off = 100 -# Cheating and skipping to use ticks_add() when we know there's no wraparound -# Real apps should use always it. -assert ticks_diff(MODULO_HALF + off, 1 + off) == MODULO_HALF - 1 -assert ticks_diff(MODULO_HALF + off, 0 + off) == -MODULO_HALF -assert ticks_diff(MODULO_HALF - off, ticks_add(1, -off)) == MODULO_HALF - 1 -assert ticks_diff(MODULO_HALF - off, ticks_add(0, -off)) == -MODULO_HALF - -print("OK") diff --git a/tests/extmod 2/time_ms_us.py b/tests/extmod 2/time_ms_us.py deleted file mode 100644 index 135cf1e096..0000000000 --- a/tests/extmod 2/time_ms_us.py +++ /dev/null @@ -1,22 +0,0 @@ -import utime -try: - utime.sleep_ms -except AttributeError: - print("SKIP") - raise SystemExit - -utime.sleep_ms(1) -utime.sleep_us(1) - -t0 = utime.ticks_ms() -t1 = utime.ticks_ms() -print(0 <= utime.ticks_diff(t1, t0) <= 1) - -t0 = utime.ticks_us() -t1 = utime.ticks_us() -print(0 <= utime.ticks_diff(t1, t0) <= 500) - -# ticks_cpu may not be implemented, at least make sure it doesn't decrease -t0 = utime.ticks_cpu() -t1 = utime.ticks_cpu() -print(utime.ticks_diff(t1, t0) >= 0) diff --git a/tests/extmod 2/time_ms_us.py.exp b/tests/extmod 2/time_ms_us.py.exp deleted file mode 100644 index b8ca7e7ef0..0000000000 --- a/tests/extmod 2/time_ms_us.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -True -True -True diff --git a/tests/extmod 2/ubinascii_a2b_base64.py b/tests/extmod 2/ubinascii_a2b_base64.py deleted file mode 100644 index 5e642ec515..0000000000 --- a/tests/extmod 2/ubinascii_a2b_base64.py +++ /dev/null @@ -1,49 +0,0 @@ -try: - try: - import ubinascii as binascii - except ImportError: - import binascii -except ImportError: - print("SKIP") - raise SystemExit - -print(binascii.a2b_base64(b'')) -print(binascii.a2b_base64(b'Zg==')) -print(binascii.a2b_base64(b'Zm8=')) -print(binascii.a2b_base64(b'Zm9v')) -print(binascii.a2b_base64(b'Zm9vYg==')) -print(binascii.a2b_base64(b'Zm9vYmE=')) -print(binascii.a2b_base64(b'Zm9vYmFy')) - -print(binascii.a2b_base64(b'AAECAwQFBgc=')) -print(binascii.a2b_base64(b'CAkKCwwNDg8=')) -print(binascii.a2b_base64(b'f4D/')) -print(binascii.a2b_base64(b'f4D+')) # convert '+' -print(binascii.a2b_base64(b'MTIzNEFCQ0RhYmNk')) - -# Ignore invalid characters and pad sequences -print(binascii.a2b_base64(b'Zm9v\n')) -print(binascii.a2b_base64(b'Zm\x009v\n')) -print(binascii.a2b_base64(b'Zm9v==')) -print(binascii.a2b_base64(b'Zm9v===')) -print(binascii.a2b_base64(b'Zm9v===YmFy')) - -# Unicode strings can be decoded -print(binascii.a2b_base64(u'Zm9v===YmFy')) - -try: - print(binascii.a2b_base64(b'abc')) -except ValueError: - print("ValueError") -try: - print(binascii.a2b_base64(b'abcde=')) -except ValueError: - print("ValueError") -try: - print(binascii.a2b_base64(b'ab*d')) -except ValueError: - print("ValueError") -try: - print(binascii.a2b_base64(b'ab=cdef=')) -except ValueError: - print("ValueError") diff --git a/tests/extmod 2/ubinascii_hexlify.py b/tests/extmod 2/ubinascii_hexlify.py deleted file mode 100644 index dabc3c7e4c..0000000000 --- a/tests/extmod 2/ubinascii_hexlify.py +++ /dev/null @@ -1,17 +0,0 @@ -try: - try: - import ubinascii as binascii - except ImportError: - import binascii -except ImportError: - print("SKIP") - raise SystemExit - -print(binascii.hexlify(b'\x00\x01\x02\x03\x04\x05\x06\x07')) -print(binascii.hexlify(b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')) -print(binascii.hexlify(b'\x7f\x80\xff')) -print(binascii.hexlify(b'1234ABCDabcd')) -try: - binascii.hexlify('') -except TypeError: - print("TypeError") diff --git a/tests/extmod 2/uctypes_32bit_intbig.py.exp b/tests/extmod 2/uctypes_32bit_intbig.py.exp deleted file mode 100644 index d1fc1fe350..0000000000 --- a/tests/extmod 2/uctypes_32bit_intbig.py.exp +++ /dev/null @@ -1,11 +0,0 @@ -b'\xff\xff\xff\x7f5678abcd' -b'\x00\x00\x00\x805678abcd' -b'\x03\x02\x01\xff5678abcd' -b'\x03\x02\x01\xff\x00\x00\x00\x80\x00\x00\x00\x00' -b'\x03\x02\x01\xff\x00\x00\x00\x00\x01\x00\x00\x00' -= -b'\x7f\xff\xff\xff5678abcd' -b'\x80\x00\x00\x005678abcd' -b'\xff\x01\x02\x035678abcd' -b'\xff\x01\x02\x03\x00\x00\x00\x00\x80\x00\x00\x00' -b'\xff\x01\x02\x03\x00\x00\x00\x01\x00\x00\x00\x00' diff --git a/tests/extmod 2/uctypes_array_assign_native_le.py b/tests/extmod 2/uctypes_array_assign_native_le.py deleted file mode 100644 index a538bf9add..0000000000 --- a/tests/extmod 2/uctypes_array_assign_native_le.py +++ /dev/null @@ -1,89 +0,0 @@ -import sys -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - -desc = { - # arr is array at offset 0, of UINT8 elements, array size is 2 - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - # arr2 is array at offset 0, size 2, of structures defined recursively - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), - - # aligned - "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), - "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), - - "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), - "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), - "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), - "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), - "arr12": (uctypes.ARRAY | 0, uctypes.UINT64| 1), - "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), -} - -data = bytearray(8) - -S = uctypes.struct(uctypes.addressof(data), desc) - -# assign byte -S.arr[0] = 0x11 -print(hex(S.arr[0])) -assert hex(S.arr[0]) == "0x11" - -# assign word -S.arr3[0] = 0x2233 -print(hex(S.arr3[0])) -assert hex(S.arr3[0]) == "0x2233" - -# assign word, with index -S.arr3[1] = 0x4455 -print(hex(S.arr3[1])) -assert hex(S.arr3[1]) == "0x4455" - -# assign long, aligned -S.arr5[0] = 0x66778899 -print(hex(S.arr5[0])) -assert hex(S.arr5[0]) == "0x66778899" - -print(S.arr5[0] == S.arr7[0].l) -assert S.arr5[0] == S.arr7[0].l - -# assign int8 -S.arr8[0] = 0x11 -print(hex(S.arr8[0])) -assert hex(S.arr8[0]) == "0x11" - -# assign int16 -S.arr9[0] = 0x1122 -print(hex(S.arr9[0])) -assert hex(S.arr9[0]) == "0x1122" - -# assign int32 -S.arr10[0] = 0x11223344 -print(hex(S.arr10[0])) -assert hex(S.arr10[0]) == "0x11223344" - -# index out of range -try: - print(S.arr8[2]) -except IndexError: - print("IndexError") - -# syntax error in descriptor -try: - S.arr13[0].l = 0x11 -except TypeError: - print("TypeError") - -# operation not supported -try: - S.arr13[0] = 0x11 -except TypeError: - print("TypeError") diff --git a/tests/extmod 2/uctypes_array_assign_native_le.py.exp b/tests/extmod 2/uctypes_array_assign_native_le.py.exp deleted file mode 100644 index 9d67b1c777..0000000000 --- a/tests/extmod 2/uctypes_array_assign_native_le.py.exp +++ /dev/null @@ -1,11 +0,0 @@ -0x11 -0x2233 -0x4455 -0x66778899 -True -0x11 -0x1122 -0x11223344 -IndexError -TypeError -TypeError diff --git a/tests/extmod 2/uctypes_array_assign_native_le_intbig.py b/tests/extmod 2/uctypes_array_assign_native_le_intbig.py deleted file mode 100644 index 84dfba0e29..0000000000 --- a/tests/extmod 2/uctypes_array_assign_native_le_intbig.py +++ /dev/null @@ -1,43 +0,0 @@ -import sys -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - -desc = { - # arr is array at offset 0, of UINT8 elements, array size is 2 - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - # arr2 is array at offset 0, size 2, of structures defined recursively - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), - - # aligned - "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), - "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), - - "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), - "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), - "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), - "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), - "arr12": (uctypes.ARRAY | 0, uctypes.UINT64| 1), - "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), -} - -data = bytearray(8) - -S = uctypes.struct(uctypes.addressof(data), desc) - -# assign int64 -S.arr11[0] = 0x11223344 -print(hex(S.arr11[0])) -assert hex(S.arr11[0]) == "0x11223344" - -# assign uint64 -S.arr12[0] = 0x11223344 -print(hex(S.arr12[0])) -assert hex(S.arr12[0]) == "0x11223344" diff --git a/tests/extmod 2/uctypes_bytearray.py b/tests/extmod 2/uctypes_bytearray.py deleted file mode 100644 index 77c93c3766..0000000000 --- a/tests/extmod 2/uctypes_bytearray.py +++ /dev/null @@ -1,22 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - "arr2": (uctypes.ARRAY | 2, uctypes.INT8 | 2), -} - -data = bytearray(b"01234567") - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -# Arrays of UINT8 are accessed as bytearrays -print(S.arr) -# But not INT8, because value range is different -print(type(S.arr2)) - -# convert to buffer -print(bytearray(S)) diff --git a/tests/extmod 2/uctypes_byteat.py b/tests/extmod 2/uctypes_byteat.py deleted file mode 100644 index 784209f803..0000000000 --- a/tests/extmod 2/uctypes_byteat.py +++ /dev/null @@ -1,10 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -data = bytearray(b'01234567') - -print(uctypes.bytes_at(uctypes.addressof(data), 4)) -print(uctypes.bytearray_at(uctypes.addressof(data), 4)) diff --git a/tests/extmod 2/uctypes_byteat.py.exp b/tests/extmod 2/uctypes_byteat.py.exp deleted file mode 100644 index e1ae4d0534..0000000000 --- a/tests/extmod 2/uctypes_byteat.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -b'0123' -bytearray(b'0123') diff --git a/tests/extmod 2/uctypes_error.py b/tests/extmod 2/uctypes_error.py deleted file mode 100644 index 2500e29278..0000000000 --- a/tests/extmod 2/uctypes_error.py +++ /dev/null @@ -1,37 +0,0 @@ -# test general errors with uctypes - -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -data = bytearray(b"01234567") - -# del subscr not supported -S = uctypes.struct(uctypes.addressof(data), {}) -try: - del S[0] -except TypeError: - print('TypeError') - -# list is an invalid descriptor -S = uctypes.struct(uctypes.addressof(data), []) -try: - S.x -except TypeError: - print('TypeError') - -# can't access attribute with invalid descriptor -S = uctypes.struct(uctypes.addressof(data), {'x':[]}) -try: - S.x -except TypeError: - print('TypeError') - -# can't assign to aggregate -S = uctypes.struct(uctypes.addressof(data), {'x':(uctypes.ARRAY | 0, uctypes.INT8 | 2)}) -try: - S.x = 1 -except TypeError: - print('TypeError') diff --git a/tests/extmod 2/uctypes_error.py.exp b/tests/extmod 2/uctypes_error.py.exp deleted file mode 100644 index 802c260d2b..0000000000 --- a/tests/extmod 2/uctypes_error.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -TypeError -TypeError -TypeError -TypeError diff --git a/tests/extmod 2/uctypes_le_float.py b/tests/extmod 2/uctypes_le_float.py deleted file mode 100644 index 84ff2b84cf..0000000000 --- a/tests/extmod 2/uctypes_le_float.py +++ /dev/null @@ -1,24 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "f32": uctypes.FLOAT32 | 0, - "f64": uctypes.FLOAT64 | 0, - "uf64": uctypes.FLOAT64 | 2, # unaligned -} - -data = bytearray(10) - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -S.f32 = 12.34 -print('%.4f' % S.f32) - -S.f64 = 12.34 -print('%.4f' % S.f64) - -S.uf64 = 12.34 -print('%.4f' % S.uf64) diff --git a/tests/extmod 2/uctypes_native_float.py b/tests/extmod 2/uctypes_native_float.py deleted file mode 100644 index acef47036d..0000000000 --- a/tests/extmod 2/uctypes_native_float.py +++ /dev/null @@ -1,20 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "f32": uctypes.FLOAT32 | 0, - "f64": uctypes.FLOAT64 | 0, -} - -data = bytearray(8) - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.NATIVE) - -S.f32 = 12.34 -print('%.4f' % S.f32) - -S.f64 = 12.34 -print('%.4f' % S.f64) diff --git a/tests/extmod 2/uctypes_ptr_le.py b/tests/extmod 2/uctypes_ptr_le.py deleted file mode 100644 index 056e456506..0000000000 --- a/tests/extmod 2/uctypes_ptr_le.py +++ /dev/null @@ -1,34 +0,0 @@ -import sys -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - -desc = { - "ptr": (uctypes.PTR | 0, uctypes.UINT8), - "ptr16": (uctypes.PTR | 0, uctypes.UINT16), - "ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}), -} - -bytes = b"01" - -addr = uctypes.addressof(bytes) -buf = addr.to_bytes(uctypes.sizeof(desc), "little") - -S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.LITTLE_ENDIAN) - -print(S.ptr[0]) -assert S.ptr[0] == ord("0") -print(S.ptr[1]) -assert S.ptr[1] == ord("1") -print(hex(S.ptr16[0])) -assert hex(S.ptr16[0]) == "0x3130" -print(S.ptr2[0].b, S.ptr2[1].b) -print (S.ptr2[0].b, S.ptr2[1].b) -print(hex(S.ptr16[0])) -assert (S.ptr2[0].b, S.ptr2[1].b) == (48, 49) diff --git a/tests/extmod 2/uctypes_ptr_native_le.py.exp b/tests/extmod 2/uctypes_ptr_native_le.py.exp deleted file mode 100644 index 30d159edd1..0000000000 --- a/tests/extmod 2/uctypes_ptr_native_le.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -48 -49 -0x3130 -48 49 -48 49 -0x3130 diff --git a/tests/extmod 2/uctypes_sizeof.py.exp b/tests/extmod 2/uctypes_sizeof.py.exp deleted file mode 100644 index b35b11aa0c..0000000000 --- a/tests/extmod 2/uctypes_sizeof.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -2 -2 -4 -TypeError -6 -1 -TypeError diff --git a/tests/extmod 2/uhashlib_sha1.py b/tests/extmod 2/uhashlib_sha1.py deleted file mode 100644 index 9d6427b33f..0000000000 --- a/tests/extmod 2/uhashlib_sha1.py +++ /dev/null @@ -1,28 +0,0 @@ -try: - import uhashlib as hashlib -except ImportError: - try: - import hashlib - except ImportError: - # This is neither uPy, nor cPy, so must be uPy with - # uhashlib module disabled. - print("SKIP") - raise SystemExit - -try: - hashlib.sha1 -except AttributeError: - # SHA1 is only available on some ports - print("SKIP") - raise SystemExit - -sha1 = hashlib.sha1(b'hello') -sha1.update(b'world') -print(sha1.digest()) - -sha1 = hashlib.sha1(b'hello') -try: - sha1.update(u'world') -except TypeError as e: - print("TypeError") -print(sha1.digest()) diff --git a/tests/extmod 2/ujson_dump.py b/tests/extmod 2/ujson_dump.py deleted file mode 100644 index b1cb4a9cbc..0000000000 --- a/tests/extmod 2/ujson_dump.py +++ /dev/null @@ -1,30 +0,0 @@ -try: - from uio import StringIO - import ujson as json -except: - try: - from io import StringIO - import json - except ImportError: - print("SKIP") - raise SystemExit - -s = StringIO() -json.dump(False, s) -print(s.getvalue()) - -s = StringIO() -json.dump({"a": (2, [3, None])}, s) -print(s.getvalue()) - -# dump to a small-int not allowed -try: - json.dump(123, 1) -except (AttributeError, OSError): # CPython and uPy have different errors - print('Exception') - -# dump to an object not allowed -try: - json.dump(123, {}) -except (AttributeError, OSError): # CPython and uPy have different errors - print('Exception') diff --git a/tests/extmod 2/ujson_dumps_extra.py b/tests/extmod 2/ujson_dumps_extra.py deleted file mode 100644 index 21a388c32d..0000000000 --- a/tests/extmod 2/ujson_dumps_extra.py +++ /dev/null @@ -1,9 +0,0 @@ -# test uPy ujson behaviour that's not valid in CPy - -try: - import ujson -except ImportError: - print("SKIP") - raise SystemExit - -print(ujson.dumps(b'1234')) diff --git a/tests/extmod 2/ujson_dumps_float.py b/tests/extmod 2/ujson_dumps_float.py deleted file mode 100644 index e8cceb6f1a..0000000000 --- a/tests/extmod 2/ujson_dumps_float.py +++ /dev/null @@ -1,10 +0,0 @@ -try: - import ujson as json -except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit - -print(json.dumps(1.2)) diff --git a/tests/extmod 2/ujson_load_readinto.py.exp b/tests/extmod 2/ujson_load_readinto.py.exp deleted file mode 100644 index f8c3c693be..0000000000 --- a/tests/extmod 2/ujson_load_readinto.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -None -abcde -[False, True, 1, -2] -{'a': True} diff --git a/tests/extmod 2/ujson_loads.py b/tests/extmod 2/ujson_loads.py deleted file mode 100644 index adba3c068d..0000000000 --- a/tests/extmod 2/ujson_loads.py +++ /dev/null @@ -1,74 +0,0 @@ -try: - import ujson as json -except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit - -def my_print(o): - if isinstance(o, dict): - print('sorted dict', sorted(o.items())) - else: - print(o) - -my_print(json.loads('null')) -my_print(json.loads('false')) -my_print(json.loads('true')) -my_print(json.loads('1')) -my_print(json.loads('-2')) -my_print(json.loads('"abc\\u0064e"')) -my_print(json.loads('[]')) -my_print(json.loads('[null]')) -my_print(json.loads('[null,false,true]')) -my_print(json.loads(' [ null , false , true ] ')) -my_print(json.loads('{}')) -my_print(json.loads('{"a":true}')) -my_print(json.loads('{"a":null, "b":false, "c":true}')) -my_print(json.loads('{"a":[], "b":[1], "c":{"3":4}}')) -my_print(json.loads('"abc\\bdef"')) -my_print(json.loads('"abc\\fdef"')) -my_print(json.loads('"abc\\ndef"')) -my_print(json.loads('"abc\\rdef"')) -my_print(json.loads('"abc\\tdef"')) -my_print(json.loads('"abc\\uabcd"')) - -# whitespace handling -my_print(json.loads('{\n\t"a":[]\r\n, "b":[1], "c":{"3":4} \n\r\t\r\r\r\n}')) - -# loading nothing should raise exception -try: - json.loads('') -except ValueError: - print('ValueError') - -# string which is not closed -try: - my_print(json.loads('"abc')) -except ValueError: - print('ValueError') - -# unaccompanied closing brace -try: - my_print(json.loads(']')) -except ValueError: - print('ValueError') - -# unspecified object type -try: - my_print(json.loads('a')) -except ValueError: - print('ValueError') - -# bad property name -try: - my_print(json.loads('{{}:"abc"}')) -except ValueError: - print('ValueError') - -# unexpected characters after white space -try: - my_print(json.loads('[null] a')) -except ValueError: - print('ValueError') diff --git a/tests/extmod 2/ujson_loads_float.py b/tests/extmod 2/ujson_loads_float.py deleted file mode 100644 index f1b8cc364c..0000000000 --- a/tests/extmod 2/ujson_loads_float.py +++ /dev/null @@ -1,17 +0,0 @@ -try: - import ujson as json -except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit - -def my_print(o): - print('%.3f' % o) - -my_print(json.loads('1.2')) -my_print(json.loads('1e2')) -my_print(json.loads('-2.3')) -my_print(json.loads('-2e3')) -my_print(json.loads('-2e-3')) diff --git a/tests/extmod 2/urandom_basic.py b/tests/extmod 2/urandom_basic.py deleted file mode 100644 index 57e6b26cba..0000000000 --- a/tests/extmod 2/urandom_basic.py +++ /dev/null @@ -1,29 +0,0 @@ -try: - import urandom as random -except ImportError: - try: - import random - except ImportError: - print("SKIP") - raise SystemExit - -# check getrandbits returns a value within the bit range -for b in (1, 2, 3, 4, 16, 32): - for i in range(50): - assert random.getrandbits(b) < (1 << b) - -# check that seed(0) gives a non-zero value -random.seed(0) -print(random.getrandbits(16) != 0) - -# check that PRNG is repeatable -random.seed(1) -r = random.getrandbits(16) -random.seed(1) -print(random.getrandbits(16) == r) - -# check that it throws an error for zero bits -try: - random.getrandbits(0) -except ValueError: - print('ValueError') diff --git a/tests/extmod 2/ure1.py b/tests/extmod 2/ure1.py deleted file mode 100644 index 710720c8b6..0000000000 --- a/tests/extmod 2/ure1.py +++ /dev/null @@ -1,103 +0,0 @@ -try: - import ure as re -except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit - -r = re.compile(".+") -m = r.match("abc") -print(m.group(0)) -try: - m.group(1) -except IndexError: - print("IndexError") - -# conversion of re and match to string -str(r) -str(m) - -r = re.compile("(.+)1") -m = r.match("xyz781") -print(m.group(0)) -print(m.group(1)) -try: - m.group(2) -except IndexError: - print("IndexError") - -r = re.compile(r"\n") -m = r.match("\n") -print(m.group(0)) -m = r.match("\\") -print(m) -r = re.compile(r"[\n-\r]") -m = r.match("\n") -print(m.group(0)) -r = re.compile(r"[\]]") -m = r.match("]") -print(m.group(0)) -print("===") - -r = re.compile("[a-cu-z]") -m = r.match("a") -print(m.group(0)) -m = r.match("z") -print(m.group(0)) -m = r.match("d") -print(m) -m = r.match("A") -print(m) -print("===") - -r = re.compile("[^a-cu-z]") -m = r.match("a") -print(m) -m = r.match("z") -print(m) -m = r.match("d") -print(m.group(0)) -m = r.match("A") -print(m.group(0)) -print("===") - -# '-' character within character class block -print(re.match("[-a]+", "-a]d").group(0)) -print(re.match("[a-]+", "-a]d").group(0)) -print("===") - -r = re.compile("o+") -m = r.search("foobar") -print(m.group(0)) -try: - m.group(1) -except IndexError: - print("IndexError") - - -m = re.match(".*", "foo") -print(m.group(0)) - -m = re.search("w.r", "hello world") -print(m.group(0)) - -m = re.match('a+?', 'ab'); print(m.group(0)) -m = re.match('a*?', 'ab'); print(m.group(0)) -m = re.match('^ab$', 'ab'); print(m.group(0)) -m = re.match('a|b', 'b'); print(m.group(0)) -m = re.match('a|b|c', 'c'); print(m.group(0)) - -# Case where anchors fail to match -r = re.compile("^b|b$") -m = r.search("abc") -print(m) - -try: - re.compile("*") -except: - print("Caught invalid regex") - -# bytes objects -m = re.match(rb'a+?', b'ab'); print(m.group(0)) diff --git a/tests/extmod 2/ure_debug.py.exp b/tests/extmod 2/ure_debug.py.exp deleted file mode 100644 index 45f5e20f6d..0000000000 --- a/tests/extmod 2/ure_debug.py.exp +++ /dev/null @@ -1,15 +0,0 @@ - 0: rsplit 5 (3) - 2: any - 3: jmp 0 (-5) - 5: save 0 - 7: split 14 (5) - 9: assert bol -10: char a -12: jmp 23 (9) -14: char b -16: class 1 0x30-0x39 -20: namedclass w -22: assert eol -23: save 1 -25: match -Bytes: 26, insts: 14 diff --git a/tests/extmod 2/ure_error.py b/tests/extmod 2/ure_error.py deleted file mode 100644 index f52f735c7f..0000000000 --- a/tests/extmod 2/ure_error.py +++ /dev/null @@ -1,25 +0,0 @@ -# test errors in regex - -try: - import ure as re -except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit - -def test_re(r): - try: - re.compile(r) - print("OK") - except: # uPy and CPy use different errors, so just ignore the type - print("Error") - -test_re(r'?') -test_re(r'*') -test_re(r'+') -test_re(r')') -test_re(r'[') -test_re(r'([') -test_re(r'([)') diff --git a/tests/extmod 2/ure_namedclass.py b/tests/extmod 2/ure_namedclass.py deleted file mode 100644 index 215d09613f..0000000000 --- a/tests/extmod 2/ure_namedclass.py +++ /dev/null @@ -1,32 +0,0 @@ -# test named char classes - -try: - import ure as re -except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit - -def print_groups(match): - print('----') - try: - i = 0 - while True: - print(m.group(i)) - i += 1 - except IndexError: - pass - -m = re.match(r'\w+','1234hello567 abc') -print_groups(m) - -m = re.match(r'(\w+)\s+(\w+)','ABC \t1234hello567 abc') -print_groups(m) - -m = re.match(r'(\S+)\s+(\D+)','ABC \thello abc567 abc') -print_groups(m) - -m = re.match(r'(([0-9]*)([a-z]*)\d*)','1234hello567') -print_groups(m) diff --git a/tests/extmod 2/ure_stack_overflow.py.exp b/tests/extmod 2/ure_stack_overflow.py.exp deleted file mode 100644 index 8a2b9bfdda..0000000000 --- a/tests/extmod 2/ure_stack_overflow.py.exp +++ /dev/null @@ -1 +0,0 @@ -RuntimeError diff --git a/tests/extmod 2/ure_sub_unmatched.py.exp b/tests/extmod 2/ure_sub_unmatched.py.exp deleted file mode 100644 index 1e5f0fda05..0000000000 --- a/tests/extmod 2/ure_sub_unmatched.py.exp +++ /dev/null @@ -1 +0,0 @@ -1-a2 diff --git a/tests/extmod 2/ussl_basic.py b/tests/extmod 2/ussl_basic.py deleted file mode 100644 index e8710ed51a..0000000000 --- a/tests/extmod 2/ussl_basic.py +++ /dev/null @@ -1,59 +0,0 @@ -# very basic test of ssl module, just to test the methods exist - -try: - import uio as io - import ussl as ssl -except ImportError: - print("SKIP") - raise SystemExit - -# create in client mode -try: - ss = ssl.wrap_socket(io.BytesIO()) -except OSError as er: - print('wrap_socket:', repr(er)) - -# create in server mode (can use this object for further tests) -socket = io.BytesIO() -ss = ssl.wrap_socket(socket, server_side=1) - -# print -print(repr(ss)[:12]) - -# setblocking -try: - ss.setblocking(False) -except NotImplementedError: - print('setblocking: NotImplementedError') -ss.setblocking(True) - -# write -print(ss.write(b'aaaa')) - -# read (underlying socket has no data) -print(ss.read(8)) - -# read (underlying socket has data, but it's bad data) -socket.write(b'aaaaaaaaaaaaaaaa') -socket.seek(0) -try: - ss.read(8) -except OSError as er: - print('read:', repr(er)) - -# close -ss.close() -# close 2nd time -ss.close() - -# read on closed socket -try: - ss.read(10) -except OSError as er: - print('read:', repr(er)) - -# write on closed socket -try: - ss.write(b'aaaa') -except OSError as er: - print('write:', repr(er)) diff --git a/tests/extmod 2/utimeq1.py b/tests/extmod 2/utimeq1.py deleted file mode 100644 index dc7f3b6600..0000000000 --- a/tests/extmod 2/utimeq1.py +++ /dev/null @@ -1,137 +0,0 @@ -# Test for utimeq module which implements task queue with support for -# wraparound time (utime.ticks_ms() style). -try: - from utime import ticks_add, ticks_diff - from utimeq import utimeq -except ImportError: - print("SKIP") - raise SystemExit - -DEBUG = 0 - -MAX = ticks_add(0, -1) -MODULO_HALF = MAX // 2 + 1 - -if DEBUG: - def dprint(*v): - print(*v) -else: - def dprint(*v): - pass - -# Try not to crash on invalid data -h = utimeq(10) -try: - h.push(1) - assert False -except TypeError: - pass - -try: - h.pop(1) - assert False -except IndexError: - pass - -# unsupported unary op -try: - ~h - assert False -except TypeError: - pass - -# pushing on full queue -h = utimeq(1) -h.push(1, 0, 0) -try: - h.push(2, 0, 0) - assert False -except IndexError: - pass - -# popping into invalid type -try: - h.pop([]) - assert False -except TypeError: - pass - -# length -assert len(h) == 1 - -# peektime -assert h.peektime() == 1 - -# peektime with empty queue -try: - utimeq(1).peektime() - assert False -except IndexError: - pass - -def pop_all(h): - l = [] - while h: - item = [0, 0, 0] - h.pop(item) - #print("!", item) - l.append(tuple(item)) - dprint(l) - return l - -def add(h, v): - h.push(v, 0, 0) - dprint("-----") - #h.dump() - dprint("-----") - -h = utimeq(10) -add(h, 0) -add(h, MAX) -add(h, MAX - 1) -add(h, 101) -add(h, 100) -add(h, MAX - 2) -dprint(h) -l = pop_all(h) -for i in range(len(l) - 1): - diff = ticks_diff(l[i + 1][0], l[i][0]) - assert diff > 0 - -def edge_case(edge, offset): - h = utimeq(10) - add(h, ticks_add(0, offset)) - add(h, ticks_add(edge, offset)) - dprint(h) - l = pop_all(h) - diff = ticks_diff(l[1][0], l[0][0]) - dprint(diff, diff > 0) - return diff - -dprint("===") -diff = edge_case(MODULO_HALF - 1, 0) -assert diff == MODULO_HALF - 1 -assert edge_case(MODULO_HALF - 1, 100) == diff -assert edge_case(MODULO_HALF - 1, -100) == diff - -# We expect diff to be always positive, per the definition of heappop() which should return -# the smallest value. -# This is the edge case where this invariant breaks, due to assymetry of two's-complement -# range - there's one more negative integer than positive, so heappushing values like below -# will then make ticks_diff() return the minimum negative value. We could make heappop -# return them in a different order, but ticks_diff() result would be the same. Conclusion: -# never add to a heap values where (a - b) == MODULO_HALF (and which are >= MODULO_HALF -# ticks apart in real time of course). -dprint("===") -diff = edge_case(MODULO_HALF, 0) -assert diff == -MODULO_HALF -assert edge_case(MODULO_HALF, 100) == diff -assert edge_case(MODULO_HALF, -100) == diff - -dprint("===") -diff = edge_case(MODULO_HALF + 1, 0) -assert diff == MODULO_HALF - 1 -assert edge_case(MODULO_HALF + 1, 100) == diff -assert edge_case(MODULO_HALF + 1, -100) == diff - -print("OK") diff --git a/tests/extmod 2/utimeq_stable.py.exp b/tests/extmod 2/utimeq_stable.py.exp deleted file mode 100644 index d86bac9de5..0000000000 --- a/tests/extmod 2/utimeq_stable.py.exp +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/tests/extmod 2/uzlib_decompio.py b/tests/extmod 2/uzlib_decompio.py deleted file mode 100644 index 112a825976..0000000000 --- a/tests/extmod 2/uzlib_decompio.py +++ /dev/null @@ -1,33 +0,0 @@ -try: - import uzlib as zlib - import uio as io -except ImportError: - print("SKIP") - raise SystemExit - - -# Raw DEFLATE bitstream -buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00') -inp = zlib.DecompIO(buf, -8) -print(buf.seek(0, 1)) -print(inp.read(1)) -print(buf.seek(0, 1)) -print(inp.read(2)) -print(inp.read()) -print(buf.seek(0, 1)) -print(inp.read(1)) -print(inp.read()) -print(buf.seek(0, 1)) - - -# zlib bitstream -inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc1')) -print(inp.read(10)) -print(inp.read()) - -# zlib bitstream, wrong checksum -inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc0')) -try: - print(inp.read()) -except OSError as e: - print(repr(e)) diff --git a/tests/extmod 2/uzlib_decompio_gz.py.exp b/tests/extmod 2/uzlib_decompio_gz.py.exp deleted file mode 100644 index 20a30c82a3..0000000000 --- a/tests/extmod 2/uzlib_decompio_gz.py.exp +++ /dev/null @@ -1,13 +0,0 @@ -16 -b'h' -18 -b'el' -b'lo' -31 -b'' -b'' -31 -b'hello' -b'hello' -ValueError -OSError(22,) diff --git a/tests/extmod 2/vfs_fat_fileio1.py b/tests/extmod 2/vfs_fat_fileio1.py deleted file mode 100644 index 4635ca84b5..0000000000 --- a/tests/extmod 2/vfs_fat_fileio1.py +++ /dev/null @@ -1,139 +0,0 @@ -try: - import uerrno - import uos -except ImportError: - print("SKIP") - raise SystemExit - -try: - uos.VfsFat -except AttributeError: - print("SKIP") - raise SystemExit - - -class RAMFS: - - SEC_SIZE = 512 - - def __init__(self, blocks): - self.data = bytearray(blocks * self.SEC_SIZE) - - def readblocks(self, n, buf): - #print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf))) - for i in range(len(buf)): - buf[i] = self.data[n * self.SEC_SIZE + i] - return 0 - - def writeblocks(self, n, buf): - #print("writeblocks(%s, %x)" % (n, id(buf))) - for i in range(len(buf)): - self.data[n * self.SEC_SIZE + i] = buf[i] - return 0 - - def ioctl(self, op, arg): - #print("ioctl(%d, %r)" % (op, arg)) - if op == 4: # BP_IOCTL_SEC_COUNT - return len(self.data) // self.SEC_SIZE - if op == 5: # BP_IOCTL_SEC_SIZE - return self.SEC_SIZE - - -try: - bdev = RAMFS(50) -except MemoryError: - print("SKIP") - raise SystemExit - -uos.VfsFat.mkfs(bdev) -vfs = uos.VfsFat(bdev) -uos.mount(vfs, '/ramdisk') -uos.chdir('/ramdisk') - -# file IO -f = open("foo_file.txt", "w") -print(str(f)[:17], str(f)[-1:]) -f.write("hello!") -f.flush() -f.close() -f.close() # allowed -try: - f.write("world!") -except OSError as e: - print(e.args[0] == uerrno.EINVAL) - -try: - f.read() -except OSError as e: - print(e.args[0] == uerrno.EINVAL) - -try: - f.flush() -except OSError as e: - print(e.args[0] == uerrno.EINVAL) - -try: - open("foo_file.txt", "x") -except OSError as e: - print(e.args[0] == uerrno.EEXIST) - -with open("foo_file.txt", "a") as f: - f.write("world!") - -with open("foo_file.txt") as f2: - print(f2.read()) - print(f2.tell()) - - f2.seek(0, 0) # SEEK_SET - print(f2.read(1)) - - f2.seek(0, 1) # SEEK_CUR - print(f2.read(1)) - f2.seek(2, 1) # SEEK_CUR - print(f2.read(1)) - - f2.seek(-2, 2) # SEEK_END - print(f2.read(1)) - -# using constructor of FileIO type to open a file -# no longer working with new VFS sub-system -#FileIO = type(f) -#with FileIO("/ramdisk/foo_file.txt") as f: -# print(f.read()) - -# dirs -vfs.mkdir("foo_dir") - -try: - vfs.rmdir("foo_file.txt") -except OSError as e: - print(e.args[0] == 20) # uerrno.ENOTDIR - -vfs.remove("foo_file.txt") -print(list(vfs.ilistdir())) - -# Here we test that opening a file with the heap locked fails correctly. This -# is a special case because file objects use a finaliser and allocating with a -# finaliser is a different path to normal allocation. It would be better to -# test this in the core tests but there are no core objects that use finaliser. -import micropython -micropython.heap_lock() -try: - vfs.open('x', 'r') -except MemoryError: - print('MemoryError') -micropython.heap_unlock() - -# Here we test that the finaliser is actually called during a garbage collection. -import gc -N = 4 -for i in range(N): - n = 'x%d' % i - f = vfs.open(n, 'w') - f.write(n) - f = None # release f without closing - [0, 1, 2, 3] # use up Python stack so f is really gone -gc.collect() # should finalise all N files by closing them -for i in range(N): - with vfs.open('x%d' % i, 'r') as f: - print(f.read()) diff --git a/tests/extmod 2/vfs_fat_fileio1.py.exp b/tests/extmod 2/vfs_fat_fileio1.py.exp deleted file mode 100644 index 4eb50402c4..0000000000 --- a/tests/extmod 2/vfs_fat_fileio1.py.exp +++ /dev/null @@ -1,18 +0,0 @@ - -True -True -True -True -hello!world! -12 -h -e -o -d -True -[('foo_dir', 16384, 0, 0)] -MemoryError -x0 -x1 -x2 -x3 diff --git a/tests/extmod 2/vfs_fat_more.py.exp b/tests/extmod 2/vfs_fat_more.py.exp deleted file mode 100644 index 24429ee095..0000000000 --- a/tests/extmod 2/vfs_fat_more.py.exp +++ /dev/null @@ -1,29 +0,0 @@ -/ -['test.txt'] -['test.txt'] -(16384, 0, 0, 0, 0, 0, 0) -(16384, 0, 0, 0, 0, 0, 0) -(32768, 0, 0, 0, 0, 0, 5) -(32768, 0, 0, 0, 0, 0, 5) -hello -['test2.txt'] -['test3.txt'] -['test4.txt'] -['test5.txt'] -['test5.txt', 'dir'] -['test5.txt', 'dir', 'dir2'] -['subdir'] -mkdir OSError True -mkdir OSError True -mkdir OSError True -mkdir OSError True -mkdir OSError True -(32768, 0, 0, 0, 0, 0, 5) -['sys', 'test5.txt', 'dir', 'dir2'] -[] -[] -['sys', 'dir'] -/ -['sys'] -[] -test_module! diff --git a/tests/extmod 2/vfs_fat_oldproto.py.exp b/tests/extmod 2/vfs_fat_oldproto.py.exp deleted file mode 100644 index b974683167..0000000000 --- a/tests/extmod 2/vfs_fat_oldproto.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -[('file.txt', 32768, 0, 6)] -hello! -[] diff --git a/tests/extmod 2/vfs_fat_ramdisk.py.exp b/tests/extmod 2/vfs_fat_ramdisk.py.exp deleted file mode 100644 index 704408cd0b..0000000000 --- a/tests/extmod 2/vfs_fat_ramdisk.py.exp +++ /dev/null @@ -1,17 +0,0 @@ -True -True -label: LABEL TEST -statvfs: (512, 512, 16, 16, 16, 0, 0, 0, 0, 255) -getcwd: / -True -[('foo_file.txt', 32768, 0, 6)] -stat root: (16384, 0, 0, 0, 0, 0, 0, 946684800, 946684800, 946684800) -stat file: (32768, 0, 0, 0, 0, 0, 6) -True -True -getcwd: /foo_dir -[] -True -getcwd: / -[(b'foo_file.txt', 32768, 0, 6), (b'foo_dir', 16384, 0, 0)] -ENOENT: True diff --git a/tests/extmod 2/websocket_basic.py.exp b/tests/extmod 2/websocket_basic.py.exp deleted file mode 100644 index 2d7657b535..0000000000 --- a/tests/extmod 2/websocket_basic.py.exp +++ /dev/null @@ -1,14 +0,0 @@ -b'ping' -b'ping' -b'\x81\x04pong' -b'pingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingping' -b'\x81~\x00\x80pongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpong' -b'\x00\x00\x00\x00' -b'' -b'\x81\x02\x88\x00' -b'ping' -b'pong' -0 -1 -2 -ioctl: EINVAL: True diff --git a/tests/feature_check 2/README b/tests/feature_check 2/README deleted file mode 100644 index d062020f7b..0000000000 --- a/tests/feature_check 2/README +++ /dev/null @@ -1,4 +0,0 @@ -This directory doesn't contain real tests, but code snippets to detect -various interpreter features, which can't be/inconvenient to detecte by -other means. Scripts here are executed by run-tests at the beginning of -testsuite to decide what other test groups to run/exclude. diff --git a/tests/feature_check 2/async_check.py b/tests/feature_check 2/async_check.py deleted file mode 100644 index 0f6361cd12..0000000000 --- a/tests/feature_check 2/async_check.py +++ /dev/null @@ -1,3 +0,0 @@ -# check if async/await keywords are supported -async def foo(): - await 1 diff --git a/tests/feature_check 2/async_check.py.exp b/tests/feature_check 2/async_check.py.exp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/feature_check 2/byteorder.py b/tests/feature_check 2/byteorder.py deleted file mode 100644 index d60f939568..0000000000 --- a/tests/feature_check 2/byteorder.py +++ /dev/null @@ -1,2 +0,0 @@ -import sys -print(sys.byteorder) diff --git a/tests/feature_check 2/byteorder.py.exp b/tests/feature_check 2/byteorder.py.exp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/feature_check 2/complex.py b/tests/feature_check 2/complex.py deleted file mode 100644 index 7576dcb953..0000000000 --- a/tests/feature_check 2/complex.py +++ /dev/null @@ -1,5 +0,0 @@ -try: - complex - print("complex") -except NameError: - print("no") diff --git a/tests/feature_check 2/complex.py.exp b/tests/feature_check 2/complex.py.exp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/feature_check 2/const.py b/tests/feature_check 2/const.py deleted file mode 100644 index db32e8c69b..0000000000 --- a/tests/feature_check 2/const.py +++ /dev/null @@ -1 +0,0 @@ -x = const(1) diff --git a/tests/feature_check 2/const.py.exp b/tests/feature_check 2/const.py.exp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/feature_check 2/coverage.py b/tests/feature_check 2/coverage.py deleted file mode 100644 index dcda53eae2..0000000000 --- a/tests/feature_check 2/coverage.py +++ /dev/null @@ -1,5 +0,0 @@ -try: - extra_coverage - print('coverage') -except NameError: - print('no') diff --git a/tests/feature_check 2/coverage.py.exp b/tests/feature_check 2/coverage.py.exp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/feature_check 2/float.py b/tests/feature_check 2/float.py deleted file mode 100644 index af93f59763..0000000000 --- a/tests/feature_check 2/float.py +++ /dev/null @@ -1,13 +0,0 @@ -# detect how many bits of precision the floating point implementation has - -try: - float -except NameError: - print(0) -else: - if float('1.0000001') == float('1.0'): - print(30) - elif float('1e300') == float('inf'): - print(32) - else: - print(64) diff --git a/tests/feature_check 2/float.py.exp b/tests/feature_check 2/float.py.exp deleted file mode 100644 index 900731ffd5..0000000000 --- a/tests/feature_check 2/float.py.exp +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/tests/feature_check 2/int_big.py b/tests/feature_check 2/int_big.py deleted file mode 100644 index f30285a98f..0000000000 --- a/tests/feature_check 2/int_big.py +++ /dev/null @@ -1,2 +0,0 @@ -# Check whether arbitrary-precision integers (MPZ) are supported -print(1000000000000000000000000000000000000000000000) diff --git a/tests/feature_check 2/int_big.py.exp b/tests/feature_check 2/int_big.py.exp deleted file mode 100644 index 9dfe3354d5..0000000000 --- a/tests/feature_check 2/int_big.py.exp +++ /dev/null @@ -1 +0,0 @@ -1000000000000000000000000000000000000000000000 diff --git a/tests/feature_check 2/native_check.py b/tests/feature_check 2/native_check.py deleted file mode 100644 index 3971d1355f..0000000000 --- a/tests/feature_check 2/native_check.py +++ /dev/null @@ -1,4 +0,0 @@ -# this test for the availability of native emitter -@micropython.native -def f(): - pass diff --git a/tests/feature_check 2/native_check.py.exp b/tests/feature_check 2/native_check.py.exp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/feature_check 2/repl_emacs_check.py b/tests/feature_check 2/repl_emacs_check.py deleted file mode 100644 index 3209716229..0000000000 --- a/tests/feature_check 2/repl_emacs_check.py +++ /dev/null @@ -1,3 +0,0 @@ -# Check for emacs keys in REPL -t = +11 -t == 2 diff --git a/tests/feature_check 2/repl_emacs_check.py.exp b/tests/feature_check 2/repl_emacs_check.py.exp deleted file mode 100644 index 82a4e28ee4..0000000000 --- a/tests/feature_check 2/repl_emacs_check.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -MicroPython \.\+ version -Use \.\+ ->>> # Check for emacs keys in REPL ->>> t = \.\+ ->>> t == 2 -True ->>> diff --git a/tests/feature_check 2/reverse_ops.py b/tests/feature_check 2/reverse_ops.py deleted file mode 100644 index 668748bc57..0000000000 --- a/tests/feature_check 2/reverse_ops.py +++ /dev/null @@ -1,9 +0,0 @@ -class Foo: - - def __radd__(self, other): - pass - -try: - 5 + Foo() -except TypeError: - print("TypeError") diff --git a/tests/feature_check 2/reverse_ops.py.exp b/tests/feature_check 2/reverse_ops.py.exp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/feature_check 2/set_check.py b/tests/feature_check 2/set_check.py deleted file mode 100644 index ec186cc5b9..0000000000 --- a/tests/feature_check 2/set_check.py +++ /dev/null @@ -1,2 +0,0 @@ -# check if set literal syntax is supported -{1} diff --git a/tests/feature_check 2/set_check.py.exp b/tests/feature_check 2/set_check.py.exp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/float 2/array_construct.py b/tests/float 2/array_construct.py deleted file mode 100644 index 938675835b..0000000000 --- a/tests/float 2/array_construct.py +++ /dev/null @@ -1,10 +0,0 @@ -# test construction of array from array with float type - -try: - from array import array -except ImportError: - print("SKIP") - raise SystemExit - -print(array('f', array('h', [1, 2]))) -print(array('d', array('f', [1, 2]))) diff --git a/tests/float 2/builtin_float_hash.py b/tests/float 2/builtin_float_hash.py deleted file mode 100644 index 7a7e374010..0000000000 --- a/tests/float 2/builtin_float_hash.py +++ /dev/null @@ -1,25 +0,0 @@ -# test builtin hash function with float args - -# these should hash to an integer with a specific value -for val in ( - '0.0', - '-0.0', - '1.0', - '2.0', - '-12.0', - '12345.0', - ): - print(val, hash(float(val))) - -# just check that these values are hashable -for val in ( - '0.1', - '-0.1', - '10.3', - '0.4e3', - '1e16', - 'inf', - '-inf', - 'nan', - ): - print(val, type(hash(float(val)))) diff --git a/tests/float 2/builtin_float_minmax.py b/tests/float 2/builtin_float_minmax.py deleted file mode 100644 index 8a53746e5d..0000000000 --- a/tests/float 2/builtin_float_minmax.py +++ /dev/null @@ -1,31 +0,0 @@ -# test builtin min and max functions with float args -try: - min - max -except: - print("SKIP") - raise SystemExit - -print(min(0, 1.0)) -print(min(1.0, 0)) -print(min(0, -1.0)) -print(min(-1.0, 0)) - -print(max(0, 1.0)) -print(max(1.0, 0)) -print(max(0, -1.0)) -print(max(-1.0, 0)) - -print(min(1.5, -1.5)) -print(min(-1.5, 1.5)) - -print(max(1.5, -1.5)) -print(max(-1.5, 1.5)) - -print(min([1, 2.9, 4, 0, -1, 2])) -print(max([1, 2.9, 4, 0, -1, 2])) - -print(min([1, 2.9, 4, 6.5, -1, 2])) -print(max([1, 2.9, 4, 6.5, -1, 2])) -print(min([1, 2.9, 4, -6.5, -1, 2])) -print(max([1, 2.9, 4, -6.5, -1, 2])) diff --git a/tests/float 2/builtin_float_pow.py b/tests/float 2/builtin_float_pow.py deleted file mode 100644 index 2de1b48176..0000000000 --- a/tests/float 2/builtin_float_pow.py +++ /dev/null @@ -1,11 +0,0 @@ -# test builtin pow function with float args - -print(pow(0.0, 0.0)) -print(pow(0, 1.0)) -print(pow(1.0, 1)) -print(pow(2.0, 3.0)) -print(pow(2.0, -4.0)) - -print(pow(0.0, float('inf'))) -print(pow(0.0, float('-inf'))) -print(pow(0.0, float('nan'))) diff --git a/tests/float 2/builtin_float_round.py b/tests/float 2/builtin_float_round.py deleted file mode 100644 index 63cb39aa35..0000000000 --- a/tests/float 2/builtin_float_round.py +++ /dev/null @@ -1,24 +0,0 @@ -# test round() with floats - -# check basic cases -tests = [ - [0.0], [1.0], [0.1], [-0.1], [123.4], [123.6], [-123.4], [-123.6], - [1.234567, 5], [1.23456, 1], [1.23456, 0], [1234.56, -2] -] -for t in tests: - print(round(*t)) - -# check .5 cases -for i in range(11): - print(round((i - 5) / 2)) - -# test second arg -for i in range(-1, 3): - print(round(1.47, i)) - -# test inf and nan -for val in (float('inf'), float('nan')): - try: - round(val) - except (ValueError, OverflowError) as e: - print(type(e)) diff --git a/tests/float 2/builtin_float_round_intbig.py b/tests/float 2/builtin_float_round_intbig.py deleted file mode 100644 index 2083e3ea3a..0000000000 --- a/tests/float 2/builtin_float_round_intbig.py +++ /dev/null @@ -1,4 +0,0 @@ -# test round() with floats that return large integers - -for x in (-1e25, 1e25): - print('%.3g' % round(x)) diff --git a/tests/float 2/bytearray_construct.py b/tests/float 2/bytearray_construct.py deleted file mode 100644 index e960d624ec..0000000000 --- a/tests/float 2/bytearray_construct.py +++ /dev/null @@ -1,9 +0,0 @@ -# test construction of bytearray from array with float type - -try: - from array import array -except ImportError: - print("SKIP") - raise SystemExit - -print(bytearray(array('f', [1, 2.3]))) diff --git a/tests/float 2/bytes_construct.py b/tests/float 2/bytes_construct.py deleted file mode 100644 index 0e4482e436..0000000000 --- a/tests/float 2/bytes_construct.py +++ /dev/null @@ -1,9 +0,0 @@ -# test construction of bytearray from array with float type - -try: - from array import array -except ImportError: - print("SKIP") - raise SystemExit - -print(bytes(array('f', [1, 2.3]))) diff --git a/tests/float 2/cmath_fun.py b/tests/float 2/cmath_fun.py deleted file mode 100644 index ae5921c304..0000000000 --- a/tests/float 2/cmath_fun.py +++ /dev/null @@ -1,55 +0,0 @@ -# test the functions imported from cmath - -try: - from cmath import * -except ImportError: - print("SKIP") - raise SystemExit - -# make sure these constants exist in cmath -print("%.5g" % e) -print("%.5g" % pi) - -test_values_non_zero = [] -base_values = (0.0, 0.5, 1.2345, 10.) -for r in base_values: - for i in base_values: - if r != 0. or i != 0.: - test_values_non_zero.append(complex(r, i)) - if r != 0.: - test_values_non_zero.append(complex(-r, i)) - if i != 0.: - test_values_non_zero.append(complex(r, -i)) - if r != 0. and i != 0.: - test_values_non_zero.append(complex(-r, -i)) -test_values = [complex(0., 0.),] + test_values_non_zero -print(test_values) - -functions = [ - ('phase', phase, test_values), - ('polar', polar, test_values), - ('rect', rect, ((0, 0), (0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, 1), (1, -1), (123., -456.))), - ('exp', exp, test_values), - ('log', log, test_values_non_zero), - ('sqrt', sqrt, test_values), - ('cos', cos, test_values), - ('sin', sin, test_values), -] - -for f_name, f, test_vals in functions: - print(f_name) - for val in test_vals: - if type(val) == tuple: - ret = f(*val) - else: - ret = f(val) - if type(ret) == float: - print("%.5g" % ret) - elif type(ret) == tuple: - print("%.5g %.5g" % ret) - else: - # some test (eg cmath.sqrt(-0.5)) disagree with CPython with tiny real part - real = ret.real - if abs(real) < 1e15: - real = 0. - print("complex(%.5g, %.5g)" % (real, ret.imag)) diff --git a/tests/float 2/cmath_fun_special.py b/tests/float 2/cmath_fun_special.py deleted file mode 100644 index 471fda8c0d..0000000000 --- a/tests/float 2/cmath_fun_special.py +++ /dev/null @@ -1,31 +0,0 @@ -# test the special functions imported from cmath - -try: - from cmath import * - log10 -except (ImportError, NameError): - print("SKIP") - raise SystemExit - -test_values_non_zero = [] -base_values = (0.0, 0.5, 1.2345, 10.) -for r in base_values: - for i in base_values: - if r != 0. or i != 0.: - test_values_non_zero.append(complex(r, i)) - if r != 0.: - test_values_non_zero.append(complex(-r, i)) - if i != 0.: - test_values_non_zero.append(complex(r, -i)) - if r != 0. and i != 0.: - test_values_non_zero.append(complex(-r, -i)) - -functions = [ - ('log10', log10, test_values_non_zero), -] - -for f_name, f, test_vals in functions: - print(f_name) - for val in test_vals: - ret = f(val) - print("complex(%.5g, %.5g)" % (ret.real, ret.imag)) diff --git a/tests/float 2/complex1.py b/tests/float 2/complex1.py deleted file mode 100644 index 479b4b3485..0000000000 --- a/tests/float 2/complex1.py +++ /dev/null @@ -1,116 +0,0 @@ -# test basic complex number functionality - -# constructor -print(complex(1)) -print(complex(1.2)) -print(complex(1.2j)) -print(complex("1")) -print(complex("1.2")) -print(complex("1.2j")) -print(complex(1, 2)) -print(complex(1j, 2j)) - -# unary ops -print(bool(1j)) -print(+(1j)) -print(-(1 + 2j)) - -# binary ops -print(1j + False) -print(1j + True) -print(1j + 2) -print(1j + 2j) -print(1j - 2) -print(1j - 2j) -print(1j * 2) -print(1j * 2j) -print(1j / 2) -print((1j / 2j).real) -print(1j / (1 + 2j)) -ans = 0j ** 0; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 0j ** 1; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 0j ** 0j; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 1j ** 2.5; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag)) - -# comparison -print(1j == 1) -print(1j == 1j) - -# comparison of nan is special -nan = float('nan') * 1j -print(nan == 1j) -print(nan == nan) - -# builtin abs -print(abs(1j)) -print("%.5g" % abs(1j + 2)) - -# builtin hash -print(hash(1 + 0j)) -print(type(hash(1j))) - -# float on lhs should delegate to complex -print(1.2 + 3j) - -# negative base and fractional power should create a complex -ans = (-1) ** 2.3; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = (-1.2) ** -3.4; print("%.5g %.5g" % (ans.real, ans.imag)) - -# check printing of inf/nan -print(float('nan') * 1j) -print(float('-nan') * 1j) -print(float('inf') * (1 + 1j)) -print(float('-inf') * (1 + 1j)) - -# can't assign to attributes -try: - (1j).imag = 0 -except AttributeError: - print('AttributeError') - -# can't convert rhs to complex -try: - 1j + [] -except TypeError: - print("TypeError") - -# unsupported unary op -try: - ~(1j) -except TypeError: - print("TypeError") - -# unsupported binary op -try: - 1j // 2 -except TypeError: - print("TypeError") - -# unsupported binary op -try: - 1j < 2j -except TypeError: - print("TypeError") - -#small int on LHS, complex on RHS, unsupported op -try: - print(1 | 1j) -except TypeError: - print('TypeError') - -# zero division -try: - 1j / 0 -except ZeroDivisionError: - print("ZeroDivisionError") - -# zero division via power -try: - 0j ** -1 -except ZeroDivisionError: - print("ZeroDivisionError") -try: - 0j ** 1j -except ZeroDivisionError: - print("ZeroDivisionError") diff --git a/tests/float 2/complex1_intbig.py b/tests/float 2/complex1_intbig.py deleted file mode 100644 index ed2390bbaf..0000000000 --- a/tests/float 2/complex1_intbig.py +++ /dev/null @@ -1,4 +0,0 @@ -# test basic complex number functionality - -# convert bignum to complex on rhs -ans = 1j + (1 << 70); print("%.5g %.5g" % (ans.real, ans.imag)) diff --git a/tests/float 2/float1.py b/tests/float 2/float1.py deleted file mode 100644 index 54807e5ac9..0000000000 --- a/tests/float 2/float1.py +++ /dev/null @@ -1,119 +0,0 @@ -# test basic float capabilities - -# literals -print(.12) -print(1.) -print(1.2) -print(0e0) -print(0e+0) -print(0e-0) - -# float construction -print(float(1.2)) -print(float("1.2")) -print(float("+1")) -print(float("1e1")) -print(float("1e+1")) -print(float("1e-1")) -print(float("inf")) -print(float("-inf")) -print(float("INF")) -print(float("infinity")) -print(float("INFINITY")) -print(float("nan")) -print(float("-nan")) -print(float("NaN")) -try: - float("") -except ValueError: - print("ValueError") -try: - float("1e+") -except ValueError: - print("ValueError") -try: - float("1z") -except ValueError: - print("ValueError") - -# construct from something with the buffer protocol -print(float(b"1.2")) -print(float(bytearray(b"3.4"))) - -# unary operators -print(bool(0.0)) -print(bool(1.2)) -print(+(1.2)) -print(-(1.2)) - -# division of integers -x = 1 / 2 -print(x) - -# /= operator -a = 1 -a /= 2 -print(a) - -# floor division -print(1.0 // 2) -print(2.0 // 2) - -# comparison -print(1.2 <= 3.4) -print(1.2 <= -3.4) -print(1.2 >= 3.4) -print(1.2 >= -3.4) - -# comparison of nan is special -nan = float('nan') -print(nan == 1.2) -print(nan == nan) - -try: - 1.0 / 0 -except ZeroDivisionError: - print("ZeroDivisionError") - -try: - 1.0 // 0 -except ZeroDivisionError: - print("ZeroDivisionError") - -try: - 1.2 % 0 -except ZeroDivisionError: - print("ZeroDivisionError") - -try: - 0.0 ** -1 -except ZeroDivisionError: - print("ZeroDivisionError") - -# unsupported unary ops - -try: - ~1.2 -except TypeError: - print("TypeError") - -try: - 1.2 in 3.4 -except TypeError: - print("TypeError") - -# small int on LHS, float on RHS, unsupported op -try: - print(1 | 1.0) -except TypeError: - print('TypeError') - -# can't convert list to float -try: - float([]) -except TypeError: - print("TypeError") - -# test constant float with more than 255 chars -x = 1.84728699436059052516398251149631771898472869943605905251639825114963177189847286994360590525163982511496317718984728699436059052516398251149631771898472869943605905251639825114963177189847286994360590525163982511496317718984728699436059052516398251149631771898472869943605905251639825114963177189 -print("%.5f" % x) diff --git a/tests/float 2/float2int_doubleprec_intbig.py b/tests/float 2/float2int_doubleprec_intbig.py deleted file mode 100644 index de2137d66c..0000000000 --- a/tests/float 2/float2int_doubleprec_intbig.py +++ /dev/null @@ -1,100 +0,0 @@ -# check cases converting float to int, requiring double precision float - -try: - import ustruct as struct -except: - import struct - -import sys -maxsize_bits = 0 -maxsize = sys.maxsize -while maxsize: - maxsize >>= 1 - maxsize_bits += 1 - -# work out configuration values -is_64bit = maxsize_bits > 32 -# 0 = none, 1 = long long, 2 = mpz -ll_type = None -if is_64bit: - if maxsize_bits < 63: - ll_type = 0 -else: - if maxsize_bits < 31: - ll_type = 0 -if ll_type is None: - one = 1 - if one << 65 < one << 62: - ll_type = 1 - else: - ll_type = 2 - -# This case occurs with time.time() values -if ll_type != 0: - print(int(1418774543.)) - print("%d" % 1418774543.) - if ll_type == 3: - print(int(2.**100)) - print("%d" % 2.**100) -else: - print(int(1073741823.)) - print("%d" % 1073741823.) - -testpass = True -p2_rng = ((30,63,1024),(62,63,1024))[is_64bit][ll_type] -for i in range(0,p2_rng): - bitcnt = len(bin(int(2.**i))) - 3; - if i != bitcnt: - print('fail: 2**%u was %u bits long' % (i, bitcnt)); - testpass = False -print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) - -testpass = True -p10_rng = ((9,18,23),(18,18,23))[is_64bit][ll_type] -for i in range(0,p10_rng): - digcnt = len(str(int(10.**i))) - 1; - if i != digcnt: - print('fail: 10**%u was %u digits long' % (i, digcnt)); - testpass = False -print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) - -def fp2int_test(num, name, should_fail): - try: - x = int(num) - passed = ~should_fail - except: - passed = should_fail - print('%s: %s' % (name, passed and 'passed' or 'failed')) - -if ll_type != 2: - if ll_type == 0: - if is_64bit: - neg_bad_fp = -1.00000005*2.**62. - pos_bad_fp = 2.**62. - neg_good_fp = -2.**62. - pos_good_fp = 0.99999993*2.**62. - else: - neg_bad_fp = -1.00000005*2.**30. - pos_bad_fp = 2.**30. - neg_good_fp = -2.**30. - pos_good_fp = 0.9999999499*2.**30. - else: - neg_bad_fp = -0.51*2.**64. - pos_bad_fp = 2.**63. - neg_good_fp = -2.**63. - pos_good_fp = 1.9999998*2.**62. - - fp2int_test(neg_bad_fp, 'neg bad', True) - fp2int_test(pos_bad_fp, 'pos bad', True) - fp2int_test(neg_good_fp, 'neg good', False) - fp2int_test(pos_good_fp, 'pos good', False) -else: - fp2int_test(-1.9999999999999981*2.**1023., 'large neg', False) - fp2int_test(1.9999999999999981*2.**1023., 'large pos', False) - -fp2int_test(float('inf'), 'inf test', True) -fp2int_test(float('nan'), 'NaN test', True) - -# test numbers < 1 (this used to fail; see issue #1044) -fp2int_test(0.0001, 'small num', False) -struct.pack('I', int(1/2)) diff --git a/tests/float 2/float2int_fp30_intbig.py b/tests/float 2/float2int_fp30_intbig.py deleted file mode 100644 index fbb94a4ccc..0000000000 --- a/tests/float 2/float2int_fp30_intbig.py +++ /dev/null @@ -1,97 +0,0 @@ -# check cases converting float to int, relying only on single precision float - -try: - import ustruct as struct -except: - import struct - -import sys -maxsize_bits = 0 -maxsize = sys.maxsize -while maxsize: - maxsize >>= 1 - maxsize_bits += 1 - -# work out configuration values -is_64bit = maxsize_bits > 32 -# 0 = none, 1 = long long, 2 = mpz -ll_type = None -if is_64bit: - if maxsize_bits < 63: - ll_type = 0 -else: - if maxsize_bits < 31: - ll_type = 0 -if ll_type is None: - one = 1 - if one << 65 < one << 62: - ll_type = 1 - else: - ll_type = 2 - -# basic conversion -print(int(14187744.)) -print("%d" % 14187744.) -if ll_type == 2: - print(int(2.**100)) - print("%d" % 2.**100) - -testpass = True -p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type] -for i in range(0,p2_rng): - bitcnt = len(bin(int(2.**i))) - 3; - if i != bitcnt: - print('fail: 2.**%u was %u bits long' % (i, bitcnt)); - testpass = False -print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) - -# TODO why does 10**12 fail this test for single precision float? -testpass = True -p10_rng = 9 -for i in range(0,p10_rng): - digcnt = len(str(int(10.**i))) - 1; - if i != digcnt: - print('fail: 10.**%u was %u digits long' % (i, digcnt)); - testpass = False -print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) - -def fp2int_test(num, name, should_fail): - try: - x = int(num) - passed = ~should_fail - except: - passed = should_fail - print('%s: %s' % (name, passed and 'passed' or 'failed')) - -if ll_type != 2: - if ll_type == 0: - if is_64bit: - neg_bad_fp = -1.00000005*2.**62. - pos_bad_fp = 2.**62. - neg_good_fp = -2.**62. - pos_good_fp = 0.99999993*2.**62. - else: - neg_bad_fp = -1.00000005*2.**30. - pos_bad_fp = 2.**30. - neg_good_fp = -2.**30. - pos_good_fp = 0.9999999499*2.**30. - else: - neg_bad_fp = -0.51*2.**64. - pos_bad_fp = 2.**63. - neg_good_fp = -2.**63. - pos_good_fp = 1.9999998*2.**62. - - fp2int_test(neg_bad_fp, 'neg bad', True) - fp2int_test(pos_bad_fp, 'pos bad', True) - fp2int_test(neg_good_fp, 'neg good', False) - fp2int_test(pos_good_fp, 'pos good', False) -else: - fp2int_test(-1.999999879*2.**126., 'large neg', False) - fp2int_test(1.999999879*2.**126., 'large pos', False) - -fp2int_test(float('inf'), 'inf test', True) -fp2int_test(float('nan'), 'NaN test', True) - -# test numbers < 1 (this used to fail; see issue #1044) -fp2int_test(0.0001, 'small num', False) -struct.pack('I', int(1/2)) diff --git a/tests/float 2/float2int_intbig.py b/tests/float 2/float2int_intbig.py deleted file mode 100644 index 3596d2f73d..0000000000 --- a/tests/float 2/float2int_intbig.py +++ /dev/null @@ -1,99 +0,0 @@ -# check cases converting float to int, relying only on single precision float - -try: - import ustruct as struct -except: - import struct - -import sys - -maxsize_bits = 0 -maxsize = sys.maxsize -while maxsize: - maxsize >>= 1 - maxsize_bits += 1 - -# work out configuration values -is_64bit = maxsize_bits > 32 -# 0 = none, 1 = long long, 2 = mpz -ll_type = None -if is_64bit: - if maxsize_bits < 63: - ll_type = 0 -else: - if maxsize_bits < 31: - ll_type = 0 -if ll_type is None: - one = 1 - if one << 65 < one << 62: - ll_type = 1 - else: - ll_type = 2 - - -# basic conversion -print(int(14187745.)) -print("%d" % 14187745.) -if ll_type == 2: - print(int(2.**100)) - print("%d" % 2.**100) - -testpass = True -p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type] -for i in range(0,p2_rng): - bitcnt = len(bin(int(2.**i))) - 3; - if i != bitcnt: - print('fail: 2.**%u was %u bits long' % (i, bitcnt)); - testpass = False -print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) - -# TODO why does 10**12 fail this test for single precision float? -testpass = True -p10_rng = 9 if (ll_type == 0 and ~is_64bit) else 11 -for i in range(0,p10_rng): - digcnt = len(str(int(10.**i))) - 1; - if i != digcnt: - print('fail: 10.**%u was %u digits long' % (i, digcnt)); - testpass = False -print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) - -def fp2int_test(num, name, should_fail): - try: - x = int(num) - passed = ~should_fail - except: - passed = should_fail - print('%s: %s' % (name, passed and 'passed' or 'failed')) - -if ll_type != 2: - if ll_type == 0: - if is_64bit: - neg_bad_fp = -1.00000005*2.**62. - pos_bad_fp = 2.**62. - neg_good_fp = -2.**62. - pos_good_fp = 0.99999993*2.**62. - else: - neg_bad_fp = -1.00000005*2.**30. - pos_bad_fp = 2.**30. - neg_good_fp = -2.**30. - pos_good_fp = 0.9999999499*2.**30. - else: - neg_bad_fp = -0.51*2.**64. - pos_bad_fp = 2.**63. - neg_good_fp = -2.**63. - pos_good_fp = 1.9999998*2.**62. - - fp2int_test(neg_bad_fp, 'neg bad', True) - fp2int_test(pos_bad_fp, 'pos bad', True) - fp2int_test(neg_good_fp, 'neg good', False) - fp2int_test(pos_good_fp, 'pos good', False) -else: - fp2int_test(-1.999999879*2.**127., 'large neg', False) - fp2int_test(1.999999879*2.**127., 'large pos', False) - -fp2int_test(float('inf'), 'inf test', True) -fp2int_test(float('nan'), 'NaN test', True) - -# test numbers < 1 (this used to fail; see issue #1044) -fp2int_test(0.0001, 'small num', False) -struct.pack('I', int(1/2)) diff --git a/tests/float 2/float_array.py b/tests/float 2/float_array.py deleted file mode 100644 index 8c8edcff7c..0000000000 --- a/tests/float 2/float_array.py +++ /dev/null @@ -1,20 +0,0 @@ -try: - from array import array -except ImportError: - print("SKIP") - raise SystemExit - -def test(a): - print(a) - a.append(1.2) - print(len(a), '%.3f' % a[0]) - a.append(1) - a.append(False) - print(len(a), '%.3f %.3f' % (a[1], a[2])) - a[-1] = 3.45 - print('%.3f' % a[-1]) - -test(array('f')) -test(array('d')) - -print('{:.4f}'.format(array('f', b'\xcc\xcc\xcc=')[0])) diff --git a/tests/float 2/float_compare.py b/tests/float 2/float_compare.py deleted file mode 100644 index 105923ac73..0000000000 --- a/tests/float 2/float_compare.py +++ /dev/null @@ -1,22 +0,0 @@ -# Extended float comparisons - -class Foo: - pass - -foo = Foo() - -print(foo == 1.0) -print(1.0 == foo) -print(1.0 == Foo) -print(1.0 == []) -print(1.0 == {}) - -try: - print(foo < 1.0) -except TypeError: - print("TypeError") - -try: - print(1.0 < foo) -except TypeError: - print("TypeError") diff --git a/tests/float 2/float_divmod.py b/tests/float 2/float_divmod.py deleted file mode 100644 index 8e7cd435a5..0000000000 --- a/tests/float 2/float_divmod.py +++ /dev/null @@ -1,25 +0,0 @@ -# test floating point floor divide and modulus -# it has some tricky corner cases - -def test(x, y): - div, mod = divmod(x, y) - print('%.8f %.8f %.8f %.8f' % (x // y, x % y, div, mod)) - print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-15) - -test(1.23456, 0.7) -test(-1.23456, 0.7) -test(1.23456, -0.7) -test(-1.23456, -0.7) - -a = 1.23456 -b = 0.7 -test(a, b) -test(a, -b) -test(-a, b) -test(-a, -b) - -for i in range(25): - x = (i - 12.5) / 6 - for j in range(25): - y = (j - 12.5) / 6 - test(x, y) diff --git a/tests/float 2/float_divmod_relaxed.py b/tests/float 2/float_divmod_relaxed.py deleted file mode 100644 index a9450fa2c4..0000000000 --- a/tests/float 2/float_divmod_relaxed.py +++ /dev/null @@ -1,33 +0,0 @@ -# test floating point floor divide and modulus -# it has some tricky corner cases - -# pyboard has 32-bit floating point and gives different (but still -# correct) answers for certain combinations of divmod arguments. - -def test(x, y): - div, mod = divmod(x, y) - print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6) - -test(1.23456, 0.7) -test(-1.23456, 0.7) -test(1.23456, -0.7) -test(-1.23456, -0.7) - -a = 1.23456 -b = 0.7 -test(a, b) -test(a, -b) -test(-a, b) -test(-a, -b) - -for i in range(25): - x = (i - 12.5) / 6 - for j in range(25): - y = (j - 12.5) / 6 - test(x, y) - -# test division by zero error -try: - divmod(1.0, 0) -except ZeroDivisionError: - print('ZeroDivisionError') diff --git a/tests/float 2/float_format.py b/tests/float 2/float_format.py deleted file mode 100644 index d43535cf2f..0000000000 --- a/tests/float 2/float_format.py +++ /dev/null @@ -1,19 +0,0 @@ -# test float formatting - -# general rounding -for val in (116, 1111, 1234, 5010, 11111): - print('%.0f' % val) - print('%.1f' % val) - print('%.3f' % val) - -# make sure rounding is done at the correct precision -for prec in range(8): - print(('%%.%df' % prec) % 6e-5) - -# check certain cases that had a digit value of 10 render as a ":" character -print('%.2e' % float('9' * 51 + 'e-39')) -print('%.2e' % float('9' * 40 + 'e-21')) - -# check a case that would render negative digit values, eg ")" characters -# the string is converted back to a float to check for no illegal characters -float('%.23e' % 1e-80) diff --git a/tests/float 2/float_parse.py b/tests/float 2/float_parse.py deleted file mode 100644 index 4b026de1c8..0000000000 --- a/tests/float 2/float_parse.py +++ /dev/null @@ -1,32 +0,0 @@ -# test parsing of floats - -inf = float('inf') - -# it shouldn't matter where the decimal point is if the exponent balances the value -print(float('1234') - float('0.1234e4')) -print(float('1.015625') - float('1015625e-6')) - -# very large integer part with a very negative exponent should cancel out -print('%.4e' % float('9' * 60 + 'e-60')) -print('%.4e' % float('9' * 60 + 'e-40')) - -# many fractional digits -print(float('.' + '9' * 70)) -print(float('.' + '9' * 70 + 'e20')) -print(float('.' + '9' * 70 + 'e-50') == float('1e-50')) - -# tiny fraction with large exponent -print(float('.' + '0' * 60 + '1e10') == float('1e-51')) -print(float('.' + '0' * 60 + '9e25') == float('9e-36')) -print(float('.' + '0' * 60 + '9e40') == float('9e-21')) - -# ensure that accuracy is retained when value is close to a subnormal -print(float('1.00000000000000000000e-37')) -print(float('10.0000000000000000000e-38')) -print(float('100.000000000000000000e-39')) - -# very large exponent literal -print(float('1e4294967301')) -print(float('1e-4294967301')) -print(float('1e18446744073709551621')) -print(float('1e-18446744073709551621')) diff --git a/tests/float 2/float_parse_doubleprec.py b/tests/float 2/float_parse_doubleprec.py deleted file mode 100644 index dcc0dd5921..0000000000 --- a/tests/float 2/float_parse_doubleprec.py +++ /dev/null @@ -1,21 +0,0 @@ -# test parsing of floats, requiring double-precision - -# very large integer part with a very negative exponent should cancel out -print(float('9' * 400 + 'e-100')) -print(float('9' * 400 + 'e-200')) -print(float('9' * 400 + 'e-400')) - -# many fractional digits -print(float('.' + '9' * 400)) -print(float('.' + '9' * 400 + 'e100')) -print(float('.' + '9' * 400 + 'e-100')) - -# tiny fraction with large exponent -print('%.14e' % float('.' + '0' * 400 + '9e100')) -print('%.14e' % float('.' + '0' * 400 + '9e200')) -print('%.14e' % float('.' + '0' * 400 + '9e400')) - -# ensure that accuracy is retained when value is close to a subnormal -print(float('1.00000000000000000000e-307')) -print(float('10.0000000000000000000e-308')) -print(float('100.000000000000000000e-309')) diff --git a/tests/float 2/float_struct.py b/tests/float 2/float_struct.py deleted file mode 100644 index dd7a418ad5..0000000000 --- a/tests/float 2/float_struct.py +++ /dev/null @@ -1,17 +0,0 @@ -# test struct package with floats -try: - try: - import ustruct as struct - except: - import struct -except ImportError: - print("SKIP") - raise SystemExit - -i = 1. + 1/2 -# TODO: it looks like '=' format modifier is not yet supported -# for fmt in ('f', 'd', '>f', '>d', 'f', '>d', '' + fmt.format(*args) + '<') - -test("{:10.4}", 123.456) -test("{:10.4e}", 123.456) -test("{:10.4e}", -123.456) -test("{:10.4f}", 123.456) -test("{:10.4f}", -123.456) -test("{:10.4g}", 123.456) -test("{:10.4g}", -123.456) -test("{:10.4n}", 123.456) -test("{:e}", 100) -test("{:f}", 200) -test("{:g}", 300) - -test("{:10.4E}", 123.456) -test("{:10.4E}", -123.456) -test("{:10.4F}", 123.456) -test("{:10.4F}", -123.456) -test("{:10.4G}", 123.456) -test("{:10.4G}", -123.456) - -test("{:06e}", float("inf")) -test("{:06e}", float("-inf")) -test("{:06e}", float("nan")) - -# The following fails right now -#test("{:10.1}", 0.0) - -print("%.0f" % (1.750000 % 0.08333333333)) -# Below isn't compatible with single-precision float -#print("%.1f" % (1.750000 % 0.08333333333)) -#print("%.2f" % (1.750000 % 0.08333333333)) -#print("%.12f" % (1.750000 % 0.08333333333)) - -# tests for errors in format string - -try: - '{:10.1b}'.format(0.0) -except ValueError: - print('ValueError') diff --git a/tests/float 2/string_format2.py b/tests/float 2/string_format2.py deleted file mode 100644 index 269023e7ff..0000000000 --- a/tests/float 2/string_format2.py +++ /dev/null @@ -1,106 +0,0 @@ -# Change the following to True to get a much more comprehensive set of tests -# to run, albeit, which take considerably longer. - -full_tests = False - -def test(fmt, *args): - print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<') - -def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg): - fmt = '{' - if conv: - fmt += '!' - fmt += conv - fmt += ':' - if alignment: - fmt += fill - fmt += alignment - fmt += sign - fmt += prefix - fmt += width - if precision: - fmt += '.' - fmt += precision - fmt += type - fmt += '}' - test(fmt, arg) - if fill == '0' and alignment == '=': - fmt = '{:' - fmt += sign - fmt += prefix - fmt += width - if precision: - fmt += '.' - fmt += precision - fmt += type - fmt += '}' - test(fmt, arg) - -eg_nums = (0.0, -0.0, 0.1, 1.234, 12.3459, 1.23456789, 123456789.0, -0.0, - -0.1, -1.234, -12.3459, 1e4, 1e-4, 1e5, 1e-5, 1e6, 1e-6, 1e10, - 1e37, -1e37, 1e-37, -1e-37, - 1.23456e8, 1.23456e7, 1.23456e6, 1.23456e5, 1.23456e4, 1.23456e3, 1.23456e2, 1.23456e1, 1.23456e0, - 1.23456e-1, 1.23456e-2, 1.23456e-3, 1.23456e-4, 1.23456e-5, 1.23456e-6, 1.23456e-7, 1.23456e-8, - -1.23456e8, -1.23456e7, -1.23456e6, -1.23456e5, -1.23456e4, -1.23456e3, -1.23456e2, -1.23456e1, -1.23456e0, - -1.23456e-1, -1.23456e-2, -1.23456e-3, -1.23456e-4, -1.23456e-5, -1.23456e-6, -1.23456e-7, -1.23456e-8) - -if full_tests: - for type in ('e', 'E', 'g', 'G', 'n'): - for width in ('', '4', '6', '8', '10'): - for alignment in ('', '<', '>', '=', '^'): - for fill in ('', '@', '0', ' '): - for sign in ('', '+', '-', ' '): - for prec in ('', '1', '3', '6'): - for num in eg_nums: - test_fmt('', fill, alignment, sign, '', width, prec, type, num) - -# Note: We use 1.23459 rather than 1.2345 because '{:3f}'.format(1.2345) -# rounds differently than print("%.3f", 1.2345); - -f_nums = (0.0, -0.0, 0.0001, 0.001, 0.01, 0.1, 1.0, 10.0, - 0.0012, 0.0123, 0.1234, 1.23459, 12.3456, - -0.0001, -0.001, -0.01, -0.1, -1.0, -10.0, - -0.0012, -0.0123, -0.1234, -1.23459, -12.3456) - -if full_tests: - for type in ('f', 'F'): - for width in ('', '4', '6', '8', '10'): - for alignment in ('', '<', '>', '=', '^'): - for fill in ('', ' ', '0', '@'): - for sign in ('', '+', '-', ' '): - # An empty precision defaults to 6, but when uPy is - # configured to use a float, we can only use a - # precision of 6 with numbers less than 10 and still - # get results that compare to CPython (which uses - # long doubles). - for prec in ('1', '2', '3'): - for num in f_nums: - test_fmt('', fill, alignment, sign, '', width, prec, type, num) - for num in int_nums2: - test_fmt('', fill, alignment, sign, '', width, '', type, num) - -pct_nums1 = (0.1, 0.58, 0.99, -0.1, -0.58, -0.99) -pct_nums2 = (True, False, 1, 0, -1) - -if full_tests: - type = '%' - for width in ('', '4', '6', '8', '10'): - for alignment in ('', '<', '>', '=', '^'): - for fill in ('', ' ', '0', '@'): - for sign in ('', '+', '-', ' '): - # An empty precision defaults to 6, but when uPy is - # configured to use a float, we can only use a - # precision of 6 with numbers less than 10 and still - # get results that compare to CPython (which uses - # long doubles). - for prec in ('1', '2', '3'): - for num in pct_nums1: - test_fmt('', fill, alignment, sign, '', width, prec, type, num) - for num in pct_nums2: - test_fmt('', fill, alignment, sign, '', width, '', type, num) -else: - for num in pct_nums1: - test_fmt('', '', '', '', '', '', '1', '%', num) - -# We don't currently test a type of '' with floats (see the detailed comment -# in objstr.c) diff --git a/tests/float 2/string_format_fp30.py b/tests/float 2/string_format_fp30.py deleted file mode 100644 index 77b2a52885..0000000000 --- a/tests/float 2/string_format_fp30.py +++ /dev/null @@ -1,41 +0,0 @@ -def test(fmt, *args): - print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<') - -test("{:10.4}", 123.456) -test("{:10.4e}", 123.456) -test("{:10.4e}", -123.456) -#test("{:10.4f}", 123.456) -#test("{:10.4f}", -123.456) -test("{:10.4g}", 123.456) -test("{:10.4g}", -123.456) -test("{:10.4n}", 123.456) -test("{:e}", 100) -test("{:f}", 200) -test("{:g}", 300) - -test("{:10.4E}", 123.456) -test("{:10.4E}", -123.456) -#test("{:10.4F}", 123.456) -#test("{:10.4F}", -123.456) -test("{:10.4G}", 123.456) -test("{:10.4G}", -123.456) - -test("{:06e}", float("inf")) -test("{:06e}", float("-inf")) -test("{:06e}", float("nan")) - -# The following fails right now -#test("{:10.1}", 0.0) - -print("%.0f" % (1.750000 % 0.08333333333)) -# Below isn't compatible with single-precision float -#print("%.1f" % (1.750000 % 0.08333333333)) -#print("%.2f" % (1.750000 % 0.08333333333)) -#print("%.12f" % (1.750000 % 0.08333333333)) - -# tests for errors in format string - -try: - '{:10.1b}'.format(0.0) -except ValueError: - print('ValueError') diff --git a/tests/float 2/string_format_modulo.py b/tests/float 2/string_format_modulo.py deleted file mode 100644 index aea534247c..0000000000 --- a/tests/float 2/string_format_modulo.py +++ /dev/null @@ -1,49 +0,0 @@ -print("%s" % 1.0) -print("%r" % 1.0) - -print("%d" % 1.0) -print("%i" % 1.0) -print("%u" % 1.0) - -# these 3 have different behaviour in Python 3.x versions -# uPy raises a TypeError, following Python 3.5 (earlier versions don't) -#print("%x" % 18.0) -#print("%o" % 18.0) -#print("%X" % 18.0) - -print("%e" % 1.23456) -print("%E" % 1.23456) -print("%f" % 1.23456) -print("%F" % 1.23456) -print("%g" % 1.23456) -print("%G" % 1.23456) - -print("%06e" % float("inf")) -print("%06e" % float("-inf")) -print("%06e" % float("nan")) - -print("%02.3d" % 123) # prec > width -print("%+f %+f" % (1.23, -1.23)) # float sign -print("% f % f" % (1.23, -1.23)) # float space sign -print("%0f" % -1.23) # negative number with 0 padding - -# numbers with large negative exponents -print('%f' % 1e-10) -print('%f' % 1e-20) -print('%f' % 1e-50) -print('%f' % 1e-100) -print('%f' % 1e-300) - -# large decimal precision should be truncated and not overflow buffer -# the output depends on the FP calculation so only first 2 digits are printed -# (the 'g' with small e are printed using 'f' style, so need to be checked) -print(('%.40f' % 1e-300)[:2]) -print(('%.40g' % 1e-1)[:2]) -print(('%.40g' % 1e-2)[:2]) -print(('%.40g' % 1e-3)[:2]) -print(('%.40g' % 1e-4)[:2]) - -print("%.0g" % 1) # 0 precision 'g' - -print('%.1e' % 9.99) # round up with positive exponent -print('%.1e' % 0.999) # round up with negative exponent diff --git a/tests/float 2/string_format_modulo2.py b/tests/float 2/string_format_modulo2.py deleted file mode 100644 index f6b1ae537d..0000000000 --- a/tests/float 2/string_format_modulo2.py +++ /dev/null @@ -1,24 +0,0 @@ -# test formatting floats with large precision, that it doesn't overflow the buffer - -def test(num, num_str): - if num == float('inf') or num == 0.0 and num_str != '0.0': - # skip numbers that overflow or underflow the FP precision - return - for kind in ('e', 'f', 'g'): - # check precision either side of the size of the buffer (32 bytes) - for prec in range(23, 36, 2): - fmt = '%.' + '%d' % prec + kind - s = fmt % num - check = abs(float(s) - num) - if num > 1: - check /= num - if check > 1e-6: - print('FAIL', num_str, fmt, s, len(s), check) - -# check pure zero -test(0.0, '0.0') - -# check some powers of 10, making sure to include exponents with 3 digits -for e in range(-8, 8): - num = pow(10, e) - test(num, '1e%d' % e) diff --git a/tests/float 2/string_format_modulo2_intbig.py b/tests/float 2/string_format_modulo2_intbig.py deleted file mode 100644 index 9992ba65d9..0000000000 --- a/tests/float 2/string_format_modulo2_intbig.py +++ /dev/null @@ -1,21 +0,0 @@ -# test formatting floats with large precision, that it doesn't overflow the buffer - -def test(num, num_str): - if num == float('inf') or num == 0.0 and num_str != '0.0': - # skip numbers that overflow or underflow the FP precision - return - for kind in ('e', 'f', 'g'): - # check precision either side of the size of the buffer (32 bytes) - for prec in range(23, 36, 2): - fmt = '%.' + '%d' % prec + kind - s = fmt % num - check = abs(float(s) - num) - if num > 1: - check /= num - if check > 1e-6: - print('FAIL', num_str, fmt, s, len(s), check) - -# check most powers of 10, making sure to include exponents with 3 digits -for e in range(-101, 102): - num = pow(10, e) - test(num, '1e%d' % e) diff --git a/tests/float 2/string_format_modulo3.py b/tests/float 2/string_format_modulo3.py deleted file mode 100644 index 5d26f25751..0000000000 --- a/tests/float 2/string_format_modulo3.py +++ /dev/null @@ -1,3 +0,0 @@ -# uPy and CPython outputs differ for the following -print("%.1g" % -9.9) # round up 'g' with '-' sign -print("%.2g" % 99.9) # round up diff --git a/tests/float 2/string_format_modulo3.py.exp b/tests/float 2/string_format_modulo3.py.exp deleted file mode 100644 index 71432b3404..0000000000 --- a/tests/float 2/string_format_modulo3.py.exp +++ /dev/null @@ -1,2 +0,0 @@ --10 -100 diff --git a/tests/float 2/true_value.py b/tests/float 2/true_value.py deleted file mode 100644 index df415f0031..0000000000 --- a/tests/float 2/true_value.py +++ /dev/null @@ -1,7 +0,0 @@ -# Test true-ish value handling - -if not 0.0: - print("float 0") - -if not 0+0j: - print("complex 0") diff --git a/tests/float 2/types.py b/tests/float 2/types.py deleted file mode 100644 index 75674c9246..0000000000 --- a/tests/float 2/types.py +++ /dev/null @@ -1,17 +0,0 @@ -# float types - -print(float) -print(complex) - -print(type(float()) == float) -print(type(complex()) == complex) - -print(type(0.0) == float) -print(type(1j) == complex) - -# hashing float types - -d = dict() -d[float] = complex -d[complex] = float -print(len(d)) diff --git a/tests/inlineasm 2/asmargs.py b/tests/inlineasm 2/asmargs.py deleted file mode 100644 index 047d9ed420..0000000000 --- a/tests/inlineasm 2/asmargs.py +++ /dev/null @@ -1,29 +0,0 @@ -# test passing arguments - -@micropython.asm_thumb -def arg0(): - mov(r0, 1) -print(arg0()) - -@micropython.asm_thumb -def arg1(r0): - add(r0, r0, 1) -print(arg1(1)) - -@micropython.asm_thumb -def arg2(r0, r1): - add(r0, r0, r1) -print(arg2(1, 2)) - -@micropython.asm_thumb -def arg3(r0, r1, r2): - add(r0, r0, r1) - add(r0, r0, r2) -print(arg3(1, 2, 3)) - -@micropython.asm_thumb -def arg4(r0, r1, r2, r3): - add(r0, r0, r1) - add(r0, r0, r2) - add(r0, r0, r3) -print(arg4(1, 2, 3, 4)) diff --git a/tests/inlineasm 2/asmargs.py.exp b/tests/inlineasm 2/asmargs.py.exp deleted file mode 100644 index e33a6964f4..0000000000 --- a/tests/inlineasm 2/asmargs.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -6 -10 diff --git a/tests/inlineasm 2/asmbcc.py b/tests/inlineasm 2/asmbcc.py deleted file mode 100644 index 540fa6591f..0000000000 --- a/tests/inlineasm 2/asmbcc.py +++ /dev/null @@ -1,27 +0,0 @@ -# test bcc instructions -# at the moment only tests beq, narrow and wide versions - -@micropython.asm_thumb -def f(r0): - mov(r1, r0) - - mov(r0, 10) - cmp(r1, 1) - beq(end) - - mov(r0, 20) - cmp(r1, 2) - beq_n(end) - - mov(r0, 30) - cmp(r1, 3) - beq_w(end) - - mov(r0, 0) - - label(end) - -print(f(0)) -print(f(1)) -print(f(2)) -print(f(3)) diff --git a/tests/inlineasm 2/asmbcc.py.exp b/tests/inlineasm 2/asmbcc.py.exp deleted file mode 100644 index 39da7d1a99..0000000000 --- a/tests/inlineasm 2/asmbcc.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -0 -10 -20 -30 diff --git a/tests/inlineasm 2/asmbitops.py b/tests/inlineasm 2/asmbitops.py deleted file mode 100644 index 8cf92b301f..0000000000 --- a/tests/inlineasm 2/asmbitops.py +++ /dev/null @@ -1,13 +0,0 @@ -@micropython.asm_thumb -def clz(r0): - clz(r0, r0) - -print(clz(0xf0)) -print(clz(0x8000)) - -@micropython.asm_thumb -def rbit(r0): - rbit(r0, r0) - -print(hex(rbit(0xf0))) -print(hex(rbit(0x8000))) diff --git a/tests/inlineasm 2/asmbitops.py.exp b/tests/inlineasm 2/asmbitops.py.exp deleted file mode 100644 index 8c560045f4..0000000000 --- a/tests/inlineasm 2/asmbitops.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -24 -16 -0xf000000 -0x10000 diff --git a/tests/inlineasm 2/asmblbx.py b/tests/inlineasm 2/asmblbx.py deleted file mode 100644 index d08c0ed6b3..0000000000 --- a/tests/inlineasm 2/asmblbx.py +++ /dev/null @@ -1,21 +0,0 @@ -# test bl and bx instructions - -@micropython.asm_thumb -def f(r0): - # jump over the internal functions - b(entry) - - label(func1) - add(r0, 2) - bx(lr) - - label(func2) - sub(r0, 1) - bx(lr) - - label(entry) - bl(func1) - bl(func2) - -print(f(0)) -print(f(1)) diff --git a/tests/inlineasm 2/asmblbx.py.exp b/tests/inlineasm 2/asmblbx.py.exp deleted file mode 100644 index 1191247b6d..0000000000 --- a/tests/inlineasm 2/asmblbx.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -1 -2 diff --git a/tests/inlineasm 2/asmconst.py b/tests/inlineasm 2/asmconst.py deleted file mode 100644 index 299a25093c..0000000000 --- a/tests/inlineasm 2/asmconst.py +++ /dev/null @@ -1,8 +0,0 @@ -# test constants in assembler - -@micropython.asm_thumb -def c1(): - movwt(r0, 0xffffffff) - movwt(r1, 0xf0000000) - sub(r0, r0, r1) -print(hex(c1())) diff --git a/tests/inlineasm 2/asmconst.py.exp b/tests/inlineasm 2/asmconst.py.exp deleted file mode 100644 index 3ef9fcabd7..0000000000 --- a/tests/inlineasm 2/asmconst.py.exp +++ /dev/null @@ -1 +0,0 @@ -0xfffffff diff --git a/tests/inlineasm 2/asmdiv.py b/tests/inlineasm 2/asmdiv.py deleted file mode 100644 index b97d566eb5..0000000000 --- a/tests/inlineasm 2/asmdiv.py +++ /dev/null @@ -1,16 +0,0 @@ -@micropython.asm_thumb -def sdiv(r0, r1): - sdiv(r0, r0, r1) - -@micropython.asm_thumb -def udiv(r0, r1): - udiv(r0, r0, r1) - -print(sdiv(1234, 3)) -print(sdiv(-1234, 3)) -print(sdiv(1234, -3)) -print(sdiv(-1234, -3)) - -print(udiv(1234, 3)) -print(udiv(0xffffffff, 0x7fffffff)) -print(udiv(0xffffffff, 0xffffffff)) diff --git a/tests/inlineasm 2/asmdiv.py.exp b/tests/inlineasm 2/asmdiv.py.exp deleted file mode 100644 index f1b80deb32..0000000000 --- a/tests/inlineasm 2/asmdiv.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -411 --411 --411 -411 -411 -2 -1 diff --git a/tests/inlineasm 2/asmfpaddsub.py b/tests/inlineasm 2/asmfpaddsub.py deleted file mode 100644 index 2bdfccf0e0..0000000000 --- a/tests/inlineasm 2/asmfpaddsub.py +++ /dev/null @@ -1,14 +0,0 @@ -@micropython.asm_thumb # r0 = r0+r1-r2 -def add_sub(r0, r1, r2): - vmov(s0, r0) - vcvt_f32_s32(s0, s0) - vmov(s1, r1) - vcvt_f32_s32(s1, s1) - vmov(s2, r2) - vcvt_f32_s32(s2, s2) - vadd(s0, s0, s1) - vsub(s0, s0, s2) - vcvt_s32_f32(s31, s0) - vmov(r0, s31) - -print(add_sub(100, 20, 30)) diff --git a/tests/inlineasm 2/asmfpaddsub.py.exp b/tests/inlineasm 2/asmfpaddsub.py.exp deleted file mode 100644 index d61f00d8ca..0000000000 --- a/tests/inlineasm 2/asmfpaddsub.py.exp +++ /dev/null @@ -1 +0,0 @@ -90 diff --git a/tests/inlineasm 2/asmfpcmp.py b/tests/inlineasm 2/asmfpcmp.py deleted file mode 100644 index d4fa1f2410..0000000000 --- a/tests/inlineasm 2/asmfpcmp.py +++ /dev/null @@ -1,14 +0,0 @@ -@micropython.asm_thumb # test vcmp, vmrs -def f(r0, r1): - vmov(s0, r0) - vcvt_f32_s32(s0, s0) - vmov(s1, r1) - vcvt_f32_s32(s1, s1) - vcmp(s1, s0) - vmrs(r0, FPSCR) - mov(r1, 28) - lsr(r0, r1) - -print(f(0,1)) -print(f(1,1)) -print(f(1,0)) diff --git a/tests/inlineasm 2/asmfpcmp.py.exp b/tests/inlineasm 2/asmfpcmp.py.exp deleted file mode 100644 index 104b3580f7..0000000000 --- a/tests/inlineasm 2/asmfpcmp.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -2 -6 -8 diff --git a/tests/inlineasm 2/asmfpldrstr.py b/tests/inlineasm 2/asmfpldrstr.py deleted file mode 100644 index 4c480671f9..0000000000 --- a/tests/inlineasm 2/asmfpldrstr.py +++ /dev/null @@ -1,11 +0,0 @@ -import array -@micropython.asm_thumb # test vldr, vstr -def arrayadd(r0): - vldr(s0, [r0, 0]) - vldr(s1, [r0, 4]) - vadd(s2, s0, s1) - vstr(s2, [r0, 8]) - -z = array.array("f", [2, 4, 10]) -arrayadd(z) -print(z[2]) diff --git a/tests/inlineasm 2/asmfpldrstr.py.exp b/tests/inlineasm 2/asmfpldrstr.py.exp deleted file mode 100644 index e0ea36feef..0000000000 --- a/tests/inlineasm 2/asmfpldrstr.py.exp +++ /dev/null @@ -1 +0,0 @@ -6.0 diff --git a/tests/inlineasm 2/asmfpmuldiv.py b/tests/inlineasm 2/asmfpmuldiv.py deleted file mode 100644 index 043a28e229..0000000000 --- a/tests/inlineasm 2/asmfpmuldiv.py +++ /dev/null @@ -1,14 +0,0 @@ -@micropython.asm_thumb # r0 = (int)(r0*r1/r2) -def muldiv(r0, r1, r2): - vmov(s0, r0) - vcvt_f32_s32(s0, s0) - vmov(s1, r1) - vcvt_f32_s32(s1, s1) - vmov(s2, r2) - vcvt_f32_s32(s2, s2) - vmul(s7, s0, s1) - vdiv(s8, s7, s2) - vcvt_s32_f32(s31, s8) - vmov(r0, s31) - -print(muldiv(100, 10, 50)) diff --git a/tests/inlineasm 2/asmfpmuldiv.py.exp b/tests/inlineasm 2/asmfpmuldiv.py.exp deleted file mode 100644 index 209e3ef4b6..0000000000 --- a/tests/inlineasm 2/asmfpmuldiv.py.exp +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/tests/inlineasm 2/asmfpsqrt.py b/tests/inlineasm 2/asmfpsqrt.py deleted file mode 100644 index 7b7d52e238..0000000000 --- a/tests/inlineasm 2/asmfpsqrt.py +++ /dev/null @@ -1,14 +0,0 @@ -# test vsqrt, vneg -@micropython.asm_thumb # r0 = -(int)(sqrt(r0)*r1) -def sqrt_test(r0, r1): - vmov(s1, r0) - vcvt_f32_s32(s1, s1) - vsqrt(s1, s1) - vmov(s2, r1) - vcvt_f32_s32(s2, s2) - vmul(s0, s1, s2) - vneg(s7, s0) - vcvt_s32_f32(s31, s7) - vmov(r0, s31) - -print(sqrt_test(256, 10)) diff --git a/tests/inlineasm 2/asmfpsqrt.py.exp b/tests/inlineasm 2/asmfpsqrt.py.exp deleted file mode 100644 index 88a1e93bab..0000000000 --- a/tests/inlineasm 2/asmfpsqrt.py.exp +++ /dev/null @@ -1 +0,0 @@ --160 diff --git a/tests/inlineasm 2/asmit.py b/tests/inlineasm 2/asmit.py deleted file mode 100644 index 57bfcc7f9a..0000000000 --- a/tests/inlineasm 2/asmit.py +++ /dev/null @@ -1,16 +0,0 @@ -# test it instruction - -@micropython.asm_thumb -def f(r0, r1): - cmp(r0, r1) - it(eq) - mov(r0, 100) -print(f(0, 0), f(1, 2)) - -@micropython.asm_thumb -def g(r0, r1): - cmp(r0, r1) - ite(eq) - mov(r0, 100) - mov(r0, 200) -print(g(0, 0), g(0, 1)) diff --git a/tests/inlineasm 2/asmit.py.exp b/tests/inlineasm 2/asmit.py.exp deleted file mode 100644 index d06c72d9bb..0000000000 --- a/tests/inlineasm 2/asmit.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -100 1 -100 200 diff --git a/tests/inlineasm 2/asmpushpop.py b/tests/inlineasm 2/asmpushpop.py deleted file mode 100644 index c9005434ba..0000000000 --- a/tests/inlineasm 2/asmpushpop.py +++ /dev/null @@ -1,8 +0,0 @@ -@micropython.asm_thumb -def f(r0, r1, r2): - push({r0}) - push({r1, r2}) - pop({r0}) - pop({r1, r2}) - -print(f(0, 1, 2)) diff --git a/tests/inlineasm 2/asmpushpop.py.exp b/tests/inlineasm 2/asmpushpop.py.exp deleted file mode 100644 index d00491fd7e..0000000000 --- a/tests/inlineasm 2/asmpushpop.py.exp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/inlineasm 2/asmrettype.py b/tests/inlineasm 2/asmrettype.py deleted file mode 100644 index f1918696ee..0000000000 --- a/tests/inlineasm 2/asmrettype.py +++ /dev/null @@ -1,21 +0,0 @@ -# test return type of inline asm - -@micropython.asm_thumb -def ret_obj(r0) -> object: - pass -ret_obj(print)(1) - -@micropython.asm_thumb -def ret_bool(r0) -> bool: - pass -print(ret_bool(0), ret_bool(1)) - -@micropython.asm_thumb -def ret_int(r0) -> int: - lsl(r0, r0, 29) -print(ret_int(0), hex(ret_int(1)), hex(ret_int(2)), hex(ret_int(4))) - -@micropython.asm_thumb -def ret_uint(r0) -> uint: - lsl(r0, r0, 29) -print(ret_uint(0), hex(ret_uint(1)), hex(ret_uint(2)), hex(ret_uint(4))) diff --git a/tests/inlineasm 2/asmrettype.py.exp b/tests/inlineasm 2/asmrettype.py.exp deleted file mode 100644 index cbb49d2472..0000000000 --- a/tests/inlineasm 2/asmrettype.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -1 -False True -0 0x20000000 0x40000000 -0x80000000 -0 0x20000000 0x40000000 0x80000000 diff --git a/tests/inlineasm 2/asmshift.py b/tests/inlineasm 2/asmshift.py deleted file mode 100644 index 0df2187347..0000000000 --- a/tests/inlineasm 2/asmshift.py +++ /dev/null @@ -1,29 +0,0 @@ -@micropython.asm_thumb -def lsl1(r0): - lsl(r0, r0, 1) -print(hex(lsl1(0x123))) - -@micropython.asm_thumb -def lsl23(r0): - lsl(r0, r0, 23) -print(hex(lsl23(1))) - -@micropython.asm_thumb -def lsr1(r0): - lsr(r0, r0, 1) -print(hex(lsr1(0x123))) - -@micropython.asm_thumb -def lsr31(r0): - lsr(r0, r0, 31) -print(hex(lsr31(0x80000000))) - -@micropython.asm_thumb -def asr1(r0): - asr(r0, r0, 1) -print(hex(asr1(0x123))) - -@micropython.asm_thumb -def asr31(r0): - asr(r0, r0, 31) -print(hex(asr31(0x80000000))) diff --git a/tests/inlineasm 2/asmshift.py.exp b/tests/inlineasm 2/asmshift.py.exp deleted file mode 100644 index c6c3a72179..0000000000 --- a/tests/inlineasm 2/asmshift.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -0x246 -0x800000 -0x91 -0x1 -0x91 --0x1 diff --git a/tests/inlineasm 2/asmspecialregs.py b/tests/inlineasm 2/asmspecialregs.py deleted file mode 100644 index 2d3b0e396f..0000000000 --- a/tests/inlineasm 2/asmspecialregs.py +++ /dev/null @@ -1,10 +0,0 @@ -@micropython.asm_thumb -def getIPSR(): - mrs(r0, IPSR) - -@micropython.asm_thumb -def getBASEPRI(): - mrs(r0, BASEPRI) - -print(getBASEPRI()) -print(getIPSR()) diff --git a/tests/inlineasm 2/asmspecialregs.py.exp b/tests/inlineasm 2/asmspecialregs.py.exp deleted file mode 100644 index aa47d0d46d..0000000000 --- a/tests/inlineasm 2/asmspecialregs.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -0 -0 diff --git a/tests/inlineasm 2/asmsum.py b/tests/inlineasm 2/asmsum.py deleted file mode 100644 index 07e71c7384..0000000000 --- a/tests/inlineasm 2/asmsum.py +++ /dev/null @@ -1,57 +0,0 @@ -@micropython.asm_thumb -def asm_sum_words(r0, r1): - - # r0 = len - # r1 = ptr - # r2 = sum - # r3 = dummy - mov(r2, 0) - - b(loop_entry) - - label(loop1) - ldr(r3, [r1, 0]) - add(r2, r2, r3) - - add(r1, r1, 4) - sub(r0, r0, 1) - - label(loop_entry) - cmp(r0, 0) - bgt(loop1) - - mov(r0, r2) - -@micropython.asm_thumb -def asm_sum_bytes(r0, r1): - - # r0 = len - # r1 = ptr - # r2 = sum - # r3 = dummy - mov(r2, 0) - - b(loop_entry) - - label(loop1) - ldrb(r3, [r1, 0]) - add(r2, r2, r3) - - add(r1, r1, 1) - sub(r0, r0, 1) - - label(loop_entry) - cmp(r0, 0) - bgt(loop1) - - mov(r0, r2) - -import array - -b = array.array('l', (100, 200, 300, 400)) -n = asm_sum_words(len(b), b) -print(b, n) - -b = array.array('b', (10, 20, 30, 40, 50, 60, 70, 80)) -n = asm_sum_bytes(len(b), b) -print(b, n) diff --git a/tests/inlineasm 2/asmsum.py.exp b/tests/inlineasm 2/asmsum.py.exp deleted file mode 100644 index d50a94c8db..0000000000 --- a/tests/inlineasm 2/asmsum.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -array('l', [100, 200, 300, 400]) 1000 -array('b', [10, 20, 30, 40, 50, 60, 70, 80]) 360 diff --git a/tests/jni 2/README b/tests/jni 2/README deleted file mode 100644 index a0689e9244..0000000000 --- a/tests/jni 2/README +++ /dev/null @@ -1,11 +0,0 @@ -Running "jni" module tests (as well as just using this module) requires -being able to load libjvm.so, which requires path to it set via -LD_LIBRARY_PATH environment variable. This path is not set automatically -and there is no easy way to guess it, because there can be installed -different implementations of JVM, for one implementation, there can be -different versions, and single version may include different variants -of JVM. - -For example, for OpenJDK 7 on x86_64, following may work: - -LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests jni/*.py diff --git a/tests/jni 2/list.py b/tests/jni 2/list.py deleted file mode 100644 index d58181d0ba..0000000000 --- a/tests/jni 2/list.py +++ /dev/null @@ -1,15 +0,0 @@ -import jni -try: - ArrayList = jni.cls("java/util/ArrayList") -except: - print("SKIP") - raise SystemExit - -l = ArrayList() -print(l) -l.add("one") -l.add("two") - -print(l.toString()) -print(l) -print(l[0], l[1]) diff --git a/tests/jni 2/list.py.exp b/tests/jni 2/list.py.exp deleted file mode 100644 index cc34bb0a21..0000000000 --- a/tests/jni 2/list.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -[] -[one, two] -[one, two] -one two diff --git a/tests/jni 2/object.py b/tests/jni 2/object.py deleted file mode 100644 index aa67615ec8..0000000000 --- a/tests/jni 2/object.py +++ /dev/null @@ -1,15 +0,0 @@ -import jni -try: - Integer = jni.cls("java/lang/Integer") -except: - print("SKIP") - raise SystemExit - -# Create object -i = Integer(42) -print(i) -# Call object method -print(i.hashCode()) -# Pass object to another method -System = jni.cls("java/lang/System") -System.out.println(i) diff --git a/tests/jni 2/object.py.exp b/tests/jni 2/object.py.exp deleted file mode 100644 index bda709ecfb..0000000000 --- a/tests/jni 2/object.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -42 -42 -42 diff --git a/tests/jni 2/system_out.py b/tests/jni 2/system_out.py deleted file mode 100644 index 86c4b9e112..0000000000 --- a/tests/jni 2/system_out.py +++ /dev/null @@ -1,8 +0,0 @@ -try: - import jni - System = jni.cls("java/lang/System") -except: - print("SKIP") - raise SystemExit - -System.out.println("Hello, Java!") diff --git a/tests/jni 2/system_out.py.exp b/tests/jni 2/system_out.py.exp deleted file mode 100644 index 01dd954f90..0000000000 --- a/tests/jni 2/system_out.py.exp +++ /dev/null @@ -1 +0,0 @@ -Hello, Java! diff --git a/tests/net_hosted 2/README b/tests/net_hosted 2/README deleted file mode 100644 index 724dd61584..0000000000 --- a/tests/net_hosted 2/README +++ /dev/null @@ -1,11 +0,0 @@ -This directory contains network tests which require just "peer to peer" -network connection between test host and device under test, instead of -full Internet connection. - -Note that setup for these tests and tests themselves are WIP, and may -not yet fully correspond to the functional specification above. - -So far, these tests are not run as part of the main testsuite and need -to be run seperately (from the main test/ directory): - - ./run-tests net_hosted/*.py diff --git a/tests/net_hosted 2/accept_nonblock.py b/tests/net_hosted 2/accept_nonblock.py deleted file mode 100644 index 56f3288e28..0000000000 --- a/tests/net_hosted 2/accept_nonblock.py +++ /dev/null @@ -1,16 +0,0 @@ -# test that socket.accept() on a non-blocking socket raises EAGAIN - -try: - import usocket as socket -except: - import socket - -s = socket.socket() -s.bind(socket.getaddrinfo('127.0.0.1', 8123)[0][-1]) -s.setblocking(False) -s.listen(1) -try: - s.accept() -except OSError as er: - print(er.args[0] == 11) # 11 is EAGAIN -s.close() diff --git a/tests/net_hosted 2/accept_nonblock.py.exp b/tests/net_hosted 2/accept_nonblock.py.exp deleted file mode 100644 index 0ca95142bb..0000000000 --- a/tests/net_hosted 2/accept_nonblock.py.exp +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/tests/net_hosted 2/accept_timeout.py b/tests/net_hosted 2/accept_timeout.py deleted file mode 100644 index 44b3b8c7cd..0000000000 --- a/tests/net_hosted 2/accept_timeout.py +++ /dev/null @@ -1,22 +0,0 @@ -# test that socket.accept() on a socket with timeout raises ETIMEDOUT - -try: - import usocket as socket -except: - import socket - -try: - socket.socket.settimeout -except AttributeError: - print('SKIP') - raise SystemExit - -s = socket.socket() -s.bind(socket.getaddrinfo('127.0.0.1', 8123)[0][-1]) -s.settimeout(1) -s.listen(1) -try: - s.accept() -except OSError as er: - print(er.args[0] in (110, 'timed out')) # 110 is ETIMEDOUT; CPython uses a string -s.close() diff --git a/tests/net_hosted 2/accept_timeout.py.exp b/tests/net_hosted 2/accept_timeout.py.exp deleted file mode 100644 index 0ca95142bb..0000000000 --- a/tests/net_hosted 2/accept_timeout.py.exp +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/tests/net_hosted 2/connect_nonblock.py b/tests/net_hosted 2/connect_nonblock.py deleted file mode 100644 index 6479978bea..0000000000 --- a/tests/net_hosted 2/connect_nonblock.py +++ /dev/null @@ -1,20 +0,0 @@ -# test that socket.connect() on a non-blocking socket raises EINPROGRESS - -try: - import usocket as socket -except: - import socket - - -def test(peer_addr): - s = socket.socket() - s.setblocking(False) - try: - s.connect(peer_addr) - except OSError as er: - print(er.args[0] == 115) # 115 is EINPROGRESS - s.close() - - -if __name__ == "__main__": - test(socket.getaddrinfo('micropython.org', 80)[0][-1]) diff --git a/tests/net_hosted 2/connect_nonblock.py.exp b/tests/net_hosted 2/connect_nonblock.py.exp deleted file mode 100644 index 0ca95142bb..0000000000 --- a/tests/net_hosted 2/connect_nonblock.py.exp +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/tests/net_hosted 2/connect_poll.py b/tests/net_hosted 2/connect_poll.py deleted file mode 100644 index ece6aa0da9..0000000000 --- a/tests/net_hosted 2/connect_poll.py +++ /dev/null @@ -1,32 +0,0 @@ -# test that socket.connect() has correct polling behaviour before, during and after - -try: - import usocket as socket, uselect as select -except: - import socket, select - - -def test(peer_addr): - s = socket.socket() - poller = select.poll() - poller.register(s) - - # test poll before connect - # note: CPython can return POLLHUP, so use the IN|OUT mask - p = poller.poll(0) - print(len(p), p[0][-1] & (select.POLLIN | select.POLLOUT)) - - s.connect(peer_addr) - - # test poll during connection - print(len(poller.poll(0))) - - # test poll after connection is established - p = poller.poll(1000) - print(len(p), p[0][-1]) - - s.close() - - -if __name__ == "__main__": - test(socket.getaddrinfo('micropython.org', 80)[0][-1]) diff --git a/tests/net_hosted 2/connect_poll.py.exp b/tests/net_hosted 2/connect_poll.py.exp deleted file mode 100644 index cdf520e090..0000000000 --- a/tests/net_hosted 2/connect_poll.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -1 4 -1 -1 4 diff --git a/tests/net_hosted 2/ssl_getpeercert.py b/tests/net_hosted 2/ssl_getpeercert.py deleted file mode 100644 index e265c830d0..0000000000 --- a/tests/net_hosted 2/ssl_getpeercert.py +++ /dev/null @@ -1,21 +0,0 @@ -# test ssl.getpeercert() method - -try: - import usocket as socket - import ussl as ssl -except: - import socket - import ssl - - -def test(peer_addr): - s = socket.socket() - s.connect(peer_addr) - s = ssl.wrap_socket(s) - cert = s.getpeercert(True) - print(type(cert), len(cert) > 100) - s.close() - - -if __name__ == "__main__": - test(socket.getaddrinfo('micropython.org', 443)[0][-1]) diff --git a/tests/net_hosted 2/ssl_getpeercert.py.exp b/tests/net_hosted 2/ssl_getpeercert.py.exp deleted file mode 100644 index ff7ef5adf1..0000000000 --- a/tests/net_hosted 2/ssl_getpeercert.py.exp +++ /dev/null @@ -1 +0,0 @@ - True diff --git a/tests/net_inet 2/README b/tests/net_inet 2/README deleted file mode 100644 index 9a5614efa6..0000000000 --- a/tests/net_inet 2/README +++ /dev/null @@ -1,5 +0,0 @@ -This directory contains network tests which require Internet connection. -Note that these tests are not run as part of the main testsuite and need -to be run seperately (from the main test/ directory): - - ./run-tests net_inet/*.py diff --git a/tests/net_inet 2/test_tls_sites.py b/tests/net_inet 2/test_tls_sites.py deleted file mode 100644 index bf8071d087..0000000000 --- a/tests/net_inet 2/test_tls_sites.py +++ /dev/null @@ -1,59 +0,0 @@ -try: - import usocket as _socket -except: - import _socket -try: - import ussl as ssl -except: - import ssl - # CPython only supports server_hostname with SSLContext - ssl = ssl.SSLContext() - - -def test_one(site, opts): - ai = _socket.getaddrinfo(site, 443) - addr = ai[0][-1] - - s = _socket.socket() - - try: - s.connect(addr) - - if "sni" in opts: - s = ssl.wrap_socket(s, server_hostname=opts["host"]) - else: - s = ssl.wrap_socket(s) - - s.write(b"GET / HTTP/1.0\r\nHost: %s\r\n\r\n" % bytes(site, 'latin')) - resp = s.read(4096) -# print(resp) - - finally: - s.close() - - -SITES = [ - "google.com", - "www.google.com", - "api.telegram.org", - {"host": "api.pushbullet.com", "sni": True}, -# "w9rybpfril.execute-api.ap-southeast-2.amazonaws.com", - {"host": "w9rybpfril.execute-api.ap-southeast-2.amazonaws.com", "sni": True}, -] - - -def main(): - for site in SITES: - opts = {} - if isinstance(site, dict): - opts = site - site = opts["host"] - - try: - test_one(site, opts) - print(site, "ok") - except Exception as e: - print(site, repr(e)) - - -main() diff --git a/tests/net_inet 2/test_tls_sites.py.exp b/tests/net_inet 2/test_tls_sites.py.exp deleted file mode 100644 index 2f3c113d2f..0000000000 --- a/tests/net_inet 2/test_tls_sites.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -google.com ok -www.google.com ok -api.telegram.org ok -api.pushbullet.com ok -w9rybpfril.execute-api.ap-southeast-2.amazonaws.com ok diff --git a/tests/run-bench-tests 2 b/tests/run-bench-tests 2 deleted file mode 100755 index f4a6776cbc..0000000000 --- a/tests/run-bench-tests 2 +++ /dev/null @@ -1,97 +0,0 @@ -#! /usr/bin/env python3 - -import os -import subprocess -import sys -import argparse -import re -from glob import glob -from collections import defaultdict - -# Tests require at least CPython 3.3. If your default python3 executable -# is of lower version, you can point MICROPY_CPYTHON3 environment var -# to the correct executable. -if os.name == 'nt': - CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') - MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/windows/micropython.exe') -else: - CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') - MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/unix/micropython') - -def run_tests(pyb, test_dict): - test_count = 0 - testcase_count = 0 - - for base_test, tests in sorted(test_dict.items()): - print(base_test + ":") - for test_file in tests: - - # run MicroPython - if pyb is None: - # run on PC - try: - output_mupy = subprocess.check_output([MICROPYTHON, '-X', 'emit=bytecode', test_file[0]]) - except subprocess.CalledProcessError: - output_mupy = b'CRASH' - else: - # run on pyboard - pyb.enter_raw_repl() - try: - output_mupy = pyb.execfile(test_file).replace(b'\r\n', b'\n') - except pyboard.PyboardError: - output_mupy = b'CRASH' - - output_mupy = float(output_mupy.strip()) - test_file[1] = output_mupy - testcase_count += 1 - - test_count += 1 - baseline = None - for t in tests: - if baseline is None: - baseline = t[1] - print(" %.3fs (%+06.2f%%) %s" % (t[1], (t[1] * 100 / baseline) - 100, t[0])) - - print("{} tests performed ({} individual testcases)".format(test_count, testcase_count)) - - # all tests succeeded - return True - -def main(): - cmd_parser = argparse.ArgumentParser(description='Run tests for MicroPython.') - cmd_parser.add_argument('--pyboard', action='store_true', help='run the tests on the pyboard') - cmd_parser.add_argument('files', nargs='*', help='input test files') - args = cmd_parser.parse_args() - - # Note pyboard support is copied over from run-tests, not testes, and likely needs revamping - if args.pyboard: - import pyboard - pyb = pyboard.Pyboard('/dev/ttyACM0') - pyb.enter_raw_repl() - else: - pyb = None - - if len(args.files) == 0: - if pyb is None: - # run PC tests - test_dirs = ('bench',) - else: - # run pyboard tests - test_dirs = ('basics', 'float', 'pyb') - tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files) - else: - # tests explicitly given - tests = sorted(args.files) - - test_dict = defaultdict(lambda: []) - for t in tests: - m = re.match(r"(.+?)-(.+)\.py", t) - if not m: - continue - test_dict[m.group(1)].append([t, None]) - - if not run_tests(pyb, test_dict): - sys.exit(1) - -if __name__ == "__main__": - main() diff --git a/tests/run-tests 2 b/tests/run-tests 2 deleted file mode 100755 index e28600361b..0000000000 --- a/tests/run-tests 2 +++ /dev/null @@ -1,615 +0,0 @@ -#! /usr/bin/env python3 - -import os -import subprocess -import sys -import platform -import argparse -import re -import threading -import multiprocessing -from multiprocessing.pool import ThreadPool -from glob import glob - -# Tests require at least CPython 3.3. If your default python3 executable -# is of lower version, you can point MICROPY_CPYTHON3 environment var -# to the correct executable. -if os.name == 'nt': - CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') - MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/windows/micropython.exe') -else: - CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') - MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/unix/micropython') - -# mpy-cross is only needed if --via-mpy command-line arg is passed -MPYCROSS = os.getenv('MICROPY_MPYCROSS', '../mpy-cross/mpy-cross') - -# Set PYTHONIOENCODING so that CPython will use utf-8 on systems which set another encoding in the locale -os.environ['PYTHONIOENCODING'] = 'utf-8' - -def rm_f(fname): - if os.path.exists(fname): - os.remove(fname) - - -# unescape wanted regex chars and escape unwanted ones -def convert_regex_escapes(line): - cs = [] - escape = False - for c in str(line, 'utf8'): - if escape: - escape = False - cs.append(c) - elif c == '\\': - escape = True - elif c in ('(', ')', '[', ']', '{', '}', '.', '*', '+', '^', '$'): - cs.append('\\' + c) - else: - cs.append(c) - # accept carriage-return(s) before final newline - if cs[-1] == '\n': - cs[-1] = '\r*\n' - return bytes(''.join(cs), 'utf8') - - -def run_micropython(pyb, args, test_file, is_special=False): - special_tests = ( - 'micropython/meminfo.py', 'basics/bytes_compare3.py', - 'basics/builtin_help.py', 'thread/thread_exc2.py', - ) - had_crash = False - if pyb is None: - # run on PC - if test_file.startswith(('cmdline/', 'feature_check/')) or test_file in special_tests: - # special handling for tests of the unix cmdline program - is_special = True - - if is_special: - # check for any cmdline options needed for this test - args = [MICROPYTHON] - with open(test_file, 'rb') as f: - line = f.readline() - if line.startswith(b'# cmdline:'): - # subprocess.check_output on Windows only accepts strings, not bytes - args += [str(c, 'utf-8') for c in line[10:].strip().split()] - - # run the test, possibly with redirected input - try: - if 'repl_' in test_file: - # Need to use a PTY to test command line editing - try: - import pty - except ImportError: - # in case pty module is not available, like on Windows - return b'SKIP\n' - import select - - def get(required=False): - rv = b'' - while True: - ready = select.select([emulator], [], [], 0.02) - if ready[0] == [emulator]: - rv += os.read(emulator, 1024) - else: - if not required or rv: - return rv - - def send_get(what): - os.write(emulator, what) - return get() - - with open(test_file, 'rb') as f: - # instead of: output_mupy = subprocess.check_output(args, stdin=f) - # openpty returns two read/write file descriptors. The first one is - # used by the program which provides the virtual - # terminal service, and the second one is used by the - # subprogram which requires a tty to work. - emulator, subterminal = pty.openpty() - p = subprocess.Popen(args, stdin=subterminal, stdout=subterminal, - stderr=subprocess.STDOUT, bufsize=0) - banner = get(True) - output_mupy = banner + b''.join(send_get(line) for line in f) - send_get(b'\x04') # exit the REPL, so coverage info is saved - p.kill() - os.close(emulator) - os.close(subterminal) - else: - output_mupy = subprocess.check_output(args + [test_file], stderr=subprocess.STDOUT) - except subprocess.CalledProcessError: - return b'CRASH' - - else: - # a standard test run on PC - - # create system command - cmdlist = [MICROPYTHON, '-X', 'emit=' + args.emit] - if args.heapsize is not None: - cmdlist.extend(['-X', 'heapsize=' + args.heapsize]) - - # if running via .mpy, first compile the .py file - if args.via_mpy: - subprocess.check_output([MPYCROSS, '-mcache-lookup-bc', '-o', 'mpytest.mpy', test_file]) - cmdlist.extend(['-m', 'mpytest']) - else: - cmdlist.append(test_file) - - # run the actual test - e = {"MICROPYPATH": os.getcwd() + ":", "LANG": "en_US.UTF-8"} - p = subprocess.Popen(cmdlist, env=e, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - output_mupy = b'' - while p.poll() is None: - output_mupy += p.stdout.read() - output_mupy += p.stdout.read() - if p.returncode != 0: - output_mupy = b'CRASH' - - # clean up if we had an intermediate .mpy file - if args.via_mpy: - rm_f('mpytest.mpy') - - else: - # run on pyboard - import pyboard - pyb.enter_raw_repl() - try: - output_mupy = pyb.execfile(test_file) - except pyboard.PyboardError: - had_crash = True - output_mupy = b'CRASH' - - # canonical form for all ports/platforms is to use \n for end-of-line - output_mupy = output_mupy.replace(b'\r\n', b'\n') - - # don't try to convert the output if we should skip this test - if had_crash or output_mupy in (b'SKIP\n', b'CRASH'): - return output_mupy - - if is_special or test_file in special_tests: - # convert parts of the output that are not stable across runs - with open(test_file + '.exp', 'rb') as f: - lines_exp = [] - for line in f.readlines(): - if line == b'########\n': - line = (line,) - else: - line = (line, re.compile(convert_regex_escapes(line))) - lines_exp.append(line) - lines_mupy = [line + b'\n' for line in output_mupy.split(b'\n')] - if output_mupy.endswith(b'\n'): - lines_mupy = lines_mupy[:-1] # remove erroneous last empty line - i_mupy = 0 - for i in range(len(lines_exp)): - if lines_exp[i][0] == b'########\n': - # 8x #'s means match 0 or more whole lines - line_exp = lines_exp[i + 1] - skip = 0 - while i_mupy + skip < len(lines_mupy) and not line_exp[1].match(lines_mupy[i_mupy + skip]): - skip += 1 - if i_mupy + skip >= len(lines_mupy): - lines_mupy[i_mupy] = b'######## FAIL\n' - break - del lines_mupy[i_mupy:i_mupy + skip] - lines_mupy.insert(i_mupy, b'########\n') - i_mupy += 1 - else: - # a regex - if lines_exp[i][1].match(lines_mupy[i_mupy]): - lines_mupy[i_mupy] = lines_exp[i][0] - else: - #print("don't match: %r %s" % (lines_exp[i][1], lines_mupy[i_mupy])) # DEBUG - pass - i_mupy += 1 - if i_mupy >= len(lines_mupy): - break - output_mupy = b''.join(lines_mupy) - - return output_mupy - - -def run_feature_check(pyb, args, base_path, test_file): - return run_micropython(pyb, args, base_path + "/feature_check/" + test_file, is_special=True) - -class ThreadSafeCounter: - def __init__(self, start=0): - self._value = start - self._lock = threading.Lock() - - def add(self, to_add): - with self._lock: self._value += to_add - - def append(self, arg): - self.add([arg]) - - @property - def value(self): - return self._value - -def run_tests(pyb, tests, args, base_path=".", num_threads=1): - test_count = ThreadSafeCounter() - testcase_count = ThreadSafeCounter() - passed_count = ThreadSafeCounter() - failed_tests = ThreadSafeCounter([]) - skipped_tests = ThreadSafeCounter([]) - - skip_tests = set() - skip_native = False - skip_int_big = False - skip_set_type = False - skip_async = False - skip_const = False - skip_revops = False - skip_endian = False - has_complex = True - has_coverage = False - - upy_float_precision = 32 - - # If we're asked to --list-tests, we can't assume that there's a - # connection to target, so we can't run feature checks usefully. - if not (args.list_tests or args.write_exp): - # Check if micropython.native is supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'native_check.py') - if output == b'CRASH': - skip_native = True - - # Check if arbitrary-precision integers are supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'int_big.py') - if output != b'1000000000000000000000000000000000000000000000\n': - skip_int_big = True - - # Check if set type (and set literals) is supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'set_check.py') - if output == b'CRASH': - skip_set_type = True - - # Check if async/await keywords are supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'async_check.py') - if output == b'CRASH': - skip_async = True - - # Check if const keyword (MicroPython extension) is supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'const.py') - if output == b'CRASH': - skip_const = True - - # Check if __rOP__ special methods are supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'reverse_ops.py') - if output == b'TypeError\n': - skip_revops = True - - # Check if emacs repl is supported, and skip such tests if it's not - t = run_feature_check(pyb, args, base_path, 'repl_emacs_check.py') - if not 'True' in str(t, 'ascii'): - skip_tests.add('cmdline/repl_emacs_keys.py') - - upy_byteorder = run_feature_check(pyb, args, base_path, 'byteorder.py') - upy_float_precision = int(run_feature_check(pyb, args, base_path, 'float.py')) - has_complex = run_feature_check(pyb, args, base_path, 'complex.py') == b'complex\n' - has_coverage = run_feature_check(pyb, args, base_path, 'coverage.py') == b'coverage\n' - cpy_byteorder = subprocess.check_output([CPYTHON3, base_path + '/feature_check/byteorder.py']) - skip_endian = (upy_byteorder != cpy_byteorder) - - # Some tests shouldn't be run under Travis CI - if os.getenv('TRAVIS') == 'true': - skip_tests.add('basics/memoryerror.py') - skip_tests.add('thread/thread_gc1.py') # has reliability issues - skip_tests.add('thread/thread_lock4.py') # has reliability issues - skip_tests.add('thread/stress_heap.py') # has reliability issues - skip_tests.add('thread/stress_recurse.py') # has reliability issues - - if upy_float_precision == 0: - skip_tests.add('extmod/ujson_dumps_float.py') - skip_tests.add('extmod/ujson_loads_float.py') - skip_tests.add('misc/rge_sm.py') - if upy_float_precision < 32: - skip_tests.add('float/float2int_intbig.py') # requires fp32, there's float2int_fp30_intbig.py instead - skip_tests.add('float/string_format.py') # requires fp32, there's string_format_fp30.py instead - skip_tests.add('float/bytes_construct.py') # requires fp32 - skip_tests.add('float/bytearray_construct.py') # requires fp32 - if upy_float_precision < 64: - skip_tests.add('float/float_divmod.py') # tested by float/float_divmod_relaxed.py instead - skip_tests.add('float/float2int_doubleprec_intbig.py') - skip_tests.add('float/float_parse_doubleprec.py') - - if not has_complex: - skip_tests.add('float/complex1.py') - skip_tests.add('float/complex1_intbig.py') - skip_tests.add('float/int_big_float.py') - skip_tests.add('float/true_value.py') - skip_tests.add('float/types.py') - - if not has_coverage: - skip_tests.add('cmdline/cmd_parsetree.py') - - # Some tests shouldn't be run on a PC - if args.target == 'unix': - # unix build does not have the GIL so can't run thread mutation tests - for t in tests: - if t.startswith('thread/mutate_'): - skip_tests.add(t) - - # Some tests shouldn't be run on pyboard - if args.target != 'unix': - skip_tests.add('basics/exception_chain.py') # warning is not printed - skip_tests.add('micropython/meminfo.py') # output is very different to PC output - skip_tests.add('extmod/machine_mem.py') # raw memory access not supported - - if args.target == 'wipy': - skip_tests.add('misc/print_exception.py') # requires error reporting full - skip_tests.update({'extmod/uctypes_%s.py' % t for t in 'bytearray le native_le ptr_le ptr_native_le sizeof sizeof_native array_assign_le array_assign_native_le'.split()}) # requires uctypes - skip_tests.add('extmod/zlibd_decompress.py') # requires zlib - skip_tests.add('extmod/uheapq1.py') # uheapq not supported by WiPy - skip_tests.add('extmod/urandom_basic.py') # requires urandom - skip_tests.add('extmod/urandom_extra.py') # requires urandom - elif args.target == 'esp8266': - skip_tests.add('misc/rge_sm.py') # too large - elif args.target == 'minimal': - skip_tests.add('basics/class_inplace_op.py') # all special methods not supported - skip_tests.add('basics/subclass_native_init.py')# native subclassing corner cases not support - skip_tests.add('misc/rge_sm.py') # too large - skip_tests.add('micropython/opt_level.py') # don't assume line numbers are stored - - # Some tests are known to fail on 64-bit machines - if pyb is None and platform.architecture()[0] == '64bit': - pass - - # Some tests use unsupported features on Windows - if os.name == 'nt': - skip_tests.add('import/import_file.py') # works but CPython prints forward slashes - - # Some tests are known to fail with native emitter - # Remove them from the below when they work - if args.emit == 'native': - skip_tests.update({'basics/%s.py' % t for t in 'gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_executing gen_yield_from_iter gen_yield_from_send gen_yield_from_stopped gen_yield_from_throw gen_yield_from_throw2 gen_yield_from_throw3 generator1 generator2 generator_args generator_close generator_closure generator_exc generator_pend_throw generator_return generator_send'.split()}) # require yield - skip_tests.update({'basics/%s.py' % t for t in 'bytes_gen class_store_class globals_del string_join gen_stack_overflow'.split()}) # require yield - skip_tests.update({'basics/async_%s.py' % t for t in 'def await await2 for for2 with with2 coroutine'.split()}) # require yield - skip_tests.update({'basics/%s.py' % t for t in 'try_reraise try_reraise2'.split()}) # require raise_varargs - skip_tests.update({'basics/%s.py' % t for t in 'with_break with_continue with_return'.split()}) # require complete with support - skip_tests.add('basics/array_construct2.py') # requires generators - skip_tests.add('basics/bool1.py') # seems to randomly fail - skip_tests.add('basics/builtin_hash_gen.py') # requires yield - skip_tests.add('basics/class_bind_self.py') # requires yield - skip_tests.add('basics/del_deref.py') # requires checking for unbound local - skip_tests.add('basics/del_local.py') # requires checking for unbound local - skip_tests.add('basics/exception_chain.py') # raise from is not supported - skip_tests.add('basics/for_range.py') # requires yield_value - skip_tests.add('basics/try_finally_loops.py') # requires proper try finally code - skip_tests.add('basics/try_finally_return.py') # requires proper try finally code - skip_tests.add('basics/try_finally_return2.py') # requires proper try finally code - skip_tests.add('basics/unboundlocal.py') # requires checking for unbound local - skip_tests.add('import/gen_context.py') # requires yield_value - skip_tests.add('misc/features.py') # requires raise_varargs - skip_tests.add('misc/rge_sm.py') # requires yield - skip_tests.add('misc/print_exception.py') # because native doesn't have proper traceback info - skip_tests.add('misc/sys_exc_info.py') # sys.exc_info() is not supported for native - skip_tests.add('micropython/emg_exc.py') # because native doesn't have proper traceback info - skip_tests.add('micropython/heapalloc_traceback.py') # because native doesn't have proper traceback info - skip_tests.add('micropython/heapalloc_iter.py') # requires generators - skip_tests.add('micropython/schedule.py') # native code doesn't check pending events - skip_tests.add('stress/gc_trace.py') # requires yield - skip_tests.add('stress/recursive_gen.py') # requires yield - skip_tests.add('extmod/vfs_userfs.py') # because native doesn't properly handle globals across different modules - skip_tests.add('../extmod/ulab/tests/argminmax.py') # requires yield - - def run_one_test(test_file): - test_file = test_file.replace('\\', '/') - - if args.filters: - # Default verdict is the opposit of the first action - verdict = "include" if args.filters[0][0] == "exclude" else "exclude" - for action, pat in args.filters: - if pat.search(test_file): - verdict = action - if verdict == "exclude": - return - - test_basename = os.path.basename(test_file) - test_name = os.path.splitext(test_basename)[0] - is_native = test_name.startswith("native_") or test_name.startswith("viper_") - is_endian = test_name.endswith("_endian") - is_int_big = test_name.startswith("int_big") or test_name.endswith("_intbig") - is_set_type = test_name.startswith("set_") or test_name.startswith("frozenset") - is_async = test_name.startswith("async_") - is_const = test_name.startswith("const") - - skip_it = test_file in skip_tests - skip_it |= skip_native and is_native - skip_it |= skip_endian and is_endian - skip_it |= skip_int_big and is_int_big - skip_it |= skip_set_type and is_set_type - skip_it |= skip_async and is_async - skip_it |= skip_const and is_const - skip_it |= skip_revops and test_name.startswith("class_reverse_op") - - if args.list_tests: - if not skip_it: - print(test_file) - return - - if skip_it: - print("skip ", test_file) - skipped_tests.append(test_name) - return - - # get expected output - test_file_expected = test_file + '.exp' - if os.path.isfile(test_file_expected): - # expected output given by a file, so read that in - with open(test_file_expected, 'rb') as f: - output_expected = f.read() - else: - # run CPython to work out expected output - e = {"PYTHONPATH": os.getcwd(), - "PATH": os.environ["PATH"], - "LANG": "en_US.UTF-8"} - p = subprocess.Popen([CPYTHON3, '-B', test_file], env=e, stdout=subprocess.PIPE) - output_expected = b'' - while p.poll() is None: - output_expected += p.stdout.read() - output_expected += p.stdout.read() - if p.returncode != 0: - output_expected = b'CPYTHON3 CRASH' - elif args.write_exp: - with open(test_file_expected, 'wb') as f: - f.write(output_expected) - - # canonical form for all host platforms is to use \n for end-of-line - output_expected = output_expected.replace(b'\r\n', b'\n') - - if args.write_exp: - return - - # run MicroPython - output_mupy = run_micropython(pyb, args, test_file) - - if output_mupy == b'SKIP\n': - print("skip ", test_file) - skipped_tests.append(test_name) - return - - testcase_count.add(len(output_expected.splitlines())) - - filename_expected = test_basename + ".exp" - filename_mupy = test_basename + ".out" - - if output_expected == output_mupy: - print("pass ", test_file) - passed_count.add(1) - rm_f(filename_expected) - rm_f(filename_mupy) - else: - with open(filename_expected, "wb") as f: - f.write(output_expected) - with open(filename_mupy, "wb") as f: - f.write(output_mupy) - print("### Expected") - print(output_expected) - print("### Actual") - print(output_mupy) - print("FAIL ", test_file) - failed_tests.append(test_name) - - test_count.add(1) - - if args.list_tests: - return True - - if num_threads > 1: - pool = ThreadPool(num_threads) - pool.map(run_one_test, tests) - else: - for test in tests: - run_one_test(test) - - print("{} tests performed ({} individual testcases)".format(test_count.value, testcase_count.value)) - print("{} tests passed".format(passed_count.value)) - - if len(skipped_tests.value) > 0: - print("{} tests skipped: {}".format(len(skipped_tests.value), ' '.join(sorted(skipped_tests.value)))) - if len(failed_tests.value) > 0: - print("{} tests failed: {}".format(len(failed_tests.value), ' '.join(sorted(failed_tests.value)))) - return False - - # all tests succeeded - return True - - -class append_filter(argparse.Action): - - def __init__(self, option_strings, dest, **kwargs): - super().__init__(option_strings, dest, default=[], **kwargs) - - def __call__(self, parser, args, value, option): - if not hasattr(args, self.dest): - args.filters = [] - if option.startswith(("-e", "--e")): - option = "exclude" - else: - option = "include" - args.filters.append((option, re.compile(value))) - - -def main(): - cmd_parser = argparse.ArgumentParser( - formatter_class=argparse.RawDescriptionHelpFormatter, - description='Run and manage tests for MicroPython.', - epilog='''\ -Options -i and -e can be multiple and processed in the order given. Regex -"search" (vs "match") operation is used. An action (include/exclude) of -the last matching regex is used: - run-tests -i async - exclude all, then include tests containg "async" anywhere - run-tests -e '/big.+int' - include all, then exclude by regex - run-tests -e async -i async_foo - include all, exclude async, yet still include async_foo -''') - cmd_parser.add_argument('--target', default='unix', help='the target platform') - cmd_parser.add_argument('--device', default='/dev/ttyACM0', help='the serial device or the IP address of the pyboard') - cmd_parser.add_argument('-b', '--baudrate', default=115200, help='the baud rate of the serial device') - cmd_parser.add_argument('-u', '--user', default='micro', help='the telnet login username') - cmd_parser.add_argument('-p', '--password', default='python', help='the telnet login password') - cmd_parser.add_argument('-d', '--test-dirs', nargs='*', help='input test directories (if no files given)') - cmd_parser.add_argument('-e', '--exclude', action=append_filter, metavar='REGEX', dest='filters', help='exclude test by regex on path/name.py') - cmd_parser.add_argument('-i', '--include', action=append_filter, metavar='REGEX', dest='filters', help='include test by regex on path/name.py') - cmd_parser.add_argument('--write-exp', action='store_true', help='save .exp files to run tests w/o CPython') - cmd_parser.add_argument('--list-tests', action='store_true', help='list tests instead of running them') - cmd_parser.add_argument('--emit', default='bytecode', help='MicroPython emitter to use (bytecode or native)') - cmd_parser.add_argument('--heapsize', help='heapsize to use (use default if not specified)') - cmd_parser.add_argument('--via-mpy', action='store_true', help='compile .py files to .mpy first') - cmd_parser.add_argument('--keep-path', action='store_true', help='do not clear MICROPYPATH when running tests') - cmd_parser.add_argument('-j', '--jobs', default=1, metavar='N', type=int, help='Number of tests to run simultaneously') - cmd_parser.add_argument('--auto-jobs', action='store_const', dest='jobs', const=multiprocessing.cpu_count(), help='Set the -j values to the CPU (thread) count') - cmd_parser.add_argument('files', nargs='*', help='input test files') - args = cmd_parser.parse_args() - - EXTERNAL_TARGETS = ('pyboard', 'wipy', 'esp8266', 'esp32', 'minimal') - if args.target == 'unix' or args.list_tests: - pyb = None - elif args.target in EXTERNAL_TARGETS: - import pyboard - pyb = pyboard.Pyboard(args.device, args.baudrate, args.user, args.password) - pyb.enter_raw_repl() - else: - raise ValueError('target must be either %s or unix' % ", ".join(EXTERNAL_TARGETS)) - - if len(args.files) == 0: - if args.test_dirs is None: - if args.target == 'pyboard': - # run pyboard tests - test_dirs = ('basics', 'micropython', 'float', 'misc', 'stress', 'extmod', 'pyb', 'pybnative', 'inlineasm') - elif args.target in ('esp8266', 'esp32', 'minimal'): - test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod') - elif args.target == 'wipy': - # run WiPy tests - test_dirs = ('basics', 'micropython', 'misc', 'extmod', 'wipy') - else: - # run PC tests - test_dirs = ( - 'basics', 'micropython', 'float', 'import', 'io', 'misc', - 'stress', 'unicode', 'extmod', '../extmod/ulab/tests', 'unix', 'cmdline', - ) - else: - # run tests from these directories - test_dirs = args.test_dirs - tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files) - else: - # tests explicitly given - tests = args.files - - if not args.keep_path: - # clear search path to make sure tests use only builtin modules - os.environ['MICROPYPATH'] = '' - - # Even if we run completely different tests in a different directory, - # we need to access feature_check's from the same directory as the - # run-tests script itself. - base_path = os.path.dirname(sys.argv[0]) or "." - try: - res = run_tests(pyb, tests, args, base_path, args.jobs) - finally: - if pyb: - pyb.close() - - if not res: - sys.exit(1) - -if __name__ == "__main__": - main() diff --git a/tests/stress 2/dict_copy.py b/tests/stress 2/dict_copy.py deleted file mode 100644 index 36db9bb7e8..0000000000 --- a/tests/stress 2/dict_copy.py +++ /dev/null @@ -1,7 +0,0 @@ -# copying a large dictionary - -a = {i:2*i for i in range(1000)} -b = a.copy() -for i in range(1000): - print(i, b[i]) -print(len(b)) diff --git a/tests/stress 2/dict_create.py b/tests/stress 2/dict_create.py deleted file mode 100644 index e9db40a8e6..0000000000 --- a/tests/stress 2/dict_create.py +++ /dev/null @@ -1,8 +0,0 @@ -# create a large dictionary - -d = {} -x = 1 -while x < 1000: - d[x] = x - x += 1 -print(d[500]) diff --git a/tests/stress 2/dict_create_max.py b/tests/stress 2/dict_create_max.py deleted file mode 100644 index 3c75db20da..0000000000 --- a/tests/stress 2/dict_create_max.py +++ /dev/null @@ -1,13 +0,0 @@ -# The aim with this test is to hit the maximum resize/rehash size of a dict, -# where there are no more primes in the table of growing allocation sizes. -# This value is 54907 items. - -d = {} -try: - for i in range(54908): - d[i] = i -except MemoryError: - pass - -# Just check the dict still has the first value -print(d[0]) diff --git a/tests/stress 2/gc_trace.py b/tests/stress 2/gc_trace.py deleted file mode 100644 index 72dc7b6276..0000000000 --- a/tests/stress 2/gc_trace.py +++ /dev/null @@ -1,17 +0,0 @@ -# test that the GC can trace nested objects - -try: - import gc -except ImportError: - print("SKIP") - raise SystemExit - -# test a big shallow object pointing to many unique objects -lst = [[i] for i in range(200)] -gc.collect() -print(lst) - -# test a deep object -lst = [[[[[(i, j, k, l)] for i in range(3)] for j in range(3)] for k in range(3)] for l in range(3)] -gc.collect() -print(lst) diff --git a/tests/stress 2/list_sort.py b/tests/stress 2/list_sort.py deleted file mode 100644 index 3a7701a1e4..0000000000 --- a/tests/stress 2/list_sort.py +++ /dev/null @@ -1,6 +0,0 @@ -# test large list sorting (should not stack overflow) -l = list(range(2000)) -l.sort() -print(l[0], l[-1]) -l.sort(reverse=True) -print(l[0], l[-1]) diff --git a/tests/stress 2/recursion.py b/tests/stress 2/recursion.py deleted file mode 100644 index 227f48396a..0000000000 --- a/tests/stress 2/recursion.py +++ /dev/null @@ -1,7 +0,0 @@ -def foo(): - foo() - -try: - foo() -except RuntimeError: - print("RuntimeError") diff --git a/tests/stress 2/recursive_data.py b/tests/stress 2/recursive_data.py deleted file mode 100644 index 3b7fa50952..0000000000 --- a/tests/stress 2/recursive_data.py +++ /dev/null @@ -1,13 +0,0 @@ -# This tests that printing recursive data structure doesn't lead to segfault. -try: - import uio as io -except ImportError: - print("SKIP") - raise SystemExit - -l = [1, 2, 3, None] -l[-1] = l -try: - print(l, file=io.StringIO()) -except RuntimeError: - print("RuntimeError") diff --git a/tests/stress 2/recursive_data.py.exp b/tests/stress 2/recursive_data.py.exp deleted file mode 100644 index 8a2b9bfdda..0000000000 --- a/tests/stress 2/recursive_data.py.exp +++ /dev/null @@ -1 +0,0 @@ -RuntimeError diff --git a/tests/stress 2/recursive_gen.py b/tests/stress 2/recursive_gen.py deleted file mode 100644 index 0e0d3914ee..0000000000 --- a/tests/stress 2/recursive_gen.py +++ /dev/null @@ -1,18 +0,0 @@ -# test deeply recursive generators - -# simple "yield from" recursion -def gen(): - yield from gen() -try: - list(gen()) -except RuntimeError: - print('RuntimeError') - -# recursion via an iterator over a generator -def gen2(): - for x in gen2(): - yield x -try: - next(gen2()) -except RuntimeError: - print('RuntimeError') diff --git a/tests/stress 2/recursive_iternext.py b/tests/stress 2/recursive_iternext.py deleted file mode 100644 index edb5a843f2..0000000000 --- a/tests/stress 2/recursive_iternext.py +++ /dev/null @@ -1,57 +0,0 @@ -# This tests that recursion with iternext doesn't lead to segfault. -try: - enumerate - filter - map - max - zip -except: - print("SKIP") - raise SystemExit - -# We need to pick an N that is large enough to hit the recursion -# limit, but not too large that we run out of heap memory. -try: - # large stack/heap, eg unix - [0] * 80000 - N = 2400 -except: - try: - # medium, eg pyboard - [0] * 10000 - N = 1000 - except: - # small, eg esp8266 - N = 100 - -try: - x = (1, 2) - for i in range(N): - x = enumerate(x) - tuple(x) -except RuntimeError: - print("RuntimeError") - -try: - x = (1, 2) - for i in range(N): - x = filter(None, x) - tuple(x) -except RuntimeError: - print("RuntimeError") - -try: - x = (1, 2) - for i in range(N): - x = map(max, x, ()) - tuple(x) -except RuntimeError: - print("RuntimeError") - -try: - x = (1, 2) - for i in range(N): - x = zip(x) - tuple(x) -except RuntimeError: - print("RuntimeError") diff --git a/tests/stress 2/recursive_iternext.py.exp b/tests/stress 2/recursive_iternext.py.exp deleted file mode 100644 index 80d1488a37..0000000000 --- a/tests/stress 2/recursive_iternext.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -RuntimeError -RuntimeError -RuntimeError -RuntimeError diff --git a/tests/thread 2/mutate_bytearray.py b/tests/thread 2/mutate_bytearray.py deleted file mode 100644 index 5015c3f9cf..0000000000 --- a/tests/thread 2/mutate_bytearray.py +++ /dev/null @@ -1,46 +0,0 @@ -# test concurrent mutating access to a shared bytearray object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared bytearray -ba = bytearray() - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - l = len(ba) - ba.append(i) - assert len(ba) >= l + 1 - - l = len(ba) - ba.extend(bytearray([i])) - assert len(ba) >= l + 1 - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 -n_repeat = 4 # use 40 for more stressful test (uses more heap) - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (n_repeat, i * 256 // n_thread, (i + 1) * 256 // n_thread)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check bytearray has correct contents -print(len(ba)) -count = [0 for _ in range(256)] -for b in ba: - count[b] += 1 -print(count) diff --git a/tests/thread 2/mutate_dict.py b/tests/thread 2/mutate_dict.py deleted file mode 100644 index 563fce39de..0000000000 --- a/tests/thread 2/mutate_dict.py +++ /dev/null @@ -1,44 +0,0 @@ -# test concurrent mutating access to a shared dict object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared dict -di = {'a':'A', 'b':'B', 'c':'C', 'd':'D'} - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - di[i] = repeat + i - assert di[i] == repeat + i - - del di[i] - assert i not in di - - di[i] = repeat + i - assert di[i] == repeat + i - - assert di.pop(i) == repeat + i - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (30, i * 300, (i + 1) * 300)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check dict has correct contents -print(sorted(di.items())) diff --git a/tests/thread 2/mutate_instance.py b/tests/thread 2/mutate_instance.py deleted file mode 100644 index 2ecfbe1092..0000000000 --- a/tests/thread 2/mutate_instance.py +++ /dev/null @@ -1,45 +0,0 @@ -# test concurrent mutating access to a shared user instance -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared user class and instance -class User: - def __init__(self): - self.a = 'A' - self.b = 'B' - self.c = 'C' -user = User() - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - setattr(user, 'attr_%u' % i, repeat + i) - assert getattr(user, 'attr_%u' % i) == repeat + i - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_repeat = 30 -n_range = 50 # 300 for stressful test (uses more heap) -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (n_repeat, i * n_range, (i + 1) * n_range)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check user instance has correct contents -print(user.a, user.b, user.c) -for i in range(n_thread * n_range): - assert getattr(user, 'attr_%u' % i) == n_repeat - 1 + i diff --git a/tests/thread 2/mutate_list.py b/tests/thread 2/mutate_list.py deleted file mode 100644 index d70e8a8a38..0000000000 --- a/tests/thread 2/mutate_list.py +++ /dev/null @@ -1,46 +0,0 @@ -# test concurrent mutating access to a shared list object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared list -li = list() - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - li.append(i) - assert li.count(i) == repeat + 1 - - li.extend([i, i]) - assert li.count(i) == repeat + 3 - - li.remove(i) - assert li.count(i) == repeat + 2 - - li.remove(i) - assert li.count(i) == repeat + 1 - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (4, i * 60, (i + 1) * 60)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check list has correct contents -li.sort() -print(li) diff --git a/tests/thread 2/mutate_set.py b/tests/thread 2/mutate_set.py deleted file mode 100644 index c4529f3562..0000000000 --- a/tests/thread 2/mutate_set.py +++ /dev/null @@ -1,39 +0,0 @@ -# test concurrent mutating access to a shared set object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared set -se = set([-1, -2, -3, -4]) - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - se.add(i) - assert i in se - - se.remove(i) - assert i not in se - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (50, i * 500, (i + 1) * 500)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check set has correct contents -print(sorted(se)) diff --git a/tests/thread 2/stress_aes.py b/tests/thread 2/stress_aes.py deleted file mode 100644 index ebf7af371b..0000000000 --- a/tests/thread 2/stress_aes.py +++ /dev/null @@ -1,257 +0,0 @@ -# Stress test for threads using AES encryption routines. -# -# AES was chosen because it is integer based and inplace so doesn't use the -# heap. It is therefore a good test of raw performance and correctness of the -# VM/runtime. It can be used to measure threading performance (concurrency is -# in principle possible) and correctness (it's non trivial for the encryption/ -# decryption to give the correct answer). -# -# The AES code comes first (code originates from a C version authored by D.P.George) -# and then the test harness at the bottom. It can be tuned to be more/less -# aggressive by changing the amount of data to encrypt, the number of loops and -# the number of threads. -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -################################################################## -# discrete arithmetic routines, mostly from a precomputed table - -# non-linear, invertible, substitution box -aes_s_box_table = bytes(( - 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, - 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0, - 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15, - 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75, - 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84, - 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf, - 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8, - 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2, - 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73, - 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb, - 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79, - 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08, - 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a, - 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e, - 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf, - 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16, -)) - -# multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b -def aes_gf8_mul_2(x): - if x & 0x80: - return (x << 1) ^ 0x11b - else: - return x << 1 - -def aes_gf8_mul_3(x): - return x ^ aes_gf8_mul_2(x) - -# non-linear, invertible, substitution box -def aes_s_box(a): - return aes_s_box_table[a & 0xff] - -# return 0x02^(a-1) in GF(2^8) -def aes_r_con(a): - ans = 1 - while a > 1: - ans <<= 1; - if ans & 0x100: - ans ^= 0x11b - a -= 1 - return ans - -################################################################## -# basic AES algorithm; see FIPS-197 -# -# Think of it as a pseudo random number generator, with each -# symbol in the sequence being a 16 byte block (the state). The -# key is a parameter of the algorithm and tells which particular -# sequence of random symbols you want. The initial vector, IV, -# sets the start of the sequence. The idea of a strong cipher -# is that it's very difficult to guess the key even if you know -# a large part of the sequence. The basic AES algorithm simply -# provides such a sequence. En/de-cryption is implemented here -# using OCB, where the sequence is xored against the plaintext. -# Care must be taken to (almost) always choose a different IV. - -# all inputs must be size 16 -def aes_add_round_key(state, w): - for i in range(16): - state[i] ^= w[i] - -# combined sub_bytes, shift_rows, mix_columns, add_round_key -# all inputs must be size 16 -def aes_sb_sr_mc_ark(state, w, w_idx, temp): - temp_idx = 0 - for i in range(4): - x0 = aes_s_box_table[state[i * 4]] - x1 = aes_s_box_table[state[1 + ((i + 1) & 3) * 4]] - x2 = aes_s_box_table[state[2 + ((i + 2) & 3) * 4]] - x3 = aes_s_box_table[state[3 + ((i + 3) & 3) * 4]] - temp[temp_idx] = aes_gf8_mul_2(x0) ^ aes_gf8_mul_3(x1) ^ x2 ^ x3 ^ w[w_idx] - temp[temp_idx + 1] = x0 ^ aes_gf8_mul_2(x1) ^ aes_gf8_mul_3(x2) ^ x3 ^ w[w_idx + 1] - temp[temp_idx + 2] = x0 ^ x1 ^ aes_gf8_mul_2(x2) ^ aes_gf8_mul_3(x3) ^ w[w_idx + 2] - temp[temp_idx + 3] = aes_gf8_mul_3(x0) ^ x1 ^ x2 ^ aes_gf8_mul_2(x3) ^ w[w_idx + 3] - w_idx += 4 - temp_idx += 4 - for i in range(16): - state[i] = temp[i] - -# combined sub_bytes, shift_rows, add_round_key -# all inputs must be size 16 -def aes_sb_sr_ark(state, w, w_idx, temp): - temp_idx = 0 - for i in range(4): - x0 = aes_s_box_table[state[i * 4]] - x1 = aes_s_box_table[state[1 + ((i + 1) & 3) * 4]] - x2 = aes_s_box_table[state[2 + ((i + 2) & 3) * 4]] - x3 = aes_s_box_table[state[3 + ((i + 3) & 3) * 4]] - temp[temp_idx] = x0 ^ w[w_idx] - temp[temp_idx + 1] = x1 ^ w[w_idx + 1] - temp[temp_idx + 2] = x2 ^ w[w_idx + 2] - temp[temp_idx + 3] = x3 ^ w[w_idx + 3] - w_idx += 4 - temp_idx += 4 - for i in range(16): - state[i] = temp[i] - -# take state as input and change it to the next state in the sequence -# state and temp have size 16, w has size 16 * (Nr + 1), Nr >= 1 -def aes_state(state, w, temp, nr): - aes_add_round_key(state, w) - w_idx = 16 - for i in range(nr - 1): - aes_sb_sr_mc_ark(state, w, w_idx, temp) - w_idx += 16 - aes_sb_sr_ark(state, w, w_idx, temp) - -# expand 'key' to 'w' for use with aes_state -# key has size 4 * Nk, w has size 16 * (Nr + 1), temp has size 16 -def aes_key_expansion(key, w, temp, nk, nr): - for i in range(4 * nk): - w[i] = key[i] - w_idx = 4 * nk - 4 - for i in range(nk, 4 * (nr + 1)): - t = temp - t_idx = 0 - if i % nk == 0: - t[0] = aes_s_box(w[w_idx + 1]) ^ aes_r_con(i // nk) - for j in range(1, 4): - t[j] = aes_s_box(w[w_idx + (j + 1) % 4]) - elif nk > 6 and i % nk == 4: - for j in range(0, 4): - t[j] = aes_s_box(w[w_idx + j]) - else: - t = w - t_idx = w_idx - w_idx += 4 - for j in range(4): - w[w_idx + j] = w[w_idx + j - 4 * nk] ^ t[t_idx + j] - -################################################################## -# simple use of AES algorithm, using output feedback (OFB) mode - -class AES: - def __init__(self, keysize): - if keysize == 128: - self.nk = 4 - self.nr = 10 - elif keysize == 192: - self.nk = 6 - self.nr = 12 - else: - assert keysize == 256 - self.nk = 8 - self.nr = 14 - - self.state = bytearray(16) - self.w = bytearray(16 * (self.nr + 1)) - self.temp = bytearray(16) - self.state_pos = 16 - - def set_key(self, key): - aes_key_expansion(key, self.w, self.temp, self.nk, self.nr) - self.state_pos = 16 - - def set_iv(self, iv): - for i in range(16): - self.state[i] = iv[i] - self.state_pos = 16; - - def get_some_state(self, n_needed): - if self.state_pos >= 16: - aes_state(self.state, self.w, self.temp, self.nr) - self.state_pos = 0 - n = 16 - self.state_pos - if n > n_needed: - n = n_needed - return n - - def apply_to(self, data): - idx = 0 - n = len(data) - while n > 0: - ln = self.get_some_state(n) - n -= ln - for i in range(ln): - data[idx + i] ^= self.state[self.state_pos + i] - idx += ln - self.state_pos += n - -################################################################## -# test code - -try: - import utime as time -except ImportError: - import time -import _thread - -class LockedCounter: - def __init__(self): - self.lock = _thread.allocate_lock() - self.value = 0 - - def add(self, val): - self.lock.acquire() - self.value += val - self.lock.release() - -count = LockedCounter() - -def thread_entry(): - global count - - aes = AES(256) - key = bytearray(256 // 8) - iv = bytearray(16) - data = bytearray(128) - # from now on we don't use the heap - - for loop in range(5): - # encrypt - aes.set_key(key) - aes.set_iv(iv) - for i in range(8): - aes.apply_to(data) - - # decrypt - aes.set_key(key) - aes.set_iv(iv) - for i in range(8): - aes.apply_to(data) - - # verify - for i in range(len(data)): - assert data[i] == 0 - - count.add(1) - -if __name__ == '__main__': - n_thread = 20 - for i in range(n_thread): - _thread.start_new_thread(thread_entry, ()) - while count.value < n_thread: - time.sleep(1) diff --git a/tests/thread 2/stress_create.py b/tests/thread 2/stress_create.py deleted file mode 100644 index 2399746cca..0000000000 --- a/tests/thread 2/stress_create.py +++ /dev/null @@ -1,22 +0,0 @@ -# stress test for creating many threads - -try: - import utime as time -except ImportError: - import time -import _thread - -def thread_entry(n): - pass - -thread_num = 0 -while thread_num < 500: - try: - _thread.start_new_thread(thread_entry, (thread_num,)) - thread_num += 1 - except MemoryError: - pass - -# wait for the last threads to terminate -time.sleep(1) -print('done') diff --git a/tests/thread 2/stress_heap.py b/tests/thread 2/stress_heap.py deleted file mode 100644 index 206cf1a860..0000000000 --- a/tests/thread 2/stress_heap.py +++ /dev/null @@ -1,48 +0,0 @@ -# stress test for the heap by allocating lots of objects within threads -# allocates about 5mb on the heap -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def last(l): - return l[-1] - -def thread_entry(n): - # allocate a bytearray and fill it - data = bytearray(i for i in range(256)) - - # run a loop which allocates a small list and uses it each iteration - lst = 8 * [0] - sum = 0 - for i in range(n): - sum += last(lst) - lst = [0, 0, 0, 0, 0, 0, 0, i + 1] - - # check that the bytearray still has the right data - for i, b in enumerate(data): - assert i == b - - # print the result of the loop and indicate we are finished - with lock: - print(sum, lst[-1]) - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 10 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (10000,)) - -# wait for threads to finish -while n_finished < n_thread: - time.sleep(1) diff --git a/tests/thread 2/stress_recurse.py b/tests/thread 2/stress_recurse.py deleted file mode 100644 index 8edee246ad..0000000000 --- a/tests/thread 2/stress_recurse.py +++ /dev/null @@ -1,27 +0,0 @@ -# test hitting the function recursion limit within a thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def foo(): - foo() - -def thread_entry(): - try: - foo() - except RuntimeError: - print('RuntimeError') - global finished - finished = True - -finished = False - -_thread.start_new_thread(thread_entry, ()) - -# busy wait for thread to finish -while not finished: - pass -print('done') diff --git a/tests/thread 2/thread_exc1.py b/tests/thread 2/thread_exc1.py deleted file mode 100644 index e00a16bd26..0000000000 --- a/tests/thread 2/thread_exc1.py +++ /dev/null @@ -1,32 +0,0 @@ -# test raising and catching an exception within a thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def foo(): - raise ValueError - -def thread_entry(): - try: - foo() - except ValueError: - pass - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, ()) - -# busy wait for threads to finish -while n_finished < n_thread: - pass -print('done') diff --git a/tests/thread 2/thread_exc2.py b/tests/thread 2/thread_exc2.py deleted file mode 100644 index 35cb324412..0000000000 --- a/tests/thread 2/thread_exc2.py +++ /dev/null @@ -1,10 +0,0 @@ -# test raising exception within thread which is not caught -import utime -import _thread - -def thread_entry(): - raise ValueError - -_thread.start_new_thread(thread_entry, ()) -utime.sleep(1) -print('done') diff --git a/tests/thread 2/thread_exc2.py.exp b/tests/thread 2/thread_exc2.py.exp deleted file mode 100644 index cc7a20aa26..0000000000 --- a/tests/thread 2/thread_exc2.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -Unhandled exception in thread started by -Traceback (most recent call last): - File \.\+, line 6, in thread_entry -ValueError: -done diff --git a/tests/thread 2/thread_exit1.py b/tests/thread 2/thread_exit1.py deleted file mode 100644 index ad7b01d89b..0000000000 --- a/tests/thread 2/thread_exit1.py +++ /dev/null @@ -1,21 +0,0 @@ -# test _thread.exit() function -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def thread_entry(): - _thread.exit() - -_thread.start_new_thread(thread_entry, ()) -_thread.start_new_thread(thread_entry, ()) - -# wait for threads to finish -time.sleep(1) -print('done') diff --git a/tests/thread 2/thread_exit2.py b/tests/thread 2/thread_exit2.py deleted file mode 100644 index 6bff8a1736..0000000000 --- a/tests/thread 2/thread_exit2.py +++ /dev/null @@ -1,21 +0,0 @@ -# test raising SystemExit to finish a thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def thread_entry(): - raise SystemExit - -_thread.start_new_thread(thread_entry, ()) -_thread.start_new_thread(thread_entry, ()) - -# wait for threads to finish -time.sleep(1) -print('done') diff --git a/tests/thread 2/thread_gc1.py b/tests/thread 2/thread_gc1.py deleted file mode 100644 index 2ea1891615..0000000000 --- a/tests/thread 2/thread_gc1.py +++ /dev/null @@ -1,36 +0,0 @@ -# test that we can run the garbage collector within threads -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import gc -import _thread - -def thread_entry(n): - # allocate a bytearray and fill it - data = bytearray(i for i in range(256)) - - # do some work and call gc.collect() a few times - for i in range(n): - for i in range(len(data)): - data[i] = data[i] - gc.collect() - - # print whether the data remains intact and indicate we are finished - with lock: - print(list(data) == list(range(256))) - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (10,)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass diff --git a/tests/thread 2/thread_ident1.py b/tests/thread 2/thread_ident1.py deleted file mode 100644 index 9a6f89ff5f..0000000000 --- a/tests/thread 2/thread_ident1.py +++ /dev/null @@ -1,23 +0,0 @@ -# test _thread.get_ident() function -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def thread_entry(): - tid = _thread.get_ident() - print('thread', type(tid) == int, tid != 0, tid != tid_main) - global finished - finished = True - -tid_main = _thread.get_ident() -print('main', type(tid_main) == int, tid_main != 0) - -finished = False -_thread.start_new_thread(thread_entry, ()) - -while not finished: - pass -print('done') diff --git a/tests/thread 2/thread_lock1.py b/tests/thread 2/thread_lock1.py deleted file mode 100644 index c2d7c9d1ed..0000000000 --- a/tests/thread 2/thread_lock1.py +++ /dev/null @@ -1,48 +0,0 @@ -# test _thread lock object using a single thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# create lock -lock = _thread.allocate_lock() - -print(type(lock) == _thread.LockType) - -# should be unlocked -print(lock.locked()) - -# basic acquire and release -print(lock.acquire()) -print(lock.locked()) -lock.release() -print(lock.locked()) - -# try acquire twice (second should fail) -print(lock.acquire()) -print(lock.locked()) -print(lock.acquire(0)) -print(lock.locked()) -lock.release() -print(lock.locked()) - -# test with capabilities of lock -with lock: - print(lock.locked()) - -# test that lock is unlocked if an error is rasied -try: - with lock: - print(lock.locked()) - raise KeyError -except KeyError: - print('KeyError') - print(lock.locked()) - -# test that we can't release an unlocked lock -try: - lock.release() -except RuntimeError: - print('RuntimeError') diff --git a/tests/thread 2/thread_lock2.py b/tests/thread 2/thread_lock2.py deleted file mode 100644 index 4ef912dff5..0000000000 --- a/tests/thread 2/thread_lock2.py +++ /dev/null @@ -1,26 +0,0 @@ -# test _thread lock objects with multiple threads -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -lock = _thread.allocate_lock() - -def thread_entry(): - lock.acquire() - print('have it') - lock.release() - -# spawn the threads -for i in range(4): - _thread.start_new_thread(thread_entry, ()) - -# wait for threads to finish -time.sleep(1) -print('done') diff --git a/tests/thread 2/thread_lock3.py b/tests/thread 2/thread_lock3.py deleted file mode 100644 index 35808d99cb..0000000000 --- a/tests/thread 2/thread_lock3.py +++ /dev/null @@ -1,29 +0,0 @@ -# test thread coordination using a lock object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -lock = _thread.allocate_lock() -n_thread = 10 -n_finished = 0 - -def thread_entry(idx): - global n_finished - while True: - with lock: - if n_finished == idx: - break - print('my turn:', idx) - with lock: - n_finished += 1 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (i,)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass diff --git a/tests/thread 2/thread_lock4.py b/tests/thread 2/thread_lock4.py deleted file mode 100644 index 440f3e90c6..0000000000 --- a/tests/thread 2/thread_lock4.py +++ /dev/null @@ -1,53 +0,0 @@ -# test using lock to coordinate access to global mutable objects -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def fac(n): - x = 1 - for i in range(1, n + 1): - x *= i - return x - -def thread_entry(): - while True: - with jobs_lock: - try: - f, arg = jobs.pop(0) - except IndexError: - return - ans = f(arg) - with output_lock: - output.append((arg, ans)) - -# create a list of jobs -jobs = [(fac, i) for i in range(20, 80)] -jobs_lock = _thread.allocate_lock() -n_jobs = len(jobs) - -# create a list to store the results -output = [] -output_lock = _thread.allocate_lock() - -# spawn threads to do the jobs -for i in range(4): - _thread.start_new_thread(thread_entry, ()) - -# wait for the jobs to complete -while True: - with jobs_lock: - if len(output) == n_jobs: - break - time.sleep(1) - -# sort and print the results -output.sort(key=lambda x: x[0]) -for arg, ans in output: - print(arg, ans) diff --git a/tests/thread 2/thread_qstr1.py b/tests/thread 2/thread_qstr1.py deleted file mode 100644 index dccfb7f517..0000000000 --- a/tests/thread 2/thread_qstr1.py +++ /dev/null @@ -1,41 +0,0 @@ -# test concurrent interning of strings -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -# function to check the interned string -def check(s, val): - assert type(s) == str - assert int(s) == val - -# main thread function -def th(base, n): - for i in range(n): - # this will intern the string and check it - exec("check('%u', %u)" % (base + i, base + i)) - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 -n_qstr_per_thread = 100 # make 1000 for a more stressful test (uses more heap) - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (i * n_qstr_per_thread, n_qstr_per_thread)) - -# wait for threads to finish -while n_finished < n_thread: - time.sleep(1) - -print('pass') diff --git a/tests/thread 2/thread_shared1.py b/tests/thread 2/thread_shared1.py deleted file mode 100644 index de339ad7f8..0000000000 --- a/tests/thread 2/thread_shared1.py +++ /dev/null @@ -1,33 +0,0 @@ -# test capability for threads to access a shared immutable data structure -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def foo(i): - pass - -def thread_entry(n, tup): - for i in tup: - foo(i) - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 2 -n_finished = 0 - -# the shared data structure -tup = (1, 2, 3, 4) - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (100, tup)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass -print(tup) diff --git a/tests/thread 2/thread_shared2.py b/tests/thread 2/thread_shared2.py deleted file mode 100644 index 2c749e6883..0000000000 --- a/tests/thread 2/thread_shared2.py +++ /dev/null @@ -1,34 +0,0 @@ -# test capability for threads to access a shared mutable data structure -# (without contention because they access different parts of the structure) -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def foo(lst, i): - lst[i] += 1 - -def thread_entry(n, lst, idx): - for i in range(n): - foo(lst, idx) - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 2 -n_finished = 0 - -# the shared data structure -lst = [0, 0] - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, ((i + 1) * 10, lst, i)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass -print(lst) diff --git a/tests/thread 2/thread_sleep1.py b/tests/thread 2/thread_sleep1.py deleted file mode 100644 index d5aa99f977..0000000000 --- a/tests/thread 2/thread_sleep1.py +++ /dev/null @@ -1,33 +0,0 @@ -# test threads sleeping -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime - sleep_ms = utime.sleep_ms -except ImportError: - import time - sleep_ms = lambda t: time.sleep(t / 1000) - -import _thread - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -def thread_entry(t): - global n_finished - sleep_ms(t) - sleep_ms(2 * t) - with lock: - n_finished += 1 - -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (10 * i,)) - -# wait for threads to finish -while n_finished < n_thread: - sleep_ms(100) -print('done', n_thread) diff --git a/tests/thread 2/thread_stacksize1.py b/tests/thread 2/thread_stacksize1.py deleted file mode 100644 index e7189fafbc..0000000000 --- a/tests/thread 2/thread_stacksize1.py +++ /dev/null @@ -1,49 +0,0 @@ -# test setting the thread stack size -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import sys -import _thread - -# different implementations have different minimum sizes -if sys.implementation.name == 'micropython': - sz = 2 * 1024 -else: - sz = 32 * 1024 - -def foo(): - pass - -def thread_entry(): - foo() - with lock: - global n_finished - n_finished += 1 - -# reset stack size to default -_thread.stack_size() - -# test set/get of stack size -print(_thread.stack_size()) -print(_thread.stack_size(sz)) -print(_thread.stack_size() == sz) -print(_thread.stack_size()) - -lock = _thread.allocate_lock() -n_thread = 2 -n_finished = 0 - -# set stack size and spawn a few threads -_thread.stack_size(sz) -for i in range(n_thread): - _thread.start_new_thread(thread_entry, ()) - -# reset stack size to default (for subsequent scripts on baremetal) -_thread.stack_size() - -# busy wait for threads to finish -while n_finished < n_thread: - pass -print('done') diff --git a/tests/thread 2/thread_start1.py b/tests/thread 2/thread_start1.py deleted file mode 100644 index 94df6dc625..0000000000 --- a/tests/thread 2/thread_start1.py +++ /dev/null @@ -1,25 +0,0 @@ -# test basic capability to start a new thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def foo(): - pass - -def thread_entry(n): - for i in range(n): - foo() - -_thread.start_new_thread(thread_entry, (10,)) -_thread.start_new_thread(thread_entry, (20,)) - -# wait for threads to finish -time.sleep(1) -print('done') diff --git a/tests/thread 2/thread_start2.py b/tests/thread 2/thread_start2.py deleted file mode 100644 index 9412bb6183..0000000000 --- a/tests/thread 2/thread_start2.py +++ /dev/null @@ -1,28 +0,0 @@ -# test capability to start a thread with keyword args -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def thread_entry(a0, a1, a2, a3): - print('thread', a0, a1, a2, a3) - -# spawn thread using kw args -_thread.start_new_thread(thread_entry, (10, 20), {'a2': 0, 'a3': 1}) - -# wait for thread to finish -time.sleep(1) - -# incorrect argument where dictionary is needed for keyword args -try: - _thread.start_new_thread(thread_entry, (), ()) -except TypeError: - print('TypeError') - -print('done') diff --git a/tests/unix 2/extra_coverage.py b/tests/unix 2/extra_coverage.py deleted file mode 100644 index 13721f1f47..0000000000 --- a/tests/unix 2/extra_coverage.py +++ /dev/null @@ -1,74 +0,0 @@ -try: - extra_coverage -except NameError: - print("SKIP") - raise SystemExit - -import uerrno -import uio - -data = extra_coverage() - -# test hashing of str/bytes that have an invalid hash -print(data[0], data[1]) -print(hash(data[0])) -print(hash(data[1])) -print(hash(bytes(data[0], 'utf8'))) -print(hash(str(data[1], 'utf8'))) - -# test streams -stream = data[2] # has set_error and set_buf. Write always returns error -stream.set_error(uerrno.EAGAIN) # non-blocking error -print(stream.read()) # read all encounters non-blocking error -print(stream.read(1)) # read 1 byte encounters non-blocking error -print(stream.readline()) # readline encounters non-blocking error -print(stream.readinto(bytearray(10))) # readinto encounters non-blocking error -print(stream.write(b'1')) # write encounters non-blocking error -print(stream.write1(b'1')) # write1 encounters non-blocking error -stream.set_buf(b'123') -print(stream.read(4)) # read encounters non-blocking error after successful reads -stream.set_buf(b'123') -print(stream.read1(4)) # read1 encounters non-blocking error after successful reads -stream.set_buf(b'123') -print(stream.readline(4)) # readline encounters non-blocking error after successful reads -try: - print(stream.ioctl(0, 0)) # ioctl encounters non-blocking error; raises OSError -except OSError: - print('OSError') -stream.set_error(0) -print(stream.ioctl(0, bytearray(10))) # successful ioctl call - -stream2 = data[3] # is textio -print(stream2.read(1)) # read 1 byte encounters non-blocking error with textio stream - -# test BufferedWriter with stream errors -stream.set_error(uerrno.EAGAIN) -buf = uio.BufferedWriter(stream, 8) -print(buf.write(bytearray(16))) - -# test basic import of frozen scripts -import frzstr1 -import frzmpy1 - -# test import of frozen packages with __init__.py -import frzstr_pkg1 -print(frzstr_pkg1.x) -import frzmpy_pkg1 -print(frzmpy_pkg1.x) - -# test import of frozen packages without __init__.py -from frzstr_pkg2.mod import Foo -print(Foo.x) -from frzmpy_pkg2.mod import Foo -print(Foo.x) - -# test raising exception in frozen script -try: - import frzmpy2 -except ZeroDivisionError: - print('ZeroDivisionError') - -# test loading a resource from a frozen string -import uio -buf = uio.resource_stream('frzstr_pkg2', 'mod.py') -print(buf.read(21)) diff --git a/tests/unix 2/extra_coverage.py.exp b/tests/unix 2/extra_coverage.py.exp deleted file mode 100644 index 06b5d37903..0000000000 --- a/tests/unix 2/extra_coverage.py.exp +++ /dev/null @@ -1,106 +0,0 @@ -# mp_printf --123 +123 123 --0123 -123 -123 -1ABCDEF -ab abc - -false true -(null) --2147483648 -2147483648 -80000000 -80000000 -abc -# GC -0 -0 -# vstr -tests -sts - -test -tes -RuntimeError: -RuntimeError: -# repl -ame__ - -argv byteorder exc_info exit -getsizeof implementation maxsize modules -path platform print_exception -stderr stdin stdout version -version_info -ementation -# attrtuple -(start=1, stop=2, step=3) -# str -1 -# bytearray -data -# mpz -1 -12345678 -0 -0 -0 -0 -0 -1 -12345 -6 -# runtime utils -TypeError: unsupported type for __abs__: 'str' -TypeError: unsupported types for __divmod__: 'str', 'str' -Warning: test -# format float -? -+1e+00 -+1e+00 -# binary -123 -456 -# VM -2 1 -# scheduler -sched(0)=1 -sched(1)=1 -sched(2)=1 -sched(3)=1 -sched(4)=0 -unlocked -3 -2 -1 -0 -0123456789 b'0123456789' -7300 -7300 -7300 -7300 -None -None -None -None -None -None -b'123' -b'123' -b'123' -OSError -0 -None -None -frzstr1 -frzmpy1 -frzstr_pkg1.__init__ -1 -frzmpy_pkg1.__init__ -1 -frzstr_pkg2.mod -1 -frzmpy_pkg2.mod -1 -ZeroDivisionError -b'# test frozen package' diff --git a/tests/unix 2/ffi_callback.py b/tests/unix 2/ffi_callback.py deleted file mode 100644 index 23b058bcec..0000000000 --- a/tests/unix 2/ffi_callback.py +++ /dev/null @@ -1,33 +0,0 @@ -try: - import ffi -except ImportError: - print("SKIP") - raise SystemExit - - -def ffi_open(names): - err = None - for n in names: - try: - mod = ffi.open(n) - return mod - except OSError as e: - err = e - raise err - -libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib')) - -qsort = libc.func("v", "qsort", "piip") - -def cmp(pa, pb): - a = ffi.as_bytearray(pa, 1) - b = ffi.as_bytearray(pb, 1) - #print("cmp:", a, b) - return a[0] - b[0] - -cmp_c = ffi.callback("i", cmp, "pp") - -s = bytearray(b"foobar") -print("org string:", s) -qsort(s, len(s), 1, cmp_c) -print("qsort'ed:", s) diff --git a/tests/unix 2/ffi_callback.py.exp b/tests/unix 2/ffi_callback.py.exp deleted file mode 100644 index d06fec52fb..0000000000 --- a/tests/unix 2/ffi_callback.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -org string: bytearray(b'foobar') -qsort'ed: bytearray(b'abfoor') diff --git a/tests/unix 2/ffi_float.py b/tests/unix 2/ffi_float.py deleted file mode 100644 index c92a39bcdc..0000000000 --- a/tests/unix 2/ffi_float.py +++ /dev/null @@ -1,32 +0,0 @@ -# test ffi float support -try: - import ffi -except ImportError: - print("SKIP") - raise SystemExit - - -def ffi_open(names): - err = None - for n in names: - try: - mod = ffi.open(n) - return mod - except OSError as e: - err = e - raise err - -libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib')) - -strtof = libc.func("f", "strtof", "sp") -print('%.6f' % strtof('1.23', None)) - -strtod = libc.func("d", "strtod", "sp") -print('%.6f' % strtod('1.23', None)) - -# test passing double and float args -libm = ffi_open(('libm.so', 'libm.so.6', 'libc.so.0', 'libc.so.6', 'libc.dylib')) -tgamma = libm.func('d', 'tgamma', 'd') -for fun in (tgamma,): - for val in (0.5, 1, 1.0, 1.5, 4, 4.0): - print('%.6f' % fun(val)) diff --git a/tests/unix 2/ffi_float.py.exp b/tests/unix 2/ffi_float.py.exp deleted file mode 100644 index b9d7da2bdb..0000000000 --- a/tests/unix 2/ffi_float.py.exp +++ /dev/null @@ -1,8 +0,0 @@ -1.230000 -1.230000 -1.772454 -1.000000 -1.000000 -0.886227 -6.000000 -6.000000 diff --git a/tests/unix 2/ffi_float2.py b/tests/unix 2/ffi_float2.py deleted file mode 100644 index 721eb4d192..0000000000 --- a/tests/unix 2/ffi_float2.py +++ /dev/null @@ -1,31 +0,0 @@ -# test ffi float support -try: - import ffi -except ImportError: - print("SKIP") - raise SystemExit - - -def ffi_open(names): - err = None - for n in names: - try: - mod = ffi.open(n) - return mod - except OSError as e: - err = e - raise err - -libm = ffi_open(('libm.so', 'libm.so.6', 'libc.so.0', 'libc.so.6', 'libc.dylib')) - -# Some libc's implement tgammaf as header macro with tgamma(), so don't assume -# it'll be in library. -try: - tgammaf = libm.func('f', 'tgammaf', 'f') -except OSError: - print("SKIP") - raise SystemExit - -for fun in (tgammaf,): - for val in (0.5, 1, 1.0, 1.5, 4, 4.0): - print('%.6f' % fun(val)) diff --git a/tests/unix 2/ffi_float2.py.exp b/tests/unix 2/ffi_float2.py.exp deleted file mode 100644 index 58fc6a01ac..0000000000 --- a/tests/unix 2/ffi_float2.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -1.772454 -1.000000 -1.000000 -0.886227 -6.000000 -6.000000 From 8fcb28e89eda64daf6d4a91ef5dd12a6ebb8c87e Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Wed, 16 Dec 2020 10:44:21 -0500 Subject: [PATCH 084/146] hopefully this gets rid of all the funny files --- .gitattributes 2 | 32 --------- .gitignore 2 | 88 ----------------------- .gitmodules 2 | 155 ----------------------------------------- tests/io/data/file1 2 | 3 - tools/.gitattributes 2 | 1 - tools/.gitignore 2 | 8 --- 6 files changed, 287 deletions(-) delete mode 100644 .gitattributes 2 delete mode 100644 .gitignore 2 delete mode 100644 .gitmodules 2 delete mode 100644 tests/io/data/file1 2 delete mode 100644 tools/.gitattributes 2 delete mode 100644 tools/.gitignore 2 diff --git a/.gitattributes 2 b/.gitattributes 2 deleted file mode 100644 index 5ebde95f07..0000000000 --- a/.gitattributes 2 +++ /dev/null @@ -1,32 +0,0 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) -# -# SPDX-License-Identifier: MIT - -# Per default everything gets normalized and gets LF line endings on checkout. -* text eol=lf - -# These will always have CRLF line endings on checkout. -*.vcxproj text eol=crlf -*.props text eol=crlf -*.bat text eol=crlf - -# These are binary so should never be modified by git. -*.png binary -*.jpg binary -*.dxf binary -*.mpy binary -*.deb binary -*.zip binary -*.pdf binary - -# These should also not be modified by git. -tests/basics/string_cr_conversion.py -text -tests/basics/string_crlf_conversion.py -text -ports/stm32/pybcdc.inf_template -text -ports/stm32/usbhost/** -text -ports/cc3200/hal/aes.c -text -ports/cc3200/hal/aes.h -text -ports/cc3200/hal/des.c -text -ports/cc3200/hal/i2s.c -text -ports/cc3200/hal/i2s.h -text -ports/cc3200/version.h -text diff --git a/.gitignore 2 b/.gitignore 2 deleted file mode 100644 index a8814be45e..0000000000 --- a/.gitignore 2 +++ /dev/null @@ -1,88 +0,0 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) -# -# SPDX-License-Identifier: MIT - -# Compiled Sources -################### -*.o -*.a -!atmel-samd/asf/**/*.a -*.elf -*.bin -*.map -*.hex -*.dis -*.exe - -# Packages -############ -dist/ -*.egg-info -.eggs - -# Logs and Databases -###################### -*.log - -# VIM Swap Files -###################### -*.swp - -# Build directory -###################### -build/ -bin/ -circuitpython-stubs/ - -# Test failure outputs -###################### -tests/*.exp -tests/*.out - -# Python cache files -###################### -__pycache__/ -*.pyc - -# Customized Makefile/project overrides -###################### -GNUmakefile -user.props - -# Sphinx output -############### -_build - -# Generated rst files -###################### -genrst/ -/autoapi/ -/shared-bindings/*/**/*.rst - -# ctags and similar -################### -TAGS - -# Merge leftovers -################# -*.orig - -# Emacs backup files -#################### -*~ - -*.DS_Store -**/*.DS_Store -*.icloud - -# POEdit mo files -#################### -*.mo - -.vscode -.idea - -# Python Virtual Environments -#################### -.venv -.env diff --git a/.gitmodules 2 b/.gitmodules 2 deleted file mode 100644 index aaa66caf71..0000000000 --- a/.gitmodules 2 +++ /dev/null @@ -1,155 +0,0 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) -# -# SPDX-License-Identifier: MIT - -[submodule "lib/axtls"] - path = lib/axtls - url = https://github.com/pfalcon/axtls - branch = micropython -[submodule "lib/libffi"] - path = lib/libffi - url = https://github.com/atgreen/libffi -[submodule "lib/berkeley-db-1.xx"] - path = lib/berkeley-db-1.xx - url = https://github.com/pfalcon/berkeley-db-1.xx -[submodule "lib/uzlib"] - path = lib/uzlib - url = https://github.com/pfalcon/uzlib -[submodule "tools/uf2"] - path = tools/uf2 - url = https://github.com/Microsoft/uf2.git -[submodule "atmel-samd/frozen/Adafruit_CircuitPython_NeoPixel"] - path = frozen/Adafruit_CircuitPython_NeoPixel - url = https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel -[submodule "frozen/Adafruit_CircuitPython_Thermistor"] - path = frozen/Adafruit_CircuitPython_Thermistor - url = https://github.com/adafruit/Adafruit_CircuitPython_Thermistor.git -[submodule "frozen/Adafruit_CircuitPython_LIS3DH"] - path = frozen/Adafruit_CircuitPython_LIS3DH - url = https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH.git -[submodule "frozen/Adafruit_CircuitPython_BusDevice"] - path = frozen/Adafruit_CircuitPython_BusDevice - url = https://github.com/adafruit/Adafruit_CircuitPython_BusDevice.git -[submodule "tools/python-semver"] - path = tools/python-semver - url = https://github.com/k-bx/python-semver.git -[submodule "atmel-samd/asf4"] - path = ports/atmel-samd/asf4 - url = https://github.com/adafruit/asf4.git - branch = circuitpython -[submodule "tools/usb_descriptor"] - path = tools/usb_descriptor - url = https://github.com/adafruit/usb_descriptor.git -[submodule "lib/nrfutil"] - path = lib/nrfutil - url = https://github.com/adafruit/nRF52_nrfutil -[submodule "ports/atmel-samd/freetouch"] - path = ports/atmel-samd/freetouch - url = https://github.com/adafruit/Adafruit_FreeTouch.git -[submodule "frozen/Adafruit_CircuitPython_CircuitPlayground"] - path = frozen/Adafruit_CircuitPython_CircuitPlayground - url = https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground.git -[submodule "frozen/Adafruit_CircuitPython_HID"] - path = frozen/Adafruit_CircuitPython_HID - url = https://github.com/adafruit/Adafruit_CircuitPython_HID.git -[submodule "ports/atmel-samd/Adafruit_CircuitPython_Motor"] - path = frozen/Adafruit_CircuitPython_Motor - url = https://github.com/adafruit/Adafruit_CircuitPython_Motor.git -[submodule "ports/atmel-samd/Adafruit_CircuitPython_seesaw"] - path = frozen/Adafruit_CircuitPython_seesaw - url = https://github.com/adafruit/Adafruit_CircuitPython_seesaw.git -[submodule "frozen/Adafruit_CircuitPython_IRRemote"] - path = frozen/Adafruit_CircuitPython_IRRemote - url = https://github.com/adafruit/Adafruit_CircuitPython_IRRemote.git -[submodule "frozen/Adafruit_CircuitPython_DotStar"] - path = frozen/Adafruit_CircuitPython_DotStar - url = https://github.com/adafruit/Adafruit_CircuitPython_DotStar.git -[submodule "ports/atmel-samd/peripherals"] - path = ports/atmel-samd/peripherals - url = https://github.com/adafruit/samd-peripherals.git -[submodule "frozen/Adafruit_CircuitPython_Crickit"] - path = frozen/Adafruit_CircuitPython_Crickit - url = https://github.com/adafruit/Adafruit_CircuitPython_Crickit -[submodule "ports/nrf/nrfx"] - path = ports/nrf/nrfx - url = https://github.com/adafruit/nrfx.git -[submodule "lib/tinyusb"] - path = lib/tinyusb - url = https://github.com/hathach/tinyusb.git - branch = master - fetchRecurseSubmodules = false -[submodule "tools/huffman"] - path = tools/huffman - url = https://github.com/tannewt/huffman.git -[submodule "tools/adabot"] - path = tools/adabot - url = https://github.com/adafruit/adabot.git -[submodule "tools/bitmap_font"] - path = tools/bitmap_font - url = https://github.com/adafruit/Adafruit_CircuitPython_BitmapFont.git -[submodule "tools/Tecate-bitmap-fonts"] - path = tools/Tecate-bitmap-fonts - url = https://github.com/Tecate/bitmap-fonts.git -[submodule "frozen/pew-pewpew-standalone-10.x"] - path = frozen/pew-pewpew-standalone-10.x - url = https://github.com/pewpew-game/pew-pewpew-standalone-10.x.git -[submodule "frozen/circuitpython-stage"] - path = frozen/circuitpython-stage - url = https://github.com/python-ugame/circuitpython-stage.git -[submodule "ports/cxd56/spresense-exported-sdk"] - path = ports/cxd56/spresense-exported-sdk - url = https://github.com/sonydevworld/spresense-exported-sdk.git -[submodule "frozen/Adafruit_CircuitPython_SD"] - path = frozen/Adafruit_CircuitPython_SD - url = https://github.com/adafruit/Adafruit_CircuitPython_SD.git -[submodule "lib/mp3"] - path = lib/mp3 - url = https://github.com/adafruit/Adafruit_MP3 -[submodule "ports/mimxrt10xx/sdk"] - path = ports/mimxrt10xx/sdk - url = https://github.com/adafruit/MIMXRT10xx_SDK -[submodule "frozen/Adafruit_CircuitPython_Register"] - path = frozen/Adafruit_CircuitPython_Register - url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git -[submodule "extmod/ulab"] - path = extmod/ulab - url = https://github.com/v923z/micropython-ulab -[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"] - path = frozen/Adafruit_CircuitPython_ESP32SPI - url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI -[submodule "frozen/Adafruit_CircuitPython_Requests"] - path = frozen/Adafruit_CircuitPython_Requests - url = https://github.com/adafruit/Adafruit_CircuitPython_Requests -[submodule "ports/stm/st_driver"] - path = ports/stm/st_driver - url = https://github.com/hathach/st_driver.git -[submodule "lib/protomatter"] - path = lib/protomatter - url = https://github.com/adafruit/Adafruit_Protomatter -[submodule "frozen/Adafruit_CircuitPython_LSM6DS"] - path = frozen/Adafruit_CircuitPython_LSM6DS - url = https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS -[submodule "frozen/Adafruit_CircuitPython_FocalTouch"] - path = frozen/Adafruit_CircuitPython_FocalTouch - url = https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch -[submodule "frozen/Adafruit_CircuitPython_DS3231"] - path = frozen/Adafruit_CircuitPython_DS3231 - url = https://github.com/adafruit/Adafruit_CircuitPython_DS3231 -[submodule "frozen/Adafruit_CircuitPython_DRV2605"] - path = frozen/Adafruit_CircuitPython_DRV2605 - url = https://github.com/adafruit/Adafruit_CircuitPython_DRV2605 -[submodule "frozen/Adafruit_CircuitPython_BLE"] - path = frozen/Adafruit_CircuitPython_BLE - url = https://github.com/adafruit/Adafruit_CircuitPython_BLE -[submodule "frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center"] - path = frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center - url = https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center -[submodule "frozen/Adafruit_CircuitPython_RFM9x"] - path = frozen/Adafruit_CircuitPython_RFM9x - url = https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git -[submodule "frozen/Adafruit_CircuitPython_RFM69"] - path = frozen/Adafruit_CircuitPython_RFM69 - url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git -[submodule "ports/esp32s2/esp-idf"] - path = ports/esp32s2/esp-idf - url = https://github.com/jepler/esp-idf.git diff --git a/tests/io/data/file1 2 b/tests/io/data/file1 2 deleted file mode 100644 index e08206337f..0000000000 --- a/tests/io/data/file1 2 +++ /dev/null @@ -1,3 +0,0 @@ -longer line1 -line2 -line3 diff --git a/tools/.gitattributes 2 b/tools/.gitattributes 2 deleted file mode 100644 index 9206a0bfc1..0000000000 --- a/tools/.gitattributes 2 +++ /dev/null @@ -1 +0,0 @@ -*.tar.gz binary diff --git a/tools/.gitignore 2 b/tools/.gitignore 2 deleted file mode 100644 index 9f65f493bc..0000000000 --- a/tools/.gitignore 2 +++ /dev/null @@ -1,8 +0,0 @@ -tinytest/.gitignore -tinytest/.travis.yml -tinytest/Makefile -tinytest/Makefile.arm-cortex-m3-qemu -tinytest/Makefile.avr -tinytest/TODO -tinytest/portable_demo.c -tinytest/tinytest_demo.c From 1f58795c56d35d6a50ecbea3fa8744e7b73f54b6 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Wed, 16 Dec 2020 10:47:37 -0500 Subject: [PATCH 085/146] still removing doubles. should be the last --- .mailmap 2 | 112 ------------------------------ mpy-cross/.gitignore 2 | 11 --- ports/atmel-samd/.gitattributes 2 | 2 - ports/atmel-samd/.gitignore 2 | 1 - 4 files changed, 126 deletions(-) delete mode 100644 .mailmap 2 delete mode 100644 mpy-cross/.gitignore 2 delete mode 100644 ports/atmel-samd/.gitattributes 2 delete mode 100644 ports/atmel-samd/.gitignore 2 diff --git a/.mailmap 2 b/.mailmap 2 deleted file mode 100644 index f9d7f47a16..0000000000 --- a/.mailmap 2 +++ /dev/null @@ -1,112 +0,0 @@ -# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò -# -# SPDX-License-Identifier: Unlicense - -Alexander Steffen -Alexander Steffen -Alexander Steffen -Benjamin Vernoux -Brent Rubell -Brent Rubell -Brent Rubell -Carlos -Chris Packham -Chris Packham -Damiano Mazzella -Damien George -Dan Halbert -Dan Halbert -Daniel Pollard -Daniel Pollard -Daniel Tralamazza -Daniel Tralamazza -David Glaude -David Glaude -George Waters -George Waters -Ha Thach -Henrik Sölver -Ilya Dmitrichenko -Ilya Dmitrichenko -Jason Pecor <14111408+jpecor@users.noreply.github.com> -Jeff Epler -Jeff Epler -Jeff Epler -Jeff Epler -Jerry Needell -Joe Bakalor -Josh Klar -Josh Klar -Juan Biondi -Juan Biondi -KalbeAbbas -KalbeAbbas -Kamil Tomaszewski -Kamil Tomaszewski <46525824+kamtom480@users.noreply.github.com> -Kattni -Kattni Rembor -Kenny -Kenny <3454741+WarriorOfWire@users.noreply.github.com> -Kevin Townsend -Kevin Townsend -Krzysztof Blazewicz -Krzysztof Blazewicz -Li Weiwei -Li Weiwei -Limor "Ladyada" Fried -Limor "Ladyada" Fried -Lucian Copeland -Lucian Copeland -Mark Olsson -Mark Olsson -Matt Land -Matt Land -Matt Wozniski -Matt Wozniski -Melissa LeBlanc-Williams -Melissa LeBlanc-Williams -Metallicow -Metallicow -Peter Hinch -Peter Hinch -Radomir Dopieralski -Radomir Dopieralski -Rafa Gould -Rafa Gould <50337143+rafa-gould@users.noreply.github.com> -Ryan Shaw -Ryan Shaw -Sabas -Sabas -Sabas -Scott Shawcroft -Scott Shawcroft -Scott Shawcroft -Scott Shawcroft -Scott Shawcroft -Sebastian Plamauer -Sebastian Plamauer -Senuros -Senuros -Stewart Colborne -Stewart Colborne -TG-Techie -TG-Techie <39284876+TG-Techie@users.noreply.github.com> -Thea Flowers -Thea Flowers -Tobias Badertscher -Tobias Badertscher -danicampora -danicampora -dherrada -dherrada <33632497+dherrada@users.noreply.github.com> -dherrada <=> -glennrub -retoc -retoc -siddacious -siddacious -siddacious -sommersoft -sommersoft -stijn -stijn diff --git a/mpy-cross/.gitignore 2 b/mpy-cross/.gitignore 2 deleted file mode 100644 index 6daeea5040..0000000000 --- a/mpy-cross/.gitignore 2 +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) -# -# SPDX-License-Identifier: MIT - -/build-* -/mpy-cross -/mpy-cross.static -/mpy-cross.static.exe -/mpy-cross.static-raspbian -/mpy-cross.fuzz -/pitools diff --git a/ports/atmel-samd/.gitattributes 2 b/ports/atmel-samd/.gitattributes 2 deleted file mode 100644 index 09bba615b1..0000000000 --- a/ports/atmel-samd/.gitattributes 2 +++ /dev/null @@ -1,2 +0,0 @@ -tools/bossac* binary -asf/**/*.a binary diff --git a/ports/atmel-samd/.gitignore 2 b/ports/atmel-samd/.gitignore 2 deleted file mode 100644 index 414487d53e..0000000000 --- a/ports/atmel-samd/.gitignore 2 +++ /dev/null @@ -1 +0,0 @@ -build-*/ From 74805527e8616076fc65e2875747ce269256528b Mon Sep 17 00:00:00 2001 From: Seth Kerr <41877068+skerr92@users.noreply.github.com> Date: Wed, 16 Dec 2020 10:52:18 -0500 Subject: [PATCH 086/146] Delete board.h not supposed to be here. --- ports/atmel-samd/boards/board.h | 47 --------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 ports/atmel-samd/boards/board.h diff --git a/ports/atmel-samd/boards/board.h b/ports/atmel-samd/boards/board.h deleted file mode 100644 index 4f0ae9d728..0000000000 --- a/ports/atmel-samd/boards/board.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H -#define MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H - -#include - -#include "py/mpconfig.h" - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H From 109b6baee45629e3c072eb17b6c96ac06d7df842 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 16 Dec 2020 14:04:31 +0000 Subject: [PATCH 087/146] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (879 of 879 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index eb73928502..8d3d54fabc 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-14 12:59-0500\n" -"PO-Revision-Date: 2020-12-11 19:08+0000\n" +"PO-Revision-Date: 2020-12-16 17:00+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1107,7 +1107,7 @@ msgstr "Frequência PWM inválida" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "Invalid Pin" -msgstr "" +msgstr "Pino inválido" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" @@ -1977,7 +1977,7 @@ msgstr "Não é possível gravar no nvm." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "Não foi possível escrever no sleep_memory." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" From 28bd29eb42d61d0a7116b6c4295e166fcfbe7145 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 16 Dec 2020 13:48:07 -0600 Subject: [PATCH 088/146] displayio: ColorConverter: fix logic errors about transparent pixels The transparent_color field was never initialized. I _think_ this means its value was always set to 0, or the blackest of blacks. Instead, initialize it to the sentinel value, newly given the name NO_TRANSPARENT_COLOR. This exposed a second problem: The test for whether there was an existing transparent color was wrong (backwards). I am guessing that this was not found due to the first bug; since the converter had a transparent color, the correct test would have led to always getting the error "Only one color can be transparent at a time". Closes #3723 --- shared-module/displayio/ColorConverter.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index 80558d037a..40dcd9d167 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -29,6 +29,8 @@ #include "py/misc.h" #include "py/runtime.h" +#define NO_TRANSPARENT_COLOR (0x1000000) + uint32_t displayio_colorconverter_dither_noise_1 (uint32_t n) { n = (n >> 13) ^ n; @@ -42,6 +44,7 @@ uint32_t displayio_colorconverter_dither_noise_2(uint32_t x, uint32_t y) { void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t* self, bool dither) { self->dither = dither; + self->transparent_color = NO_TRANSPARENT_COLOR; } uint16_t displayio_colorconverter_compute_rgb565(uint32_t color_rgb888) { @@ -130,7 +133,7 @@ bool common_hal_displayio_colorconverter_get_dither(displayio_colorconverter_t* } void common_hal_displayio_colorconverter_make_transparent(displayio_colorconverter_t* self, uint32_t transparent_color) { - if (self->transparent_color >= 0x1000000) { + if (self->transparent_color != NO_TRANSPARENT_COLOR) { mp_raise_RuntimeError(translate("Only one color can be transparent at a time")); } self->transparent_color = transparent_color; @@ -138,8 +141,8 @@ void common_hal_displayio_colorconverter_make_transparent(displayio_colorconvert void common_hal_displayio_colorconverter_make_opaque(displayio_colorconverter_t* self, uint32_t transparent_color) { (void) transparent_color; - // 0x1000000 will never equal a valid color - self->transparent_color = 0x1000000; + // NO_TRANSPARENT_COLOR will never equal a valid color + self->transparent_color = NO_TRANSPARENT_COLOR; } void displayio_colorconverter_convert(displayio_colorconverter_t *self, const _displayio_colorspace_t* colorspace, const displayio_input_pixel_t *input_pixel, displayio_output_pixel_t *output_color) { From fac0bf1db8adb4caeba9d3bbec10a670a989ce7d Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 12:37:32 +0800 Subject: [PATCH 089/146] Add files via upload --- .../boards/stackrduino_m0_pro/board.c | 37 +++++++++++++++++ .../boards/stackrduino_m0_pro/mpconfigboard.h | 36 +++++++++++++++++ .../stackrduino_m0_pro/mpconfigboard.mk | 26 ++++++++++++ .../boards/stackrduino_m0_pro/pins.c | 40 +++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/board.c create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c new file mode 100644 index 0000000000..d7e856d611 --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h new file mode 100644 index 0000000000..8f23e82d48 --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h @@ -0,0 +1,36 @@ +#define MICROPY_HW_BOARD_NAME "StackRduino M0 PRO" +#define MICROPY_HW_MCU_NAME "samd21g18" + +#define MICROPY_HW_LED_STATUS (&pin_PA17) +#define MICROPY_HW_NEOPIXEL (&pin_PA06) + +#define SPI_FLASH_BAUDRATE (8000000) + +#define SPI_FLASH_MOSI_PIN &pin_PB22 +#define SPI_FLASH_MISO_PIN &pin_PB03 +#define SPI_FLASH_SCK_PIN &pin_PB23 +#define SPI_FLASH_CS_PIN &pin_PA27 + +// These are pins not to reset. +#define MICROPY_PORT_A (PORT_PA06) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA23) +#define DEFAULT_I2C_BUS_SDA (&pin_PA22) + +#define DEFAULT_SPI_BUS_SCK (&pin_PB11) +#define DEFAULT_SPI_BUS_MOSI (&pin_PB10) +#define DEFAULT_SPI_BUS_MISO (&pin_PA12) + +#define DEFAULT_UART_BUS_RX (&pin_PA11) +#define DEFAULT_UART_BUS_TX (&pin_PA10) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 + + + diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk new file mode 100644 index 0000000000..a7caf5bc81 --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -0,0 +1,26 @@ +LD_FILE = boards/samd21x18-bootloader-external-flash.ld +USB_VID = 0x1209 +USB_PID = 0xE3E3 +USB_PRODUCT = "StackRduino M0 PRO" +USB_MANUFACTURER = "StackRduino" + +CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 + +SPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ" +LONGINT_IMPL = MPZ + + +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_COUNTIO = 0 +CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_VECTORIO = 0 + +CFLAGS_INLINE_LIMIT = 60 +SUPEROPT_GC = 0 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c new file mode 100644 index 0000000000..50dc341f9e --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c @@ -0,0 +1,40 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 70a9c601a8461717effdfd543697778922a3a0c9 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 12:52:51 +0800 Subject: [PATCH 090/146] Update devices.h Correct capacity value for the MX25R1635F from 0x18 to 0x15 (tested and working) refer to https://github.com/adafruit/circuitpython/issues/3558 --- supervisor/shared/external_flash/devices.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index a874dbd4fd..6797f86f08 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -537,7 +537,7 @@ typedef struct { .start_up_time_us = 800, \ .manufacturer_id = 0xc2, \ .memory_type = 0x28, \ - .capacity = 0x18, \ + .capacity = 0x15, \ .max_clock_speed_mhz = 33, /* 8 mhz for dual/quad */ \ .quad_enable_bit_mask = 0x80, \ .has_sector_protection = false, \ From 70739ff639f53d00473a69b892771e95995b1c5d Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 13:11:53 +0800 Subject: [PATCH 091/146] Update pins.c --- ports/atmel-samd/boards/stackrduino_m0_pro/pins.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c index 50dc341f9e..7ddaec4113 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c @@ -23,16 +23,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, From f3b7cd6a5d15ec82c4a9d06a65fbf5dc444ef3e0 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 14:24:07 +0800 Subject: [PATCH 092/146] Delete pins.c --- .../boards/stackrduino_m0_pro/pins.c | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c deleted file mode 100644 index 7ddaec4113..0000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 3d9e4958c5c7d9373c373aa3be5947aaeb504330 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 14:24:24 +0800 Subject: [PATCH 093/146] Add files via upload --- .../boards/stackrduino_m0_pro/pins.c | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c new file mode 100644 index 0000000000..95d2eb5a3d --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c @@ -0,0 +1,40 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 23ad9c7402325cf50e7f09db11f0aad4e396b935 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 15:17:04 +0800 Subject: [PATCH 094/146] Update mpconfigboard.h removed whitespace --- ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h index 8f23e82d48..f0b2764a49 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h @@ -31,6 +31,3 @@ // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 - - - From 109e147b46838ee0b97b825d91de8d2dc6834e6c Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 16:22:47 +0800 Subject: [PATCH 095/146] Update board.c updated path to board.h --- ports/atmel-samd/boards/stackrduino_m0_pro/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c index d7e856d611..84960e73cf 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } From 0a7c74230c9cee04785e906cbe8160f6d7d40ddb Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 16:26:54 +0800 Subject: [PATCH 096/146] Update mpconfigboard.mk updated for 6.1 --- ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk index a7caf5bc81..955f3d593b 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -1,4 +1,3 @@ -LD_FILE = boards/samd21x18-bootloader-external-flash.ld USB_VID = 0x1209 USB_PID = 0xE3E3 USB_PRODUCT = "StackRduino M0 PRO" @@ -18,9 +17,9 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From 736c0d4c3d880664aab0e82c26bd7d92cf6e5b6a Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:08:46 +0800 Subject: [PATCH 097/146] Delete pins.c --- .../boards/stackrduino_m0_pro/pins.c | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c deleted file mode 100644 index 95d2eb5a3d..0000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 1284418fa7df4683074a3ad020dac27967c9819e Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:08:48 +0800 Subject: [PATCH 098/146] Delete mpconfigboard.mk --- .../stackrduino_m0_pro/mpconfigboard.mk | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk deleted file mode 100644 index 955f3d593b..0000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ /dev/null @@ -1,25 +0,0 @@ -USB_VID = 0x1209 -USB_PID = 0xE3E3 -USB_PRODUCT = "StackRduino M0 PRO" -USB_MANUFACTURER = "StackRduino" - -CHIP_VARIANT = SAMD21G18A -CHIP_FAMILY = samd21 - -SPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICE_COUNT = 1 -EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ" -LONGINT_IMPL = MPZ - - -CIRCUITPY_BITBANGIO = 0 -CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_COUNTIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 -CIRCUITPY_VECTORIO = 0 -CIRCUITPY_BUSDEVICE = 0 - -CFLAGS_INLINE_LIMIT = 60 -SUPEROPT_GC = 0 - -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From f3fb01416679132e52a401226a1df7408b621903 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:08:50 +0800 Subject: [PATCH 099/146] Delete mpconfigboard.h --- .../boards/stackrduino_m0_pro/mpconfigboard.h | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h deleted file mode 100644 index f0b2764a49..0000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h +++ /dev/null @@ -1,33 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "StackRduino M0 PRO" -#define MICROPY_HW_MCU_NAME "samd21g18" - -#define MICROPY_HW_LED_STATUS (&pin_PA17) -#define MICROPY_HW_NEOPIXEL (&pin_PA06) - -#define SPI_FLASH_BAUDRATE (8000000) - -#define SPI_FLASH_MOSI_PIN &pin_PB22 -#define SPI_FLASH_MISO_PIN &pin_PB03 -#define SPI_FLASH_SCK_PIN &pin_PB23 -#define SPI_FLASH_CS_PIN &pin_PA27 - -// These are pins not to reset. -#define MICROPY_PORT_A (PORT_PA06) -#define MICROPY_PORT_B (0) -#define MICROPY_PORT_C (0) - -#define BOARD_HAS_CRYSTAL 1 - -#define DEFAULT_I2C_BUS_SCL (&pin_PA23) -#define DEFAULT_I2C_BUS_SDA (&pin_PA22) - -#define DEFAULT_SPI_BUS_SCK (&pin_PB11) -#define DEFAULT_SPI_BUS_MOSI (&pin_PB10) -#define DEFAULT_SPI_BUS_MISO (&pin_PA12) - -#define DEFAULT_UART_BUS_RX (&pin_PA11) -#define DEFAULT_UART_BUS_TX (&pin_PA10) - -// USB is always used internally so skip the pin objects for it. -#define IGNORE_PIN_PA24 1 -#define IGNORE_PIN_PA25 1 From bc95c7f2190939e43995d7bf331c66f08f11ef80 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:08:52 +0800 Subject: [PATCH 100/146] Delete board.c --- .../boards/stackrduino_m0_pro/board.c | 37 ------------------- 1 file changed, 37 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/board.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c deleted file mode 100644 index 84960e73cf..0000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "supervisor/board.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} From c6de41b4ea809770b3e19b6bbe017827ff7aa320 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:14:49 +0800 Subject: [PATCH 101/146] Update build.yml added stackrduino_m0_pro board --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0edc8c023d..fff8e826fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -301,6 +301,7 @@ jobs: - "sparkfun_samd21_mini" - "sparkfun_samd51_thing_plus" - "spresense" + - "stackrduino_m0_pro" - "stm32f411ce_blackpill" - "stm32f411ve_discovery" - "stm32f412zg_discovery" From 81ff95a8eb6364072113ba203131d897a9c7f171 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 20:29:54 +0800 Subject: [PATCH 102/146] Add files via upload --- .../boards/stackrduino_m0_pro/board.c | 37 +++++++++++++++++ .../boards/stackrduino_m0_pro/mpconfigboard.h | 33 +++++++++++++++ .../stackrduino_m0_pro/mpconfigboard.mk | 25 ++++++++++++ .../boards/stackrduino_m0_pro/pins.c | 40 +++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/board.c create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c new file mode 100644 index 0000000000..84960e73cf --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h new file mode 100644 index 0000000000..f0b2764a49 --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h @@ -0,0 +1,33 @@ +#define MICROPY_HW_BOARD_NAME "StackRduino M0 PRO" +#define MICROPY_HW_MCU_NAME "samd21g18" + +#define MICROPY_HW_LED_STATUS (&pin_PA17) +#define MICROPY_HW_NEOPIXEL (&pin_PA06) + +#define SPI_FLASH_BAUDRATE (8000000) + +#define SPI_FLASH_MOSI_PIN &pin_PB22 +#define SPI_FLASH_MISO_PIN &pin_PB03 +#define SPI_FLASH_SCK_PIN &pin_PB23 +#define SPI_FLASH_CS_PIN &pin_PA27 + +// These are pins not to reset. +#define MICROPY_PORT_A (PORT_PA06) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA23) +#define DEFAULT_I2C_BUS_SDA (&pin_PA22) + +#define DEFAULT_SPI_BUS_SCK (&pin_PB11) +#define DEFAULT_SPI_BUS_MOSI (&pin_PB10) +#define DEFAULT_SPI_BUS_MISO (&pin_PA12) + +#define DEFAULT_UART_BUS_RX (&pin_PA11) +#define DEFAULT_UART_BUS_TX (&pin_PA10) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk new file mode 100644 index 0000000000..955f3d593b --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -0,0 +1,25 @@ +USB_VID = 0x1209 +USB_PID = 0xE3E3 +USB_PRODUCT = "StackRduino M0 PRO" +USB_MANUFACTURER = "StackRduino" + +CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 + +SPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ" +LONGINT_IMPL = MPZ + + +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_COUNTIO = 0 +CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 + +CFLAGS_INLINE_LIMIT = 60 +SUPEROPT_GC = 0 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c new file mode 100644 index 0000000000..95d2eb5a3d --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c @@ -0,0 +1,40 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 06022a5e9145dbe5213802edbe6dd7a2b5ff5f81 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 21:58:24 +0800 Subject: [PATCH 103/146] Update mpconfigboard.mk changed CFLAGS_INLINE_LIMIT = 55 --- ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk index 955f3d593b..4a8b85e2f3 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -19,7 +19,7 @@ CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_BUSDEVICE = 0 -CFLAGS_INLINE_LIMIT = 60 +CFLAGS_INLINE_LIMIT = 55 SUPEROPT_GC = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From 7afa1a1d766bb7fb8f4afe2c8d4de336e0be566c Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 22:47:01 +0800 Subject: [PATCH 104/146] Update mpconfigboard.mk reduced to CFLAGS_INLINE_LIMIT = 35 for tranaslations --- .../stackrduino_m0_pro/mpconfigboard.mk | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk index 4a8b85e2f3..704d265141 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -22,4 +22,37 @@ CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 55 SUPEROPT_GC = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), ja) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif +ifeq ($(TRANSLATION), pl) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif +ifeq ($(TRANSLATION), fr) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif +ifeq ($(TRANSLATION), pt_BR) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif +ifeq ($(TRANSLATION), es) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif From f224ed18488b1e92b6d13b09b696769a2ac380ce Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 17 Dec 2020 10:54:37 -0600 Subject: [PATCH 105/146] OnDiskBitmap: Correct handling of "0 color palette" images Microsoft documentation says: > If biCompression equals BI_RGB and the bitmap uses 8 bpp or less, the bitmap has a color table immediatelly following the BITMAPINFOHEADER structure. The color table consists of an array of RGBQUAD values. The size of the array is given by the biClrUsed member. If biClrUsed is zero, the array contains the maximum number of colors for the given bitdepth; that is, 2^biBitCount colors. Formerly, we treated 0 colors as "no image palette" during construction, but then during common_hal_displayio_ondiskbitmap_get_pixel indexed into the palette anyway. This could have unpredictable results. On a pygamer, it gave an image that was blue and black. On magtag, it gave a crash. --- shared-module/displayio/OnDiskBitmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shared-module/displayio/OnDiskBitmap.c b/shared-module/displayio/OnDiskBitmap.c index 993fc03de6..c1a0ddeb7e 100644 --- a/shared-module/displayio/OnDiskBitmap.c +++ b/shared-module/displayio/OnDiskBitmap.c @@ -57,7 +57,7 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, uint32_t compression = read_word(bmp_header, 15); uint32_t number_of_colors = read_word(bmp_header, 23); - bool indexed = ((bits_per_pixel <= 8) && (number_of_colors != 0)); + bool indexed = bits_per_pixel <= 8; self->bitfield_compressed = (compression == 3); self->bits_per_pixel = bits_per_pixel; self->width = read_word(bmp_header, 9); @@ -75,6 +75,9 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, self->b_bitmask = 0x1f; } } else if (indexed && self->bits_per_pixel != 1) { + if (number_of_colors == 0) { + number_of_colors = 1 << bits_per_pixel; + } uint16_t palette_size = number_of_colors * sizeof(uint32_t); uint16_t palette_offset = 0xe + header_size; From 4863413bc9aa3104f2c983efa43bf3afa028b80b Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 18 Dec 2020 00:34:56 +0530 Subject: [PATCH 106/146] rename ota to dualbank --- locale/circuitpython.pot | 20 ++-- .../common-hal/{ota => dualbank}/__init__.c | 65 ++++++------- .../common-hal/{ota => dualbank}/__init__.h | 8 +- ports/esp32s2/mpconfigport.mk | 2 +- ports/esp32s2/supervisor/port.c | 6 +- py/circuitpy_defns.mk | 6 +- py/circuitpy_mpconfig.h | 10 +- py/circuitpy_mpconfig.mk | 4 +- shared-bindings/{ota => dualbank}/__init__.c | 96 ++++++++----------- shared-bindings/{ota => dualbank}/__init__.h | 11 +-- 10 files changed, 102 insertions(+), 126 deletions(-) rename ports/esp32s2/common-hal/{ota => dualbank}/__init__.c (76%) rename ports/esp32s2/common-hal/{ota => dualbank}/__init__.h (84%) rename shared-bindings/{ota => dualbank}/__init__.c (55%) rename shared-bindings/{ota => dualbank}/__init__.h (78%) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 6ee4d816a5..d7f95091c8 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-10 16:56+0530\n" +"POT-Creation-Date: 2020-12-17 19:42+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -936,6 +936,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1420,10 +1424,6 @@ msgstr "" msgid "Not settable" msgstr "" -#: ports/esp32s2/common-hal/ota/__init__.c -msgid "OTA Update Failed" -msgstr "" - #: shared-bindings/util.c msgid "" "Object has been deinitialized and can no longer be used. Create a new object." @@ -1911,10 +1911,6 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" -#: ports/esp32s2/common-hal/ota/__init__.c -msgid "Unable to switch boot partition" -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -1983,6 +1979,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3210,7 +3210,7 @@ msgstr "" msgid "offset is too large" msgstr "" -#: shared-bindings/ota/__init__.c +#: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" msgstr "" diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/dualbank/__init__.c similarity index 76% rename from ports/esp32s2/common-hal/ota/__init__.c rename to ports/esp32s2/common-hal/dualbank/__init__.c index 5ea25fb5d4..0f468a036b 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/dualbank/__init__.c @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#include "common-hal/ota/__init__.h" -#include "shared-bindings/ota/__init__.h" +#include "common-hal/dualbank/__init__.h" +#include "shared-bindings/dualbank/__init__.h" #include @@ -35,21 +35,24 @@ static const esp_partition_t *update_partition = NULL; static esp_ota_handle_t update_handle = 0; -static bool ota_inited = false; -static const char *TAG = "OTA"; +static const char *TAG = "dualbank"; -void ota_reset(void) { - update_handle = 0; - update_partition = NULL; - ota_inited = false; +void dualbank_reset(void) { + // should use `abort` instead of `end` + // but not in idf v4.2 + // esp_ota_abort(update_handle); + if (esp_ota_end(update_handle) == ESP_OK) { + update_handle = 0; + update_partition = NULL; + } } static void __attribute__((noreturn)) task_fatal_error(void) { ESP_LOGE(TAG, "Exiting task due to fatal error..."); - mp_raise_RuntimeError(translate("OTA Update Failed")); + mp_raise_RuntimeError(translate("Update Failed")); } -void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset) { +void common_hal_dualbank_flash(const void *buf, const size_t len, const size_t offset) { esp_err_t err; const esp_partition_t *running = esp_ota_get_running_partition(); @@ -67,7 +70,7 @@ void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offse assert(update_partition != NULL); } - if (!ota_inited) { + if (update_handle == 0) { if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { esp_app_desc_t new_app_info; memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); @@ -102,14 +105,13 @@ void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offse ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); task_fatal_error(); } - ota_inited = true; } else { ESP_LOGE(TAG, "received package is not fit len"); task_fatal_error(); } } - if (offset == -1) { + if (offset == 0) { err = esp_ota_write(update_handle, buf, len); } else { err = esp_ota_write_with_offset(update_handle, buf, len, offset); @@ -120,31 +122,18 @@ void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offse } } -void common_hal_ota_finish(void) { - if (ota_inited) { - esp_err_t err; - - err = esp_ota_end(update_handle); - if (err != ESP_OK) { - if (err == ESP_ERR_OTA_VALIDATE_FAILED) { - ESP_LOGE(TAG, "Image validation failed, image is corrupted"); - } - ESP_LOGE(TAG, "esp_ota_end failed (%s)!", esp_err_to_name(err)); - task_fatal_error(); +void common_hal_dualbank_switch(void) { + if (esp_ota_end(update_handle) == ESP_OK) { + update_handle = 0; + update_partition = NULL; + } + esp_err_t err = esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)); + if (err != ESP_OK) { + if (err == ESP_ERR_OTA_VALIDATE_FAILED) { + ESP_LOGE(TAG, "Image validation failed, image is corrupted"); + mp_raise_RuntimeError(translate("Firmware image is invalid")); } - - err = esp_ota_set_boot_partition(update_partition); - if (err != ESP_OK) { - ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); - task_fatal_error(); - } - - ota_reset(); - } -} - -void common_hal_ota_switch(void) { - if (esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)) != ESP_OK) { - mp_raise_RuntimeError(translate("Unable to switch boot partition")); + ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); } } diff --git a/ports/esp32s2/common-hal/ota/__init__.h b/ports/esp32s2/common-hal/dualbank/__init__.h similarity index 84% rename from ports/esp32s2/common-hal/ota/__init__.h rename to ports/esp32s2/common-hal/dualbank/__init__.h index 983b57e3f2..8b18336c94 100644 --- a/ports/esp32s2/common-hal/ota/__init__.h +++ b/ports/esp32s2/common-hal/dualbank/__init__.h @@ -24,9 +24,9 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H -#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DUALBANK___INIT___H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DUALBANK___INIT___H -extern void ota_reset(void); +extern void dualbank_reset(void); -#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H +#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DUALBANK___INIT___H diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index da231107fb..2ad8afb51c 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -19,11 +19,11 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 CIRCUITPY_COUNTIO = 1 +CIRCUITPY_DUALBANK = 1 CIRCUITPY_FREQUENCYIO = 1 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 1 CIRCUITPY_NVM = 1 -CIRCUITPY_OTA = 1 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 201d9962e2..a56ac61c81 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -41,7 +41,7 @@ #include "common-hal/busio/I2C.h" #include "common-hal/busio/SPI.h" #include "common-hal/busio/UART.h" -#include "common-hal/ota/__init__.h" +#include "common-hal/dualbank/__init__.h" #include "common-hal/ps2io/Ps2.h" #include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" @@ -124,8 +124,8 @@ void reset_port(void) { analogout_reset(); #endif -#if CIRCUITPY_OTA - ota_reset(); +#if CIRCUITPY_DUALBANK + dualbank_reset(); #endif #if CIRCUITPY_PS2IO diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 68e806d4b2..a871479141 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -205,8 +205,8 @@ endif ifeq ($(CIRCUITPY_OS),1) SRC_PATTERNS += os/% endif -ifeq ($(CIRCUITPY_OTA),1) -SRC_PATTERNS += ota/% +ifeq ($(CIRCUITPY_DUALBANK),1) +SRC_PATTERNS += dualbank/% endif ifeq ($(CIRCUITPY_PIXELBUF),1) SRC_PATTERNS += _pixelbuf/% @@ -350,7 +350,7 @@ SRC_COMMON_HAL_ALL = \ nvm/ByteArray.c \ nvm/__init__.c \ os/__init__.c \ - ota/__init__.c \ + dualbank/__init__.c \ ps2io/Ps2.c \ ps2io/__init__.c \ pulseio/PulseIn.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 6a0daa7e9b..08c92a77ef 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -539,11 +539,11 @@ extern const struct _mp_obj_module_t os_module; #define OS_MODULE_ALT_NAME #endif -#if CIRCUITPY_OTA -extern const struct _mp_obj_module_t ota_module; -#define OTA_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_ota), (mp_obj_t)&ota_module }, +#if CIRCUITPY_DUALBANK +extern const struct _mp_obj_module_t dualbank_module; +#define DUALBANK_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_dualbank), (mp_obj_t)&dualbank_module }, #else -#define OTA_MODULE +#define DUALBANK_MODULE #endif #if CIRCUITPY_PEW @@ -834,7 +834,7 @@ extern const struct _mp_obj_module_t wifi_module; NETWORK_MODULE \ SOCKET_MODULE \ WIZNET_MODULE \ - OTA_MODULE \ + DUALBANK_MODULE \ PEW_MODULE \ PIXELBUF_MODULE \ PS2IO_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 09074bf53c..af1dccf024 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -179,8 +179,8 @@ CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM) CIRCUITPY_OS ?= 1 CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS) -CIRCUITPY_OTA ?= 0 -CFLAGS += -DCIRCUITPY_OTA=$(CIRCUITPY_OTA) +CIRCUITPY_DUALBANK ?= 0 +CFLAGS += -DCIRCUITPY_DUALBANK=$(CIRCUITPY_DUALBANK) CIRCUITPY_PIXELBUF ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF) diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/dualbank/__init__.c similarity index 55% rename from shared-bindings/ota/__init__.c rename to shared-bindings/dualbank/__init__.c index 8ecc6d9c41..8021ab18b9 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/dualbank/__init__.c @@ -24,19 +24,20 @@ * THE SOFTWARE. */ -#include "shared-bindings/ota/__init__.h" +#include "shared-bindings/dualbank/__init__.h" -//| """OTA Module +//| """DUALBANK Module //| -//| The `ota` module implements over-the-air update. +//| The `dualbank` module adds ability to update and switch +//| between the two app partitions. //| -//| There are two identical ota partitions ota_0/1, these -//| contain different firmware versions. +//| There are two identical partitions, these contain different +//| firmware versions. //| Having two partitions enables rollback functionality. //| //| The two partitions are defined as boot partition and -//| next-update partition. Calling `ota.flash()` writes the -//| next-update partition. +//| next-update partition. Calling `dualbank.flash()` writes +//| the next-update partition. //| //| After the next-update partition is written a validation //| check is performed and on a successful validation this @@ -47,81 +48,68 @@ //| //| .. code-block:: python //| -//| import ota +//| import dualbank //| -//| ota.flash(buffer, offset) -//| ota.finish() +//| dualbank.flash(buffer, offset) +//| dualbank.switch() //| """ //| ... //| -//| def switch() -> None: -//| """Switches the boot partition. On next reset, -//| firmware will be loaded from the partition -//| just switched over to.""" -//| ... -//| -STATIC mp_obj_t ota_switch(void) { - common_hal_ota_switch(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); - -//| def finish() -> None: -//| """Validates flashed firmware, sets next boot partition. -//| **Must be called** after the firmware has been -//| completely written into the flash using `ota.flash()`. -//| -//| This is to be called only once per update.""" -//| ... -//| -STATIC mp_obj_t ota_finish(void) { - common_hal_ota_finish(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); - //| def flash(*buffer: ReadableBuffer, offset: int=0) -> None: -//| """Writes one of two OTA partitions at the given offset. -//| -//| The default offset is 0. It is necessary to provide the -//| offset when writing in discontinous chunks. +//| """Writes one of two app partitions at the given offset. //| //| This can be called multiple times when flashing the firmware -//| in small chunks.""" +//| in small chunks. +//| """ //| ... //| -STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t dualbank_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_offset }; static const mp_arg_t allowed_args[] = { { MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED }, - { MP_QSTR_offset, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} }, + { MP_QSTR_offset, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - if (args[ARG_offset].u_int < -1) { + if (args[ARG_offset].u_int < 0) { mp_raise_ValueError(translate("offset must be >= 0")); } mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); - common_hal_ota_flash(bufinfo.buf, bufinfo.len, args[ARG_offset].u_int); + common_hal_dualbank_flash(bufinfo.buf, bufinfo.len, args[ARG_offset].u_int); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 0, ota_flash); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(dualbank_flash_obj, 0, dualbank_flash); -STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, - { MP_ROM_QSTR(MP_QSTR_switch), MP_ROM_PTR(&ota_switch_obj) }, - { MP_ROM_QSTR(MP_QSTR_finish), MP_ROM_PTR(&ota_finish_obj) }, - { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) }, +//| def switch() -> None: +//| """Switches the boot partition. +//| +//| On next reset, firmware will be loaded from the partition +//| just switched over to. +//| """ +//| ... +//| +STATIC mp_obj_t dualbank_switch(void) { + common_hal_dualbank_switch(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(dualbank_switch_obj, dualbank_switch); + +STATIC const mp_rom_map_elem_t dualbank_module_globals_table[] = { + // module name + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_dualbank) }, + // module functions + { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&dualbank_flash_obj) }, + { MP_ROM_QSTR(MP_QSTR_switch), MP_ROM_PTR(&dualbank_switch_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(ota_module_globals, ota_module_globals_table); +STATIC MP_DEFINE_CONST_DICT(dualbank_module_globals, dualbank_module_globals_table); -const mp_obj_module_t ota_module = { +const mp_obj_module_t dualbank_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&ota_module_globals, + .globals = (mp_obj_dict_t*)&dualbank_module_globals, }; diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/dualbank/__init__.h similarity index 78% rename from shared-bindings/ota/__init__.h rename to shared-bindings/dualbank/__init__.h index 82273f975a..7edbc6d68a 100644 --- a/shared-bindings/ota/__init__.h +++ b/shared-bindings/dualbank/__init__.h @@ -24,13 +24,12 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DUALBANK___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_DUALBANK___INIT___H #include "py/runtime.h" -extern void common_hal_ota_switch(void); -extern void common_hal_ota_finish(void); -extern void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset); +extern void common_hal_dualbank_switch(void); +extern void common_hal_dualbank_flash(const void *buf, const size_t len, const size_t offset); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DUALBANK___INIT___H From 6c4df5a8b45c6b20e00b5499c5db1d4f5da444a2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 18 Dec 2020 11:13:28 -0600 Subject: [PATCH 107/146] adafruit_bus_device: Don't transmit STOP condition in write_then_readinto Closes #3795 --- shared-bindings/adafruit_bus_device/I2CDevice.c | 8 ++++---- shared-bindings/adafruit_bus_device/I2CDevice.h | 2 +- shared-module/adafruit_bus_device/I2CDevice.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/I2CDevice.c index 4c9086162d..a4c04e198c 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/I2CDevice.c @@ -163,7 +163,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_readinto_obj, 2, //| """ //| ... //| -STATIC void write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { +STATIC void write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end, bool transmit_stop_bit) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); @@ -173,7 +173,7 @@ STATIC void write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, in mp_raise_ValueError(translate("Buffer must be at least length 1")); } - uint8_t status = common_hal_adafruit_bus_device_i2cdevice_write(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length); + uint8_t status = common_hal_adafruit_bus_device_i2cdevice_write(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length, transmit_stop_bit); if (status != 0) { mp_raise_OSError(status); } @@ -191,7 +191,7 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - write(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int); + write(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int, true); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_write_obj, 2, adafruit_bus_device_i2cdevice_write); @@ -233,7 +233,7 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write_then_readinto(size_t n_args, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - write(self, args[ARG_out_buffer].u_obj, args[ARG_out_start].u_int, args[ARG_out_end].u_int); + write(self, args[ARG_out_buffer].u_obj, args[ARG_out_start].u_int, args[ARG_out_end].u_int, false); readinto(self, args[ARG_in_buffer].u_obj, args[ARG_in_start].u_int, args[ARG_in_end].u_int); diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.h b/shared-bindings/adafruit_bus_device/I2CDevice.h index 7b2182ff03..cf7b1321a0 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.h +++ b/shared-bindings/adafruit_bus_device/I2CDevice.h @@ -45,7 +45,7 @@ extern const mp_obj_type_t adafruit_bus_device_i2cdevice_type; // Initializes the hardware peripheral. extern void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address); extern uint8_t common_hal_adafruit_bus_device_i2cdevice_readinto(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); -extern uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); +extern uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length, bool transmit_stop_bit); extern void common_hal_adafruit_bus_device_i2cdevice_lock(adafruit_bus_device_i2cdevice_obj_t *self); extern void common_hal_adafruit_bus_device_i2cdevice_unlock(adafruit_bus_device_i2cdevice_obj_t *self); extern void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_device_i2cdevice_obj_t *self); diff --git a/shared-module/adafruit_bus_device/I2CDevice.c b/shared-module/adafruit_bus_device/I2CDevice.c index ee4b4fa554..83abe80d64 100644 --- a/shared-module/adafruit_bus_device/I2CDevice.c +++ b/shared-module/adafruit_bus_device/I2CDevice.c @@ -57,8 +57,8 @@ uint8_t common_hal_adafruit_bus_device_i2cdevice_readinto(adafruit_bus_device_i2 return common_hal_busio_i2c_read(self->i2c, self->device_address, buffer, length); } -uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { - return common_hal_busio_i2c_write(self->i2c, self->device_address, buffer, length, true); +uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length, bool transmit_stop_bit) { + return common_hal_busio_i2c_write(self->i2c, self->device_address, buffer, length, transmit_stop_bit); } void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_device_i2cdevice_obj_t *self) { From 88b1e2fe61d68c4a4d2ef9e48147c20a929e779e Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Sun, 20 Dec 2020 13:35:15 -0600 Subject: [PATCH 108/146] remove Internal flash unnecessary --- ports/nrf/boards/bastble/mpconfigboard.mk | 2 -- ports/nrf/boards/bastble/pins.c | 1 - 2 files changed, 3 deletions(-) diff --git a/ports/nrf/boards/bastble/mpconfigboard.mk b/ports/nrf/boards/bastble/mpconfigboard.mk index 0e01c4d0f3..eca900de77 100644 --- a/ports/nrf/boards/bastble/mpconfigboard.mk +++ b/ports/nrf/boards/bastble/mpconfigboard.mk @@ -5,8 +5,6 @@ USB_MANUFACTURER = "ElectronicCats" MCU_CHIP = nrf52840 -INTERNAL_FLASH_FILESYSTEM = 1 - QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/nrf/boards/bastble/pins.c b/ports/nrf/boards/bastble/pins.c index 6e4cc511b0..b35dad43de 100644 --- a/ports/nrf/boards/bastble/pins.c +++ b/ports/nrf/boards/bastble/pins.c @@ -36,7 +36,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { // voltage sense battery { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_P0_26) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_10) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_09) }, From bd3c5c33fb0d49f420410e3a949a093d235db81c Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Sun, 20 Dec 2020 14:57:10 -0600 Subject: [PATCH 109/146] define QSPI pinout --- ports/nrf/boards/bastble/mpconfigboard.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ports/nrf/boards/bastble/mpconfigboard.h b/ports/nrf/boards/bastble/mpconfigboard.h index 67a62e915b..e36227c6bc 100644 --- a/ports/nrf/boards/bastble/mpconfigboard.h +++ b/ports/nrf/boards/bastble/mpconfigboard.h @@ -5,6 +5,15 @@ #define CIRCUITPY_AUTORELOAD_DELAY_MS 500 +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 30) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 29) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 28) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 2) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 3) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 26) +#endif + #define DEFAULT_I2C_BUS_SCL (&pin_P1_10) #define DEFAULT_I2C_BUS_SDA (&pin_P1_11) From 2e393ed1957dae806c8e98e68bbcb82f1fa1ffdb Mon Sep 17 00:00:00 2001 From: BennyE Date: Sun, 20 Dec 2020 22:03:38 +0100 Subject: [PATCH 110/146] adding debug infos --- ports/esp32s2/common-hal/wifi/Radio.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 49cb8ec30f..1a242da058 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -42,6 +42,10 @@ #define MAC_ADDRESS_LENGTH 6 +#include "components/log/include/esp_log.h" + +static const char* TAG = "wifi"; + static void start_station(wifi_radio_obj_t *self) { if (self->sta_mode) { return; @@ -194,6 +198,19 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { if (esp_wifi_sta_get_ap_info(&self->ap_info.record) != ESP_OK){ return mp_const_none; } else { + ESP_EARLY_LOGW(TAG, "ssid: %s", self->ap_info.record.ssid); + ESP_EARLY_LOGW(TAG, "channel: %d", self->ap_info.record.primary); + ESP_EARLY_LOGW(TAG, "secondary: %d", self->ap_info.record.second); + ESP_EARLY_LOGW(TAG, "rssi: %d", self->ap_info.record.rssi); + ESP_EARLY_LOGW(TAG, "authmode: %d", self->ap_info.record.authmode); + ESP_EARLY_LOGW(TAG, "pairwise_cipher: %d", self->ap_info.record.pairwise_cipher); + ESP_EARLY_LOGW(TAG, "group_cipher: %d", self->ap_info.record.group_cipher); + ESP_EARLY_LOGW(TAG, "11b: %d", self->ap_info.record.phy_11b); + ESP_EARLY_LOGW(TAG, "11g: %d", self->ap_info.record.phy_11g); + ESP_EARLY_LOGW(TAG, "11n: %d", self->ap_info.record.phy_11n); + ESP_EARLY_LOGW(TAG, "phy_lr: %d", self->ap_info.record.phy_lr); + ESP_EARLY_LOGW(TAG, "country: %s", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "countryCC: %s", self->ap_info.record.country.cc); memcpy(&ap_info->record, &self->ap_info.record, sizeof(wifi_ap_record_t)); return MP_OBJ_FROM_PTR(ap_info); } From d24a5d62700252a49152ed2bc6af0b9b3025344e Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Sun, 20 Dec 2020 15:52:19 -0600 Subject: [PATCH 111/146] update path board.h --- ports/nrf/boards/bastble/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/bastble/board.c b/ports/nrf/boards/bastble/board.c index 7c42cee57d..b6fb04f06c 100644 --- a/ports/nrf/boards/bastble/board.c +++ b/ports/nrf/boards/bastble/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "nrf.h" #include "nrf_rtc.h" From ae3b4408350e5623ef769a2860984d2d8937be59 Mon Sep 17 00:00:00 2001 From: BennyE Date: Tue, 22 Dec 2020 00:32:48 +0100 Subject: [PATCH 112/146] more fixes and still with debug --- ports/esp32s2/common-hal/wifi/Network.c | 3 +- ports/esp32s2/common-hal/wifi/Radio.c | 38 ++++++++++++++++++- .../esp32s2/common-hal/wifi/ScannedNetworks.c | 6 +++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index ab60b98f45..d134db057e 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -51,6 +51,7 @@ mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { const char* cstr = (const char*) self->record.country.cc; - return mp_obj_new_str(cstr, strlen(cstr)); + // We know that we only want the CC thus limiting to two chars + return mp_obj_new_str(cstr, 2); } diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 1a242da058..08d8bbcd50 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -198,6 +198,37 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { if (esp_wifi_sta_get_ap_info(&self->ap_info.record) != ESP_OK){ return mp_const_none; } else { + ESP_EARLY_LOGW(TAG, "country before handler country: %s", (char *)&self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "country memory at: %p", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "countryCC memory at: %p", self->ap_info.record.country.cc); + ESP_EARLY_LOGW(TAG, "countryCC strlen: %d", strlen(self->ap_info.record.country.cc)); + // The struct member appears to be (not NULL!), I don't know how to properly test for it. + // If the ESP-IDF starts working fine, this "if" wouldn't trigger. + // Note: It is possible that Wi-Fi APs don't have a CC set, then even after this workaround + // the element would remain empty. + if (strlen(self->ap_info.record.country.cc) == 0) { + // Workaround to fill country related information in ap_info until ESP-IDF carries a fix + // esp_wifi_sta_get_ap_info does not appear to fill wifi_country_t (e.g. country.cc) details + // (IDFGH-4437) #6267 + ESP_EARLY_LOGW(TAG, "Triggered missing country workaround"); + if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { + ESP_EARLY_LOGW(TAG, "Workaround worked fine!"); + ESP_EARLY_LOGW(TAG, "country: %d", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "CC: %s", self->ap_info.record.country.cc); + } else { + ESP_EARLY_LOGW(TAG, "Workaround failed!"); + } + //} else { + // ESP_EARLY_LOGW(TAG, "Triggered missing country workaround IN ELSE"); + // //memset(&self->ap_info.record.country, 0, sizeof(wifi_country_t)); + // if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { + // //if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { + // ESP_EARLY_LOGW(TAG, "Workaround worked fine!"); + // ESP_EARLY_LOGW(TAG, "CC: %s", self->ap_info.record.country.cc); + // } else { + // ESP_EARLY_LOGW(TAG, "Workaround failed!"); + // } + } ESP_EARLY_LOGW(TAG, "ssid: %s", self->ap_info.record.ssid); ESP_EARLY_LOGW(TAG, "channel: %d", self->ap_info.record.primary); ESP_EARLY_LOGW(TAG, "secondary: %d", self->ap_info.record.second); @@ -209,8 +240,13 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { ESP_EARLY_LOGW(TAG, "11g: %d", self->ap_info.record.phy_11g); ESP_EARLY_LOGW(TAG, "11n: %d", self->ap_info.record.phy_11n); ESP_EARLY_LOGW(TAG, "phy_lr: %d", self->ap_info.record.phy_lr); - ESP_EARLY_LOGW(TAG, "country: %s", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "ap_info.record: %s", self->ap_info.record); + ESP_EARLY_LOGW(TAG, "country with cast: %s", (char *)&self->ap_info.record.country); + //ESP_EARLY_LOGW(TAG, "country: %s", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "country memory at: %p", self->ap_info.record.country); ESP_EARLY_LOGW(TAG, "countryCC: %s", self->ap_info.record.country.cc); + ESP_EARLY_LOGW(TAG, "countryCC memory at: %p", self->ap_info.record.country.cc); + ESP_EARLY_LOGW(TAG, "countryCC strlen: %d", strlen(self->ap_info.record.country.cc)); memcpy(&ap_info->record, &self->ap_info.record, sizeof(wifi_ap_record_t)); return MP_OBJ_FROM_PTR(ap_info); } diff --git a/ports/esp32s2/common-hal/wifi/ScannedNetworks.c b/ports/esp32s2/common-hal/wifi/ScannedNetworks.c index cc733308db..0540ffc5cc 100644 --- a/ports/esp32s2/common-hal/wifi/ScannedNetworks.c +++ b/ports/esp32s2/common-hal/wifi/ScannedNetworks.c @@ -39,6 +39,10 @@ #include "components/esp_wifi/include/esp_wifi.h" +#include "components/log/include/esp_log.h" + +static const char* TAG = "wifi"; + static void wifi_scannednetworks_done(wifi_scannednetworks_obj_t *self) { self->done = true; if (self->results != NULL) { @@ -117,6 +121,8 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) wifi_network_obj_t *entry = m_new_obj(wifi_network_obj_t); entry->base.type = &wifi_network_type; + // benny remove again + ESP_EARLY_LOGW(TAG, "scan country: %s", &self->results[self->current_result].country); memcpy(&entry->record, &self->results[self->current_result], sizeof(wifi_ap_record_t)); self->current_result++; From 3b4c14f3ec8b36a00a7eeba562baa7647b82f2e2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 21 Dec 2020 20:43:46 -0500 Subject: [PATCH 113/146] unmounted filesystems start as ejected --- supervisor/shared/usb/usb_msc_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c index b39f60dcd2..7532b6aead 100644 --- a/supervisor/shared/usb/usb_msc_flash.c +++ b/supervisor/shared/usb/usb_msc_flash.c @@ -39,7 +39,7 @@ #define MSC_FLASH_BLOCK_SIZE 512 -static bool ejected[1] = {false}; +static bool ejected[1] = {true}; void usb_msc_mount(void) { // Reset the ejection tracking every time we're plugged into USB. This allows for us to battery From aa1f0e93ba8fddc358a52c38389f41a9640d6271 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 22 Dec 2020 03:46:23 +0100 Subject: [PATCH 114/146] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 12 ++++++++++++ locale/cs.po | 12 ++++++++++++ locale/de_DE.po | 12 ++++++++++++ locale/el.po | 12 ++++++++++++ locale/es.po | 12 ++++++++++++ locale/fil.po | 12 ++++++++++++ locale/fr.po | 12 ++++++++++++ locale/hi.po | 12 ++++++++++++ locale/it_IT.po | 12 ++++++++++++ locale/ja.po | 12 ++++++++++++ locale/ko.po | 12 ++++++++++++ locale/nl.po | 12 ++++++++++++ locale/pl.po | 12 ++++++++++++ locale/pt_BR.po | 12 ++++++++++++ locale/sv.po | 12 ++++++++++++ locale/zh_Latn_pinyin.po | 12 ++++++++++++ 16 files changed, 192 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index dd9693f536..150a92c04a 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -954,6 +954,10 @@ msgstr "File sudah ada" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -2021,6 +2025,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3256,6 +3264,10 @@ msgstr "panjang data string memiliki keganjilan (odd-length)" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" diff --git a/locale/cs.po b/locale/cs.po index e178a3fd5b..39e5a50cf3 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -940,6 +940,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1987,6 +1991,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3215,6 +3223,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 85b3b90a06..95ff26aeec 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -951,6 +951,10 @@ msgstr "Datei existiert" msgid "Filters too complex" msgstr "Filter zu komplex" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Format nicht unterstützt" @@ -2033,6 +2037,10 @@ msgstr "Nicht unterstützte Operation" msgid "Unsupported pull value." msgstr "Nicht unterstützter Pull-Wert." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3292,6 +3300,10 @@ msgstr "String mit ungerader Länge" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset außerhalb der Grenzen" diff --git a/locale/el.po b/locale/el.po index 1a835fd424..e1b44d2916 100644 --- a/locale/el.po +++ b/locale/el.po @@ -935,6 +935,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1982,6 +1986,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3210,6 +3218,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/es.po b/locale/es.po index 27b1756571..c335d0f396 100644 --- a/locale/es.po +++ b/locale/es.po @@ -955,6 +955,10 @@ msgstr "El archivo ya existe" msgid "Filters too complex" msgstr "Filtros muy complejos" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Sin capacidades para el formato" @@ -2036,6 +2040,10 @@ msgstr "Operación no soportada" msgid "Unsupported pull value." msgstr "valor pull no soportado." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3286,6 +3294,10 @@ msgstr "string de longitud impar" msgid "offset is too large" msgstr "offset es demasiado grande" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset fuera de límites" diff --git a/locale/fil.po b/locale/fil.po index e55fc5e2cc..067dfc4d79 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -948,6 +948,10 @@ msgstr "Mayroong file" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -2004,6 +2008,10 @@ msgstr "Hindi sinusuportahang operasyon" msgid "Unsupported pull value." msgstr "Hindi suportado ang pull value." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3257,6 +3265,10 @@ msgstr "odd-length string" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" diff --git a/locale/fr.po b/locale/fr.po index eef3132739..3836da812e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -960,6 +960,10 @@ msgstr "Le fichier existe" msgid "Filters too complex" msgstr "Filtre trop complexe" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Format non supporté" @@ -2045,6 +2049,10 @@ msgstr "Opération non supportée" msgid "Unsupported pull value." msgstr "Valeur de tirage 'pull' non supportée." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3305,6 +3313,10 @@ msgstr "chaîne de longueur impaire" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "décalage hors limites" diff --git a/locale/hi.po b/locale/hi.po index 51b751c82a..7d90c65dc0 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -935,6 +935,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1982,6 +1986,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3210,6 +3218,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 80dabb6256..b14acaf9e4 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -948,6 +948,10 @@ msgstr "File esistente" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -2016,6 +2020,10 @@ msgstr "Operazione non supportata" msgid "Unsupported pull value." msgstr "Valore di pull non supportato." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3263,6 +3271,10 @@ msgstr "stringa di lunghezza dispari" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" diff --git a/locale/ja.po b/locale/ja.po index 226a8e179b..0bd6504b9b 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -948,6 +948,10 @@ msgstr "ファイルが存在します" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "非対応の形式" @@ -2007,6 +2011,10 @@ msgstr "非対応の操作" msgid "Unsupported pull value." msgstr "非対応のpull値" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3240,6 +3248,10 @@ msgstr "奇数長の文字列" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 456cb47e65..e307955362 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -940,6 +940,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1988,6 +1992,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3216,6 +3224,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 63ff70716f..bbd732cb5c 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -948,6 +948,10 @@ msgstr "Bestand bestaat" msgid "Filters too complex" msgstr "Filters zijn te complex" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Formaat wordt niet ondersteund" @@ -2027,6 +2031,10 @@ msgstr "Niet-ondersteunde operatie" msgid "Unsupported pull value." msgstr "Niet-ondersteunde pull-waarde." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3272,6 +3280,10 @@ msgstr "string met oneven lengte" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset buiten bereik" diff --git a/locale/pl.po b/locale/pl.po index 718bf50f42..380dedd606 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -948,6 +948,10 @@ msgstr "Plik istnieje" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Nie wspierany format" @@ -1998,6 +2002,10 @@ msgstr "Zła operacja" msgid "Unsupported pull value." msgstr "Zła wartość podciągnięcia." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3233,6 +3241,10 @@ msgstr "łańcuch o nieparzystej długości" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset poza zakresem" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 8d3d54fabc..4a1674e493 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -957,6 +957,10 @@ msgstr "Arquivo já existe" msgid "Filters too complex" msgstr "Os filtros são muito complexos" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "O formato não é suportado" @@ -2045,6 +2049,10 @@ msgstr "Operação não suportada" msgid "Unsupported pull value." msgstr "O valor pull não é compatível." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3297,6 +3305,10 @@ msgstr "sequência com comprimento ímpar" msgid "offset is too large" msgstr "o offset é muito grande" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "desvio fora dos limites" diff --git a/locale/sv.po b/locale/sv.po index a608866e3b..26eb19cbb1 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -948,6 +948,10 @@ msgstr "Filen finns redan" msgid "Filters too complex" msgstr "Filter för komplexa" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Formatet stöds inte" @@ -2024,6 +2028,10 @@ msgstr "Åtgärd som inte stöds" msgid "Unsupported pull value." msgstr "Ogiltigt Pull-värde." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3266,6 +3274,10 @@ msgstr "sträng har udda längd" msgid "offset is too large" msgstr "offset är för stor" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset utanför gränserna" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 1cbcc709ff..3106151d46 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -946,6 +946,10 @@ msgstr "Wénjiàn cúnzài" msgid "Filters too complex" msgstr "guò lǜ qì tài fù zá" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Bù zhīyuán géshì" @@ -2016,6 +2020,10 @@ msgstr "Bù zhīchí de cāozuò" msgid "Unsupported pull value." msgstr "Bù zhīchí de lādòng zhí." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3257,6 +3265,10 @@ msgstr "jīshù zìfú chuàn" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "piānlí biānjiè" From 39ca406a31f630f9e169ab18ce2fa223aa60077a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 21 Dec 2020 23:32:11 -0500 Subject: [PATCH 115/146] Add Adafruit to MICROPY_HW_BOARD_NAME for various boards --- .../boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h | 2 +- ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h | 2 +- ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h | 2 +- ports/stm/boards/feather_stm32f405_express/mpconfigboard.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h index be376e5a94..8dfe912712 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h @@ -26,7 +26,7 @@ //Micropython setup -#define MICROPY_HW_BOARD_NAME "MagTag" +#define MICROPY_HW_BOARD_NAME "Adafruit MagTag" #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h b/ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h index 7280aab9c2..b25d7d1169 100644 --- a/ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h @@ -26,7 +26,7 @@ //Micropython setup -#define MICROPY_HW_BOARD_NAME "Metro ESP32S2" +#define MICROPY_HW_BOARD_NAME "Adafruit Metro ESP32S2" #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h b/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h index e96ec13dd9..e027e2b5ee 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h +++ b/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h @@ -1,4 +1,4 @@ -#define MICROPY_HW_BOARD_NAME "Feather MIMXRT1011" +#define MICROPY_HW_BOARD_NAME "Adafruit Feather MIMXRT1011" #define MICROPY_HW_MCU_NAME "IMXRT1011DAE5A" #define MICROPY_HW_NEOPIXEL (&pin_GPIO_00) diff --git a/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h index 0d49748c84..e69be6cf95 100644 --- a/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h +++ b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h @@ -26,7 +26,7 @@ //Micropython setup -#define MICROPY_HW_BOARD_NAME "Feather STM32F405 Express" +#define MICROPY_HW_BOARD_NAME "Adafruit Feather STM32F405 Express" #define MICROPY_HW_MCU_NAME "STM32F405RG" #define FLASH_SIZE (0x100000) From 17e7973ff2028536034c8c8898044ac93fa10b51 Mon Sep 17 00:00:00 2001 From: Jonathan Giles Date: Mon, 21 Dec 2020 08:38:37 -0500 Subject: [PATCH 116/146] Add support for Winbond W25Q64FV --- supervisor/shared/external_flash/devices.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index 466ab49eb8..be18647953 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -363,6 +363,24 @@ typedef struct { .write_status_register_split = false, \ } +// Settings for the Winbond W25Q64FV 8MiB SPI flash. +// Datasheet: https://www.winbond.com/resource-files/w25q64fv%20revs%2007182017.pdf +#define W25Q64FV {\ + .total_size = (1 << 23), /* 8 MiB */ \ + .start_up_time_us = 5000, \ + .manufacturer_id = 0xef, \ + .memory_type = 0x40, \ + .capacity = 0x17, \ + .max_clock_speed_mhz = 104, \ + .quad_enable_bit_mask = 0x02, \ + .has_sector_protection = false, \ + .supports_fast_read = true, \ + .supports_qspi = true, \ + .supports_qspi_writes = true, \ + .write_status_register_split = false, \ + .single_status_byte = false, \ +} + // Settings for the Winbond W25Q64JV-IM 8MiB SPI flash. Note that JV-IQ has a different .memory_type (0x40) // Datasheet: http://www.winbond.com/resource-files/w25q64jv%20revj%2003272018%20plus.pdf #define W25Q64JV_IM {\ From aaa3c61819bc0c819df88df00d6fe8b52d677356 Mon Sep 17 00:00:00 2001 From: Jonathan Giles Date: Tue, 22 Dec 2020 09:07:50 -0500 Subject: [PATCH 117/146] Add default I2C pins for STM32F411CE --- ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h | 3 +++ ports/stm/boards/stm32f411ce_blackpill/pins.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h index 83a8bded39..4351339540 100644 --- a/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h +++ b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h @@ -42,6 +42,9 @@ // #define SPI_FLASH_SCK_PIN (&pin_PA05) // #define SPI_FLASH_CS_PIN (&pin_PA04) +#define DEFAULT_I2C_BUS_SCL (&pin_PB06) +#define DEFAULT_I2C_BUS_SDA (&pin_PB07) + #define CIRCUITPY_AUTORELOAD_DELAY_MS (500) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000) diff --git a/ports/stm/boards/stm32f411ce_blackpill/pins.c b/ports/stm/boards/stm32f411ce_blackpill/pins.c index 2f8aab6e8e..16946b8bee 100644 --- a/ports/stm/boards/stm32f411ce_blackpill/pins.c +++ b/ports/stm/boards/stm32f411ce_blackpill/pins.c @@ -35,5 +35,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_C14), MP_ROM_PTR(&pin_PC14) }, { MP_ROM_QSTR(MP_QSTR_C13), MP_ROM_PTR(&pin_PC13) }, { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PC13) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From d4e9eea397c887d9eceb5f4c6aba117a4dc3d03b Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 22 Dec 2020 10:06:43 -0500 Subject: [PATCH 118/146] mark alarm.wake_alarm during gc sweep --- main.c | 4 ++++ ports/esp32s2/common-hal/alarm/__init__.c | 8 ++++++-- shared-bindings/alarm/__init__.c | 13 ++++++++++++- shared-bindings/alarm/__init__.h | 8 ++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index d940f93d18..27ed6ff116 100755 --- a/main.c +++ b/main.c @@ -613,6 +613,10 @@ void gc_collect(void) { background_callback_gc_collect(); + #if CIRCUITPY_ALARM + common_hal_alarm_gc_collect(); + #endif + #if CIRCUITPY_DISPLAYIO displayio_gc_collect(); #endif diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 5d1f3e95d4..9f19f1afc4 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -25,10 +25,12 @@ * THE SOFTWARE. */ +#include "py/gc.h" #include "py/obj.h" #include "py/objtuple.h" #include "py/runtime.h" +#include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/SleepMemory.h" #include "shared-bindings/alarm/time/TimeAlarm.h" @@ -38,8 +40,6 @@ #include "supervisor/port.h" #include "supervisor/shared/workflow.h" -#include "common-hal/alarm/__init__.h" - #include "esp_sleep.h" #include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" @@ -159,3 +159,7 @@ void NORETURN alarm_enter_deep_sleep(void) { // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); } + +void common_hal_alarm_gc_collect(void) { + gc_collect_ptr(alarm_get_wake_alarm()); +} diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 700fe020ea..778674f6d5 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -199,7 +199,18 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SleepMemory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_type) }, { MP_ROM_QSTR(MP_QSTR_sleep_memory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_obj) }, }; -STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); +MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); + +// Fetch value from module dict. +mp_obj_t alarm_get_wake_alarm(void) { + mp_map_elem_t *elem = + mp_map_lookup(&alarm_module_globals.map, MP_ROM_QSTR(MP_QSTR_wake_alarm), MP_MAP_LOOKUP); + if (elem) { + return elem->value; + } else { + return NULL; + } +} STATIC void alarm_set_wake_alarm(mp_obj_t alarm) { // Equivalent of: diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 8c4b6cad96..a90405da6b 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -31,6 +31,9 @@ #include "common-hal/alarm/__init__.h" +// Make module dict available elsewhere, so we can fetch +extern mp_obj_dict_t alarm_module_globals; + extern mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); // Deep sleep is a two step process. Alarms are set when the VM is valid but @@ -43,6 +46,10 @@ extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj // Deep sleep is entered outside of the VM so we omit the `common_hal_` prefix. extern NORETURN void alarm_enter_deep_sleep(void); +// Fetches value from module dict. +extern mp_obj_t alarm_get_wake_alarm(void); + +extern void common_hal_alarm_gc_collect(void); extern mp_obj_t common_hal_alarm_get_wake_alarm(void); // Used by wake-up code. @@ -52,4 +59,5 @@ void alarm_save_wakeup_alarm(void); // True if an alarm is alerting. This is most useful for pretend deep sleep. extern bool alarm_woken_from_sleep(void); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H From da8f02366544d3a9fd5553c52f592a5fa7d74305 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Dec 2020 10:27:42 -0600 Subject: [PATCH 119/146] esp32s2: make flash: use the stub Very long ago, this was apparently not supported in esptool yet, at least when operating over USB CDC. This now works just fine, and our esp webtool relies on it as well. It makes flashing faster, too. --- ports/esp32s2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 35f82dd8a1..4334e6b10e 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -338,10 +338,10 @@ $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ flash: $(BUILD)/firmware.bin - esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x0000 $^ + esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x0000 $^ flash-circuitpython-only: $(BUILD)/circuitpython-firmware.bin - esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x10000 $^ + esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x10000 $^ include $(TOP)/py/mkrules.mk From 4db2d692e394c4f79da2d2b8b840dfac8276782d Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 22 Dec 2020 15:43:26 +0000 Subject: [PATCH 120/146] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (882 of 882 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 4a1674e493..9918acc4d0 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-14 12:59-0500\n" -"PO-Revision-Date: 2020-12-16 17:00+0000\n" +"PO-Revision-Date: 2020-12-22 18:07+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -959,7 +959,7 @@ msgstr "Os filtros são muito complexos" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "A imagem do firmware é invalida" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -2051,7 +2051,7 @@ msgstr "O valor pull não é compatível." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "A atualização falou" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3307,7 +3307,7 @@ msgstr "o offset é muito grande" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "o offset deve ser >= 0" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" From 89079039adadac7c73fe03892ac2114dcc567429 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 22 Dec 2020 18:54:42 -0500 Subject: [PATCH 121/146] FrequencyIn: do not raise in interrupt handler --- ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c b/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c index 02d0482dca..f973db90b0 100644 --- a/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +++ b/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c @@ -82,7 +82,8 @@ void frequencyin_emergency_cancel_capture(uint8_t index) { #ifdef SAM_D5X_E5X NVIC_EnableIRQ(EIC_0_IRQn + self->channel); #endif - mp_raise_RuntimeError(translate("Frequency captured is above capability. Capture Paused.")); + // Frequency captured is above capability. Capture paused. + // We can't raise an error here; we're in an interrupt handler. } void frequencyin_interrupt_handler(uint8_t index) { From 1fca297a2d2bfefb1cdef3ecbac05f54d15e08eb Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 22 Dec 2020 16:13:02 -0800 Subject: [PATCH 122/146] A couple sleep fixes * Better messaging when code is stopped by an auto-reload. * Auto-reload works during sleeps on ESP32-S2. Ticks wake up the main task each time. * Made internal naming consistent. CamelCase Python names are NOT separated by an underscore. --- main.c | 9 ++- ports/esp32s2/common-hal/alarm/__init__.c | 31 ++++------ ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 60 +++++++++---------- ports/esp32s2/common-hal/alarm/pin/PinAlarm.h | 12 ++-- .../esp32s2/common-hal/alarm/time/TimeAlarm.c | 26 ++++---- .../esp32s2/common-hal/alarm/time/TimeAlarm.h | 2 +- ports/esp32s2/supervisor/port.c | 28 +++++---- py/obj.c | 2 + shared-bindings/alarm/__init__.c | 10 ++-- shared-bindings/alarm/__init__.h | 3 - shared-bindings/alarm/pin/PinAlarm.c | 46 +++++++------- shared-bindings/alarm/pin/PinAlarm.h | 18 +++--- shared-bindings/alarm/time/TimeAlarm.c | 32 +++++----- shared-bindings/alarm/time/TimeAlarm.h | 12 ++-- 14 files changed, 142 insertions(+), 149 deletions(-) diff --git a/main.c b/main.c index 27ed6ff116..9c4055a287 100755 --- a/main.c +++ b/main.c @@ -308,8 +308,11 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { return reload_requested; } - // Display a different completion message if the user has no USB attached (cannot save files) - serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); + if (reload_requested && result.return_code == PYEXEC_EXCEPTION) { + serial_write_compressed(translate("\nCode stopped by auto-reload.\n")); + } else { + serial_write_compressed(translate("\nCode done running.\n")); + } } // Program has finished running. @@ -407,7 +410,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { alarm_enter_deep_sleep(); // Does not return. } else { - serial_write_compressed(translate("Pretending to deep sleep until alarm, any key or file write.\n")); + serial_write_compressed(translate("Pretending to deep sleep until alarm, CTRL-C or file write.\n")); } } } diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 9f19f1afc4..f2686cf184 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -54,7 +54,7 @@ const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { void alarm_reset(void) { alarm_time_timealarm_reset(); - alarm_pin_pin_alarm_reset(); + alarm_pin_pinalarm_reset(); alarm_sleep_memory_reset(); esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } @@ -63,7 +63,7 @@ STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(void) { if (alarm_time_timealarm_woke_us_up()) { return ESP_SLEEP_WAKEUP_TIMER; } - if (alarm_pin_pin_alarm_woke_us_up()) { + if (alarm_pin_pinalarm_woke_us_up()) { return ESP_SLEEP_WAKEUP_GPIO; } @@ -84,7 +84,7 @@ STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { case ESP_SLEEP_WAKEUP_GPIO: case ESP_SLEEP_WAKEUP_EXT0: case ESP_SLEEP_WAKEUP_EXT1: { - return alarm_pin_pin_alarm_get_wakeup_alarm(n_alarms, alarms); + return alarm_pin_pinalarm_get_wakeup_alarm(n_alarms, alarms); } case ESP_SLEEP_WAKEUP_TOUCHPAD: @@ -106,7 +106,7 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { // Set up light sleep or deep sleep alarms. STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { - alarm_pin_pin_alarm_set_alarms(deep_sleep, n_alarms, alarms); + alarm_pin_pinalarm_set_alarms(deep_sleep, n_alarms, alarms); alarm_time_timealarm_set_alarms(deep_sleep, n_alarms, alarms); } @@ -123,25 +123,14 @@ STATIC void _idle_until_alarm(void) { } } -// Is it safe to do a light sleep? Check whether WiFi is on or there are -// other ongoing tasks that should not be shut down. -STATIC bool _light_sleep_ok(void) { - int64_t connecting_delay_ticks = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - port_get_raw_ticks(NULL); - return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj) && - !supervisor_workflow_active() && - connecting_delay_ticks <= 0; -} - mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { _setup_sleep_alarms(false, n_alarms, alarms); - // Light sleep can break some functionality so only do it when possible. Otherwise we idle. - if (_light_sleep_ok()) { - // Flush the UART to complete the log line. - uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM); - esp_light_sleep_start(); - } else { - _idle_until_alarm(); + // We cannot esp_light_sleep_start() here because it shuts down all non-RTC peripherals. + _idle_until_alarm(); + + if (mp_hal_is_interrupted()) { + return mp_const_none; // Shouldn't be given to python code because exception handling should kick in. } mp_obj_t wake_alarm = _get_wake_alarm(n_alarms, alarms); @@ -154,7 +143,7 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala } void NORETURN alarm_enter_deep_sleep(void) { - alarm_pin_pin_alarm_prepare_for_deep_sleep(); + alarm_pin_pinalarm_prepare_for_deep_sleep(); // The ESP-IDF caches the deep sleep settings and applies them before sleep. // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index 01e2faeb87..df8d10ef9e 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -38,7 +38,7 @@ #include "components/soc/src/esp32s2/include/hal/gpio_ll.h" #include "components/xtensa/include/esp_debug_helpers.h" -void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { +void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { if (edge) { mp_raise_ValueError(translate("Cannot wake on pin edge. Only level.")); } @@ -51,41 +51,41 @@ void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, m self->pull = pull; } -mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self) { +mcu_pin_obj_t *common_hal_alarm_pin_pinalarm_get_pin(alarm_pin_pinalarm_obj_t *self) { return self->pin; } -bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self) { +bool common_hal_alarm_pin_pinalarm_get_value(alarm_pin_pinalarm_obj_t *self) { return self->value; } -bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self) { +bool common_hal_alarm_pin_pinalarm_get_edge(alarm_pin_pinalarm_obj_t *self) { return false; } -bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self) { +bool common_hal_alarm_pin_pinalarm_get_pull(alarm_pin_pinalarm_obj_t *self) { return self->pull; } gpio_isr_handle_t gpio_interrupt_handle; // Low and high are relative to pin number. 32+ is high. <32 is low. -static volatile uint32_t low_pin_status = 0; -static volatile uint32_t high_pin_status = 0; +static volatile uint32_t pin_31_0_status = 0; +static volatile uint32_t pin_63_32_status = 0; void gpio_interrupt(void *arg) { (void) arg; - gpio_ll_get_intr_status(&GPIO, xPortGetCoreID(), (uint32_t*) &low_pin_status); - gpio_ll_clear_intr_status(&GPIO, low_pin_status); - gpio_ll_get_intr_status_high(&GPIO, xPortGetCoreID(), (uint32_t*) &high_pin_status); - gpio_ll_clear_intr_status_high(&GPIO, high_pin_status); + gpio_ll_get_intr_status(&GPIO, xPortGetCoreID(), (uint32_t*) &pin_31_0_status); + gpio_ll_clear_intr_status(&GPIO, pin_31_0_status); + gpio_ll_get_intr_status_high(&GPIO, xPortGetCoreID(), (uint32_t*) &pin_63_32_status); + gpio_ll_clear_intr_status_high(&GPIO, pin_63_32_status); // disable the interrupts that fired, maybe all of them for (size_t i = 0; i < 32; i++) { uint32_t mask = 1 << i; - if ((low_pin_status & mask) != 0) { + if ((pin_31_0_status & mask) != 0) { gpio_ll_intr_disable(&GPIO, i); } - if ((high_pin_status & mask) != 0) { + if ((pin_63_32_status & mask) != 0) { gpio_ll_intr_disable(&GPIO, 32 + i); } } @@ -96,18 +96,18 @@ void gpio_interrupt(void *arg) { } } -bool alarm_pin_pin_alarm_woke_us_up(void) { - return low_pin_status != 0 || high_pin_status != 0; +bool alarm_pin_pinalarm_woke_us_up(void) { + return pin_31_0_status != 0 || pin_63_32_status != 0; } -mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { +mp_obj_t alarm_pin_pinalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { // First, check to see if we match any given alarms. - uint64_t pin_status = ((uint64_t) high_pin_status) << 32 | low_pin_status; + uint64_t pin_status = ((uint64_t) pin_63_32_status) << 32 | pin_31_0_status; for (size_t i = 0; i < n_alarms; i++) { - if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pinalarm_type)) { continue; } - alarm_pin_pin_alarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); + alarm_pin_pinalarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); if ((pin_status & (1ull << alarm->pin->number)) != 0) { return alarms[i]; } @@ -131,8 +131,8 @@ mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *a } } - alarm_pin_pin_alarm_obj_t *alarm = m_new_obj(alarm_pin_pin_alarm_obj_t); - alarm->base.type = &alarm_pin_pin_alarm_type; + alarm_pin_pinalarm_obj_t *alarm = m_new_obj(alarm_pin_pinalarm_obj_t); + alarm->base.type = &alarm_pin_pinalarm_type; alarm->pin = NULL; // Map the pin number back to a pin object. for (size_t i = 0; i < mcu_pin_globals.map.used; i++) { @@ -151,7 +151,7 @@ static uint64_t high_alarms = 0; static uint64_t low_alarms = 0; static uint64_t pull_pins = 0; -void alarm_pin_pin_alarm_reset(void) { +void alarm_pin_pinalarm_reset(void) { if (gpio_interrupt_handle != NULL) { esp_intr_free(gpio_interrupt_handle); gpio_interrupt_handle = NULL; @@ -168,21 +168,21 @@ void alarm_pin_pin_alarm_reset(void) { high_alarms = 0; low_alarms = 0; pull_pins = 0; - high_pin_status = 0; - low_pin_status = 0; + pin_63_32_status = 0; + pin_31_0_status = 0; } -void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { +void alarm_pin_pinalarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { // Bitmask of wake up settings. size_t high_count = 0; size_t low_count = 0; for (size_t i = 0; i < n_alarms; i++) { // TODO: Check for ULP or touch alarms because they can't coexist with GPIO alarms. - if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pinalarm_type)) { continue; } - alarm_pin_pin_alarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); + alarm_pin_pinalarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); gpio_num_t pin_number = alarm->pin->number; if (alarm->value) { @@ -239,8 +239,8 @@ void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_o } // Set GPIO interrupts so they wake us from light sleep or from idle via the // interrupt handler above. - low_pin_status = 0; - high_pin_status = 0; + pin_31_0_status = 0; + pin_63_32_status = 0; if (gpio_isr_register(gpio_interrupt, NULL, 0, &gpio_interrupt_handle) != ESP_OK) { mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); } @@ -282,7 +282,7 @@ void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_o } -void alarm_pin_pin_alarm_prepare_for_deep_sleep(void) { +void alarm_pin_pinalarm_prepare_for_deep_sleep(void) { if (pull_pins == 0) { return; } diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h index 8b14931cab..93672c1f2d 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h @@ -32,10 +32,10 @@ typedef struct { mcu_pin_obj_t *pin; bool value; bool pull; -} alarm_pin_pin_alarm_obj_t; +} alarm_pin_pinalarm_obj_t; -void alarm_pin_pin_alarm_reset(void); -void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms); -void alarm_pin_pin_alarm_prepare_for_deep_sleep(void); -mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); -bool alarm_pin_pin_alarm_woke_us_up(void); +void alarm_pin_pinalarm_reset(void); +void alarm_pin_pinalarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms); +void alarm_pin_pinalarm_prepare_for_deep_sleep(void); +mp_obj_t alarm_pin_pinalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); +bool alarm_pin_pinalarm_woke_us_up(void); diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index a7abde6a4e..bcde0ab3c0 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -34,23 +34,23 @@ #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/time/__init__.h" -void common_hal_alarm_time_time_alarm_construct(alarm_time_time_alarm_obj_t *self, mp_float_t monotonic_time) { +void common_hal_alarm_time_timealarm_construct(alarm_time_timealarm_obj_t *self, mp_float_t monotonic_time) { self->monotonic_time = monotonic_time; } -mp_float_t common_hal_alarm_time_time_alarm_get_monotonic_time(alarm_time_time_alarm_obj_t *self) { +mp_float_t common_hal_alarm_time_timealarm_get_monotonic_time(alarm_time_timealarm_obj_t *self) { return self->monotonic_time; } mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { // First, check to see if we match for (size_t i = 0; i < n_alarms; i++) { - if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_timealarm_type)) { return alarms[i]; } } - alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); - timer->base.type = &alarm_time_time_alarm_type; + alarm_time_timealarm_obj_t *timer = m_new_obj(alarm_time_timealarm_obj_t); + timer->base.type = &alarm_time_timealarm_type; // TODO: Set monotonic_time based on the RTC state. timer->monotonic_time = 0.0f; return timer; @@ -78,20 +78,20 @@ void alarm_time_timealarm_reset(void) { } void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { - bool time_alarm_set = false; - alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; + bool timealarm_set = false; + alarm_time_timealarm_obj_t *timealarm = MP_OBJ_NULL; for (size_t i = 0; i < n_alarms; i++) { - if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_time_timealarm_type)) { continue; } - if (time_alarm_set) { + if (timealarm_set) { mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); } - time_alarm = MP_OBJ_TO_PTR(alarms[i]); - time_alarm_set = true; + timealarm = MP_OBJ_TO_PTR(alarms[i]); + timealarm_set = true; } - if (!time_alarm_set) { + if (!timealarm_set) { return; } @@ -109,7 +109,7 @@ void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_ // Compute how long to actually sleep, considering the time now. mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; - mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); + mp_float_t wakeup_in_secs = MAX(0.0f, timealarm->monotonic_time - now_secs); const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); esp_sleep_enable_timer_wakeup(sleep_for_us); diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h index 277ababc20..dfd75524fd 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h @@ -30,7 +30,7 @@ typedef struct { mp_obj_base_t base; mp_float_t monotonic_time; // values compatible with time.monotonic_time() -} alarm_time_time_alarm_obj_t; +} alarm_time_timealarm_obj_t; // Find the alarm object that caused us to wake up or create an equivalent one. mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 8a87180cd9..17a413a2ed 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -74,6 +74,10 @@ extern void esp_restart(void) NORETURN; void tick_timer_cb(void* arg) { supervisor_tick(); + + // CircuitPython's VM is run in a separate FreeRTOS task from timer callbacks. So, we have to + // notify the main task every time in case it's waiting for us. + xTaskNotifyGive(circuitpython_task); } void sleep_timer_cb(void* arg); @@ -92,6 +96,8 @@ safe_mode_t port_init(void) { args.name = "CircuitPython Sleep"; esp_timer_create(&args, &_sleep_timer); + circuitpython_task = xTaskGetCurrentTaskHandle(); + // Send the ROM output out of the UART. This includes early logs. #ifdef DEBUG ets_install_uart_printf(); @@ -114,16 +120,16 @@ safe_mode_t port_init(void) { } esp_reset_reason_t reason = esp_reset_reason(); - if (reason == ESP_RST_BROWNOUT) { - return BROWNOUT; + switch (reason) { + case ESP_RST_BROWNOUT: + return BROWNOUT; + case ESP_RST_PANIC: + case ESP_RST_INT_WDT: + case ESP_RST_WDT: + return HARD_CRASH; + default: + break; } - if (reason == ESP_RST_PANIC || - reason == ESP_RST_INT_WDT || - reason == ESP_RST_WDT) { - return HARD_CRASH; - } - - circuitpython_task = xTaskGetCurrentTaskHandle(); return NO_SAFE_MODE; } @@ -262,10 +268,6 @@ void port_enable_tick(void) { // Disable 1/1024 second tick. void port_disable_tick(void) { esp_timer_stop(_tick_timer); - - // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. - // Tick disable can happen via auto-reload so poke the main task here. - xTaskNotifyGive(circuitpython_task); } void sleep_timer_cb(void* arg) { diff --git a/py/obj.c b/py/obj.c index 218fb43213..5f19089e85 100644 --- a/py/obj.c +++ b/py/obj.c @@ -68,10 +68,12 @@ void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t #ifdef RUN_BACKGROUND_TASKS RUN_BACKGROUND_TASKS; #endif + #if MICROPY_KBD_EXCEPTION // Stop printing if we've been interrupted. if (mp_hal_is_interrupted()) { return; } + #endif #ifndef NDEBUG if (o_in == MP_OBJ_NULL) { diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 778674f6d5..dc5309353b 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -71,8 +71,8 @@ void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { for (size_t i = 0; i < n_args; i++) { - if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pin_alarm_type) || - MP_OBJ_IS_TYPE(objs[i], &alarm_time_time_alarm_type)) { + if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pinalarm_type) || + MP_OBJ_IS_TYPE(objs[i], &alarm_time_timealarm_type)) { continue; } mp_raise_TypeError_varg(translate("Expected an alarm")); @@ -159,7 +159,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_exit_and_deep_sleep_until_alarms_obj, STATIC const mp_map_elem_t alarm_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pin) }, - { MP_ROM_QSTR(MP_QSTR_PinAlarm), MP_OBJ_FROM_PTR(&alarm_pin_pin_alarm_type) }, + { MP_ROM_QSTR(MP_QSTR_PinAlarm), MP_OBJ_FROM_PTR(&alarm_pin_pinalarm_type) }, }; STATIC MP_DEFINE_CONST_DICT(alarm_pin_globals, alarm_pin_globals_table); @@ -172,7 +172,7 @@ STATIC const mp_obj_module_t alarm_pin_module = { STATIC const mp_map_elem_t alarm_time_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) }, - { MP_ROM_QSTR(MP_QSTR_TimeAlarm), MP_OBJ_FROM_PTR(&alarm_time_time_alarm_type) }, + { MP_ROM_QSTR(MP_QSTR_TimeAlarm), MP_OBJ_FROM_PTR(&alarm_time_timealarm_type) }, }; STATIC MP_DEFINE_CONST_DICT(alarm_time_globals, alarm_time_globals_table); @@ -199,7 +199,7 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SleepMemory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_type) }, { MP_ROM_QSTR(MP_QSTR_sleep_memory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_obj) }, }; -MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); +STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); // Fetch value from module dict. mp_obj_t alarm_get_wake_alarm(void) { diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index a90405da6b..4c12e0e70a 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -31,9 +31,6 @@ #include "common-hal/alarm/__init__.h" -// Make module dict available elsewhere, so we can fetch -extern mp_obj_dict_t alarm_module_globals; - extern mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); // Deep sleep is a two step process. Alarms are set when the VM is valid but diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index 83ccc0d766..89de016bcc 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -60,9 +60,9 @@ //| """ //| ... //| -STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - alarm_pin_pin_alarm_obj_t *self = m_new_obj(alarm_pin_pin_alarm_obj_t); - self->base.type = &alarm_pin_pin_alarm_type; +STATIC mp_obj_t alarm_pin_pinalarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + alarm_pin_pinalarm_obj_t *self = m_new_obj(alarm_pin_pinalarm_obj_t); + self->base.type = &alarm_pin_pinalarm_type; enum { ARG_pin, ARG_value, ARG_edge, ARG_pull }; static const mp_arg_t allowed_args[] = { { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -75,7 +75,7 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_ mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); - common_hal_alarm_pin_pin_alarm_construct(self, + common_hal_alarm_pin_pinalarm_construct(self, pin, args[ARG_value].u_bool, args[ARG_edge].u_bool, @@ -87,19 +87,19 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_ //| pin: microcontroller.Pin //| """The trigger pin.""" //| -STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_pin(mp_obj_t self_in) { - alarm_pin_pin_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); - mcu_pin_obj_t* pin = common_hal_alarm_pin_pin_alarm_get_pin(self); +STATIC mp_obj_t alarm_pin_pinalarm_obj_get_pin(mp_obj_t self_in) { + alarm_pin_pinalarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + mcu_pin_obj_t* pin = common_hal_alarm_pin_pinalarm_get_pin(self); if (pin == NULL) { return mp_const_none; } return MP_OBJ_FROM_PTR(pin); } -MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_pin_obj, alarm_pin_pin_alarm_obj_get_pin); +MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pinalarm_get_pin_obj, alarm_pin_pinalarm_obj_get_pin); -const mp_obj_property_t alarm_pin_pin_alarm_pin_obj = { +const mp_obj_property_t alarm_pin_pinalarm_pin_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&alarm_pin_pin_alarm_get_pin_obj, + .proxy = {(mp_obj_t)&alarm_pin_pinalarm_get_pin_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; @@ -107,29 +107,29 @@ const mp_obj_property_t alarm_pin_pin_alarm_pin_obj = { //| value: bool //| """The value on which to trigger.""" //| -STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_value(mp_obj_t self_in) { - alarm_pin_pin_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_bool(common_hal_alarm_pin_pin_alarm_get_value(self)); +STATIC mp_obj_t alarm_pin_pinalarm_obj_get_value(mp_obj_t self_in) { + alarm_pin_pinalarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(common_hal_alarm_pin_pinalarm_get_value(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_value_obj, alarm_pin_pin_alarm_obj_get_value); +MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pinalarm_get_value_obj, alarm_pin_pinalarm_obj_get_value); -const mp_obj_property_t alarm_pin_pin_alarm_value_obj = { +const mp_obj_property_t alarm_pin_pinalarm_value_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&alarm_pin_pin_alarm_get_value_obj, + .proxy = {(mp_obj_t)&alarm_pin_pinalarm_get_value_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; -STATIC const mp_rom_map_elem_t alarm_pin_pin_alarm_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&alarm_pin_pin_alarm_pin_obj) }, - { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&alarm_pin_pin_alarm_value_obj) }, +STATIC const mp_rom_map_elem_t alarm_pin_pinalarm_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&alarm_pin_pinalarm_pin_obj) }, + { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&alarm_pin_pinalarm_value_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(alarm_pin_pin_alarm_locals_dict, alarm_pin_pin_alarm_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(alarm_pin_pinalarm_locals_dict, alarm_pin_pinalarm_locals_dict_table); -const mp_obj_type_t alarm_pin_pin_alarm_type = { +const mp_obj_type_t alarm_pin_pinalarm_type = { { &mp_type_type }, .name = MP_QSTR_PinAlarm, - .make_new = alarm_pin_pin_alarm_make_new, - .locals_dict = (mp_obj_t)&alarm_pin_pin_alarm_locals_dict, + .make_new = alarm_pin_pinalarm_make_new, + .locals_dict = (mp_obj_t)&alarm_pin_pinalarm_locals_dict, }; diff --git a/shared-bindings/alarm/pin/PinAlarm.h b/shared-bindings/alarm/pin/PinAlarm.h index 49ba710899..48865009c3 100644 --- a/shared-bindings/alarm/pin/PinAlarm.h +++ b/shared-bindings/alarm/pin/PinAlarm.h @@ -24,20 +24,20 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PINALARM_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PINALARM_H #include "py/obj.h" #include "py/objtuple.h" #include "common-hal/microcontroller/Pin.h" #include "common-hal/alarm/pin/PinAlarm.h" -extern const mp_obj_type_t alarm_pin_pin_alarm_type; +extern const mp_obj_type_t alarm_pin_pinalarm_type; -void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull); -extern mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self); -extern bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self); -extern bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self); -extern bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self); +void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull); +extern mcu_pin_obj_t *common_hal_alarm_pin_pinalarm_get_pin(alarm_pin_pinalarm_obj_t *self); +extern bool common_hal_alarm_pin_pinalarm_get_value(alarm_pin_pinalarm_obj_t *self); +extern bool common_hal_alarm_pin_pinalarm_get_edge(alarm_pin_pinalarm_obj_t *self); +extern bool common_hal_alarm_pin_pinalarm_get_pull(alarm_pin_pinalarm_obj_t *self); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PINALARM_H diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index 1c4d976ada..1c9b8d37c5 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -56,10 +56,10 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) { //| """ //| ... //| -STATIC mp_obj_t alarm_time_time_alarm_make_new(const mp_obj_type_t *type, +STATIC mp_obj_t alarm_time_timealarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - alarm_time_time_alarm_obj_t *self = m_new_obj(alarm_time_time_alarm_obj_t); - self->base.type = &alarm_time_time_alarm_type; + alarm_time_timealarm_obj_t *self = m_new_obj(alarm_time_timealarm_obj_t); + self->base.type = &alarm_time_timealarm_type; enum { ARG_monotonic_time, ARG_epoch_time }; static const mp_arg_t allowed_args[] = { @@ -105,7 +105,7 @@ STATIC mp_obj_t alarm_time_time_alarm_make_new(const mp_obj_type_t *type, mp_raise_ValueError(translate("Time is in the past.")); } - common_hal_alarm_time_time_alarm_construct(self, monotonic_time); + common_hal_alarm_time_timealarm_construct(self, monotonic_time); return MP_OBJ_FROM_PTR(self); } @@ -116,28 +116,28 @@ STATIC mp_obj_t alarm_time_time_alarm_make_new(const mp_obj_type_t *type, //| by this property only as a `time.monotonic()` time. //| """ //| -STATIC mp_obj_t alarm_time_time_alarm_obj_get_monotonic_time(mp_obj_t self_in) { - alarm_time_time_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_alarm_time_time_alarm_get_monotonic_time(self)); +STATIC mp_obj_t alarm_time_timealarm_obj_get_monotonic_time(mp_obj_t self_in) { + alarm_time_timealarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_alarm_time_timealarm_get_monotonic_time(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_time_alarm_get_monotonic_time_obj, alarm_time_time_alarm_obj_get_monotonic_time); +MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_timealarm_get_monotonic_time_obj, alarm_time_timealarm_obj_get_monotonic_time); -const mp_obj_property_t alarm_time_time_alarm_monotonic_time_obj = { +const mp_obj_property_t alarm_time_timealarm_monotonic_time_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&alarm_time_time_alarm_get_monotonic_time_obj, + .proxy = {(mp_obj_t)&alarm_time_timealarm_get_monotonic_time_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; -STATIC const mp_rom_map_elem_t alarm_time_time_alarm_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_monotonic_time), MP_ROM_PTR(&alarm_time_time_alarm_monotonic_time_obj) }, +STATIC const mp_rom_map_elem_t alarm_time_timealarm_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_monotonic_time), MP_ROM_PTR(&alarm_time_timealarm_monotonic_time_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(alarm_time_time_alarm_locals_dict, alarm_time_time_alarm_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(alarm_time_timealarm_locals_dict, alarm_time_timealarm_locals_dict_table); -const mp_obj_type_t alarm_time_time_alarm_type = { +const mp_obj_type_t alarm_time_timealarm_type = { { &mp_type_type }, .name = MP_QSTR_TimeAlarm, - .make_new = alarm_time_time_alarm_make_new, - .locals_dict = (mp_obj_t)&alarm_time_time_alarm_locals_dict, + .make_new = alarm_time_timealarm_make_new, + .locals_dict = (mp_obj_t)&alarm_time_timealarm_locals_dict, }; diff --git a/shared-bindings/alarm/time/TimeAlarm.h b/shared-bindings/alarm/time/TimeAlarm.h index ceb3291c9d..0a4b9caf4a 100644 --- a/shared-bindings/alarm/time/TimeAlarm.h +++ b/shared-bindings/alarm/time/TimeAlarm.h @@ -24,16 +24,16 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTONIC_TIME_ALARM_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTINIC_TIME_ALARM_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIMEALARM_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIMEALARM_H #include "py/obj.h" #include "common-hal/alarm/time/TimeAlarm.h" -extern const mp_obj_type_t alarm_time_time_alarm_type; +extern const mp_obj_type_t alarm_time_timealarm_type; -extern void common_hal_alarm_time_time_alarm_construct(alarm_time_time_alarm_obj_t *self, mp_float_t monotonic_time); -extern mp_float_t common_hal_alarm_time_time_alarm_get_monotonic_time(alarm_time_time_alarm_obj_t *self); +extern void common_hal_alarm_time_timealarm_construct(alarm_time_timealarm_obj_t *self, mp_float_t monotonic_time); +extern mp_float_t common_hal_alarm_time_timealarm_get_monotonic_time(alarm_time_timealarm_obj_t *self); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTONIC_TIME_ALARM_H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIMEALARM_H From e9c9fce15ddf292763cf4375c6e5e0c3f25d9e35 Mon Sep 17 00:00:00 2001 From: BennyE Date: Wed, 23 Dec 2020 14:59:09 +0100 Subject: [PATCH 123/146] Remove debug log messages --- ports/esp32s2/common-hal/wifi/Radio.c | 41 ++----------------- .../esp32s2/common-hal/wifi/ScannedNetworks.c | 6 --- 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 08d8bbcd50..d4db5d08d3 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -198,55 +198,20 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { if (esp_wifi_sta_get_ap_info(&self->ap_info.record) != ESP_OK){ return mp_const_none; } else { - ESP_EARLY_LOGW(TAG, "country before handler country: %s", (char *)&self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "country memory at: %p", self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "countryCC memory at: %p", self->ap_info.record.country.cc); - ESP_EARLY_LOGW(TAG, "countryCC strlen: %d", strlen(self->ap_info.record.country.cc)); // The struct member appears to be (not NULL!), I don't know how to properly test for it. - // If the ESP-IDF starts working fine, this "if" wouldn't trigger. + // When the ESP-IDF starts working fine (when their bugfix is available), this "if" wouldn't trigger. // Note: It is possible that Wi-Fi APs don't have a CC set, then even after this workaround // the element would remain empty. if (strlen(self->ap_info.record.country.cc) == 0) { // Workaround to fill country related information in ap_info until ESP-IDF carries a fix // esp_wifi_sta_get_ap_info does not appear to fill wifi_country_t (e.g. country.cc) details // (IDFGH-4437) #6267 - ESP_EARLY_LOGW(TAG, "Triggered missing country workaround"); if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { - ESP_EARLY_LOGW(TAG, "Workaround worked fine!"); - ESP_EARLY_LOGW(TAG, "country: %d", self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "CC: %s", self->ap_info.record.country.cc); + ESP_EARLY_LOGW(TAG, "Country Code: %s", self->ap_info.record.country.cc); } else { - ESP_EARLY_LOGW(TAG, "Workaround failed!"); + ESP_EARLY_LOGW(TAG, "Country Code - Workaround failed!"); } - //} else { - // ESP_EARLY_LOGW(TAG, "Triggered missing country workaround IN ELSE"); - // //memset(&self->ap_info.record.country, 0, sizeof(wifi_country_t)); - // if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { - // //if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { - // ESP_EARLY_LOGW(TAG, "Workaround worked fine!"); - // ESP_EARLY_LOGW(TAG, "CC: %s", self->ap_info.record.country.cc); - // } else { - // ESP_EARLY_LOGW(TAG, "Workaround failed!"); - // } } - ESP_EARLY_LOGW(TAG, "ssid: %s", self->ap_info.record.ssid); - ESP_EARLY_LOGW(TAG, "channel: %d", self->ap_info.record.primary); - ESP_EARLY_LOGW(TAG, "secondary: %d", self->ap_info.record.second); - ESP_EARLY_LOGW(TAG, "rssi: %d", self->ap_info.record.rssi); - ESP_EARLY_LOGW(TAG, "authmode: %d", self->ap_info.record.authmode); - ESP_EARLY_LOGW(TAG, "pairwise_cipher: %d", self->ap_info.record.pairwise_cipher); - ESP_EARLY_LOGW(TAG, "group_cipher: %d", self->ap_info.record.group_cipher); - ESP_EARLY_LOGW(TAG, "11b: %d", self->ap_info.record.phy_11b); - ESP_EARLY_LOGW(TAG, "11g: %d", self->ap_info.record.phy_11g); - ESP_EARLY_LOGW(TAG, "11n: %d", self->ap_info.record.phy_11n); - ESP_EARLY_LOGW(TAG, "phy_lr: %d", self->ap_info.record.phy_lr); - ESP_EARLY_LOGW(TAG, "ap_info.record: %s", self->ap_info.record); - ESP_EARLY_LOGW(TAG, "country with cast: %s", (char *)&self->ap_info.record.country); - //ESP_EARLY_LOGW(TAG, "country: %s", self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "country memory at: %p", self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "countryCC: %s", self->ap_info.record.country.cc); - ESP_EARLY_LOGW(TAG, "countryCC memory at: %p", self->ap_info.record.country.cc); - ESP_EARLY_LOGW(TAG, "countryCC strlen: %d", strlen(self->ap_info.record.country.cc)); memcpy(&ap_info->record, &self->ap_info.record, sizeof(wifi_ap_record_t)); return MP_OBJ_FROM_PTR(ap_info); } diff --git a/ports/esp32s2/common-hal/wifi/ScannedNetworks.c b/ports/esp32s2/common-hal/wifi/ScannedNetworks.c index 0540ffc5cc..cc733308db 100644 --- a/ports/esp32s2/common-hal/wifi/ScannedNetworks.c +++ b/ports/esp32s2/common-hal/wifi/ScannedNetworks.c @@ -39,10 +39,6 @@ #include "components/esp_wifi/include/esp_wifi.h" -#include "components/log/include/esp_log.h" - -static const char* TAG = "wifi"; - static void wifi_scannednetworks_done(wifi_scannednetworks_obj_t *self) { self->done = true; if (self->results != NULL) { @@ -121,8 +117,6 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) wifi_network_obj_t *entry = m_new_obj(wifi_network_obj_t); entry->base.type = &wifi_network_type; - // benny remove again - ESP_EARLY_LOGW(TAG, "scan country: %s", &self->results[self->current_result].country); memcpy(&entry->record, &self->results[self->current_result], sizeof(wifi_ap_record_t)); self->current_result++; From 42a229c08b6b5d64af8d4bc5ec99f3e285befd14 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 23 Dec 2020 10:43:04 -0600 Subject: [PATCH 124/146] circuitpy_mpconfig.mk: Unconditionally disable CIRCUITPY_BUSDEVICE Several issues have been found in the implementation. While they're unresolved, it may be better to disable the built-in module. (This means that to work on fixing the module, it'll be necessary to revert this commit) --- py/circuitpy_mpconfig.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index af1dccf024..e588c41e0d 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -96,7 +96,7 @@ CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO) CIRCUITPY_BOARD ?= 1 CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD) -CIRCUITPY_BUSDEVICE ?= $(CIRCUITPY_FULL_BUILD) +CIRCUITPY_BUSDEVICE = 0 CFLAGS += -DCIRCUITPY_BUSDEVICE=$(CIRCUITPY_BUSDEVICE) CIRCUITPY_BUILTINS_POW3 ?= $(CIRCUITPY_FULL_BUILD) From ad4939ed5ccedefbaf0a9c3fbe8c9cfa08764e03 Mon Sep 17 00:00:00 2001 From: _fonzlate Date: Wed, 23 Dec 2020 19:48:15 +0000 Subject: [PATCH 125/146] Translated using Weblate (Dutch) Currently translated at 100.0% (882 of 882 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/nl/ --- locale/nl.po | 130 ++++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 63 deletions(-) diff --git a/locale/nl.po b/locale/nl.po index bbd732cb5c..8712dc7ec5 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -6,15 +6,15 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-14 12:59-0500\n" -"PO-Revision-Date: 2020-10-27 16:47+0000\n" -"Last-Translator: Jelle Jager \n" +"PO-Revision-Date: 2020-12-23 20:14+0000\n" +"Last-Translator: _fonzlate \n" "Language-Team: none\n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" @@ -294,7 +294,7 @@ msgstr "Adres type buiten bereik" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "Alle CAN-peripherals zijn in gebruik" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -304,7 +304,7 @@ msgstr "Alle I2C peripherals zijn in gebruik" #: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" -msgstr "" +msgstr "Alle PCNT-eenheden zijn in gebruik" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -427,7 +427,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "Baudrate wordt niet ondersteund door randapparatuur" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c @@ -441,7 +441,7 @@ msgstr "Bit clock en word select moeten een clock eenheid delen" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "Bitdiepte moet tussen 1 en 6 liggen, niet %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." @@ -859,7 +859,7 @@ msgstr "Verwachtte een adres" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" -msgstr "" +msgstr "Verwachtte een alarm" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -876,7 +876,7 @@ msgstr "FFT alleen voor ndarrays gedefineerd" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FFT is alleen geïmplementeerd voor lineaire arrays" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" @@ -950,7 +950,7 @@ msgstr "Filters zijn te complex" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "Firmware image is ongeldig" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1014,7 +1014,7 @@ msgstr "I2SOut is niet beschikbaar" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IO's 0, 2 en 4 ondersteunen geen interne pullup in slaapstand" #: shared-bindings/aesio/aes.c #, c-format @@ -1035,7 +1035,7 @@ msgstr "Incorrecte buffer grootte" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "De initialisatie is mislukt vanwege een gebrek aan geheugen" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -1102,7 +1102,7 @@ msgstr "Ongeldige PWM frequentie" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "Invalid Pin" -msgstr "" +msgstr "Ongeldige Pin" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" @@ -1300,7 +1300,7 @@ msgstr "Een meervoud van 6 rgb pinnen moet worden gebruikt, niet %d" #: ports/esp32s2/common-hal/nvm/ByteArray.c msgid "NVS Error" -msgstr "" +msgstr "NVS-fout" #: py/parse.c msgid "Name too long" @@ -1323,7 +1323,7 @@ msgstr "Geen DMA kanaal gevonden" #: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" -msgstr "" +msgstr "Geen I2C-apparaat op adres: %x" #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c @@ -1465,7 +1465,7 @@ msgstr "Alleen IPv4 adressen worden ondersteund" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 sockets supported" -msgstr "" +msgstr "Alleen IPv4-sockets ondersteund" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1486,7 +1486,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "Slechts één alarm.time alarm kan worden ingesteld." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1551,7 +1551,7 @@ msgstr "Pin nummer al gereserveerd door EXTI" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "PinAlarm not yet implemented" -msgstr "" +msgstr "PinAlarm nog niet geïmplementeerd" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1598,10 +1598,14 @@ msgstr "Prefix buffer moet op de heap zijn" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"Druk een willekeurige toets om de REPL te starten. Gebruik CTRL+D om te " +"herstarten.\n" #: main.c msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" +"Simuleert diepe slaapstand tot alarm, een willekeurige toets of schrijven " +"naar bestand.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1773,7 +1777,7 @@ msgstr "Geef op zijn minst 1 UART pin op" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Geef monotonic_time of epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" @@ -1848,7 +1852,7 @@ msgstr "Tile breedte moet exact de bitmap breedte verdelen" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "Tijdstip ligt in het verleden." #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -1963,7 +1967,7 @@ msgstr "Niet in staat om naar nvm te schrijven." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "Kan niet naar sleep_memory schrijven." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2033,7 +2037,7 @@ msgstr "Niet-ondersteunde pull-waarde." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "Update Mislukt" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -2102,7 +2106,7 @@ msgstr "WiFi wachtwoord moet tussen 8 en 63 karakters bevatten" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "Gewekt door alarm.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" @@ -2159,7 +2163,7 @@ msgstr "argsort argument moet een ndarray zijn" #: extmod/ulab/code/numerical/numerical.c msgid "argsort is not implemented for flattened arrays" -msgstr "" +msgstr "argsort wordt niet geïmplementeerd voor vlakke arrays" #: py/runtime.c msgid "argument has wrong type" @@ -2184,7 +2188,7 @@ msgstr "argumenten moeten ndarrays zijn" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" -msgstr "" +msgstr "array en indexlengte moeten gelijk zijn" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c @@ -2193,7 +2197,7 @@ msgstr "array/bytes vereist aan de rechterkant" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" +msgstr "verzoek om (arg)min.(arg)max te krijgen van lege reeks" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" @@ -2205,15 +2209,15 @@ msgstr "attributen nog niet ondersteund" #: extmod/ulab/code/numerical/numerical.c msgid "axis is out of bounds" -msgstr "" +msgstr "as is buiten bereik" #: extmod/ulab/code/numerical/numerical.c msgid "axis must be None, or an integer" -msgstr "" +msgstr "as moet None of een integer zijn" #: extmod/ulab/code/numerical/numerical.c msgid "axis too long" -msgstr "" +msgstr "as te lang" #: py/builtinevex.c msgid "bad compile mode" @@ -2419,7 +2423,7 @@ msgstr "kan niet schakelen tussen handmatige en automatische veld specificatie" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "kan uitvoer niet converteren zonder conversieregel" #: py/objtype.c msgid "cannot create '%q' instances" @@ -2520,7 +2524,7 @@ msgstr "kon SD kaart versie niet bepalen" #: extmod/ulab/code/numerical/numerical.c msgid "cross is defined for 1D arrays of length 3" -msgstr "" +msgstr "kruis wordt gedefinieerd voor 1D-arrays van lengte 3" #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" @@ -2563,7 +2567,7 @@ msgstr "diff argument moet een ndarray zijn" #: extmod/ulab/code/numerical/numerical.c msgid "differentiation order out of range" -msgstr "" +msgstr "differentiatievolgorde buiten bereik" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2596,7 +2600,7 @@ msgstr "end_x moet een int zijn" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "epoch_time niet ondersteund op dit bord" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -2686,7 +2690,7 @@ msgstr "eerste argument moet een functie zijn" #: extmod/ulab/code/ulab_create.c msgid "first argument must be a tuple of ndarrays" -msgstr "" +msgstr "eerste argument moet een tupel van ndarrays zijn" #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" @@ -2743,7 +2747,7 @@ msgstr "functie heeft hetzelfde teken aan beide uiteinden van het interval" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "" +msgstr "functie is alleen gedefinieerd voor ndarrays" #: py/argcheck.c #, c-format @@ -2840,7 +2844,7 @@ msgstr "inline assembler moet een functie zijn" #: extmod/ulab/code/ndarray.c msgid "input and output shapes are not compatible" -msgstr "" +msgstr "in- en uitvoervormen zijn niet compatibel" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" @@ -2852,7 +2856,7 @@ msgstr "invoer array lengte moet een macht van 2 zijn" #: extmod/ulab/code/ulab_create.c msgid "input arrays are not compatible" -msgstr "" +msgstr "input arrays zijn niet compatibel" #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" @@ -2868,19 +2872,19 @@ msgstr "invoermatrix is singulier" #: extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "" +msgstr "invoer moet een gesloten ndarray zijn" #: extmod/ulab/code/ulab_create.c msgid "input must be a tensor of rank 2" -msgstr "" +msgstr "invoer moet een tensor van rang 2 zijn" #: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "invoer moet een ndarray zijn" #: extmod/ulab/code/filter/filter.c msgid "input must be one-dimensional" -msgstr "" +msgstr "invoer moet eendimensionaal zijn" #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" @@ -2896,7 +2900,7 @@ msgstr "invoervectors moeten van gelijke lengte zijn" #: extmod/ulab/code/poly/poly.c msgid "inputs are not iterable" -msgstr "" +msgstr "invoer is niet itereerbaar" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -2970,7 +2974,7 @@ msgstr "ongeldige syntax voor nummer" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" -msgstr "" +msgstr "io moet rtc io zijn" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3041,7 +3045,7 @@ msgstr "long int wordt niet ondersteund in deze build" #: ports/esp32s2/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" -msgstr "" +msgstr "loopback + silent mode wordt niet ondersteund door randapparaat" #: py/parse.c msgid "malformed f-string" @@ -3075,7 +3079,7 @@ msgstr "max_length moet >0 zijn" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" -msgstr "" +msgstr "maximaal aantal dimensies is 4" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3083,11 +3087,11 @@ msgstr "maximale recursiediepte overschreden" #: extmod/ulab/code/approx/approx.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter moet groter dan 0 zijn" #: extmod/ulab/code/approx/approx.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter moet groter dan 0 zijn" #: py/runtime.c #, c-format @@ -3210,7 +3214,7 @@ msgstr "niet-trefwoord argument na trefwoord argument" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" -msgstr "" +msgstr "norm is gedefinieerd voor 1D en 2D arrays" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" @@ -3278,11 +3282,11 @@ msgstr "string met oneven lengte" #: extmod/ulab/code/ulab_create.c msgid "offset is too large" -msgstr "" +msgstr "compensatie is te groot" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "compensatie moet groter of gelijk 0 zijn" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3308,11 +3312,11 @@ msgstr "operands konden niet samen verzonden worden" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "operatie is alleen geïmplementeerd voor 1D Booleaanse arrays" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented for flattened array" -msgstr "" +msgstr "operatie is niet geïmplementeerd voor vlakke array" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" @@ -3451,7 +3455,7 @@ msgstr "gevraagde lengte is %d maar object heeft lengte %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "resultaat kan niet naar gespecificeerd type geconverteerd worden" #: py/compile.c msgid "return annotation must be an identifier" @@ -3473,7 +3477,7 @@ msgstr "rgb_pins[%d] bevindt zich niet op dezelfde poort als klok" #: extmod/ulab/code/numerical/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "roll argument moet een ndarray zijn" #: py/objstr.c msgid "rsplit(None,n)" @@ -3501,7 +3505,7 @@ msgstr "scriptcompilatie wordt niet ondersteund" #: extmod/ulab/code/ndarray.c msgid "shape must be a tuple" -msgstr "" +msgstr "vorm moet een tupel zijn" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3650,7 +3654,7 @@ msgstr "timestamp buiten bereik voor platform time_t" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "tobytes kunnen alleen ingeroepen worden voor gesloten arrays" #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" @@ -3671,7 +3675,7 @@ msgstr "trapz is gedefinieerd voor eendimensionale arrays van gelijke lengte" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" -msgstr "" +msgstr "triggerniveau moet 0 of 1 zijn" #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" @@ -3684,12 +3688,12 @@ msgstr "tuple of lijst heeft onjuiste lengte" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install geeft esp-idf fout #%d" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start geeft esp-idf error #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -3817,11 +3821,11 @@ msgstr "vectoren moeten van gelijke lengte zijn" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" -msgstr "" +msgstr "conflict bij ontwaken" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "watchdog niet geïnitialiseerd" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" @@ -3837,11 +3841,11 @@ msgstr "window moet <= interval zijn" #: extmod/ulab/code/numerical/numerical.c msgid "wrong axis index" -msgstr "" +msgstr "foute index voor as" #: extmod/ulab/code/ulab_create.c msgid "wrong axis specified" -msgstr "" +msgstr "onjuiste as gespecificeerd" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" From 1a8033470a83c0ee202001296d8c03e28104f409 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 23 Dec 2020 12:22:50 -0800 Subject: [PATCH 126/146] Stub out mp_hal_is_interrupted for UNIX --- ports/unix/mphalport.h | 2 ++ ports/unix/unix_mphal.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ports/unix/mphalport.h b/ports/unix/mphalport.h index 6f2880d4ef..4e459ffca5 100644 --- a/ports/unix/mphalport.h +++ b/ports/unix/mphalport.h @@ -24,12 +24,14 @@ * THE SOFTWARE. */ #include +#include #ifndef CHAR_CTRL_C #define CHAR_CTRL_C (3) #endif void mp_hal_set_interrupt_char(char c); +bool mp_hal_is_interrupted(void); void mp_hal_stdio_mode_raw(void); void mp_hal_stdio_mode_orig(void); diff --git a/ports/unix/unix_mphal.c b/ports/unix/unix_mphal.c index e9494d7ff2..77deb3152f 100644 --- a/ports/unix/unix_mphal.c +++ b/ports/unix/unix_mphal.c @@ -81,6 +81,10 @@ void mp_hal_set_interrupt_char(char c) { } } +bool mp_hal_is_interrupted(void) { + return false; +} + #if MICROPY_USE_READLINE == 1 #include From a11ad2572761bc4900994fbf42361efb387cd059 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 21 Dec 2020 22:58:17 -0500 Subject: [PATCH 127/146] BLE fixes --- ports/nrf/common-hal/_bleio/Adapter.c | 11 ++++++++++- shared-bindings/_bleio/Adapter.c | 13 ++++++++++--- shared-bindings/_bleio/Characteristic.c | 4 ++-- shared-bindings/_bleio/Descriptor.c | 4 ++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index 537f43f237..53a40f9a67 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -470,7 +470,16 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* ble_drv_add_event_handler(scan_on_ble_evt, self->scan_results); uint32_t nrf_timeout = SEC_TO_UNITS(timeout, UNIT_10_MS); - if (timeout <= 0.0001) { + if (nrf_timeout > UINT16_MAX) { + // 0xffff / 100 + mp_raise_ValueError(translate("timeout must be < 655.35 secs")); + } + if (nrf_timeout == 0 && timeout > 0.0f) { + // Make sure converted timeout is > 0 if original timeout is > 0. + mp_raise_ValueError(translate("non-zero timeout must be > 0.01")); + } + + if (nrf_timeout) { nrf_timeout = BLE_GAP_SCAN_TIMEOUT_UNLIMITED; } diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 682177093d..7d7076aab6 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -33,8 +33,8 @@ #include "shared-bindings/_bleio/Address.h" #include "shared-bindings/_bleio/Adapter.h" -#define ADV_INTERVAL_MIN (0.0020f) -#define ADV_INTERVAL_MIN_STRING "0.0020" +#define ADV_INTERVAL_MIN (0.02001f) +#define ADV_INTERVAL_MIN_STRING "0.02001" #define ADV_INTERVAL_MAX (10.24f) #define ADV_INTERVAL_MAX_STRING "10.24" // 20ms is recommended by Apple @@ -307,7 +307,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_float_t timeout = 0; + mp_float_t timeout = 0.0f; if (args[ARG_timeout].u_obj != mp_const_none) { timeout = mp_obj_get_float(args[ARG_timeout].u_obj); } @@ -325,6 +325,13 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args mp_raise_ValueError_varg(translate("interval must be in range %s-%s"), INTERVAL_MIN_STRING, INTERVAL_MAX_STRING); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" + if (timeout != 0.0f && timeout < interval) { + mp_raise_ValueError(translate("non-zero timeout must be >= interval")); + } +#pragma GCC diagnostic pop + const mp_float_t window = mp_obj_float_get(args[ARG_window].u_obj); if (window > interval) { mp_raise_ValueError(translate("window must be <= interval")); diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index 5e384a44ca..a0751b7e34 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -110,8 +110,8 @@ STATIC mp_obj_t bleio_characteristic_add_to_service(size_t n_args, const mp_obj_ common_hal_bleio_attribute_security_mode_check_valid(write_perm); const mp_int_t max_length_int = args[ARG_max_length].u_int; - if (max_length_int <= 0) { - mp_raise_ValueError(translate("max_length must be > 0")); + if (max_length_int < 0) { + mp_raise_ValueError(translate("max_length must be >= 0")); } const size_t max_length = (size_t) max_length_int; const bool fixed_length = args[ARG_fixed_length].u_bool; diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index c313007c6d..60f0acf44b 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -101,8 +101,8 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o common_hal_bleio_attribute_security_mode_check_valid(write_perm); const mp_int_t max_length_int = args[ARG_max_length].u_int; - if (max_length_int <= 0) { - mp_raise_ValueError(translate("max_length must be > 0")); + if (max_length_int < 0) { + mp_raise_ValueError(translate("max_length must be >= 0")); } const size_t max_length = (size_t) max_length_int; const bool fixed_length = args[ARG_fixed_length].u_bool; From 153a686837638ce8722769156610313efca0e559 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 23 Dec 2020 16:41:56 -0500 Subject: [PATCH 128/146] make translate for main --- locale/circuitpython.pot | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e44892fc3b..4a25ec4853 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -949,10 +949,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3009,7 +3005,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3147,6 +3143,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3568,6 +3572,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" From c371119da4e6f56c15e46c53e914344bb89d026c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 23 Dec 2020 15:00:53 -0800 Subject: [PATCH 129/146] Make translate --- locale/circuitpython.pot | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d64cff1859..59c15027cc 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 15:00-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,7 +20,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -534,6 +540,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -566,6 +584,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "" @@ -609,6 +631,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1458,7 +1484,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1520,10 +1546,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1564,7 +1586,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c From 1a6b1b1953b20a0ddd8b5f76d6dc366399ea1aee Mon Sep 17 00:00:00 2001 From: BennyE Date: Thu, 24 Dec 2020 00:37:37 +0100 Subject: [PATCH 130/146] implementing suggested changes --- ports/esp32s2/common-hal/wifi/Network.c | 5 +++-- ports/esp32s2/common-hal/wifi/Radio.c | 17 +++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index d134db057e..be4935dba5 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -51,7 +51,8 @@ mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { const char* cstr = (const char*) self->record.country.cc; - // We know that we only want the CC thus limiting to two chars + // To address esp_wifi_get_country() returned/set wifi_country_t structure + // doesn't follow the documented behaviour (IDFGH-4486) #6315 + // 2 instead of strlen(cstr) which would be 6 and contain full element return mp_obj_new_str(cstr, 2); } - diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index d4db5d08d3..c498501c7f 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -42,10 +42,6 @@ #define MAC_ADDRESS_LENGTH 6 -#include "components/log/include/esp_log.h" - -static const char* TAG = "wifi"; - static void start_station(wifi_radio_obj_t *self) { if (self->sta_mode) { return; @@ -198,18 +194,15 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { if (esp_wifi_sta_get_ap_info(&self->ap_info.record) != ESP_OK){ return mp_const_none; } else { - // The struct member appears to be (not NULL!), I don't know how to properly test for it. - // When the ESP-IDF starts working fine (when their bugfix is available), this "if" wouldn't trigger. - // Note: It is possible that Wi-Fi APs don't have a CC set, then even after this workaround - // the element would remain empty. if (strlen(self->ap_info.record.country.cc) == 0) { // Workaround to fill country related information in ap_info until ESP-IDF carries a fix // esp_wifi_sta_get_ap_info does not appear to fill wifi_country_t (e.g. country.cc) details // (IDFGH-4437) #6267 - if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { - ESP_EARLY_LOGW(TAG, "Country Code: %s", self->ap_info.record.country.cc); - } else { - ESP_EARLY_LOGW(TAG, "Country Code - Workaround failed!"); + // Note: It is possible that Wi-Fi APs don't have a CC set, then even after this workaround + // the element would remain empty. + memset(&self->ap_info.record.country, 0, sizeof(wifi_country_t)); + if (esp_wifi_get_country(&self->ap_info.record.country) != ESP_OK) { + return mp_const_none; } } memcpy(&ap_info->record, &self->ap_info.record, sizeof(wifi_ap_record_t)); From ce01aed5cf59746f5be2892491e02a505fe3c50e Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 24 Dec 2020 03:25:47 +0100 Subject: [PATCH 131/146] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 25 ++++++++++++++++++------- locale/cs.po | 20 ++++++++++++++------ locale/de_DE.po | 27 +++++++++++++++++++-------- locale/el.po | 20 ++++++++++++++------ locale/es.po | 28 +++++++++++++++++++++------- locale/fil.po | 20 ++++++++++++++------ locale/fr.po | 28 +++++++++++++++++++++------- locale/hi.po | 20 ++++++++++++++------ locale/it_IT.po | 20 ++++++++++++++------ locale/ja.po | 28 +++++++++++++++++++++------- locale/ko.po | 20 ++++++++++++++------ locale/nl.po | 30 ++++++++++++++++++++++-------- locale/pl.po | 28 +++++++++++++++++++++------- locale/pt_BR.po | 30 ++++++++++++++++++++++-------- locale/sv.po | 28 +++++++++++++++++++++------- locale/zh_Latn_pinyin.po | 28 +++++++++++++++++++++------- 16 files changed, 291 insertions(+), 109 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 150a92c04a..14b038797e 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -967,11 +967,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" -"Frekuensi yang ditangkap berada di atas kemampuan. Penangkapan Ditunda." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "Frekuensi harus cocok dengan PWMOut yang ada menggunakan timer ini" @@ -3054,7 +3049,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3192,6 +3187,14 @@ msgstr "non-keyword arg setelah */**" msgid "non-keyword arg after keyword arg" msgstr "non-keyword arg setelah keyword arg" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3614,6 +3617,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" @@ -3874,6 +3881,10 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "" +#~ "Frekuensi yang ditangkap berada di atas kemampuan. Penangkapan Ditunda." + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Tekan tombol apa saja untuk masuk ke dalam REPL. Gunakan CTRL+D untuk " diff --git a/locale/cs.po b/locale/cs.po index 39e5a50cf3..7921c5a3bf 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -953,10 +953,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3013,7 +3009,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3151,6 +3147,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3572,6 +3576,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 95ff26aeec..8f995b5e43 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -964,12 +964,6 @@ msgstr "Format nicht unterstützt" msgid "Framebuffer requires %d bytes" msgstr "Framepuffer benötigt %d bytes" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" -"Die aufgezeichnete Frequenz liegt über der Leistungsgrenze. Aufnahme " -"angehalten." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3089,7 +3083,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length muss 0-%d sein, wenn fixed_length %s ist" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3227,6 +3221,14 @@ msgstr "Nicht-Schlüsselwort arg nach * / **" msgid "non-keyword arg after keyword arg" msgstr "Nicht-Schlüsselwort Argument nach Schlüsselwort Argument" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3655,6 +3657,10 @@ msgstr "Das Zeitlimit hat den maximal zulässigen Wert überschritten" msgid "timeout must be 0.0-100.0 seconds" msgstr "Das Zeitlimit muss 0,0-100,0 Sekunden betragen" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout muss >= 0.0 sein" @@ -3918,6 +3924,11 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "" +#~ "Die aufgezeichnete Frequenz liegt über der Leistungsgrenze. Aufnahme " +#~ "angehalten." + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum " diff --git a/locale/el.po b/locale/el.po index e1b44d2916..0352e4735b 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -948,10 +948,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3008,7 +3004,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3146,6 +3142,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3567,6 +3571,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" diff --git a/locale/es.po b/locale/es.po index c335d0f396..987f61e206 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -968,10 +968,6 @@ msgstr "Sin capacidades para el formato" msgid "Framebuffer requires %d bytes" msgstr "Framebuffer requiere %d bytes" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "Frecuencia capturada por encima de la capacidad. Captura en pausa." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3081,8 +3077,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length debe ser 0-%d cuando fixed_length es %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_lenght debe ser > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3221,6 +3217,14 @@ msgstr "" "no deberia estar/tener agumento por palabra clave despues de argumento por " "palabra clave" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "norma está definida para arrays 1D y 2D" @@ -3646,6 +3650,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "el tiempo de espera debe ser 0.0-100.0 segundos" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "tiempo muerto debe ser >= 0.0" @@ -3905,6 +3913,12 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "Frecuencia capturada por encima de la capacidad. Captura en pausa." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_lenght debe ser > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar." diff --git a/locale/fil.po b/locale/fil.po index 067dfc4d79..e808ff1dd2 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -961,10 +961,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3055,7 +3051,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3193,6 +3189,14 @@ msgstr "non-keyword arg sa huli ng */**" msgid "non-keyword arg after keyword arg" msgstr "non-keyword arg sa huli ng keyword arg" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3619,6 +3623,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" diff --git a/locale/fr.po b/locale/fr.po index 3836da812e..3c09a72864 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -973,10 +973,6 @@ msgstr "Format non supporté" msgid "Framebuffer requires %d bytes" msgstr "Le framebuffer nécessite %d octets" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "La fréquence capturée est au delà des capacités. Capture en pause." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3101,8 +3097,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length doit être 0-%d lorsque fixed_length est %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length doit être > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3240,6 +3236,14 @@ msgstr "argument non-nommé après */**" msgid "non-keyword arg after keyword arg" msgstr "argument non-nommé après argument nommé" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3668,6 +3672,10 @@ msgstr "le délai d'expiration a dépassé la valeur maximale prise en charge" msgid "timeout must be 0.0-100.0 seconds" msgstr "le délai doit être compris entre 0.0 et 100.0 secondes" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "'timeout' doit être >= 0.0" @@ -3927,6 +3935,12 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "La fréquence capturée est au delà des capacités. Capture en pause." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length doit être > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger." diff --git a/locale/hi.po b/locale/hi.po index 7d90c65dc0..1f868b0966 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -948,10 +948,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3008,7 +3004,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3146,6 +3142,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3567,6 +3571,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index b14acaf9e4..289d308af7 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -961,10 +961,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3058,7 +3054,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3197,6 +3193,14 @@ msgstr "argomento non nominato dopo */**" msgid "non-keyword arg after keyword arg" msgstr "argomento non nominato seguito da argomento nominato" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3627,6 +3631,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" diff --git a/locale/ja.po b/locale/ja.po index 0bd6504b9b..e8028ac059 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -961,10 +961,6 @@ msgstr "非対応の形式" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "キャプチャした周波数は能力を超えています。キャプチャ停止" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "このタイマーを使う既存のPWMOutと周波数を一致させる必要があります" @@ -3038,8 +3034,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_lengthは0より大きくなければなりません" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3176,6 +3172,14 @@ msgstr "*/** の後に非キーワード引数は置けません" msgid "non-keyword arg after keyword arg" msgstr "キーワード引数の後に非キーワード引数は置けません" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3600,6 +3604,10 @@ msgstr "タイムアウト長は対応する最大値を超えています" msgid "timeout must be 0.0-100.0 seconds" msgstr "timeoutは0.0〜100.0秒でなければなりません" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeoutは0.0以上でなければなりません" @@ -3859,6 +3867,12 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "キャプチャした周波数は能力を超えています。キャプチャ停止" + +#~ msgid "max_length must be > 0" +#~ msgstr "max_lengthは0より大きくなければなりません" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "何らかのキーを押すとREPLに入ります。CTRL-Dでリロード。" diff --git a/locale/ko.po b/locale/ko.po index e307955362..54c819770c 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -953,10 +953,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3014,7 +3010,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3152,6 +3148,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3573,6 +3577,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 8712dc7ec5..bd5fcaff6d 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-23 20:14+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -961,11 +961,6 @@ msgstr "Formaat wordt niet ondersteund" msgid "Framebuffer requires %d bytes" msgstr "Framebuffer benodigd %d bytes" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" -"De vastgelegde frequentie is boven de capaciteit. Vastleggen gepauzeerd." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3074,8 +3069,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length moet 0-%d zijn als fixed_length %s is" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length moet >0 zijn" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3212,6 +3207,14 @@ msgstr "niet-trefwoord argument na */**" msgid "non-keyword arg after keyword arg" msgstr "niet-trefwoord argument na trefwoord argument" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "norm is gedefinieerd voor 1D en 2D arrays" @@ -3636,6 +3639,10 @@ msgstr "time-outduur is groter dan de ondersteunde maximale waarde" msgid "timeout must be 0.0-100.0 seconds" msgstr "timeout moet tussen 0.0 en 100.0 seconden zijn" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout moet groter dan 0.0 zijn" @@ -3895,6 +3902,13 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "" +#~ "De vastgelegde frequentie is boven de capaciteit. Vastleggen gepauzeerd." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length moet >0 zijn" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Druk een willekeurige toets om de REPL te starten. Gebruik CTRL+D om te " diff --git a/locale/pl.po b/locale/pl.po index 380dedd606..07c2df2aae 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -961,10 +961,6 @@ msgstr "Nie wspierany format" msgid "Framebuffer requires %d bytes" msgstr "Bufor ramki wymaga %d bajtów" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "Uzyskana częstotliwość jest niemożliwa. Spauzowano." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3031,8 +3027,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length musi być > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3169,6 +3165,14 @@ msgstr "argument nienazwany po */**" msgid "non-keyword arg after keyword arg" msgstr "argument nienazwany po nazwanym" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3592,6 +3596,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout musi być >= 0.0" @@ -3851,6 +3859,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "Uzyskana częstotliwość jest niemożliwa. Spauzowano." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length musi być > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować." diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 9918acc4d0..f66c88491c 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-22 18:07+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -970,11 +970,6 @@ msgstr "O formato não é suportado" msgid "Framebuffer requires %d bytes" msgstr "O Framebuffer requer %d bytes" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" -"A frequência capturada está acima da capacidade. A captura está em pausa." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3093,8 +3088,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "o max_length deve ser 0-%d quando Fixed_length for %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length deve ser > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3233,6 +3228,14 @@ msgstr "um arg sem palavra-chave após */ **" msgid "non-keyword arg after keyword arg" msgstr "um arg não-palavra-chave após a palavra-chave arg" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "a norma é definida para matrizes 1D e 2D" @@ -3661,6 +3664,10 @@ msgstr "a duração do tempo limite excedeu o valor máximo suportado" msgid "timeout must be 0.0-100.0 seconds" msgstr "o tempo limite deve ser entre 0.0 a 100.0 segundos" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "o tempo limite deve ser >= 0,0" @@ -3920,6 +3927,13 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "" +#~ "A frequência capturada está acima da capacidade. A captura está em pausa." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length deve ser > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar." diff --git a/locale/sv.po b/locale/sv.po index 26eb19cbb1..75f052815e 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -961,10 +961,6 @@ msgstr "Formatet stöds inte" msgid "Framebuffer requires %d bytes" msgstr "Framebuffer kräver %d byte" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "Infångningsfrekvens är för hög. Infångning pausad." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "Frekvensen måste matcha befintlig PWMOut med denna timer" @@ -3064,8 +3060,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length måste vara 0-%d när fixed_length är %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length måste vara > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3202,6 +3198,14 @@ msgstr "icke nyckelord arg efter * / **" msgid "non-keyword arg after keyword arg" msgstr "icke nyckelord arg efter nyckelord arg" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "norm är definierad för 1D- och 2D-matriser" @@ -3626,6 +3630,10 @@ msgstr "timeout-längd överskred det maximala värde som stöds" msgid "timeout must be 0.0-100.0 seconds" msgstr "timeout måste vara 0.0-100.0 sekunder" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout måste vara >= 0.0" @@ -3885,6 +3893,12 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "Infångningsfrekvens är för hög. Infångning pausad." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length måste vara > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Tryck på valfri knapp för att gå in i REPL. Använd CTRL-D för att ladda " diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 3106151d46..398d84a196 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -959,10 +959,6 @@ msgstr "Bù zhīyuán géshì" msgid "Framebuffer requires %d bytes" msgstr "zhēn huǎn chōng qū xū yào %d zì jié" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "Pínlǜ bǔhuò gāo yú nénglì. Bǔhuò zàntíng." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "Pínlǜ bìxū yǔ shǐyòng cǐ jìshí qì de xiàn yǒu PWMOut xiāng pǐpèi" @@ -3055,8 +3051,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "Dāng gùdìng chángdù wèi %s shí, zuìdà chángdù bìxū wèi 0-%d" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "Max_length bìxū > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3193,6 +3189,14 @@ msgstr "zài */** zhīhòu fēi guānjiàn cí cānshù" msgid "non-keyword arg after keyword arg" msgstr "guānjiàn zì cānshù zhīhòu de fēi guānjiàn zì cānshù" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3616,6 +3620,10 @@ msgstr "chāoshí shíjiān chāoguò zuìdà zhīchí zhí" msgid "timeout must be 0.0-100.0 seconds" msgstr "Chāo shí shíjiān bìxū wèi 0.0 Dào 100.0 Miǎo" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "chāoshí bìxū shì >= 0.0" @@ -3875,6 +3883,12 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "Pínlǜ bǔhuò gāo yú nénglì. Bǔhuò zàntíng." + +#~ msgid "max_length must be > 0" +#~ msgstr "Max_length bìxū > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài." From cf4862e96e75303b9ecf1cbb7201bf982d552a5f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 23 Dec 2020 22:52:27 -0500 Subject: [PATCH 132/146] make translate again --- locale/circuitpython.pot | 384 +++------------------------------------ 1 file changed, 23 insertions(+), 361 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d71ba29a38..c5830adabb 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 21:58-0500\n" +"POT-Creation-Date: 2020-12-23 22:50-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -884,14 +884,6 @@ msgstr "" msgid "Extended advertisements with scan response not supported." msgstr "" -#: extmod/ulab/code/fft/fft.c -msgid "FFT is defined for ndarrays only" -msgstr "" - -#: extmod/ulab/code/fft/fft.c -msgid "FFT is implemented for linear arrays only" -msgstr "" - #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -962,6 +954,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -971,10 +967,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -2005,6 +1997,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -2114,22 +2110,10 @@ msgstr "" msgid "arg is an empty sequence" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "argsort argument must be an ndarray" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "argsort is not implemented for flattened arrays" -msgstr "" - #: py/runtime.c msgid "argument has wrong type" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "argument must be ndarray" -msgstr "" - #: py/argcheck.c shared-bindings/_stage/__init__.c #: shared-bindings/digitalio/DigitalInOut.c shared-bindings/gamepad/GamePad.c msgid "argument num/types mismatch" @@ -2139,43 +2123,15 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c -msgid "arguments must be ndarrays" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "array and index length must be equal" -msgstr "" - #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "attempt to get argmin/argmax of an empty sequence" -msgstr "" - #: py/objstr.c msgid "attributes not supported yet" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "axis is out of bounds" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, or an integer" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "axis too long" -msgstr "" - #: py/builtinevex.c msgid "bad compile mode" msgstr "" @@ -2377,10 +2333,6 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" -#: extmod/ulab/code/ndarray_operators.c -msgid "cannot cast output with casting rule" -msgstr "" - #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2457,38 +2409,10 @@ msgstr "" msgid "conversion to object" msgstr "" -#: extmod/ulab/code/filter/filter.c -msgid "convolve arguments must be linear arrays" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "convolve arguments must be ndarrays" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "convolve arguments must not be empty" -msgstr "" - -#: extmod/ulab/code/poly/poly.c -msgid "could not invert Vandermonde matrix" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "cross is defined for 1D arrays of length 3" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "data must be iterable" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "data must be of equal length" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2514,14 +2438,6 @@ msgstr "" msgid "dict update sequence has wrong length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "diff argument must be an ndarray" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "differentiation order out of range" -msgstr "" - #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2633,38 +2549,10 @@ msgstr "" msgid "filesystem must provide mount method" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "first argument must be a callable" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "first argument must be a function" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "first argument must be a tuple of ndarrays" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "first argument must be an iterable" -msgstr "" - -#: extmod/ulab/code/vector/vectorise.c -msgid "first argument must be an ndarray" -msgstr "" - #: py/objtype.c msgid "first argument to super() must be type" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "flattening order must be either 'C', or 'F'" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "flip argument must be an ndarray" -msgstr "" - #: py/objint.c msgid "float too big" msgstr "" @@ -2694,14 +2582,6 @@ msgstr "" msgid "function got multiple values for argument '%q'" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "function has the same sign at the ends of interval" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "function is defined for ndarrays only" -msgstr "" - #: py/argcheck.c #, c-format msgid "function missing %d required positional arguments" @@ -2765,11 +2645,6 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "index is out of bounds" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2778,14 +2653,6 @@ msgstr "" msgid "indices must be integers" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "indices must be integers, slices, or Boolean lists" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "initial values must be iterable" -msgstr "" - #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "initial_value length is wrong" msgstr "" @@ -2794,66 +2661,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" -msgstr "" - -#: extmod/ulab/code/fft/fft.c -msgid "input array length must be power of 2" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "input arrays are not compatible" -msgstr "" - -#: extmod/ulab/code/poly/poly.c -msgid "input data must be an iterable" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "input matrix is asymmetric" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "input matrix is singular" -msgstr "" - -#: extmod/ulab/code/user/user.c -msgid "input must be a dense ndarray" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c -msgid "input must be an ndarray" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "input must be one-dimensional" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "input must be square matrix" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "input must be tuple, list, range, or ndarray" -msgstr "" - -#: extmod/ulab/code/poly/poly.c -msgid "input vectors must be of equal length" -msgstr "" - -#: extmod/ulab/code/poly/poly.c -msgid "inputs are not iterable" -msgstr "" - #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2862,10 +2669,6 @@ msgstr "" msgid "integer required" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "interp is defined for 1D arrays of equal length" -msgstr "" - #: shared-bindings/_bleio/Adapter.c #, c-format msgid "interval must be in range %s-%s" @@ -2936,14 +2739,6 @@ msgstr "" msgid "issubclass() arg 2 must be a class or a tuple of classes" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "iterables are not of the same length" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "iterations did not converge" -msgstr "" - #: py/objstr.c msgid "join expects a list of str/bytes objects consistent with self object" msgstr "" @@ -3008,14 +2803,6 @@ msgstr "" msgid "math domain error" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "matrix dimensions do not match" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "matrix is not positive definite" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format @@ -3023,25 +2810,13 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "max_length must be >= 0" msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "maxiter must be > 0" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "maxiter should be > 0" -msgstr "" - #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3055,10 +2830,6 @@ msgstr "" msgid "module not found" msgstr "" -#: extmod/ulab/code/poly/poly.c -msgid "more degrees of freedom than data points" -msgstr "" - #: py/compile.c msgid "multiple *x in assignment" msgstr "" @@ -3161,8 +2932,12 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "norm is defined for 1D and 2D arrays" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" msgstr "" #: shared-bindings/_bleio/UUID.c @@ -3177,10 +2952,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" -#: extmod/ulab/code/ulab_create.c -msgid "number of points must be at least 2" -msgstr "" - #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" @@ -3229,8 +3000,8 @@ msgstr "" msgid "odd-length string" msgstr "" -#: extmod/ulab/code/ulab_create.c -msgid "offset is too large" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" msgstr "" #: py/objstr.c py/objstrunicode.c @@ -3250,27 +3021,6 @@ msgstr "" msgid "only slices with step=1 (aka None) are supported" msgstr "" -#: extmod/ulab/code/compare/compare.c extmod/ulab/code/ndarray.c -#: extmod/ulab/code/vector/vectorise.c -msgid "operands could not be broadcast together" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented on ndarrays" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "operation is not supported for given type" -msgstr "" - #: py/modbuiltins.c msgid "ord expects a character" msgstr "" @@ -3384,10 +3134,6 @@ msgstr "" msgid "raw f-strings are not implemented" msgstr "" -#: extmod/ulab/code/fft/fft.c -msgid "real and imaginary parts must be of equal length" -msgstr "" - #: py/builtinimport.c msgid "relative import" msgstr "" @@ -3397,10 +3143,6 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" -#: extmod/ulab/code/ndarray_operators.c -msgid "results cannot be cast to specified type" -msgstr "" - #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3419,10 +3161,6 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "roll argument must be an ndarray" -msgstr "" - #: py/objstr.c msgid "rsplit(None,n)" msgstr "" @@ -3445,10 +3183,6 @@ msgstr "" msgid "script compilation not supported" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "" - #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" @@ -3461,18 +3195,10 @@ msgstr "" msgid "single '}' encountered in format string" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "size is defined for ndarrays only" -msgstr "" - #: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "slice step can't be zero" -msgstr "" - #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "" @@ -3485,22 +3211,6 @@ msgstr "" msgid "soft reboot\n" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sort argument must be an ndarray" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "sos array must be of shape (n_section, 6)" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "sos[:, 3] should be all ones" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "sosfilt requires iterable arguments" -msgstr "" - #: shared-bindings/displayio/Bitmap.c msgid "source palette too large" msgstr "" @@ -3578,6 +3288,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" @@ -3594,35 +3308,19 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "tobytes can be invoked for dense arrays only" -msgstr "" - #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "too many indices" -msgstr "" - #: py/runtime.c #, c-format msgid "too many values to unpack (expected %d)" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "trapz is defined for 1D arrays of equal length" -msgstr "" - #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "" @@ -3757,10 +3455,6 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "vectors must have same lengths" -msgstr "" - #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" msgstr "" @@ -3781,19 +3475,7 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "wrong axis index" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "wrong axis specified" -msgstr "" - -#: extmod/ulab/code/vector/vectorise.c -msgid "wrong input type" -msgstr "" - -#: extmod/ulab/code/ulab_create.c py/objstr.c +#: py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -3801,14 +3483,6 @@ msgstr "" msgid "wrong number of values to unpack" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong operand type" -msgstr "" - -#: extmod/ulab/code/vector/vectorise.c -msgid "wrong output type" -msgstr "" - #: shared-module/displayio/Shape.c msgid "x value out of bounds" msgstr "" @@ -3824,15 +3498,3 @@ msgstr "" #: py/objrange.c msgid "zero step" msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "zi must be an ndarray" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "zi must be of float type" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "zi must be of shape (n_section, 2)" -msgstr "" From 578abae0f50725b67a3f8102ed5d1e6fa6feb4c0 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 23 Dec 2020 23:05:10 -0500 Subject: [PATCH 133/146] make translate yet again; forgot to fetch submodules to fresh clone --- locale/circuitpython.pot | 362 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 360 insertions(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index c5830adabb..3edadd57c7 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 22:50-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -884,6 +884,14 @@ msgstr "" msgid "Extended advertisements with scan response not supported." msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is defined for ndarrays only" +msgstr "" + +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -2110,10 +2118,22 @@ msgstr "" msgid "arg is an empty sequence" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort argument must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "argument must be ndarray" +msgstr "" + #: py/argcheck.c shared-bindings/_stage/__init__.c #: shared-bindings/digitalio/DigitalInOut.c shared-bindings/gamepad/GamePad.c msgid "argument num/types mismatch" @@ -2123,15 +2143,43 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c +msgid "arguments must be ndarrays" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get argmin/argmax of an empty sequence" +msgstr "" + #: py/objstr.c msgid "attributes not supported yet" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "axis is out of bounds" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "axis must be None, or an integer" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "axis too long" +msgstr "" + #: py/builtinevex.c msgid "bad compile mode" msgstr "" @@ -2333,6 +2381,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2409,10 +2461,38 @@ msgstr "" msgid "conversion to object" msgstr "" +#: extmod/ulab/code/filter/filter.c +msgid "convolve arguments must be linear arrays" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "convolve arguments must be ndarrays" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "convolve arguments must not be empty" +msgstr "" + +#: extmod/ulab/code/poly/poly.c +msgid "could not invert Vandermonde matrix" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "data must be iterable" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "data must be of equal length" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2438,6 +2518,14 @@ msgstr "" msgid "dict update sequence has wrong length" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "diff argument must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2549,10 +2637,38 @@ msgstr "" msgid "filesystem must provide mount method" msgstr "" +#: extmod/ulab/code/vector/vectorise.c +msgid "first argument must be a callable" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "first argument must be a function" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "first argument must be an iterable" +msgstr "" + +#: extmod/ulab/code/vector/vectorise.c +msgid "first argument must be an ndarray" +msgstr "" + #: py/objtype.c msgid "first argument to super() must be type" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "flattening order must be either 'C', or 'F'" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "flip argument must be an ndarray" +msgstr "" + #: py/objint.c msgid "float too big" msgstr "" @@ -2582,6 +2698,14 @@ msgstr "" msgid "function got multiple values for argument '%q'" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "function has the same sign at the ends of interval" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" +msgstr "" + #: py/argcheck.c #, c-format msgid "function missing %d required positional arguments" @@ -2645,6 +2769,11 @@ msgstr "" msgid "incorrect padding" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "index is out of bounds" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2653,6 +2782,14 @@ msgstr "" msgid "indices must be integers" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "indices must be integers, slices, or Boolean lists" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "initial values must be iterable" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "initial_value length is wrong" msgstr "" @@ -2661,6 +2798,66 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input argument must be an integer or a 2-tuple" +msgstr "" + +#: extmod/ulab/code/fft/fft.c +msgid "input array length must be power of 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + +#: extmod/ulab/code/poly/poly.c +msgid "input data must be an iterable" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "input matrix is asymmetric" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "input matrix is singular" +msgstr "" + +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "input must be square matrix" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "input must be tuple, list, range, or ndarray" +msgstr "" + +#: extmod/ulab/code/poly/poly.c +msgid "input vectors must be of equal length" +msgstr "" + +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2669,6 +2866,10 @@ msgstr "" msgid "integer required" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "interp is defined for 1D arrays of equal length" +msgstr "" + #: shared-bindings/_bleio/Adapter.c #, c-format msgid "interval must be in range %s-%s" @@ -2739,6 +2940,14 @@ msgstr "" msgid "issubclass() arg 2 must be a class or a tuple of classes" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "iterables are not of the same length" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "iterations did not converge" +msgstr "" + #: py/objstr.c msgid "join expects a list of str/bytes objects consistent with self object" msgstr "" @@ -2803,6 +3012,14 @@ msgstr "" msgid "math domain error" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "matrix dimensions do not match" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "matrix is not positive definite" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format @@ -2813,10 +3030,22 @@ msgstr "" msgid "max_length must be >= 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -2830,6 +3059,10 @@ msgstr "" msgid "module not found" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "more degrees of freedom than data points" +msgstr "" + #: py/compile.c msgid "multiple *x in assignment" msgstr "" @@ -2940,6 +3173,10 @@ msgstr "" msgid "non-zero timeout must be >= interval" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -2952,6 +3189,10 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "number of points must be at least 2" +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" @@ -3000,6 +3241,10 @@ msgstr "" msgid "odd-length string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" msgstr "" @@ -3021,6 +3266,27 @@ msgstr "" msgid "only slices with step=1 (aka None) are supported" msgstr "" +#: extmod/ulab/code/compare/compare.c extmod/ulab/code/ndarray.c +#: extmod/ulab/code/vector/vectorise.c +msgid "operands could not be broadcast together" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented on ndarrays" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "operation is not supported for given type" +msgstr "" + #: py/modbuiltins.c msgid "ord expects a character" msgstr "" @@ -3134,6 +3400,10 @@ msgstr "" msgid "raw f-strings are not implemented" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "real and imaginary parts must be of equal length" +msgstr "" + #: py/builtinimport.c msgid "relative import" msgstr "" @@ -3143,6 +3413,10 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3161,6 +3435,10 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" + #: py/objstr.c msgid "rsplit(None,n)" msgstr "" @@ -3183,6 +3461,10 @@ msgstr "" msgid "script compilation not supported" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "shape must be a tuple" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" @@ -3195,10 +3477,18 @@ msgstr "" msgid "single '}' encountered in format string" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "size is defined for ndarrays only" +msgstr "" + #: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "" @@ -3211,6 +3501,22 @@ msgstr "" msgid "soft reboot\n" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sort argument must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: shared-bindings/displayio/Bitmap.c msgid "source palette too large" msgstr "" @@ -3308,19 +3614,35 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "too many indices" +msgstr "" + #: py/runtime.c #, c-format msgid "too many values to unpack (expected %d)" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays of equal length" +msgstr "" + #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "tuple index out of range" +msgstr "" + #: py/obj.c msgid "tuple/list has wrong length" msgstr "" @@ -3455,6 +3777,10 @@ msgstr "" msgid "value_count must be > 0" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "vectors must have same lengths" +msgstr "" + #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" msgstr "" @@ -3475,7 +3801,19 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: py/objstr.c +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" + +#: extmod/ulab/code/vector/vectorise.c +msgid "wrong input type" +msgstr "" + +#: extmod/ulab/code/ulab_create.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -3483,6 +3821,14 @@ msgstr "" msgid "wrong number of values to unpack" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "wrong operand type" +msgstr "" + +#: extmod/ulab/code/vector/vectorise.c +msgid "wrong output type" +msgstr "" + #: shared-module/displayio/Shape.c msgid "x value out of bounds" msgstr "" @@ -3498,3 +3844,15 @@ msgstr "" #: py/objrange.c msgid "zero step" msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" From f3e54414e5771a2463a8a93b4dcbb395584d2fe3 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 24 Dec 2020 14:03:10 +0800 Subject: [PATCH 134/146] litex: ensure we don't re-enable interrups during ISR During an interrupt handler, interrupts are implicitly disabled. They will be re-enabled when the interrupt handler returns. Due to some changes that were made, varous calls will re-enable interrupts after they're finished. Examples of this include calling `CALLBACK_CRITICAL_END` and getting the number of ticks with `port_get_raw_ticks()`. This patch prevents this from happening by doing two things: 1. Use standard calls in `port_get_raw_ticks()` to disable and re-enable interrupts, preventing nesting issues, and 2. Increase the nesting count inside `isr()`, reflecting the implicit call that is made by hardware when an interrupt is handled This helps to address #3841. Signed-off-by: Sean Cross --- ports/litex/mphalport.c | 15 +++++++++++++++ ports/litex/supervisor/port.c | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ports/litex/mphalport.c b/ports/litex/mphalport.c index 862f163939..c7369dc050 100644 --- a/ports/litex/mphalport.c +++ b/ports/litex/mphalport.c @@ -44,16 +44,31 @@ void mp_hal_delay_us(mp_uint_t delay) { extern void SysTick_Handler(void); +// This value contains the number of times "common_hal_mcu_disable_interrupts()" +// has been called without calling "common_hal_mcu_enable_interrupts()". Since +// this is the interrupt handler, that means we're handling an interrupt, so +// this value should be `0`. +// +// Interrupts should already be disabled when this handler is running, which means +// this value is logically already `1`. If we didn't do this, then interrupts would +// be prematurely enabled by interrupt handlers that enable and disable interrupts. +extern volatile uint32_t nesting_count; + __attribute__((section(".ramtext"))) void isr(void) { uint8_t irqs = irq_pending() & irq_getmask(); + // Increase the "nesting count". Note: This should be going from 0 -> 1. + nesting_count += 1; #ifdef CFG_TUSB_MCU if (irqs & (1 << USB_INTERRUPT)) usb_irq_handler(); #endif if (irqs & (1 << TIMER0_INTERRUPT)) SysTick_Handler(); + + // Decrease the "nesting count". Note: This should be going from 1 -> 0. + nesting_count -= 1; } mp_uint_t cpu_get_regs_and_sp(mp_uint_t *regs) { diff --git a/ports/litex/supervisor/port.c b/ports/litex/supervisor/port.c index 02617b9af7..9897fa397e 100644 --- a/ports/litex/supervisor/port.c +++ b/ports/litex/supervisor/port.c @@ -32,6 +32,8 @@ #include "irq.h" #include "csr.h" +#include "shared-bindings/microcontroller/__init__.h" + // Global millisecond tick count. 1024 per second because most RTCs are clocked with 32.768khz // crystals. volatile uint64_t raw_ticks = 0; @@ -129,9 +131,9 @@ uint32_t port_get_saved_word(void) { uint64_t port_get_raw_ticks(uint8_t* subticks) { // Reading 64 bits may take two loads, so turn of interrupts while we do it. - irq_setie(false); + common_hal_mcu_disable_interrupts(); uint64_t raw_tick_snapshot = raw_ticks; - irq_setie(true); + common_hal_mcu_enable_interrupts(); return raw_tick_snapshot; } From 2f95cc95a494395658eefed6130b9a8732117482 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 24 Dec 2020 14:06:57 +0800 Subject: [PATCH 135/146] litex: move more critical code to RAM The XIP SPI flash on Fomu is slow, which results in certain operations taking a long time. This becomes a problem for time-critical operations such as USB. Move various calls into RAM to improve performance. This includes the call to __modsi3 and __udivsi3 which are used by the supervisor handler to determine if periodic callbacks need to be run. This finishes fixing #3841 Signed-off-by: Sean Cross --- ports/litex/boards/fomu/fomu-spi.ld | 5 +++++ ports/litex/common-hal/microcontroller/__init__.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ports/litex/boards/fomu/fomu-spi.ld b/ports/litex/boards/fomu/fomu-spi.ld index 9b6443c673..e7db25b0c5 100644 --- a/ports/litex/boards/fomu/fomu-spi.ld +++ b/ports/litex/boards/fomu/fomu-spi.ld @@ -51,6 +51,11 @@ SECTIONS *(.text.tu_edpt_dir) *(.text.tu_fifo_empty) *(.text.usbd_edpt_busy) + *(.text.usb_irq_handler) + *(.text.supervisor_tick) + *(.text.port_get_raw_ticks) + *(.text.__modsi3) + *(.text.__udivsi3) *(.text.irq_getmask) *(.text.irq_setmask) *(.text.irq_pending) diff --git a/ports/litex/common-hal/microcontroller/__init__.c b/ports/litex/common-hal/microcontroller/__init__.c index 3c91661144..522a41e2e3 100644 --- a/ports/litex/common-hal/microcontroller/__init__.c +++ b/ports/litex/common-hal/microcontroller/__init__.c @@ -59,12 +59,15 @@ void common_hal_mcu_delay_us(uint32_t delay) { volatile uint32_t nesting_count = 0; +__attribute__((section(".ramtext"))) void common_hal_mcu_disable_interrupts(void) { - irq_setie(0); - // __DMB(); + if (nesting_count == 0) { + irq_setie(0); + } nesting_count++; } +__attribute__((section(".ramtext"))) void common_hal_mcu_enable_interrupts(void) { if (nesting_count == 0) { // This is very very bad because it means there was mismatched disable/enables so we From 64bb055700d425617adff7748890354d925248fd Mon Sep 17 00:00:00 2001 From: BennyE Date: Thu, 24 Dec 2020 15:40:53 +0100 Subject: [PATCH 136/146] Updating comment to reflect feedback of espressif from IDFGH-4486 -> works correct as per the protocol --- ports/esp32s2/common-hal/wifi/Network.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index be4935dba5..2674df0651 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -51,8 +51,6 @@ mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { const char* cstr = (const char*) self->record.country.cc; - // To address esp_wifi_get_country() returned/set wifi_country_t structure - // doesn't follow the documented behaviour (IDFGH-4486) #6315 - // 2 instead of strlen(cstr) which would be 6 and contain full element + // 2 instead of strlen(cstr) as this gives us only the country-code return mp_obj_new_str(cstr, 2); } From 2729666d82965dc8a01a9aa2b11387af661c4822 Mon Sep 17 00:00:00 2001 From: Uwe Gartmann Date: Fri, 25 Dec 2020 17:53:43 +0100 Subject: [PATCH 137/146] SAMD51: change of DAC power setting Fixes wrong DAC output levels at high data rate closes adafruit#3796 --- ports/atmel-samd/common-hal/audioio/AudioOut.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/common-hal/audioio/AudioOut.c b/ports/atmel-samd/common-hal/audioio/AudioOut.c index 5cefba56f1..34b718dca8 100644 --- a/ports/atmel-samd/common-hal/audioio/AudioOut.c +++ b/ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -197,7 +197,7 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self, #endif #ifdef SAM_D5X_E5X DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI0; - DAC->DACCTRL[0].reg = DAC_DACCTRL_CCTRL_CC100K | + DAC->DACCTRL[0].reg = DAC_DACCTRL_CCTRL_CC12M | DAC_DACCTRL_ENABLE | DAC_DACCTRL_LEFTADJ; DAC->CTRLB.reg = DAC_CTRLB_REFSEL_VREFPU; @@ -206,7 +206,7 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self, #ifdef SAM_D5X_E5X if (channel1_enabled) { DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI1; - DAC->DACCTRL[1].reg = DAC_DACCTRL_CCTRL_CC100K | + DAC->DACCTRL[1].reg = DAC_DACCTRL_CCTRL_CC12M | DAC_DACCTRL_ENABLE | DAC_DACCTRL_LEFTADJ; DAC->CTRLB.reg = DAC_CTRLB_REFSEL_VREFPU; From f7cafbf5f9ff244c0f7681ff2b07fe9d493c9aa3 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 26 Dec 2020 12:54:36 +0530 Subject: [PATCH 138/146] re-arrange ci actions --- .github/workflows/build.yml | 52 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36b8db388a..1a21c13c4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,32 @@ jobs: run: | gcc --version python3 --version + - name: Translations + run: make check-translate + - 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 + run: make check-stubs -j2 + - uses: actions/upload-artifact@v2 + with: + name: stubs + path: circuitpython-stubs* + - name: Test Documentation Build (HTML) + run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html + - uses: actions/upload-artifact@v2 + with: + name: docs + path: _build/html + - name: Test Documentation Build (LaTeX/PDF) + run: | + make latexpdf + - uses: actions/upload-artifact@v2 + with: + name: docs + path: _build/latex - name: Build mpy-cross run: make -C mpy-cross -j2 - name: Build unix port @@ -68,32 +94,6 @@ jobs: - name: mpy Tests run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float working-directory: tests - - name: Build and Validate Stubs - run: make check-stubs -j2 - - uses: actions/upload-artifact@v2 - with: - name: stubs - path: circuitpython-stubs* - - name: Test Documentation Build (HTML) - run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html - - uses: actions/upload-artifact@v2 - with: - name: docs - path: _build/html - - name: Test Documentation Build (LaTeX/PDF) - run: | - make latexpdf - - uses: actions/upload-artifact@v2 - with: - name: docs - path: _build/latex - - name: Translations - run: make check-translate - - 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 mpy-cross.static-raspbian run: make -C mpy-cross -j2 -f Makefile.static-raspbian - uses: actions/upload-artifact@v2 From 938a0fa2fc9ffaba15f345f102a34c5354166c4a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 26 Dec 2020 13:39:48 -0500 Subject: [PATCH 139/146] Add include to tick.c for mp_hal_is_interrupted() --- supervisor/shared/tick.c | 1 + 1 file changed, 1 insertion(+) diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 5d75a5395c..e51c48c739 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -26,6 +26,7 @@ #include "supervisor/shared/tick.h" +#include "lib/utils/interrupt_char.h" #include "py/mpstate.h" #include "py/runtime.h" #include "supervisor/linker.h" From 6c7e6abcfdb4bdffd37dc4649bc7232f3cde4897 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Sun, 27 Dec 2020 20:30:49 -0800 Subject: [PATCH 140/146] Downgrade OTA API for IDF 4.2 --- ports/esp32s2/common-hal/dualbank/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/dualbank/__init__.c b/ports/esp32s2/common-hal/dualbank/__init__.c index 0f468a036b..1414f131d1 100644 --- a/ports/esp32s2/common-hal/dualbank/__init__.c +++ b/ports/esp32s2/common-hal/dualbank/__init__.c @@ -100,7 +100,7 @@ void common_hal_dualbank_flash(const void *buf, const size_t len, const size_t o } } - err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); + err = esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle); if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); task_fatal_error(); From dc332baa87bf1fa3d777ffe31c7dc29b24a6a142 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 28 Dec 2020 20:04:00 +0530 Subject: [PATCH 141/146] update common_hal_reset_pin() --- ports/atmel-samd/common-hal/microcontroller/Pin.c | 3 +++ ports/esp32s2/common-hal/busio/SPI.c | 8 ++------ ports/esp32s2/common-hal/microcontroller/Pin.c | 3 +++ ports/litex/common-hal/microcontroller/Pin.c | 3 +++ ports/mimxrt10xx/common-hal/busio/SPI.c | 9 +++------ ports/mimxrt10xx/common-hal/busio/UART.c | 10 ++++------ ports/mimxrt10xx/common-hal/microcontroller/Pin.c | 3 +++ ports/nrf/common-hal/microcontroller/Pin.c | 3 +++ ports/stm/common-hal/microcontroller/Pin.c | 3 +++ shared-module/displayio/FourWire.c | 4 +--- 10 files changed, 28 insertions(+), 21 deletions(-) diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.c b/ports/atmel-samd/common-hal/microcontroller/Pin.c index 7dd87a3b2c..564d037e03 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Pin.c +++ b/ports/atmel-samd/common-hal/microcontroller/Pin.c @@ -169,6 +169,9 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(pin->number); } diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 562881585d..62f47999cf 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -248,12 +248,8 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) { spi_bus_free(self->host_id); common_hal_reset_pin(self->clock_pin); - if (self->MOSI_pin != NULL) { - common_hal_reset_pin(self->MOSI_pin); - } - if (self->MISO_pin != NULL) { - common_hal_reset_pin(self->MISO_pin); - } + common_hal_reset_pin(self->MOSI_pin); + common_hal_reset_pin(self->MISO_pin); self->clock_pin = NULL; self->MISO_pin = NULL; self->MOSI_pin = NULL; diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 81dfa1308d..26bd6c16be 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -89,6 +89,9 @@ void reset_pin_number(gpio_num_t pin_number) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(pin->number); } diff --git a/ports/litex/common-hal/microcontroller/Pin.c b/ports/litex/common-hal/microcontroller/Pin.c index 38601e0d3c..4d088a0763 100644 --- a/ports/litex/common-hal/microcontroller/Pin.c +++ b/ports/litex/common-hal/microcontroller/Pin.c @@ -42,6 +42,9 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(0, pin->number); } diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index 8fe1b799d6..ce7cbea7ec 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -220,12 +220,9 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) { never_reset_spi[self->clock->bank_idx - 1] = false; common_hal_reset_pin(self->clock->pin); - if (self->mosi != NULL) { - common_hal_reset_pin(self->mosi->pin); - } - if (self->miso != NULL) { - common_hal_reset_pin(self->miso->pin); - } + common_hal_reset_pin(self->mosi->pin); + common_hal_reset_pin(self->miso->pin); + self->clock = NULL; self->mosi = NULL; self->miso = NULL; diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index db5582d150..03a6e8f3ef 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -295,12 +295,10 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { LPUART_Deinit(self->uart); gc_free(self->ringbuf); - if (self->rx) { - common_hal_reset_pin(self->rx->pin); - } - if (self->tx) { - common_hal_reset_pin(self->tx->pin); - } + + common_hal_reset_pin(self->rx->pin); + common_hal_reset_pin(self->tx->pin); + self->rx = NULL; self->tx = NULL; diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index a005924e2f..50970f8e22 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -67,6 +67,9 @@ void reset_all_pins(void) { // Since i.MX pins need extra register and reset information to reset properly, // resetting pins by number alone has been removed. void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } never_reset_pins[pin->mux_idx] = false; claimed_pins[pin->mux_idx] = false; *(uint32_t*)pin->mux_reg = pin->mux_reset; diff --git a/ports/nrf/common-hal/microcontroller/Pin.c b/ports/nrf/common-hal/microcontroller/Pin.c index bc7ff831a5..23d6e23bfe 100644 --- a/ports/nrf/common-hal/microcontroller/Pin.c +++ b/ports/nrf/common-hal/microcontroller/Pin.c @@ -134,6 +134,9 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(pin->number); } diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 0e333c71cf..37c202d86e 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -125,6 +125,9 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(pin->port, pin->number); } diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c index 06f8a84e35..e993f2480c 100644 --- a/shared-module/displayio/FourWire.c +++ b/shared-module/displayio/FourWire.c @@ -76,9 +76,7 @@ void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self) { common_hal_reset_pin(self->command.pin); common_hal_reset_pin(self->chip_select.pin); - if (self->reset.pin) { - common_hal_reset_pin(self->reset.pin); - } + common_hal_reset_pin(self->reset.pin); } bool common_hal_displayio_fourwire_reset(mp_obj_t obj) { From dc8593db93d1c7213e5be07571498cf42f38be34 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Mon, 28 Dec 2020 16:32:25 +0000 Subject: [PATCH 142/146] Translated using Weblate (Swedish) Currently translated at 100.0% (884 of 884 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 75f052815e..9c2d30d068 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 16:41-0500\n" -"PO-Revision-Date: 2020-12-07 20:26+0000\n" +"PO-Revision-Date: 2020-12-28 17:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" @@ -950,7 +950,7 @@ msgstr "Filter för komplexa" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "Firmware-avbilden är ogiltig" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1096,7 +1096,7 @@ msgstr "Ogiltig PWM-frekvens" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "Invalid Pin" -msgstr "" +msgstr "Ogiltig pinne" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" @@ -1591,10 +1591,12 @@ msgstr "Prefixbufferten måste finnas på heap" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"Tryck på valfri tangent för att gå in i REPL. Använd CTRL-D för att ladda om." +"\n" #: main.c msgid "Pretending to deep sleep until alarm, any key or file write.\n" -msgstr "" +msgstr "Fingerar djup sömn tills larm, valfri tangent eller filskrivning.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1956,7 +1958,7 @@ msgstr "Det gick inte att skriva till nvm." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "Det gick inte att skriva till sleep_memory." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2026,7 +2028,7 @@ msgstr "Ogiltigt Pull-värde." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "Uppdateringen misslyckades" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -2092,7 +2094,7 @@ msgstr "WiFi-lösenord måste vara mellan 8 och 63 tecken" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "Vaknade av larm.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" @@ -3061,7 +3063,7 @@ msgstr "max_length måste vara 0-%d när fixed_length är %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "max_length must be >= 0" -msgstr "" +msgstr "max_length måste vara >= 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3200,11 +3202,11 @@ msgstr "icke nyckelord arg efter nyckelord arg" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" -msgstr "" +msgstr "Icke-noll timeout måste vara > 0.01" #: shared-bindings/_bleio/Adapter.c msgid "non-zero timeout must be >= interval" -msgstr "" +msgstr "Icke-noll timeout måste vara >= intervall" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" @@ -3280,7 +3282,7 @@ msgstr "offset är för stor" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "offset måste vara >= 0" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3632,7 +3634,7 @@ msgstr "timeout måste vara 0.0-100.0 sekunder" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "timeout must be < 655.35 secs" -msgstr "" +msgstr "timeout måste vara < 655,35 sekunder" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" From 860c4d5af44f1fe89b975d9fc052f06af88bb137 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Mon, 28 Dec 2020 18:59:42 +0100 Subject: [PATCH 143/146] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 45 ++++++++++++++++++++++++------- locale/cs.po | 45 ++++++++++++++++++++++++------- locale/de_DE.po | 45 ++++++++++++++++++++++++------- locale/el.po | 38 +++++++++++++++++++++------ locale/es.po | 45 ++++++++++++++++++++++++------- locale/fil.po | 38 +++++++++++++++++++++------ locale/fr.po | 48 ++++++++++++++++++++++++++------- locale/hi.po | 38 +++++++++++++++++++++------ locale/it_IT.po | 38 +++++++++++++++++++++------ locale/ja.po | 45 ++++++++++++++++++++++++------- locale/ko.po | 45 ++++++++++++++++++++++++------- locale/nl.po | 55 ++++++++++++++++++++++++++++++-------- locale/pl.po | 45 ++++++++++++++++++++++++------- locale/pt_BR.po | 55 ++++++++++++++++++++++++++++++-------- locale/sv.po | 57 +++++++++++++++++++++++++++++++--------- locale/zh_Latn_pinyin.po | 45 ++++++++++++++++++++++++------- 16 files changed, 580 insertions(+), 147 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 14b038797e..45b35f1955 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Kode selesai berjalan. Menunggu memuat ulang.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -540,6 +544,18 @@ msgstr "Blok CBC harus merupakan kelipatan 16 byte" msgid "Call super().__init__() before accessing native object." msgstr "Panggil super().__init__() sebelum mengakses objek asli." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Tidak dapat mengatur CCCD pada Karakteristik lokal" @@ -576,6 +592,10 @@ msgstr "" "Tidak dapat menggunakan output di kedua channel dengan menggunakan pin yang " "sama" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Tidak dapat membaca tanpa pin MISO." @@ -623,6 +643,10 @@ msgstr "" "Tidak dapat membuat variasi frekuensi pada penghitung waktu yang sudah " "digunakan" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Tidak dapat menulis tanpa pin MOSI." @@ -1484,7 +1508,7 @@ msgstr "" "Hanya monokrom, 4bpp atau 8bpp yang diindeks, dan 16bpp atau lebih yang " "didukung: %d bpp diberikan" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1548,10 +1572,6 @@ msgstr "Pin harus mendukung interupsi perangkat keras" msgid "Pin number already reserved by EXTI" msgstr "Nomor pin sudah dipesan oleh EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1595,7 +1615,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3881,6 +3901,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Kode selesai berjalan. Menunggu memuat ulang.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "" #~ "Frekuensi yang ditangkap berada di atas kemampuan. Penangkapan Ditunda." diff --git a/locale/cs.po b/locale/cs.po index 7921c5a3bf..7ceb85db72 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Kód byl dokončen. Čekám na opětovné nahrání.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -538,6 +542,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -570,6 +586,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "" @@ -613,6 +633,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1462,7 +1486,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1524,10 +1548,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1568,7 +1588,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3839,6 +3859,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Kód byl dokončen. Čekám na opětovné nahrání.\n" + #~ msgid "" #~ "\n" #~ "To exit, please reset the board without " diff --git a/locale/de_DE.po b/locale/de_DE.po index 8f995b5e43..e481e52c1f 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -18,10 +18,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Der Code wurde ausgeführt. Warte auf reload.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -541,6 +545,18 @@ msgstr "CBC-Blöcke müssen ein Vielfaches von 16 Bytes sein" msgid "Call super().__init__() before accessing native object." msgstr "Rufe super().__init__() vor dem Zugriff auf ein natives Objekt auf." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "CCCD kann nicht auf lokales Merkmal eingestellt werden" @@ -574,6 +590,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Kann nicht beite Kanäle auf dem gleichen Pin ausgeben" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Kann ohne MISO-Pin nicht lesen." @@ -618,6 +638,10 @@ msgid "Cannot vary frequency on a timer that is already in use" msgstr "" "Die Frequenz eines bereits verwendeten Timers kann nicht variiert werden" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Kann nicht ohne MOSI-Pin schreiben." @@ -1485,7 +1509,7 @@ msgstr "" "Nur monochrome, indizierte 4bpp oder 8bpp, und 16bpp oder größere BMPs " "unterstützt: %d bpp wurden gegeben" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1547,10 +1571,6 @@ msgstr "Pin muss Hardware-Interrupts unterstützen" msgid "Pin number already reserved by EXTI" msgstr "PIN-Nummer bereits von EXTI reserviert" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1594,7 +1614,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3924,6 +3944,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Der Code wurde ausgeführt. Warte auf reload.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "" #~ "Die aufgezeichnete Frequenz liegt über der Leistungsgrenze. Aufnahme " diff --git a/locale/el.po b/locale/el.po index 0352e4735b..80aebe497c 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -19,7 +19,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -533,6 +539,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -565,6 +583,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "" @@ -608,6 +630,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1457,7 +1483,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1519,10 +1545,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1563,7 +1585,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c diff --git a/locale/es.po b/locale/es.po index 987f61e206..1e3e3be5b9 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -21,10 +21,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"El código terminó su ejecución. Esperando para recargar.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -547,6 +551,18 @@ msgstr "Los bloques CBC deben ser múltiplos de 16 bytes" msgid "Call super().__init__() before accessing native object." msgstr "Llame a super().__ init __() antes de acceder al objeto nativo." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "No se puede configurar CCCD en la característica local" @@ -581,6 +597,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "No se puede tener ambos canales en el mismo pin" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "No se puede leer sin pin MISO." @@ -624,6 +644,10 @@ msgstr "No se puede obtener inequívocamente sizeof escalar" msgid "Cannot vary frequency on a timer that is already in use" msgstr "No puede variar la frecuencia en un temporizador que ya está en uso" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "No se puede escribir sin pin MOSI." @@ -1486,7 +1510,7 @@ msgstr "" "Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o " "más: %d bpp proporcionados" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1550,10 +1574,6 @@ msgstr "El pin debe admitir interrupciones de hardware" msgid "Pin number already reserved by EXTI" msgstr "Número de pin ya reservado por EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1601,7 +1621,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3913,6 +3933,13 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "El código terminó su ejecución. Esperando para recargar.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "Frecuencia capturada por encima de la capacidad. Captura en pausa." diff --git a/locale/fil.po b/locale/fil.po index e808ff1dd2..09dcfad660 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -18,7 +18,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -539,6 +545,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -572,6 +590,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Hindi maaaring output ang mga parehong channel sa parehong pin" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Hindi maaring mabasa kapag walang MISO pin." @@ -615,6 +637,10 @@ msgstr "Hindi puedeng hindi sigurado ang get sizeof scalar" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Hindi maaring isulat kapag walang MOSI pin." @@ -1475,7 +1501,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1538,10 +1564,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1582,7 +1604,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c diff --git a/locale/fr.po b/locale/fr.po index 3c09a72864..0eac4c4b46 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -20,10 +20,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Fin d'exécution du code. En attente de rechargement.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -547,6 +551,18 @@ msgstr "Les blocs CBC doivent être des multiples de 16 octets" msgid "Call super().__init__() before accessing native object." msgstr "Appelez super () .__ init __ () avant d'accéder à l'objet natif." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Impossible de définir CCCD sur une caractéristique locale" @@ -582,6 +598,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Les 2 canaux de sortie ne peuvent être sur la même broche" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Impossible de lire sans broche MISO." @@ -627,6 +647,10 @@ msgid "Cannot vary frequency on a timer that is already in use" msgstr "" "Impossible de faire varier la fréquence sur une minuterie déjà utilisée" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Impossible d'écrire sans broche MOSI." @@ -1491,7 +1515,7 @@ msgstr "" "Prise en charge uniquement des monochromes, 4 bpp ou 8 bpp indexés et 16 bpp " "ou plus : %d bpp fournis" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1557,10 +1581,6 @@ msgstr "La broche doit prendre en charge les interruptions matérielles" msgid "Pin number already reserved by EXTI" msgstr "Numéro de broche déjà réservé par EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "PinAlarm pas encore implémenté" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1608,7 +1628,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3935,6 +3955,16 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Fin d'exécution du code. En attente de rechargement.\n" + +#~ msgid "PinAlarm not yet implemented" +#~ msgstr "PinAlarm pas encore implémenté" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "La fréquence capturée est au delà des capacités. Capture en pause." diff --git a/locale/hi.po b/locale/hi.po index 1f868b0966..5a75cf4017 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -19,7 +19,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -533,6 +539,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -565,6 +583,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "" @@ -608,6 +630,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1457,7 +1483,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1519,10 +1545,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1563,7 +1585,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 289d308af7..fe742d588c 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -18,7 +18,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -539,6 +545,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -572,6 +590,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Impossibile dare in output entrambi i canal sullo stesso pin" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Impossibile leggere senza pin MISO." @@ -616,6 +638,10 @@ msgstr "Impossibile ricavare la grandezza scalare di sizeof inequivocabilmente" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Impossibile scrivere senza pin MOSI." @@ -1480,7 +1506,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1547,10 +1573,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1592,7 +1614,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c diff --git a/locale/ja.po b/locale/ja.po index e8028ac059..dbab57219c 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -21,10 +21,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"コードの実行が完了しました。リロードを待っています。\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -544,6 +548,18 @@ msgstr "" "ネイティブオブジェクトにアクセスする前にsuper().__init__()を呼び出してくださ" "い" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "ローカルのCharacteristicにはCCCDを設定できません" @@ -576,6 +592,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "同じピン上の両チャネルに出力できません" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "MISOピンなしで読み込めません" @@ -619,6 +639,10 @@ msgstr "スカラのサイズを曖昧さなしに取得できません" msgid "Cannot vary frequency on a timer that is already in use" msgstr "使用中のタイマー上では周波数を変えられません" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "MOSIピンなしで書き込みできません" @@ -1474,7 +1498,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1537,10 +1561,6 @@ msgstr "ピンはハードウェア割り込みに対応していなければな msgid "Pin number already reserved by EXTI" msgstr "ピン番号はすでにEXTIによって予約されています" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1581,7 +1601,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3867,6 +3887,13 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "コードの実行が完了しました。リロードを待っています。\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "キャプチャした周波数は能力を超えています。キャプチャ停止" diff --git a/locale/ko.po b/locale/ko.po index 54c819770c..e0006f000e 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -20,10 +20,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"실행 완료 코드. 재장전 을 기다리는 중입니다\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -538,6 +542,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -570,6 +586,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "MISO핀이 없으면 읽을 수 없습니다" @@ -613,6 +633,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1462,7 +1486,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1524,10 +1548,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1568,7 +1588,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3840,6 +3860,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "실행 완료 코드. 재장전 을 기다리는 중입니다\n" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다" diff --git a/locale/nl.po b/locale/nl.po index bd5fcaff6d..57bd8cd0b3 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-23 20:14+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Code is uitgevoerd. Wachten op herladen.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -540,6 +544,18 @@ msgstr "CBC blocks moeten meervouden van 16 bytes zijn" msgid "Call super().__init__() before accessing native object." msgstr "Roep super().__init__() aan voor toegang native object." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Kan CCCD niet toewijzen aan lokaal Characteristic" @@ -573,6 +589,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Output van beide kanalen kan niet op dezelfde pin" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Kan niet lezen zonder MISO pin." @@ -617,6 +637,10 @@ msgstr "Kan niet ondubbelzinning sizeof scalar verkrijgen" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Kan de frequentie van een timer die al in gebruik is niet variëren" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Kan niet schrijven zonder MOSI pin." @@ -1479,7 +1503,7 @@ msgstr "" "Alleen monochrome en 4bpp of 8bpp, en 16bpp of grotere geïndiceerde BMP's " "zijn ondersteund: %d bpp is gegeven" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Slechts één alarm.time alarm kan worden ingesteld." @@ -1544,10 +1568,6 @@ msgstr "Pin moet hardware interrupts ondersteunen" msgid "Pin number already reserved by EXTI" msgstr "Pin nummer al gereserveerd door EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "PinAlarm nog niet geïmplementeerd" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1597,10 +1617,8 @@ msgstr "" "herstarten.\n" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" -"Simuleert diepe slaapstand tot alarm, een willekeurige toets of schrijven " -"naar bestand.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -3902,6 +3920,21 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Code is uitgevoerd. Wachten op herladen.\n" + +#~ msgid "PinAlarm not yet implemented" +#~ msgstr "PinAlarm nog niet geïmplementeerd" + +#~ msgid "Pretending to deep sleep until alarm, any key or file write.\n" +#~ msgstr "" +#~ "Simuleert diepe slaapstand tot alarm, een willekeurige toets of schrijven " +#~ "naar bestand.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "" #~ "De vastgelegde frequentie is boven de capaciteit. Vastleggen gepauzeerd." diff --git a/locale/pl.po b/locale/pl.po index 07c2df2aae..fe969af3d1 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -21,10 +21,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Kod wykonany. Czekam na przeładowanie.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -542,6 +546,18 @@ msgstr "Bloki CBC muszą być wielokrotnościami 16 bajtów" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -574,6 +590,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Nie można mieć obu kanałów na tej samej nóżce" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Nie można czytać bez nóżki MISO." @@ -617,6 +637,10 @@ msgstr "Wielkość skalara jest niejednoznaczna" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Nie można zmieniać częstotliwości timera, który jest już używany" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Nie można pisać bez nóżki MOSI." @@ -1473,7 +1497,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1535,10 +1559,6 @@ msgstr "Pin musi obsługiwać przerwania sprzętowe" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1579,7 +1599,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3859,6 +3879,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Kod wykonany. Czekam na przeładowanie.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "Uzyskana częstotliwość jest niemożliwa. Spauzowano." diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f66c88491c..beb5401a5f 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-22 18:07+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"O código concluiu a execução. Esperando pela recarga.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -548,6 +552,18 @@ msgstr "Os blocos CBC devem ter múltiplos de 16 bytes" msgid "Call super().__init__() before accessing native object." msgstr "Chame super().__init__() antes de acessar o objeto nativo." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Não é possível definir o CCCD com a característica local" @@ -582,6 +598,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Não é possível emitir os dois canais no mesmo pino" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Não é possível ler sem o pino MISO." @@ -626,6 +646,10 @@ msgstr "Não é possível obter inequivocamente o tamanho do escalar" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Não é possível variar a frequência em um timer que já esteja em uso" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Não é possível fazer a escrita sem um pino MOSI." @@ -1487,7 +1511,7 @@ msgstr "" "São compatíveis apenas os BMPs monocromáticos, indexados em 4bpp ou 8bpp e " "16bpp ou superior: determinado %d bpp" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Apenas um alarme alarm.time pode ser definido." @@ -1553,10 +1577,6 @@ msgstr "O pino deve ser compatível com as interrupções do hardware" msgid "Pin number already reserved by EXTI" msgstr "Número do PIN já está reservado através da EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "PinAlarm ainda não foi implementado" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1607,10 +1627,8 @@ msgstr "" "Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar.\n" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" -"Simular o deep sleep até o alarme, até qualquer chave ou até a escrita do " -"arquivo.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -3927,6 +3945,21 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "O código concluiu a execução. Esperando pela recarga.\n" + +#~ msgid "PinAlarm not yet implemented" +#~ msgstr "PinAlarm ainda não foi implementado" + +#~ msgid "Pretending to deep sleep until alarm, any key or file write.\n" +#~ msgstr "" +#~ "Simular o deep sleep até o alarme, até qualquer chave ou até a escrita do " +#~ "arquivo.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "" #~ "A frequência capturada está acima da capacidade. A captura está em pausa." diff --git a/locale/sv.po b/locale/sv.po index 9c2d30d068..0d17fc539c 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-28 17:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Koden har kört klart. Väntar på omladdning.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -540,6 +544,18 @@ msgstr "CBC-block måste vara multiplar om 16 byte" msgid "Call super().__init__() before accessing native object." msgstr "Anropa super().__init__() innan du använder det ursprungliga objektet." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Kan inte ställa in CCCD på lokal karaktäristik" @@ -573,6 +589,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Det går inte att mata ut båda kanalerna på samma pinne" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Kan inte läsa utan MISO-pinne." @@ -617,6 +637,10 @@ msgstr "Kan inte entydigt få sizeof scalar" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Det går inte att ändra frekvensen på en timer som redan används" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Kan inte skriva utan MOSI-pinne." @@ -1478,7 +1502,7 @@ msgstr "" "Endast monokrom, indexerad 4 bpp eller 8 bpp och 16 bpp eller högre BMP: er " "stöds: %d bpp angiven" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Endast ett alarm.time kan ställas in." @@ -1542,10 +1566,6 @@ msgstr "Pinnen måste stödja hårdvaruavbrott" msgid "Pin number already reserved by EXTI" msgstr "PInn-nummer redan reserverat av EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "PinAlarm är inte implementerat ännu" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1591,12 +1611,12 @@ msgstr "Prefixbufferten måste finnas på heap" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" -"Tryck på valfri tangent för att gå in i REPL. Använd CTRL-D för att ladda om." -"\n" +"Tryck på valfri tangent för att gå in i REPL. Använd CTRL-D för att ladda " +"om.\n" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" -msgstr "Fingerar djup sömn tills larm, valfri tangent eller filskrivning.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -3895,6 +3915,19 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Koden har kört klart. Väntar på omladdning.\n" + +#~ msgid "PinAlarm not yet implemented" +#~ msgstr "PinAlarm är inte implementerat ännu" + +#~ msgid "Pretending to deep sleep until alarm, any key or file write.\n" +#~ msgstr "Fingerar djup sömn tills larm, valfri tangent eller filskrivning.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "Infångningsfrekvens är för hög. Infångning pausad." diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 398d84a196..ff1d89a313 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -20,10 +20,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Dàimǎ yǐ wánchéng yùnxíng. Zhèngzài děngdài chóngxīn jiāzài.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -542,6 +546,18 @@ msgstr "CBC kuài bì xū shì 16 zì jié de bèi shù" msgid "Call super().__init__() before accessing native object." msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__()." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Wúfǎ jiāng CCCD shèzhì wéi běndì tèzhēng" @@ -574,6 +590,10 @@ msgstr "Nín wúfǎ sǎomiáo kuòzhǎn de, kě liánjiē de guǎnggào." msgid "Cannot output both channels on the same pin" msgstr "Wúfǎ shūchū tóng yīgè yǐn jiǎo shàng de liǎng gè píndào" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Wúfǎ dòu qǔ méiyǒu MISO de yǐn jiǎo." @@ -617,6 +637,10 @@ msgstr "Wúfǎ míngquè de huòdé biāoliàng de dàxiǎo" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Wúfǎ gēnggǎi yǐ zài shǐyòng de jìshí qì shàng de pínlǜ" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Wúfǎ xiě rù MOSI de yǐn jiǎo." @@ -1475,7 +1499,7 @@ msgstr "" "Jǐn zhīchí dān sè, suǒyǐn wéi 4bpp huò 8bpp yǐjí 16bpp huò gèng gāo de BMP: " "Gěi chū %d bpp" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1538,10 +1562,6 @@ msgstr "Yǐn jiǎo bìxū zhīchí yìngjiàn zhōngduàn" msgid "Pin number already reserved by EXTI" msgstr "Zhēn hào yǐ bèi EXTI bǎoliú" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1586,7 +1606,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3883,6 +3903,13 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Dàimǎ yǐ wánchéng yùnxíng. Zhèngzài děngdài chóngxīn jiāzài.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "Pínlǜ bǔhuò gāo yú nénglì. Bǔhuò zàntíng." From 62eb65e4017a2a3240aaa803e8a0813b41b3feab Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 29 Dec 2020 13:19:40 +0000 Subject: [PATCH 144/146] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (889 of 889 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index beb5401a5f..1d8819a699 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 23:04-0500\n" -"PO-Revision-Date: 2020-12-22 18:07+0000\n" +"PO-Revision-Date: 2020-12-29 16:08+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,19 +14,23 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"O código concluiu a sua execução.\n" #: main.c msgid "" "\n" "Code stopped by auto-reload.\n" msgstr "" +"\n" +"O código parou através do auto-reload.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -554,15 +558,18 @@ msgstr "Chame super().__init__() antes de acessar o objeto nativo." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "" +msgstr "O alarme só pode acontecer no RTC IO a partir do deep sleep." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" +"O alarme só pode acontecer em um pino com nível baixo enquanto os outros " +"alarmes só com nível alto a partir do deep sleep." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." msgstr "" +"O alarme só é possível nos dois pinos com sinal baixo a partir do deep sleep." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" @@ -582,7 +589,7 @@ msgstr "Não é possível excluir valores" #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" -msgstr "Não é possível obter pull enquanto está modo de saída" +msgstr "Não é possível obter (pull) enquanto estiver no modo saída" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" @@ -600,7 +607,7 @@ msgstr "Não é possível emitir os dois canais no mesmo pino" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "" +msgstr "Não é possível obter (pull) nos pinos somente de entrada." #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." @@ -648,7 +655,7 @@ msgstr "Não é possível variar a frequência em um timer que já esteja em uso #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." -msgstr "" +msgstr "Não é possível acordar (wake) no pino edge. Nível apenas." #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." @@ -1346,7 +1353,7 @@ msgstr "Nenhum DAC no chip" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "No DMA channel found" -msgstr "Nenhum canal DMA encontrado" +msgstr "Nenhum canal DMA foi encontrado" #: shared-module/adafruit_bus_device/I2CDevice.c #, c-format @@ -1629,6 +1636,8 @@ msgstr "" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +"Tentando entrar no deep sleep até o alarme, pressione CTRL-C ou grave o " +"arquivo.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -3107,7 +3116,7 @@ msgstr "o max_length deve ser 0-%d quando Fixed_length for %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "max_length must be >= 0" -msgstr "" +msgstr "max_length deve ser >= 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3248,11 +3257,11 @@ msgstr "um arg não-palavra-chave após a palavra-chave arg" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" -msgstr "" +msgstr "o tempo limite não zero deve ser > 0.01" #: shared-bindings/_bleio/Adapter.c msgid "non-zero timeout must be >= interval" -msgstr "" +msgstr "o tempo limite não zero deve ser >= intervalo" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" @@ -3684,7 +3693,7 @@ msgstr "o tempo limite deve ser entre 0.0 a 100.0 segundos" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "timeout must be < 655.35 secs" -msgstr "" +msgstr "o tempo limite deve ser < 655.35 seg" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" From 8666083bd0cf86d8509b4ba20ae4e2340cf6ca1b Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Tue, 29 Dec 2020 18:57:50 +0000 Subject: [PATCH 145/146] Translated using Weblate (French) Currently translated at 100.0% (889 of 889 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 89 +++++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 39 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 0eac4c4b46..1098170d79 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,26 +8,30 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 23:04-0500\n" -"PO-Revision-Date: 2020-12-08 19:21+0000\n" -"Last-Translator: Antonin ENFRUN \n" +"PO-Revision-Date: 2020-12-29 19:50+0000\n" +"Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"Exécution du code complété.\n" #: main.c msgid "" "\n" "Code stopped by auto-reload.\n" msgstr "" +"\n" +"Exécution du code arrêté par l'auto-rechargement.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -553,15 +557,19 @@ msgstr "Appelez super () .__ init __ () avant d'accéder à l'objet natif." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "" +msgstr "L'alarme peut seulement être depuis TRC IO depuis le someil profond." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" +"L'alarme peut seulement être sur une broche basse tandis que d'autres " +"alarment sont sur des broches hautes depuis le someil profond." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." msgstr "" +"L'alarme peut seulement être sur deux broches basses depuis le someil " +"profond." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" @@ -600,7 +608,7 @@ msgstr "Les 2 canaux de sortie ne peuvent être sur la même broche" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "" +msgstr "Ne peut tirer sur une broche d'entrée seule." #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." @@ -649,7 +657,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." -msgstr "" +msgstr "Ne peut reveillé sur le board de broche. Seuleument à niveau." #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." @@ -894,7 +902,7 @@ msgstr "Attendu une adresse" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" -msgstr "" +msgstr "Une alarme était prévue" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -986,7 +994,7 @@ msgstr "Filtre trop complexe" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "Image du microprogramme est invalide" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1045,7 +1053,7 @@ msgstr "I2SOut n'est pas disponible" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IOs 0, 2 & 4 ne supportent pas l'éleveuse interne en mode someil" #: shared-bindings/aesio/aes.c #, c-format @@ -1133,7 +1141,7 @@ msgstr "Fréquence de PWM invalide" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "Invalid Pin" -msgstr "" +msgstr "Broche invalide" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" @@ -1517,7 +1525,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "Seulement une alarme alarm.time peut être réglée." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1626,10 +1634,13 @@ msgstr "Le tampon de préfixe doit être sur le tas" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"Appuyez sur n'importe quelle touche pour utiliser le REPL. Utilisez CTRL-D " +"pour relancer.\n" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +"Feinte de someil profond jusqu'à l'alarme, Ctrl-C ou écriture au fichier.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1877,7 +1888,7 @@ msgstr "La largeur de la tuile doit diviser exactement la largeur de l'image" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "L'heure est dans le passé." #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -1996,7 +2007,7 @@ msgstr "Impossible d'écrire sur la mémoire non-volatile." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "Impossibilitée d'écriture à sleep_memory." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2067,7 +2078,7 @@ msgstr "Valeur de tirage 'pull' non supportée." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "Mise-à-jour échouée" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -2137,7 +2148,7 @@ msgstr "Le mot de passe WiFi doit faire entre 8 et 63 caractères" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "Réveil par alarme.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" @@ -2462,7 +2473,7 @@ msgstr "" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "output ne peut être projeté sans règle de projection" #: py/objtype.c msgid "cannot create '%q' instances" @@ -2640,7 +2651,7 @@ msgstr "end_x doit être un entier 'int'" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "epoch_time n'est pas supporté sur ce panneau" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -2922,11 +2933,11 @@ msgstr "l'entrée doit être un tenseur de rang 2" #: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "l'entrée doit être un ndarray" #: extmod/ulab/code/filter/filter.c msgid "input must be one-dimensional" -msgstr "" +msgstr "l'entrée doit être uni-dimensionelle" #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" @@ -2942,7 +2953,7 @@ msgstr "les vecteurs d'entrée doivent être de longueur égale" #: extmod/ulab/code/poly/poly.c msgid "inputs are not iterable" -msgstr "" +msgstr "les entrées ne sont pas itérables" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -3016,7 +3027,7 @@ msgstr "syntaxe invalide pour un nombre" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" -msgstr "" +msgstr "io doit être rtc io" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3118,11 +3129,11 @@ msgstr "max_length doit être 0-%d lorsque fixed_length est %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "max_length must be >= 0" -msgstr "" +msgstr "max_length doit être >= 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" -msgstr "" +msgstr "nombre maximal de dimensions est 4" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3258,15 +3269,15 @@ msgstr "argument non-nommé après argument nommé" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" -msgstr "" +msgstr "le délai non-zéro doit être > 0.01" #: shared-bindings/_bleio/Adapter.c msgid "non-zero timeout must be >= interval" -msgstr "" +msgstr "le délai non-zéro doit être >= interval" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" -msgstr "" +msgstr "norm est défini pour des tableaux 1D et 2D" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" @@ -3335,11 +3346,11 @@ msgstr "chaîne de longueur impaire" #: extmod/ulab/code/ulab_create.c msgid "offset is too large" -msgstr "" +msgstr "offset est trop large" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "offset doit être >= 0" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3365,11 +3376,11 @@ msgstr "les opérandes ne pouvaient pas être diffusés ensemble" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "opération implémentée que pour des tableaux 1D booléennes" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented for flattened array" -msgstr "" +msgstr "l'opération n'est pas implémentée pour un tableau applatit" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" @@ -3510,7 +3521,7 @@ msgstr "la longueur requise est %d mais l'objet est long de %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "résultats ne peuvent être transformé au type spécifié" #: py/compile.c msgid "return annotation must be an identifier" @@ -3532,7 +3543,7 @@ msgstr "rgb_pins[%d] n'est pas sur le même port que l'horloge" #: extmod/ulab/code/numerical/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "paramêtre roll doit être un ndarray" #: py/objstr.c msgid "rsplit(None,n)" @@ -3560,7 +3571,7 @@ msgstr "compilation de script non supportée" #: extmod/ulab/code/ndarray.c msgid "shape must be a tuple" -msgstr "" +msgstr "forme doit être un tuple" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3694,7 +3705,7 @@ msgstr "le délai doit être compris entre 0.0 et 100.0 secondes" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "timeout must be < 655.35 secs" -msgstr "" +msgstr "le délai (timeout) doit être < 655.35 secondes" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" @@ -3714,7 +3725,7 @@ msgstr "'timestamp' hors bornes pour 'time_t' de la plateforme" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "tobytes ne peut être appelé que pour des tableaux dense" #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" @@ -3735,7 +3746,7 @@ msgstr "trapz n'est défini que pour des tableaux 1D de longueur égale" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" -msgstr "" +msgstr "niveau du déclencheur doit être 0 ou 1" #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" @@ -3881,7 +3892,7 @@ msgstr "les vecteurs doivent avoir la même longueur" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" -msgstr "" +msgstr "conflit au réveil" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" @@ -3901,11 +3912,11 @@ msgstr "la fenêtre doit être <= intervalle" #: extmod/ulab/code/numerical/numerical.c msgid "wrong axis index" -msgstr "" +msgstr "index d'axe incorrecte" #: extmod/ulab/code/ulab_create.c msgid "wrong axis specified" -msgstr "" +msgstr "axe incorrecte spécifiée" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" From ffbe37b056ab87f32853ddd6009dea75db297df9 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Tue, 29 Dec 2020 20:35:58 +0000 Subject: [PATCH 146/146] Translated using Weblate (French) Currently translated at 100.0% (889 of 889 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 1098170d79..b88bf3b8b9 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 23:04-0500\n" -"PO-Revision-Date: 2020-12-29 19:50+0000\n" +"PO-Revision-Date: 2020-12-29 20:38+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -59,7 +59,7 @@ msgstr " sortie :\n" #: py/objstr.c #, c-format msgid "%%c requires int or char" -msgstr "%%c nécessite un entier 'int' ou un caractère 'char'" +msgstr "%%c nécessite un chiffre entier 'int' ou un caractère 'char'" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -74,7 +74,7 @@ msgstr "Échec de %q : %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" -msgstr "%q utilisé" +msgstr "%q en cours d'utilisation" #: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c @@ -114,19 +114,19 @@ msgstr "%q est hors de porté" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "PIN %q invalide" +msgstr "broche %q invalide" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" -msgstr "%q doit être un entier (int)" +msgstr "%q doit être un chiffre entier (int)" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" -msgstr "%q() prend %d arguments positionnels mais %d ont été donnés" +msgstr "%q() prend %d paramêtres positionnels mais %d ont été donnés" #: py/argcheck.c msgid "'%q' argument required" -msgstr "'%q' argument requis" +msgstr "paramêtre '%q' requis" #: py/runtime.c msgid "'%q' object cannot assign attribute '%q'" @@ -197,7 +197,7 @@ msgstr "'%s' attend un entier" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects at most r%d" -msgstr "'%s' s'attend au plus à r%d" +msgstr "'%s' attend au plus à r%d" #: py/emitinlinethumb.c #, c-format @@ -437,8 +437,8 @@ msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" -"Auto-chargement activé. Copiez simplement les fichiers en USB pour les " -"lancer ou entrez sur REPL pour le désactiver.\n" +"Auto-chargement activé. Copiez ou sauvegardez les fichiers via USB pour les " +"lancer ou démarrez le REPL pour le désactiver.\n" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" @@ -1602,7 +1602,7 @@ msgstr "" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" -msgstr "Ainsi que tout autre module présent sur le système de fichiers\n" +msgstr "Ainsi que tout autres modules présents sur le système de fichiers\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points"