Commit Graph

1229 Commits

Author SHA1 Message Date
Damien George
0c12adca46 stm32/boards/USBDONGLE_WB55: Add definition files for new board. 2019-07-17 17:00:34 +10:00
Damien George
d2a8fb747f stm32/boards/NUCLEO_WB55: Add definition files for new board. 2019-07-17 17:00:34 +10:00
Damien George
9849567a06 stm32/boards: Add MCU support files for STM32WB55. 2019-07-17 16:50:42 +10:00
Damien George
59b7166d87 stm32: Add initial support for STM32WBxx MCUs.
This new series of MCUs is similar to the L4 series with an additional
Cortex-M0 coprocessor.  The firmware for the wireless stack must be managed
separately and MicroPython does not currently interface to it.  Supported
features so far include: RTC, UART, USB, internal flash filesystem.
2019-07-17 16:33:31 +10:00
Damien George
d42392b9a7 stm32/make-stmconst.py: Allow more variation in parens and int-suffix L. 2019-07-17 16:27:17 +10:00
Damien George
02b2ad4fbd stm32/boards/STM32F769DISC: Fix length of FLASH_APP section.
Fixes issue #4924.
2019-07-17 16:19:50 +10:00
Damien George
baea43bba7 stm32/boards/B_L072Z_LRWAN1: Enable USB VCP support. 2019-07-16 14:50:44 +10:00
Damien George
64aebca155 stm32/Makefile: Allow a board to disable float support.
By using "MICROPY_FLOAT_IMPL = none" in its mpconfigboard.mk file.
2019-07-16 14:47:32 +10:00
Damien George
102d9911e9 stm32/mphalport: Fix GPIO clock enable for L0 MCUs. 2019-07-16 14:47:12 +10:00
Damien George
4096fa397b stm32/powerctrlboot: Increase SYSCLK to 32MHz for L0 MCUs. 2019-07-16 14:46:31 +10:00
Damien George
4c1ad1f691 stm32: Add support for USB on L0 MCUs. 2019-07-16 14:45:53 +10:00
Damien George
788e7f50f2 stm32/usbd_cdc_interface: Make CDC TX/RX buffer sizes configurable. 2019-07-16 14:41:59 +10:00
Damien George
f302f784e9 stm32/usb: Add config options to disable USB MSC and/or HID.
The new configurations MICROPY_HW_USB_MSC and MICROPY_HW_USB_HID can be
used by a board to enabled or disable MSC and/or HID.  They are both
enabled by default.
2019-07-16 14:39:21 +10:00
Damien George
fd49fcb229 stm32/gccollect: Always use MP_STATE_THREAD(stack_top) to get stack top.
In a non-thread build, using &_ram_end as the top-of-stack is no longer
correct because the stack is not always at the very top end of RAM.  See
eg 04c7cdb668 and
3786592097.  The correct value to use is
&_estack, which is the value stored in MP_STATE_THREAD(stack_top), and
using the same code for both thread and non-thread builds makes the code
cleaner.
2019-07-11 17:32:01 +10:00
Paul m. p. P
a1c870e9f4 javascript: Enable support for frozen bytecode via FROZEN_MPY_DIR. 2019-07-09 13:17:15 +10:00
Paul m. p. P
42d30c5baf unix/unix_mphal: Include time.h for CLOCK_MONOTONIC. 2019-07-09 13:05:59 +10:00
Damien George
a17b901a9e stm32/boards/B_L072Z_LRWAN1: Add definition files for new board. 2019-07-09 12:54:09 +10:00
Damien George
278e9bffe9 stm32/mboot: Update dependencies to enable parallel build with -j. 2019-07-09 11:46:47 +10:00
Damien George
342539bdcc stm32/mboot: Use STARTUP_FILE from stm32lib. 2019-07-09 11:35:47 +10:00
Damien George
5a81d2d6b8 stm32/mboot: Remove use of BSRRL/H for H7 MCUs due to stm32lib update. 2019-07-09 11:34:54 +10:00
Damien George
c8f19f1371 stm32/mboot: Make _estack an array to avoid compiler warnings.
The compiler can warn about out-of-bounds array access if _estack is just a
single uint8_t.
2019-07-09 11:33:57 +10:00
Damien George
d43dd886a5 stm32/boards/NUCLEO_F413ZH: Remove STARTUP_FILE, it's defined globally.
The Makefile now defines this variable to the correct value (but it can
still be overridden by a board if necessary).
2019-07-09 11:32:12 +10:00
Chris Mason
c24d81119c stm32/boards/NUCLEO_L452RE: Add definition files for new board. 2019-07-08 16:50:45 +10:00
Chris Mason
64181b5f76 stm32: Add support for STM32L452 MCUs. 2019-07-08 16:50:19 +10:00
Damien George
eea61a09c4 stm32/boards/NUCLEO_F446RE: Enable DAC. 2019-07-08 16:08:40 +10:00
Damien George
5fd62c8992 stm32: Remove SystemInit funcs, use stm32lib versions instead.
stm32lib now provides system_stm32XXxx.c source files for all MCU variants,
which includes SystemInit and prescaler tables.  Since these are quite
standard and don't need to be changed, switch to use them instead of custom
variants, making the start-up code cleaner.

