aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-02-13stm32: Factor out flash and SPI block-device code to separate files.Damien George
Prior to this patch, storage.c was a combination of code that handled either internal flash or external SPI flash and exposed one of them as a block device for the local storage. It was also exposed to the USB MSC. This patch splits out the flash and SPI code to separate files, which each provide a general block-device interface (at the C level). Then storage.c just picks one of them to use as the local storage medium. The aim of this factoring is to allow to add new block devices in the future and allow for easier configurability.
2018-02-13stm32/boards: Update all boards to work with new USB configuration.Damien George
2018-02-13lib/utils/pyexec: Update to work with new MICROPY_HW_ENABLE_USB option.Damien George
2018-02-13stm32: Introduce MICROPY_HW_ENABLE_USB and clean up USB config.Damien George
This patch allows to completely compile-out support for USB, and no-USB is now the default. If a board wants to enable USB it should define: #define MICROPY_HW_ENABLE_USB (1) And then one or more of the following to select the USB PHY: #define MICROPY_HW_USB_FS (1) #define MICROPY_HW_USB_HS (1) #define MICROPY_HW_USB_HS_IN_FS (1)
2018-02-13stm32/timer: Support MCUs that don't have TIM4 and/or TIM5.Damien George
2018-02-13stm32/spi: Further updates to use newer versions of HAL names.Damien George
2018-02-13stm32: Update HAL macro and constant names to use newer versions.Damien George
Newer versions of the HAL use names which are cleaner and more self-consistent amongst the HAL itself. This patch switches to use those names in most places so it is easier to update the HAL in the future.
2018-02-12stm32/usbdev: Fix USBD setup request handler to use correct recipient.Damien George
Prior to this patch the USBD driver did not handle the recipient correctly for setup requests. It was not interpreting the req->wIndex field in the right way: in some cases this field indicates the endpoint number but the code was assuming it always indicated the interface number. This patch fixes this. The only noticeable change is to the MSC interface, which should now correctly respond to the USB_REQ_CLEAR_FEATURE request and hence unmount properly from the host when requested.
2018-02-09stm32/boards: Remove all config options that are set to defaults.Damien George
mpconfigboard_common.h now sets the defaults so there is no longer a need to explicitly list all configuration options in a board's mpconfigboard.h file.
2018-02-09stm32: Add mpconfigboard_common.h with common/default board settings.Damien George
This file mirrors py/mpconfig.h but for board-level config options. It provides a default configuration, to be overridden by a specific mpconfigboard.h file, as well as setting up certain macros to automatically configure a board.
2018-02-08py/objfloat: Fix case of raising 0 to -infinity.Damien George
It was raising an exception but it should return infinity.
2018-02-08py/parsenum: Fix parsing of floats that are close to subnormal.Damien George
Prior to this patch, a float literal that was close to subnormal would have a loss of precision when parsed. The worst case was something like float('10000000000000000000e-326') which returned 0.0.
2018-02-08py/vm: Simplify stack sentinel values for unwind return and jump.Damien George
This patch simplifies how sentinel values are stored on the stack when doing an unwind return or jump. Instead of storing two values on the stack for an unwind jump it now stores only one: a negative small integer means unwind-return and a non-negative small integer means unwind-jump with the value being the number of exceptions to unwind. The savings in code size are: bare-arm: -56 minimal x86: -68 unix x64: -80 unix nanbox: -4 stm32: -56 cc3200: -64 esp8266: -76 esp32: -156
2018-02-08.travis.yml,ports/unix/Makefile: Add coverage test for script via stdin.Damien George
2018-02-08tests/unix: Add coverage test for calling mp_obj_new_bytearray.Damien George
2018-02-07py/modbuiltins: For builtin_chr, use uint8_t instead of char for array.Damien George
The array should be of type unsigned byte because that is the type of the values being stored. And changing to uint8_t helps to prevent warnings from some static analysers.
2018-02-07tests/basics: Rename remaining tests that are for built-in functions.Damien George
For consistency with all of the other tests that are named builtin_XXX.py.
2018-02-07py/objtype: Check and prevent delete/store on a fixed locals map.Damien George
Note that the check for elem!=NULL is removed for the MP_MAP_LOOKUP_ADD_IF_NOT_FOUND case because mp_map_lookup will always return non-NULL for such a case.
2018-02-05stm32/main: Remove need for first_soft_reset variable.Damien George
2018-02-05stm32/main: Reorder some init calls to put them before soft-reset loop.Damien George
The calls to rtc_init_start(), sdcard_init() and storage_init() are all guarded by a check for first_soft_reset, so it's simpler to just put them all before the soft-reset loop, without the check. The call to machine_init() can also go before the soft-reset loop because it is only needed to check the reset cause which can happen once at the first boot. To allow this to work, the reset cause must be set to SOFT upon a soft-reset, which is the role of the new function machine_deinit().
2018-02-05stm32/rtc: Add compile-time option to set RTC source as LSE bypass.Damien George
To use the LSE bypass feature (where an external source provides the RTC clock) a board must set the config variable MICROPY_HW_RTC_USE_BYPASS.
2018-02-05stm32/rtc: Fix RTC init to use LSI if LSI is already selected on boot.Damien George
Upon boot the RTC early-init function should detect if LSE or LSI is already selected/running and, if so, use it. When the LSI has previously (in the previous reset cycle) been selected as the clock source the only way to reliably tell is if the RTCSEL bits of the RCC_BDCR are set to the correct LSI value. In particular the RCC_CSR bits for LSI control do not indicate if the LSI is ready even if it is selected. This patch removes the check on the RCC_CSR bits for the LSI being on and ready and only uses the check on the RCC_BDCR to see if the LSI should be used straightaway. This was tested on a PYBLITEv1.0 and with the patch the LSI persists correctly as the RTC source as long as the backup domain remains powered.
2018-02-05stm32/rtc: Fix rtc_info flags when LSE fails and falls back to LSI.Damien George
Previously, if LSE is selected but fails and the RTC falls back to LSI, then the rtc_info flags would incorrectly state that LSE is used. This patch fixes that by setting the bit in rtc_info only after the clock is ready.
2018-02-05stm32/spi: Accept machine.SPI object in spi_from_mp_obj() function.Damien George
Also, change ValueError to TypeError if the argument to this function is not of an SPI type.
2018-02-05drivers/cc3200: Update to work with new stm32 SPI API.Damien George
2018-02-05stm32: Update LCD and network drivers to work with new SPI API.Damien George
2018-02-05stm32/spi: Provide better separation between SPI driver and uPy objs.Damien George
There is an underlying hardware SPI driver (built on top of the STM HAL) and then on top of this sits the legacy pyb.SPI class as well as the machine.SPI class. This patch improves the separation between these layers, in particular decoupling machine.SPI from pyb.SPI.
2018-02-04py/compile: Combine compiler-opt of 2 and 3 tuple-to-tuple assignment.Damien George
This patch combines the compiler optimisation code for double and triple tuple-to-tuple assignment, taking it from two separate if-blocks to one combined if-block. This can be done because the code for both of these optimisations has a lot in common. Combining them together reduces code size for ports that have the triple-tuple optimisation enabled (and doesn't change code size for ports that have it disabled).
2018-02-02stm32/i2c: Allow I2C peripheral state to persist across a soft reset.Damien George
The I2C sub-system is independent from the uPy state (eg the heap) and so can safely persist across a soft reset.
2018-02-02stm32/spi: Allow SPI peripheral state to persist across a soft reset.Damien George
The SPI sub-system is independent from the uPy state (eg the heap) and so can safely persist across a soft reset. And this is actually necessary for drivers that rely on SPI and that also need to persist across soft reset (eg external SPI flash memory).
2018-02-02stm32/rng: Simplify RNG implementation by accessing raw peripheral regs.Damien George
It saves code size and RAM, and is more efficient to execute.
2018-02-02stm32/spi: Add support for a board naming SPI peripherals 4, 5 and 6.Damien George
2018-02-02stm32/i2c: Use macros instead of magic numbers for I2C speed grades.liamkinne
2018-02-01stm32/usbdev: Add support for high-speed USB device mode.Damien George
This patch adds support in the USBD configuration and CDC-MSC-HID class for high-speed USB mode. To enable it the board configuration must define USE_USB_HS, and either not define USE_USB_HS_IN_FS, or be an STM32F723 or STM32F733 MCU which have a built-in HS PHY. High-speed mode is then selected dynamically by passing "high_speed=True" to the pyb.usb_mode() function, otherwise it defaults to full-speed mode. This patch has been tested on an STM32F733.
2018-02-01stm32/usb: Allow board to select which USBD is used as the main one.Damien George
By defining MICROPY_HW_USB_MAIN_DEV a given board can select to use either USB_PHY_FS_ID or USB_PHY_HS_ID as the main USBD peripheral, on which the REPL will appear. If not defined this will be automatically configured.
2018-02-01docs/library/pyb.rst: Add note about availability of USB MSC-only mode.Damien George
2018-02-01stm32/usbdev: Add support for MSC-only USB device class.Damien George
Select this mode in boot.py via: pyb.usb_mode('MSC')
2018-02-01stm32/sdcard: Use maximum speed SDMMC clock on F7 MCUs.Damien George
This will get the SDMMC clock up to 48MHz.
2018-02-01stm32/sdcard: Only define IRQ handler if using SDMMC1 peripheral.Damien George
So that the IRQ can be used by other peripheral drivers if needed.
2018-02-01stm32/modmachine: In freq(), select flash latency value based on freq.Damien George
2018-02-01stm32: Improve support for STM32F722, F723, F732, F733 MCUs.Damien George
2018-02-01stm32/can: Support MCUs without a CAN2 peripheral.Damien George
2018-02-01stm32/usbdev: Combine all str descriptor accessor funcs into one func.Damien George
There's no need to have these as separate functions, they just take up unnecessary code space and combining them allows to factor common code, and also allows to support arbitrary string descriptor indices.
2018-02-01stm32/usbdev: Reduce dependency on py header files.Damien George
2018-02-01stm32/sdcard: Make SD wait routine more power efficient by using WFI.Damien George
Using WFI allows the CPU to sleep while it is waiting, reducing power consumption.
2018-02-01stm32/spi: Make SPI DMA wait routine more power efficient by using WFI.Damien George
The routine waits for the DMA to finish, which is signalled from a DMA IRQ handler. Using WFI makes the CPU sleep while waiting for the IRQ to arrive which decreases power consumption. To make it work correctly the check for the change in state must be atomic and so IRQs must be disabled during the check. The key feature of the Cortex MCU that makes this possible is that WFI will exit when an IRQ arrives even if IRQs are disabled.
2018-01-31drivers/sdcard: Update doc for ESP8266 to use correct SPI number.Hemanth kumar
machine.SPI(0) results in ValueError on ESP8266. SPI(1) is the user hardware SPI port (or use SPI(-1) for software SPI).
2018-01-31minimal/README: Update text to better describe what "make run" does.Damien George
2018-01-31esp32/machine_uart: Fix check of UART id so it only allows valid UARTs.Damien George
2018-01-31.gitmodules: Use https URL for lwIP submodule.Damien George
HTTPS is supported by Savannah and better to be secure than not.