Commit Graph

10471 Commits

Author SHA1 Message Date
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
Paul m. p. P
862cc45a9c py/mkrules.mk: Use $(CPP) not $(CC) -E for preprocessor rule. 2019-06-25 15:03:41 +10:00
Damien George
e06dcad5d3 travis: Build esp32 firmware as part of Travis CI.
Toolchain installation and build takes about 3 minutes.
2019-06-25 14:55:10 +10:00
Damien George
cc12f750b4 travis: Build esp8266 firmware as part of Travis CI.
Toolchain installation and build takes about 1 minute.
2019-06-25 14:55:10 +10:00
Damien George
c60e0a09f0 travis: Selectively fetch git submodules only when needed.
This saves time when building on Travis CI: unconditionally fetching all
submodules takes about 40 seconds, but not all are needed for any given
port, so only fetch as necessary.
2019-06-25 14:55:10 +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
34c04d2319 py/nlrthumb: Save and restore VFP registers s16-s21 when CPU has them.
These s16-s21 registers are used by gcc so need to be saved.  Future
versions of gcc (beyond v9.1.0), or other compilers, may eventually need
additional registers saved/restored.

See issue #4844.
2019-06-19 14:53:17 +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
9d3031cc9d tools/mpy-tool.py: Fix linking of qstr objects in native ARM Thumb code.
Previously, when linking qstr objects in native code for ARM Thumb, the
index into the machine code was being incremented by 4, not 8.  It should
be 8 to account for the size of the two machine instructions movw and movt.
This patch makes sure the index into the machine code is incremented by the
correct amount for all variations of qstr linking.

See issue #4829.
2019-06-11 11:36:39 +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
49388e339e extmod/extmod.mk: Include mdns app source in lwIP build. 2019-06-05 16:13:34 +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
ef7357d4ab extmod/modussl_mbedtls: Allow to build with object representation D. 2019-06-05 15:33:15 +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
678ec182cd extmod/extmod.mk: Integrate mbedTLS so it is built from source.
Setting MICROPY_PY_USSL and MICROPY_SSL_MBEDTLS at the Makefile-level will
now build mbedTLS from source and include it in the build, with the ussl
module using this TLS library.  Extra settings like MBEDTLS_CONFIG_FILE may
need to be provided by a given port.

If a port wants to use its own mbedTLS library then it should not set
MICROPY_SSL_MBEDTLS at the Makefile-level but rather set it at the C level,
and provide the library as part of the build in its own way (see eg esp32
port).
2019-06-05 15:22:21 +10:00
Damien George
399417adba lib: Add new submodule for mbedtls, currently at v2.17.0.
From upstream source: https://github.com/ARMmbed/mbedtls.git
2019-06-05 15:21:40 +10:00
Damien George
cd6b115815 extmod: Factor out makefile rules from py.mk to new extmod.mk file.
To logically separate extmod related rules out, and prevent py.mk from
growing too large.
2019-06-05 14:23:12 +10:00
Yonatan Goldschmidt
7cf26ca4bd py/obj: Optimise small-int comparison to 0 in mp_obj_is_true.
Instead of converting to a small-int at runtime this can be done at compile
time, then we only have a simple comparison during runtime.  This reduces
code size on some ports (e.g -4 on qemu-arm, -52 on unix nanbox), and for
others at least doesn't increase code size.
2019-06-05 10:54:23 +10:00
Damien George
faf3d3e9e9 tools/mpy-tool.py: Fix linking qstrs in native code, and multiple files.
Fixes errors in the tool when 1) linking qstrs in native ARM-M code; 2)
freezing multiple files some of which use native code and some which don't.

Fixes issue #4829.
2019-06-04 22:21:01 +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
Damien George
cf1c131f73 extmod: Add network-level class binding to cyw43 driver. 2019-06-03 16:47:35 +10:00
Damien George
7b70ab7258 drivers: Add driver for CYW43xx WiFi SoCs. 2019-06-03 16:47:35 +10:00
Damien George
53f2ac9017 gitattributes: Mark *.a files as binary. 2019-06-03 14:57:50 +10:00
Damien George
1043f1a047 lib/netutils: Add DHCP server component. 2019-06-03 14:57:50 +10:00