The SystemInit code in stm32lib was checked and is equivalent to what is
removed from the stm32 port in this commit.
2019-07-08 15:23:53 +10:00
Damien George
c15dc2c4b9 stm32/powerctrl: Move F0's SystemClock_Config to powerctrlboot.c. 2019-07-08 15:23:53 +10:00
Damien George
21ecf8be5f stm32/powerctrl: Move L0's SystemClock_Config to powerctrlboot.c file. 2019-07-08 15:23:53 +10:00
Damien George
7c2e83324b stm32/boards/NUCLEO_L073RZ: Add definition files for new board. 2019-07-05 17:28:54 +10:00
Damien George
6053e450b8 stm32/mpconfigport.h: Make "framebuf" module configurable by a board. 2019-07-05 17:26:49 +10:00
Damien George
9c096c190c stm32/boards: Add MCU support files for STM32L072. 2019-07-05 17:26:03 +10:00
Damien George
23d9c6a0fd stm32: Add initial support for STM32L0xx MCUs. 2019-07-05 17:24:59 +10:00
Eric Poulsen
fa5c0b819c esp32/network_ppp: Add ppp_set_usepeerdns(pcb, 1) when init'ing iface.
Without this you often don't get any DNS server from your network provider.
Additionally, setting your own DNS _does not work_ without this option set
(which could be a bug in the PPP stack).
2019-07-04 11:17:41 +10:00
Damien George
c1a8c7fc09 stm32/boards/PYBD_SFx: Automatically turn on EN_3V3 when powering SD/MMC 2019-07-04 11:11:11 +10:00
Damien George
7f33f158b9 stm32/sdcard: Add hook for a board to power on SD/MMC. 2019-07-04 11:10:54 +10:00
Damien George
1cd2bc066d stm32/boards/PYBD_SFx: Configure EN_3V3 pin as output on boot.
But leave it turned off, the application must turn it on if/when needed.
2019-07-04 11:03:10 +10:00
Damien George
afb2e9dd94 stm32/modmachine: Disable IRQs before entering bootloader.
To make sure that the code that enters the bootloader is not interrupted.
2019-07-04 10:49:51 +10:00
Damien George
04da8864e5 stm32/lwip_inc: Define LWIP_NO_CTYPE_H=1 to use lwIP ctype funcs. 2019-07-04 10:36:51 +10:00
Damien George
592f68449d stm32/mpu: Include MPU functions when ETH is enabled. 2019-07-03 23:50:34 +10:00
Damien George
7cf8285ac8 stm32/boards: Remove startup_stm32*.s files now they are in stm32lib. 2019-07-03 23:44:17 +10:00
Damien George
6b6403ce76 stm32/Makefile: Use startup_stm32*.s file from stm32lib.
This means that each MCU now gets a unique IRQ table, eg a specific one for
STM32F405, STM32F411, etc rather than just STM32F4xx.
2019-07-03 23:42:36 +10:00
Damien George
241e577753 stm32/Makefile: Remove Wno-attributes for ll_usb HAL file.
This HAL file is now patched so it doesn't have these warnings.
2019-07-03 23:41:33 +10:00
Damien George
73e8b7e0e4 stm32: Update components to work with new H7xx HAL. 2019-07-03 23:40:49 +10:00
Damien George
3581deec81 stm32/boards/PYBD_SF2: Put mbedtls library code in external QSPI flash.
mbedtls is large and self contained so is a good candidate to be in
external XIP flash, to keep enough spare ROM in internal flash.
2019-07-03 16:50:02 +10:00
Damien George
f88cb8a514 stm32/modmachine: Make RTC class available in machine module.
This is a start to make a more consistent machine.RTC class across ports.
The stm32 pyb.RTC class at least has the datetime() method which behaves
the same as esp8266 and esp32, and with this patch the ntptime.py script
now works with stm32.
2019-07-03 16:46:07 +10:00
Damien George
ef00048fed extmod/modwebrepl: Add config option to put filebuf[512] on stack/bss.
Since the esp8266 has a small stack this buffer is kept in the BSS.
2019-07-03 12:55:57 +10:00
Damien George
79b6688558 stm32/extint: Simplify bitband support config for different MCUs. 2019-07-03 12:02:58 +10:00
Damien George
14bec7964f stm32/spi: Factor out code to calculate SPI source frequency. 2019-07-03 12:02:46 +10:00
Damien George
f114ce0a4b stm32/usb: Add "port" keyword argument to pyb.usb_mode, to select FS/HS.
If the board supports it, the USB port can now be explicitly specified, eg:

    pyb.usb_mode('VCP', port=0).

