summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-11-08stm32/mbedtls: Enable mbedtls certificate time validation.iabdalkader
This is a reimplementation of b560b9fe715e293caef80533d61d8c3b179b0339 for the stm32 port.
2022-11-08samd/boards/SEEED_WIO_TERMINAL: Enable using the 32kHz crystal.robert-hh
That was missing from the configuration.
2022-11-08samd/README: Update README to reflect recent changes to the port.robert-hh
Most of the content of README.md became obsolete and was replaced by the documentation of MicroPython. Instead, README.md now shows build instructions like the other ports.
2022-11-08docs/samd/pinout: Fix the pin numbering for the default assignments.robert-hh
It still used the 'old' pin numbers.
2022-11-08samd/mcu/samd51: Use an additional manifest.py for SAMD51 boards.robert-hh
Including the uasyncio scripts and the drivers for DHT, DS18x20 and onewire. The uasyncio scripts need about 8k of flash and are not included for the SAMD21 boards by default.
2022-11-08docs/library/machine: Add machine.memX to docs with brief example.Matt Trentini
2022-11-08py/objarray: Detect bytearray(str) without an encoding.Jim Mussared
This prevents a very subtle bug caused by writing e.g. `bytearray('\xfd')` which gives you `(0xc3, 0xbd)`. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-08py/builtinimport: Fix crash handling "weak link" module names.Simon Arlott
There are two calls to mp_builtin___import__(): 1. ports/unix/main.c:main_() which provides a str in args[0] 2. py/runtime.c:mp_import_name() which provides a qstr in args[0] The default implementation of mp_builtin___import__() is mp_builtin___import___default() which has a different implementation based on MICROPY_ENABLE_EXTERNAL_IMPORT. If MICROPY_ENABLE_EXTERNAL_IMPORT is disabled then the handling of weak links assumes that args[0] is a `const char *`, when it is either a str or qstr object. Use the existing qstr of the module name instead, and also use a vstr instead of strcpy() to ensure no overflow occurs.
2022-11-08shared/runtime/gchelper_native: Fix pointer cast on x86_64.Simon Arlott
gc_helper_collect_regs_and_stack() is casting a pointer to uint32_t; the variables involved are always pointers so it should be using uintptr_t.
2022-11-07webassembly/Makefile: Change compiler optimisation from O3 to Os.Damien George
Emscripten strongly advises the use of optimisation when compiling with ASYNCIFY enabled. Testing the difference betwen O3 and Os for various configurations gives: flags firmware.wasm micropython.js perf -O3 -s ASYNCIFY 1342003 212845 0 (baseline) -O3 -s ASYNCIFY -s WASM=0 - 7064750 -30% -O3 367131 196569 +140% -O3 -s WASM=0 - 2818260 +30% -Os -s ASYNCIFY 1135450 213064 +40% -Os -s ASYNCIFY -s WASM=0 - 6239768 -30% -Os 295028 196569 +180% -Os -s WASM=0 - 2271358 +30% The first row is prior to this commit. The second and third columns show firmware size (add them to get the total size). The fourth column shows the approximate change in performance compared to the baseline. The performance was measured using run-perfbench.py and the error was large, up to 20%, although general trends in the change in performance could still be seen. In summary, using using Os instead of O3 makes it a little bit faster in all cases, and smaller output (wasm/js) in all cases. Signed-off-by: Damien George <damien@micropython.org>
2022-11-07webassembly/README: Update README to describe new stdout behaviour.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-11-07webassembly: Dispatch micropython-print via document not mp_js_stdout.Nicholas H.Tollervey
2022-11-03webassembly: Support piping in a program on stdin.Damien George
The performance benchmark suite can now be run on the webassembly port. Signed-off-by: Damien George <damien@micropython.org>
2022-11-03webassembly: Change "stack" argument to "heapsize".Damien George
Because that's what mp_js_init() takes as its argument. Signed-off-by: Damien George <damien@micropython.org>
2022-11-03webassembly: Use Date's now() instead of getTime().Damien George
Using now() is a bit faster because it doesn't need to create a new Date. Signed-off-by: Damien George <damien@micropython.org>
2022-11-03github/workflows: Print test failures for webassembly workflow.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-11-03tests/run-perfbench: Support --heapsize argument and pass to executable.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-11-02tools/makemanifest.py: Fix printing of mpy_cross.CrossCompileError.Damien George
This change was missed by 5852fd7708d02d6ca85e4a5ed01d8263e3962631 Signed-off-by: Damien George <damien@micropython.org>
2022-11-01webassembly: Add support for VFS and enable VFS_POSIX.Damien George
This gets filesystem support working. Signed-off-by: Damien George <damien@micropython.org>
2022-11-01webassembly/mpconfigport: Use MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES.Damien George
This simplifies the config file. This is not a no-op, it does enable a few new features to bring the port in line with this config level. Signed-off-by: Damien George <damien@micropython.org>
2022-11-01extmod/vfs_posix: Include errno.h and unistd.h headers.Damien George
errno.h is needed for the errno variable, and unistd.h is needed for chdir. Signed-off-by: Damien George <damien@micropython.org>
2022-10-31tools/mpremote: Make RemoteFile objects iterable.Damien George
So that filesystems mounted with "mpremote mount" can have their files iterated over, making them consistent with other files. Signed-off-by: Damien George <damien@micropython.org>
2022-10-31tools/mpremote: Handle FileNotFound exceptions in listdir.Jim Mussared
The except handler for OSError didn't include the line that actually calls os.listdir, so an invalid path wasn't handled correctly. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-31esp32/machine_pwm: Verify PWM is active when config methods are called.robert-hh
Checks are added for pwm.freq(), pwm_duty(), pwm_duty_u10() and pwm.duty_u16(). This avoids a core dump on ESP32C3, and misleading error messages on Xtensa ESP32 devices.
2022-10-31esp32/machine_pin: Fix size of machine_pin_irq_handler array.Ihor Nehrutsa
Set the size of machine_pin_irq_handler array to GPIO_NUM_MAX: - Min GPIO_NUM_MAX is 22 for IDF_TARGET_ESP32C3. - Max GPIO_NUM_MAX is 49 for IDF_TARGET_ESP32S3. The MP_REGISTER_ROOT_POINTER entry must be hard-coded, because the location that it's evaluated by the compiler does not include the relevant IDF header to get a definition of GPIO_NUM_MAX.
2022-10-28esp32/machine_i2c: Fix clocks and timeouts for ESP32-C3, ESP32-S3.Mark Grosen
Each SoC family has its own clocks and timings/timeouts. For I2C, the default source clock is either APB (ESP32, ESP32-S2) or XTAL (ESP32-S3, ESP32-C3) as shown in the datasheets. Since machine_i2c.c/machine_hw_i2c_init() uses the default clk_flags (0), the alternate low-power clock source is never selected in ESP-IDF i2c.c/i2c_param_config(). There is not an API in i2c.c to get the source clock frequency, so a compile-time value is used based on SoC family. Also, the maximum timeout is different across the SoC families, so use the I2C_LL_MAX_TIMEOUT constant to eliminate the warning from i2c_set_timeout(). With these changes, the following results were obtained. The I2C SCL frequencies were measured with a Saleae logic analyzer. ESP32 (TTGO T Dislay) I2C(0, scl=22, sda=21, freq=101781) Measured: 100KHz I2C(0, scl=22, sda=21, freq=430107) Measured: 400KHz I2C(0, scl=22, sda=21, freq=1212121) Measured: 941KHz ESP32-S3 (TTGO T-QT) I2C(0, scl=34, sda=33, freq=111111) Measured: 107KHz I2C(0, scl=34, sda=33, freq=444444) Measured: 400KHz I2C(0, scl=34, sda=33, freq=1111111) Measured: 842KHz ESP32-C3 (XIAO ESP32C3) I2C(0, scl=7, sda=6, freq=107816) Measured: 103KHz I2C(0, scl=7, sda=6, freq=444444) Measured: 380KHz I2C(0, scl=7, sda=6, freq=1176470) Measured: 800KHz (ESP32-S2 board was not available for testing.)
2022-10-27samd/machine_timer: Use extmod version of machine.Timer.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-10-27renesas-ra/machine_timer: Use extmod version of machine.Timer.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-10-27mimxrt/machine_timer: Use extmod version of machine.Timer.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-10-27extmod/machine_timer: Move stm32's implementation of machine.Timer here.Damien George
So it can be reused by other ports. Signed-off-by: Damien George <damien@micropython.org>
2022-10-27nrf: Rename MICROPY_PY_MACHINE_TIMER to MICROPY_PY_MACHINE_TIMER_NRF.Damien George
So that it doesn't clash with the extmod version. Also make the default for this enabled, so that most boards do not need to configure it. Signed-off-by: Damien George <damien@micropython.org>
2022-10-27mimxrt/machine_timer: Use soft-timer implementation for machine.Timer.robert-hh
This releases the hardware timers for other tasks, which need a higher resolution and faster response. And it is less port-specific code.
2022-10-27mimxrt: Fix CPU freeze when calling __WFE() in MICROPY_EVENT_POLL_HOOK.robert-hh
This issue affected i.MX RT 1052, 1062 and 1064. It seems to be addressed by Errata ERR006223, which also mentions i.MX RT101x and 102x, but these devices worked well even without the change. As a side effect, the current consumption at an idle REPL drops significantly with this fix. Fixes issue #7235.
2022-10-27mimxrt/machine_pin: Add the Pin.toggle() method.robert-hh
For consistency with other ports, even if this method is undocumented at the moment.
2022-10-27py/makeversionhdr: Fall back to py/mpconfig.h instead of docs/conf.py.Damien George
Commit 64af916c111b61bce82c00f356a6b1cb81946d87 removed the version string from docs/conf.py. py/mpconfig.h is a better place to get the version from, so use that (when there is no git repository). Signed-off-by: Damien George <damien@micropython.org>
2022-10-26docs/samd: Add documentation for the samd port.robert-hh
Includes a general overview, a quickref, pinout tables, and the beginnings of a tutorial.
2022-10-26docs/templates/layout.html: Indicate latest vs release docs.Jim Mussared
When looking at latest (the default for docs.micropython.org), make it clear that this isn't the release version. - Changes the version in the top-left to "latest". - Adds a message to the top of each page to explain. For future release versions, add a short message to link to the latest version. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-26py/obj: Add comments explaining the slot index scheme.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-25samd/modmachine: Add machine.softreset().robert-hh
For consistency with other ports.
2022-10-25samd/machine_spi: Register SerCom objects as root pointers.robert-hh
Protect SerCom (UART, SPI, I2C) objects from getting freed by the GC when they go out of scope without being deinitialized. Otherwise the ISR of a Sercom may access an invalid data structure.
2022-10-25samd/machine_spi: Implement spi.deinit() and simplify sercom_deinit_all.robert-hh
The sercom_deinit_all() function does not need the object pointers.
2022-10-25samd/machine_uart: Use a finaliser to tidy up UART on soft reset.robert-hh
And use the common sercom_table, saving a few bytes of RAM.
2022-10-25samd/machine_pwm: Serialize fast update of PWM settings.robert-hh
Any update of freq or duty_cycle requires the previous PWM cycle to be finished. Otherwise the new settings are not accepted. Other changes in this commit: - Report the set duty cycles even when the PWM is not yet started. - pwm.freq(0) stops the pwm device, instead of raising an expception. - Clear the duty cycle value cache on soft reset.
2022-10-25samd/boards: Rework the pins.csv files.robert-hh
Changes are: - Remove the LED_Pxxx definitions from pins.csv, now that the LED class is gone. - Remove the '-' lines. - Add default lines for USB and SWCLK, SWDIO.
2022-10-25samd/modmachine: Replace the LED class by the Signal class.robert-hh
It simplifies and improves the code. The LED_Pxxx lines of the board.csv lines can still be used, but will be taken as Pin definitions.
2022-10-25samd: Make ADC, DAC, PWM, SPI objects consistent in how they print out.robert-hh
All of ADC, DAC, Pin, PWM and SPI looked different before this change.
2022-10-25samd/machine_pin: Change the pin handling and naming/numbering.robert-hh
Pin numbers are now the MCU port numbers in the range: PA0..PA31: 0..31 PB0..PB31: 32..63 PC0..PC31: 64..95 PD0..PD31: 96..127 Pins can be denoted by the GPIO port number, the name as defined in pins.csv or a string in the form Pxnn, like "PA16" or "PD03". The pins.c and pins.h files are now obsolete. The pin objects are part of the AF table. As result of a simplification, the code now supports using pin names or numbers instead of pin objects for modules like UART, SPI, PWM, I2C, ADC, pininfo.
2022-10-25samd/boards/SEEED_WIO_TERMINAL: Declare more pins for SEEED WIO board.robert-hh
Defining all pins from the external 40 Pin connector, and some internal pins like the one for SD and LCD.
2022-10-25samd/clock_config: Extend the SAMD51 us-counter to 60 bit.robert-hh
This removes the difference in the time.ticks_us() range between SAMD21 and SAMD51. The function mp_hal_ticks_us_64() is added and used for: - SAMD51's mp_hal_ticks_us and mp_hal_delay_us(). For SAMD21, keep the previous methods, which are faster. - mp_hal_ticks_ms() and mp_hal_tick_ms_64(), which saves some bytes and removes a potential race condition every 50 days. Also set the us-counter for SAMD51 to 16 MHz for a faster reading of the microsecond value. Note: With SAMD51, mp_hal_ticks_us_64() has a 60 bit range only, which is still a long time (~36000 years).
2022-10-25samd/machine_rtc: Add the machine.RTC class.robert-hh
Methods implemented are: - rtc.init(date) - rtc.datetime([new_date]) - rtc.calibration(value) The presence of this class can be controlled by MICROPY_PY_MACHINE_RTC. If the RTC module is used, the time module uses the RTC as well. For boards without a 32kHz crystal, using RTC makes no sense, since it will then use the ULP32K oscillator, which is not precise at all. Therefore, it will by default only be enabled for boards using a crystal, but can be enabled in the respective mpconfigboard.h.