port=0 is USB FS and port=1 is USB HS.
2019-07-03 11:58:56 +10:00
Damien George
46b3cc4572 stm32/usb: Add support to auto-detect USB interface, either FS or HS.
If both FS and HS USB peripherals are enabled for a board then the active
one used for the REPL will now be auto-detected, by checking to see if both
the DP and DM lines are actively pulled low.  By default the code falls
back to use MICROPY_HW_USB_MAIN_DEV if nothing can be detected.
2019-07-03 11:51:13 +10:00
Damien George
6d2e654b14 stm32/mpconfigport.h: Enable useful networking modules if lwIP enabled. 2019-07-03 11:21:45 +10:00
Damien George
d821a27b58 stm32/boards/PYBD_SFx: Put SPI flash to sleep during sleep modes. 2019-07-03 01:27:33 +10:00
Damien George
ea033bf25a stm32/powerctrl: Add hooks for a board to perform actions on sleep/wake. 2019-07-03 01:27:33 +10:00
Damien George
caabdd99c0 stm32/qspi: Handle bus acquisition.
When going out of memory-mapped mode to do a control transfer to the QSPI
flash, the MPU settings must be changed to forbid access to the memory
mapped region.  And any ongoing transfer (eg memory mapped continuous read)
must be aborted.
2019-07-03 01:27:33 +10:00
Damien George
2034c0a2e3 stm32/qspi: Force a reset of the QSPI peripheral when initialising it.
To ensure it is in a known state on start up.
2019-07-03 01:27:33 +10:00
Damien George
8da39fd182 stm32/qspi: Use MPU to allow access to valid memory-mapped QSPI region.
The Cortex-M7 CPU will do speculative loads from any memory location that
is not explicitly forbidden.  This includes the QSPI memory-mapped region
starting at 0x90000000 and with size 256MiB.  Speculative loads to this
QSPI region may 1) interfere with the QSPI peripheral registers (eg the
address register) if the QSPI is not in memory-mapped mode; 2) attempt to
access data outside the configured size of the QSPI flash when it is in
memory-mapped mode.  Both of these scenarios will lead to issues with the
QSPI peripheral (eg Cortex bus lock up in scenario 2).

To prevent such speculative loads from interfering with the peripheral the
MPU is configured in this commit to restrict access to the QSPI mapped
region: when not memory mapped the entire region is forbidden; when memory
mapped only accesses to the valid flash size are permitted.
2019-07-03 01:27:33 +10:00
Damien George
eca4115f66 stm32/sdram: Use MPU helper functions to configure MPU for SDRAM use. 2019-07-03 01:27:33 +10:00
Damien George
f7eb2c72f7 stm32/eth: Use MPU helper functions to configure MPU for ETH use. 2019-07-03 01:27:33 +10:00
Damien George
8dcf25e1bd stm32/mpu: Add helper functions for configuring MPU. 2019-07-03 01:27:33 +10:00
Damien George
08075beeb9 samd: Remove "makefile" file.
This file can be added by a user to customise the build process.
2019-07-02 17:09:59 +10:00
Damien George
097b0f9397 windows/mpconfigport.h: Define empty MP_WEAK symbol. 2019-07-01 22:53:00 +10:00
Damien George
89a23a05b3 esp8266: Provide custom machine_time_pulse_us that feeds soft WDT.
So that the timeout for machine.time_pulse_us() can be large.

Fixes issue #2775.
2019-07-01 22:53:00 +10:00
Damien George
999733b1fb minimal: Use soft float for CROSS=1 Cortex-M4 target.
When compiled with hard float the system should enable FP access when it
starts or else FP instructions lead to a fault.  But this minimal port does
not enable (or use) FP and so, to keep it minimal, switch to use soft
floating point.  (This became an issue due to the recent commit
34c04d2319 which saves/restores FP registers
in the NLR state.)
2019-07-01 22:48:05 +10:00
Damien George
5f9bd11527 samd: Add new port to Microchip SAMDxx microcontrollers.
Initially supporting SAMD21 and SAMD51.
2019-07-01 17:19:18 +10:00
Damien George
c80614dfc8 ports: Provide mp_hal_stdio_poll for sys.stdio polling where needed. 2019-07-01 17:10:12 +10:00
Chris Mason
3786592097 stm32/boards: Optimise flash and RAM allocation for L4 boards.
Optimisations are:
- Remove FLASH_ISR section since devices with a small flash sector erase
  size don't need special FLASH_ISR handling.  This reduces flash image by
  approx 1.5k.
- Make SRAM2 contiguous with SRAM1 where possible.
- Simplify configuration of 2k RAM buffer used for flash filesystem.

RAM changes with this commit:
- L432: stack   6k -> 10k,  bss + heap   42k ->  52k
- L476: stack  16k -> 30k,  bss + heap   80k ->  96k
- L496: stack 206k -> 16k,  bss + heap  112k -> 302k
2019-07-01 16:57:20 +10:00
Mikhail Zakharov
ced340d739 unix/unix_mphal: Use CLOCK_MONOTONIC for ticks_ms/us when available. 2019-06-26 11:07:45 +10:00
Glenn Ruben Bakke
d889def06b nrf/led: Adjust how board LEDs are defined.
Change static LED functions to lowercase names, and trim down source code
lines for variants of MICROPY_HW_LED_COUNT.  Also rename configuration for
MICROPY_HW_LEDx_LEVEL to MICROPY_HW_LEDx_PULLUP to align with global PULLUP
configuration.
2019-06-25 16:02:31 +10:00
Damien George
d21d578644 stm32/usb: Fix regression with auto USB PID value giving PID=0xffff.
Commit 9e68eec8ea introduced a regression
where the PID of the USB device would be 0xffff if the default value was
used.  This commit fixes that by using a signed int type.
2019-06-25 15:43:54 +10:00
Josh Lloyd
2f262d5f9a esp32/Makefile: Include all driver/*.c source files in the build.
Fixes #4869.
2019-06-25 15:12:34 +10:00
Damien George
009b1f6559 stm32/boards: Rework all stm32??xx_hal_conf.h files to use common code.
This eliminates a lot of duplicated code in these header files.
2019-06-25 14:18:24 +10:00
Damien George
f96f53cd97 stm32/boards: Add stm32??xx_hal_conf_base.h files with common settings.
These are intended to be used by all boards, to reduce the size of a
board's configuration.
2019-06-25 14:18:24 +10:00
Damien George
89ebb3325b stm32/boards/pllvalues.py: Support HSx_VALUE defined without uint32_t. 2019-06-25 14:18:24 +10:00
Damien George
04c7cdb668 stm32: Enter bootloader via a system reset.
Entering a bootloader (ST system bootloader, or custom mboot) from software
by directly branching to it is not reliable, and the reliability of it
working can depend on the peripherals that were enabled by the application
code.  It's also not possible to branch to a bootloader if the WDT is
enabled (unless the bootloader has specific provisions to feed the WDT).

This patch changes the way a bootloader is entered from software by first
doing a complete system reset, then branching to the desired bootloader
early on in the start-up process.  The top two words of RAM (of the stack)
are reserved to store flags indicating that the bootloader should be
entered after a reset.
2019-06-25 14:15:49 +10:00
Damien George
205c6d0dc9 stm32/Makefile: Print info messages about use of mboot/QSPI flash. 2019-06-24 21:59:58 +10:00
Damien George
5da60ff9cb stm32/boards: Enable ussl module via mbedtls for boards with network. 2019-06-24 17:48:28 +10:00
Damien George
b80bccccff esp32/modnetwork: Still try to reconnect to WLAN even with AUTH_FAIL.
WIFI_REASON_AUTH_FAIL does not necessarily mean the password is wrong, and
a wrong password may not lead to a WIFI_REASON_AUTH_FAIL error code.  So to
improve reliability connecting to a WLAN always reconnect regardless of the
error.
2019-06-22 21:50:49 +10:00
Damien George
3ee3995be1 esp32: Update to use ESP IDF v3.3-beta3.
This updates ESP IDF to use v3.3-beta3.  And also adjusts README.md to
point to stable docs which provide a link to download the correct toolchain
for this IDF version, namely 1.22.0-80-g6c4433a-5.2.0
2019-06-19 14:32:15 +10:00
Nicko van Someren
1a51fc9ddf esp32/machine_sdcard: Fix bug in SPI slot number selection.
And fix minor typo in docs when referring to SDCard class.
2019-06-17 12:36:22 +10:00
Paul m. p. P
637aa9784d esp8266/uart: Fix invalid ringbuf name when event driven REPL enabled. 2019-06-17 12:34:10 +10:00
Chris Mason
14cf91f704 stm32: In link script, define start of stack separately from heap end.
Previously the end of the heap was the start (lowest address) of the stack.
With the changes in this commit these addresses are now independent,
allowing a board to place the heap and stack in separate locations.
2019-06-14 15:29:24 +10:00
Damien George
8b18cfedee stm32/usbd_msc: Allow to compile when USB enabled and SD card disabled. 2019-06-11 21:01:14 +10:00
Damien George
53200247b7 stm32/usb: Add "msc" kw-arg to pyb.usb_mode to select MSC logical units.
With this the user can select multiple logical units to expose over USB MSC
at once, eg: pyb.usb_mode('VCP+MSC', msc=(pyb.Flash(), pyb.SDCard())).  The
default behaviour is the original behaviour of just one unit at a time.
2019-06-11 16:22:09 +10:00
Damien George
9e68eec8ea stm32/usb: Use ARG_xxx enums to access kw args in pyb_usb_mode. 2019-06-11 15:50:21 +10:00
Damien George
38bcc99a58 stm32/usbd_msc: Provide Mode Sense response data in MSC interface.
Eventually these responses could be filled in by a function to make their
contents dynamic, depending on the attached logical units.  But for now
they are fixed, and this patch fixes the MODE SENSE(6) responses so it is
the correct length with the correct header.
2019-06-11 15:43:59 +10:00
Damien George
829aa58c5c stm32/usbd_msc: Provide custom irquiry processing by MSC interface.
So the MSC interface can customise the inquiry response based on the
attached logical units.
2019-06-11 15:43:58 +10:00
Damien George
518aa571ab stm32/usbd_msc: Rework USBD MSC code to support multiple logical units.
SCSI can support multiple logical units over the one interface (in this
case over USBD MSC) and here the MSC code is reworked to support this
feature.  At this point only one LU is used and the behaviour is mostly
unchanged from before, except the INQUIRY result is different (it will
report "Flash" for both flash and SD card).
2019-06-11 15:43:15 +10:00
Damien George
62f004ba42 stm32/lwip_inc: Update to enable mDNS, TCP listen backlog, faster DHCP. 2019-06-05 16:14:45 +10:00
Damien George
9e4b3681fd stm32: Support optional lwIP mDNS responder. 2019-06-05 16:14:09 +10:00
Damien George
fd839221fd stm32/boards/PYBD_SFx: Enable ussl module using mbedTLS. 2019-06-05 15:38:01 +10:00
Damien George
fed4c23590 stm32: Integrate optional mbedTLS component for ussl module.
To use it a board should define MICROPY_PY_USSL=1 and MICROPY_SSL_MBEDTLS=1
at the Makefile level.  With the provided configuration it adds about 64k
to the build.
2019-06-05 15:37:31 +10:00
Damien George
9d72f07b6d unix/mpconfigport.mk: Update comment about TLS implementations.
As long as the submodule is checked out, mbedTLS is now fully integrated
into the unix build if MICROPY_SSL_MBEDTLS=1.
2019-06-05 15:28:30 +10:00
Damien George
ce8262a164 stm32/modnetwork: Replace generic netif NIC polling with specific code.
It doesn't work to tie the polling of an underlying NIC driver (eg to check
the NIC for pending Ethernet frames) with its associated lwIP netif.  This
is because most NICs are implemented with IRQs and don't need polling,
because there can be multiple lwIP netif's per NIC driver, and because it
restricts the use of the netif->state variable.  Instead the NIC should
have its own specific way of processing incoming Ethernet frame.

This patch removes this generic NIC polling feature, and for the only
driver that uses it (Wiznet5k) replaces it with an explicit call to the
poll function (which could eventually be improved by using a proper
external interrupt).
2019-06-03 17:14:34 +10:00
Damien George
62fe47aa3a stm32/boards/PYBD_SFx: Enable CYW43 WLAN driver. 2019-06-03 17:14:34 +10:00
Damien George
8b7409c295 stm32: Integrate in the cyw43 driver and network.WLAN class.
Enable it by setting MICROPY_PY_NETWORK_CYW43=1 at the Makefile level.
2019-06-03 17:14:34 +10:00
Damien George
12ed6f91ee stm32: Add low-level SDIO interface for cyw43 driver. 2019-06-03 16:53:46 +10:00
Damien George
370a8116c4 stm32/mphalport: Add support for having MAC in OTP region. 2019-06-03 16:47:35 +10:00
Damien George
10e173aaea stm32/extint: Add extint_set() function for internal C access to EXTI. 2019-06-03 16:47:35 +10:00
Damien George
345e9864aa stm32/modpyb: Add pyb.country() function to set the country.
To be used for peripherals (like radio) that must be location aware.
2019-06-03 16:47:35 +10:00
Nicko van Someren
8e3af7d4c8 esp32: Add machine.SDCard class using built-in HW SD/MMC controller.
This adds support for SD cards using the ESP32's built-in hardware SD/MMC
host controller, over either the SDIO bus or SPI.  The class is available
as machine.SDCard and using it can be as simple as:

    uos.mount(machine.SDCard(), '/sd')
2019-06-03 00:37:41 +10:00
Damien George
8f55c74533 stm32/boards: Add board definition files for PYBD -SF2, -SF3, -SF6.
These are core configurations providing PYBv1.x-level features.
2019-05-31 22:44:25 +10:00
Damien George
34cae24e30 stm32/boards/pllvalues.py: Search nested headers for HSx_VALUE defines. 2019-05-31 21:44:53 +10:00
Damien George
f8274d5e7d stm32/boards/make-pins.py: Allow pins.csv to skip or hide board-pin name
If the board-pin name is left empty then only the cpu-pin name is used, eg
",PA0".  If the board-pin name starts with a hyphen then it's available as
a C definition but not in the firmware, eg "-X1,PA0".
2019-05-31 21:41:30 +10:00
Damien George
3fc7c8e35c stm32/usb: Include py/mpconfig.h instead of mpconfigboard.h.
Because py/mpconfig.h has header include guards.
2019-05-31 21:39:34 +10:00
Martin Dybdal
de76f73d34 esp32/machine_timer: Reuse Timer handles, deallocate only on soft-reset.
The patch solves the problem where multiple Timer objects (e.g. multiple
Timer(0) instances) could initialise multiple handles to the same internal
timer.  The list of timers is now maintained not for "active" timers (where
init is called), but for all timers created.  The timers are only removed
from the list of timers on soft-reset (machine_timer_deinit_all).

Fixes #4078.
2019-05-31 14:55:07 +10:00
Damien George
ff91b05cfa stm32/usb: Support up to 3 VCP interfaces on USB device peripheral.
To enable define MICROPY_HW_USB_CDC_NUM to 3.
2019-05-31 11:35:42 +10:00
Damien George
0c29502ad9 stm32/usb: Refactor CDC VCP code to enable N CDC interfaces.
The board config option MICROPY_HW_USB_ENABLE_CDC2 is now changed to
MICROPY_HW_USB_CDC_NUM, and the latter should be defined to the maximum
number of CDC interfaces to support (defaults to 1).
2019-05-30 21:11:04 +10:00
Damien George
0bb6b63e66 stm32/mboot/README: Fix some typos, describe bootloader and fwupdate.py. 2019-05-29 16:26:02 +10:00
Andrew Leech
66bcb5596a stm32/modmachine: In bootloader() disable caches before reset of periphs
Otherwise flushing and disabling the D-cache will give a hard-fault when
SDRAM is used.

Fixes #4818.
2019-05-29 15:50:17 +10:00
Damien George
883e987b90 esp32/modsocket: Raise EAGAIN when accept fails in non-blocking mode.
EAGAIN should be for pure non-blocking mode and ETIMEDOUT for when there is
a finite (but non-zero) timeout enabled.
2019-05-28 17:43:00 +10:00
Damien George
8c9758ff2e unix/modusocket: Raise ETIMEDOUT when connect or accept has timeout. 2019-05-28 17:22:54 +10:00
Tom Manning
887a6712c2 esp32/machine_touchpad: Use HW timer for FSM to enable wake-on-touch. 2019-05-28 11:14:34 +10:00
Andrew Leech
1470184bdd stm32/sdram: Update MPU settings to block invalid region, change attrs.
Set the active MPU region to the actual size of SDRAM configured and
invalidate the rest of the memory-mapped region, to prevent errors due to
CPU speculation.  Also update the attributes of the SDRAM region as per ST
recommendations, and change region numbers to avoid conflicts elsewhere in
the codebase (see eth usage).
2019-05-24 15:55:00 +10:00
Damien George
5357dad52e esp8266: Fix ticks_ms to correctly handle wraparound of system counter.
Fixes issue #4795.
2019-05-24 15:37:34 +10:00
Paul Sokolovsky
c4a6d9c631 zephyr: Switch back to enabling I2C in board-specific configs.
I2C can't be enabled in prj_base.conf because it's a board-specific
feature.  For example, if a board doesn't have I2C but CONFIG_I2C=y then
the build will fail (on Zephyr build system side).  The patch here gets the
qemu_cortex_m3 build working again.
2019-05-24 15:33:02 +10:00
Paul Sokolovsky
b88bf42793 zephyr/README: Reorder content related to recently added I2C.
So it fits better with existing narrative.
2019-05-24 15:29:29 +10:00
stijn
2762f323bf windows: Fix line wrapping behaviour on the REPL.
This enables going back to previous wrapped lines using backspace or left
arrow: instead of just sticking to the beginning of a line, the cursor will
move a line up.
2019-05-23 22:11:11 +10:00
Andrew Leech
4f44778728 stm32/sdcard: Add switch break to ensure only correct SD/MMC IRQ is run. 2019-05-23 21:55:31 +10:00
Damien George
9cf1cbb057 nrf/mphalport: Use wfi to save power while waiting at the UART REPL. 2019-05-22 12:47:48 +10:00
Damien George
456c89f749 nrf/uart: Make UART print output something, and add write method. 2019-05-22 12:47:48 +10:00
Damien George
50d5114fcd nrf/mpconfigport.h: Enable MICROPY_KBD_EXCEPTION by default. 2019-05-22 12:47:48 +10:00
Damien George
302ffdba7f nrf/uart: Change UART driver to be non-blocking and use IRQs.
As part of this, ctrl-C is now able to interrupt a running program.
2019-05-22 12:47:19 +10:00
Glenn Ruben Bakke
d80abd035e nrf/nrfx_glue: Adapt to nrfx v.1.7.1.
Defining NRFX_STATIC_ASSERT macro to be empty, but available
to nrfx.
2019-05-21 23:16:20 +02:00
Damien George
c769da1aaa stm32/i2c: Support setting the I2C TIMINGR value via keyword arg.
On MCUs that have an I2C TIMINGR register, this can now be explicitly set
via the "timingr" keyword argument to the I2C constructor, for both
machine.I2C and pyb.I2C.  This allows to configure precise timing values
when the defaults are inadequate.
2019-05-21 13:45:17 +10:00
Damien George
ddc657658a stm32/machine_i2c: Simplify ROM initialisation of static HW I2C objects. 2019-05-21 12:38:34 +10:00
Andrew Leech
ed2b6ea0a8 stm32/i2c: Make timeout for hardware I2C configurable.
Previously the hardware I2C timeout was hard coded to 50ms which isn't
guaranteed to be enough depending on the clock stretching specs of the I2C
device(s) in use.

This patch ensures the hardware I2C implementation honors the existing
timeout argument passed to the machine.I2C constructor.  The default
timeout for software and hardware I2C is now 50ms.
2019-05-21 12:20:19 +10:00
Damien George
647b27d028 zephyr/machine_i2c: Update to support new C-level I2C API. 2019-05-20 15:04:29 +10:00
Damien George
bb29bde102 nrf/machine/i2c: Update to support new C-level I2C API. 2019-05-20 15:04:29 +10:00
Damien George
38ac697b45 stm32/machine_i2c: Update to support new C-level I2C API. 2019-05-20 15:04:29 +10:00
Damien George
1f63e9b701 stm32/adc: Fix VBAT_DIV to be 4 for STM32F411.
Fixes issue #4794.
2019-05-20 14:37:28 +10:00
Damien George
653e1756c0 various: Update early copyright years to match actual edit history. 2019-05-17 18:06:11 +10:00
Paul Sokolovsky
016d9a40fe various: Add and update my copyright line based on git history.
For modules I initially created or made substantial contributions to.
2019-05-17 18:04:15 +10:00
Damien George
e1e3704aa1 stm32/modmachine: Create dedicated asm function to branch to bootloader.
Recent gcc versions (at least 9.1) give a warning about using "sp" in the
clobber list.  Such code is removed by this patch.  A dedicated function is
instead used to set SP and branch to the bootloader so the code has full
control over what happens.

Fixes issue #4785.
2019-05-17 17:20:43 +10:00
Damien George
0557f0b74b esp32/network_ppp: Add a timeout for closing PPP connection.
This also fixes deleting the PPP task, since eTaskGetState() never returns
eDeleted.

A limitation with this patch: once the PPP is deactivated (ppp.active(0))
it cannot be used again. A new PPP instance must be created instead.
2019-05-17 17:14:45 +10:00
Damien George
2630d3e51f esp32/machine_uart: Implement UART.deinit() method. 2019-05-15 17:01:54 +10:00
iabdalkader
746fcea7f8 stm32/boards/NUCLEO_H743ZI: Enable SPI3 on this board. 2019-05-15 16:08:10 +10:00
iabdalkader
1646eff864 stm32/irq: Fix IRQ_ENABLE_STATS stats config to work on all MCUs.
Only the M4 and M7 MCUs have an FPU and FPU_IRQn, and FPU_IRQn is not
always the last entry/IRQ number.
2019-05-15 16:04:01 +10:00
iabdalkader
07af74daef stm32/spi: Enable SPI IRQs and add IRQHandlers for H7 MCUs.
The H7 HAL uses SPI IRQs when the SPI is running in DMA mode.
2019-05-15 15:59:25 +10:00
iabdalkader
123c065131 stm32/dma: Always reset and configure the H7 DMA peripheral.
This is required for the H7 DMA to work.
2019-05-15 15:55:41 +10:00
stijn
90fae9172a py/objarray: Add support for memoryview.itemsize attribute.
This allows figuring out the number of bytes in the memoryview object as
len(memview) * memview.itemsize.

The feature is enabled via MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE and is
disabled by default.
2019-05-14 17:15:17 +10:00
iabdalkader
7359a9e2f2 stm32/dma: Initialise all members of DMA structs for H7 MCUs. 2019-05-13 12:57:44 +10:00
Damien George
7e21cf723a nrf: Change types to size_t for all uses of mp_obj_str_get_data. 2019-05-13 12:39:56 +10:00
Damien George
8586afa6f5 esp32/modnetwork: Change type to size_t for uses of mp_obj_str_get_data. 2019-05-13 12:39:03 +10:00
Damien George
99a8fa7940 esp8266/modmachine: Handle overflow of timer to get longer periods.
Can now handle up to about 298 days maximum for millisecond periods.

Fixes issue #4664.
2019-05-10 15:50:35 +10:00
Andrew Leech
29865e3e58 stm32/rtc: Allow overriding startup timeouts from mpconfigboard. 2019-05-09 12:08:43 +10:00
Elad Namdar
3f54462add unix/modusocket: Fix use of setsockopt in usocket.settimeout impl.
The original code called setsockopt(SO_RCVTIMEO/SO_SNDTIMEO) with NULL
timeout structure argument, which is an illegal usage of that function.
The old code also didn't validate the return value of setsockopt, missing
the bug completely.
2019-05-08 13:12:30 +10:00
Damien George
b8c74014e4 stm32/usbd_cdc_interface: Don't retransmit chars if USB is reconnected.
Before this change, if the USB was reconnected it was possible that some
characters in the TX buffer were retransmitted because tx_buf_ptr_out and
tx_buf_ptr_out_shadow were reset while tx_buf_ptr_in wasn't.  That
behaviour is fixed here by retaining the TX buffer state across reconnects.

Fixes issue #4761.
2019-05-08 12:45:24 +10:00
Damien George
97753a1bbc stm32: Move factory reset files and code to separate source file.
The new function factory_reset_make_files() populates the given filesystem
with the default factory files.  It is defined with weak linkage so it can
be overridden by a board.

This commit also brings some minor user-facing changes:

- boot.py is now no longer created unconditionally if it doesn't exist, it
  is now only created when the filesystem is formatted and the other files
  are populated (so, before, if the user deleted boot.py it would be
  recreated at next boot; now it won't be).

- pybcdc.inf and README.txt are only created if the board has USB, because
  they only really make sense if the filesystem is exposed via USB.
2019-05-07 13:59:51 +10:00
Damien George
34942d0a72 stm32/machine_uart: Change default UART timeout to 0, for non blocking.
It's more common to need non-blocking behaviour when reading from a UART,
rather than having a large timeout like 1000ms (the original behaviour).
With a large timeout it's 1) likely that the function will read forever if
characters keep trickling it; or 2) the function will unnecessarily wait
when characters come sporadically, eg at a REPL prompt.
2019-05-07 13:56:42 +10:00
Yonatan Goldschmidt
ef9843653b extmod/moducryptolib: Add AES-CTR support.
Selectable at compile time via MICROPY_PY_UCRYPTOLIB_CTR.  Disabled by
default.
2019-05-06 18:09:48 +10:00