Commit Graph

409 Commits

Author SHA1 Message Date
Damien George
20b4b85f72 ports: Enable MICROPY_PY_BUILTINS_ROUND_INT on selected ports. 2018-05-22 14:18:16 +10:00
Damien George
e773a2cdba stm32/main: Use consistent indenting of macro #if's. 2018-05-22 13:17:03 +10:00
Damien George
f68e722005 stm32/rng: Use Yasmarang for rng_get() if MCU doesn't have HW RNG. 2018-05-22 10:36:03 +10:00
Damien George
cda964198a stm32: Integrate lwIP as implementation of usocket module.
This patch allows to use lwIP as the implementation of the usocket module,
instead of the existing socket-multiplexer that delegates the entire TCP/IP
layer to the NIC itself.

This is disabled by default, and enabled by defining MICROPY_PY_LWIP to 1.

When enabled, the lwIP TCP/IP stack will be included in the build with
default settings for memory usage and performance (see
lwip_inc/lwipopts.h).  It is then up to a particular NIC to register itself
with lwIP using the standard lwIP netif API.
2018-05-21 17:36:06 +10:00
Damien George
6c955932f3 stm32/rtc: Don't try to set SubSeconds value on RTC.
The hardware doesn't allow it, instead the value is reset to 255 upon
setting the other calendar/time values.
2018-05-21 14:08:37 +10:00
Daniel Shaulov
cac2eddc16 minimal/main: Allow to compile without GC enabled. 2018-05-21 13:13:21 +10:00
Damien George
afd0701bf7 esp8266: Change UART(0) to attach to REPL via uos.dupterm interface.
This patch makes it so that UART(0) can by dynamically attached to and
detached from the REPL by using the uos.dupterm function.  Since WebREPL
uses dupterm slot 0 the UART uses dupterm slot 1 (a slot which is newly
introduced by this patch).  UART(0) must now be attached manually in
boot.py (or otherwise) and inisetup.py is changed to provide code to do
this.  For example, to attach use:

    import uos, machine
    uart = machine.UART(0, 115200)
    uos.dupterm(uart, 1)

and to detach use:

    uos.dupterm(None, 1)

When attached, all incoming chars on UART(0) go straight to stdin so
uart.read() will always return None.  Use sys.stdin.read() if it's needed
to read characters from the UART(0) while it's also used for the REPL (or
detach, read, then reattach).  When detached the UART(0) can be used for
other purposes.

If there are no objects in any of the dupterm slots when the REPL is
started (on hard or soft reset) then UART(0) is automatically attached.
Without this, the only way to recover a board without a REPL would be to
completely erase and reflash (which would install the default boot.py which
attaches the REPL).
2018-05-21 11:31:59 +10:00
Damien George
2923671a0c esp32/Makefile: Update to latest ESP IDF version. 2018-05-21 11:28:36 +10:00
Paul Sokolovsky
478410b409 zephyr/Makefile: Add kobj_types_h_target to Z_EXPORTS.
New generated Zephyr header file, without it build breaks.
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
5a023372df zephyr: Add prj_disco_l475_iot1.conf with sensor drivers. 2018-05-21 10:35:16 +10:00
Paul Sokolovsky
7afbc49863 zephyr/prj_base.conf: Enable DHCP and group static IPs together.
Add CONFIG_NET_DHCPV4, which, after
https://github.com/zephyrproject-rtos/zephyr/pull/5750 works as follows:
static addresses are configured after boot, and DHCP requests are sent
at the same time. If valid DHCP reply is received, it overrides static
addresses.

This setup works out of the box for both direct connection to a
workstation (DHCP server usually is not available) and for connection
to a router (DHCP is available and required).
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
0e52ee957d zephyr/modzsensor: Zephyr sensor subsystem bindings. 2018-05-21 10:35:16 +10:00
Paul Sokolovsky
080b0be1c8 zephyr/mpconfigport.h: Enable uhashlib and ubinascii modules.
To be able to use data integrity checks in various tests.
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
9480c188e8 zephyr/main: After builtin testsuite, drop to REPL.
It makes sense to make even testsuite-enabled builds be suitable for
interactive use.
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
1050045979 zephyr/README: Hint about existence of qemu_x86_nommu. 2018-05-21 10:35:16 +10:00
Tobias Badertscher
769e37b646 stm32/boards: Add config files for new board, STM32L496GDISC. 2018-05-18 22:39:49 +10:00
Tobias Badertscher
4005c63571 stm32/boards: Add board ld and af.csv files for STM32L496 MCU. 2018-05-18 22:39:44 +10:00
Tobias Badertscher
708cdb6276 stm32: Add support for STM32L496 MCU. 2018-05-18 22:37:30 +10:00
Damien George
58331e3c28 esp8266/modmachine: Allow I2C and SPI to be configured out of the build.
I2C costs about 3000 bytes of code, and SPI costs about 4400 bytes.
2018-05-17 23:37:12 +10:00
Damien George
dd13065843 esp8266/modnetwork: Raise ValueError when getting invalid WLAN id.
Instead of crashing due to out-of-bounds array access.  Fixes #3348.
2018-05-17 22:12:24 +10:00
Damien George
f8a5cd24d8 esp8266/modnetwork: Return empty str for hostname if STA is inactive.
Instead of crashing due to NULL pointer dereference.  Fixes issue #3341.
2018-05-17 22:11:22 +10:00
Damien George
94a79f340d esp8266/mpconfigport.h: Add some weak links to common Python modules.
To make it easier/simpler to write code that can run under both CPython and
on an ESP8266 board.
2018-05-17 13:27:18 +10:00
Ryan Shaw
b9ff46f1ed stm32: Enable UART7/8 on F4 series that have these peripherals. 2018-05-16 11:55:07 +10:00
Damien George
cdaace1fdf esp32/modnetwork: Fix STA/AP activate/deactivate for new IDF API.
WIFI_MODE_NULL is no longer supported by the ESP IDF, instead one must use
esp_wifi_start/esp_wifi_stop.
2018-05-15 11:50:37 +10:00
Damien George
e6b66f1092 stm32/usb: Initialise cdc variable to prevent compiler warnings.
Some compilers cannot deduce that cdc will always be written before being
used.
2018-05-15 00:18:03 +10:00
Damien George
47ecbbbecb stm32/usb: Add ability to have 2x VCP interfaces on the one USB device.
This patch adds the configuration MICROPY_HW_USB_ENABLE_CDC2 which enables
a new USB device configuration at runtime: VCP+VCP+MSC.  It will give two
independent VCP interfaces available via pyb.USB_VCP(0) and pyb.USB_VCP(1).
The first one is the usual one and has the REPL on it.  The second one is
available for general use.

This configuration is disabled by default because if the mode is not used
then it takes up about 2200 bytes of RAM.  Also, F4 MCUs can't support this
mode on their USB FS peripheral (eg PYBv1.x) because they don't have enough
endpoints.  The USB HS peripheral of an F4 supports it, as well as both the
USB FS and USB HS peripherals of F7 MCUs.
2018-05-14 23:44:45 +10:00
Damien George
2e565cc0d4 stm32/usb: Change HID report funcs to take HID state, not usbdev state. 2018-05-14 17:04:43 +10:00
Damien George
91bca340ec stm32/usb: Change CDC tx/rx funcs to take CDC state, not usbdev state. 2018-05-14 16:55:04 +10:00
Damien George
68271a27e6 stm32/usb: Make CDC endpoint definitions private to core usbdev driver. 2018-05-14 16:53:45 +10:00
Damien George
ed92d62326 stm32/usb: Combine HID lower-layer and interface state into one struct. 2018-05-14 16:34:31 +10:00
Damien George
bf08a99ccd stm32/usb: Combine CDC lower-layer and interface state into one struct. 2018-05-14 16:15:58 +10:00
Damien George
ed32284b70 stm32/usb: Use usbd_cdc_itf_t pointer directly in USB_VCP class. 2018-05-14 15:24:44 +10:00
Damien George
fb25c81062 stm32/modpyb: Remove unused includes and clean up comments.
The documentation (including the examples) for elapsed_millis and
elapsed_micros can be found in docs/library/pyb.rst so doesn't need to be
written in full in the source code.
2018-05-14 14:01:50 +10:00
Damien George
88c26a48b4 stm32/pyb_i2c: Put pyb.I2C under MICROPY_PY_PYB_LEGACY setting.
When disabled, the pyb.I2C class saves around 8k of code space and 172
bytes of RAM.  The same functionality is now available in machine.I2C
(for F4 and F7 MCUs).

It is still enabled by default.
2018-05-14 13:53:46 +10:00
Damien George
92c5e2708d stm32/modpyb: Introduce MICROPY_PY_PYB_LEGACY config option for pyb mod.
This is enabled by default.  When it is disabled all legacy functions and
classes in the pyb module are excluded from the build.
2018-05-14 13:49:22 +10:00
Damien George
a0f7b4c678 stm32/accel: Switch pyb.Accel to use new C-level I2C API. 2018-05-14 13:23:18 +10:00
Damien George
ce824bb67e stm32/machine_i2c: Use new F4 hardware I2C driver for machine.I2C class.
And remove the old one based on ST code.
2018-05-14 13:22:12 +10:00
Damien George
b21415ed4f stm32/i2c: Add new hardware I2C driver for F4 MCUs.
This driver uses low-level register access to control the I2C peripheral
(ie it doesn't rely on the ST HAL) and provides the same C-level API as the
existing F7 hardware driver.
2018-05-14 13:19:03 +10:00
Peter D. Gray
ca36645410 stm32/usbd_hid_interface: Address possible race condition vs. interrupt.
The USB IRQ may fire once USBD_HID_ClearNAK() is called and then change the
last_read_len value.
2018-05-14 12:08:34 +10:00
Peter D. Gray
1f1623d3b7 stm32/usbdev: Be honest about data not being written to HID endpoint.
USB_HID.send() should now return 0 if it could not send the report to the
host.
2018-05-14 12:01:27 +10:00
Bas Wijnen
67e1a4f8be esp32: Update to latest ESP IDF version.
- Updated supported git hash to current IDF version.
- Added missing targets and includes to Makefile.
- Updated error codes for networking module.
- Added required constant to sdkconfig configuration.
2018-05-14 11:42:46 +10:00
Damien George
aeaace0737 stm32/usbdev: Remove unused RxState variable, and unused struct. 2018-05-11 23:20:59 +10:00
Damien George
abde0fa226 stm32/usbdev: Convert files to unix line endings.
Also remove trailing whitespace and convert tabs to spaces.
2018-05-11 23:03:52 +10:00
Damien George
56a273ebff stm32/usbd_conf: Changes files to unix line endings and apply styling.
This patch is only cosmetic and has no functional change.
2018-05-11 22:17:58 +10:00
Damien George
9f4eda542a stm32/usbd_conf.h: Remove unused macros and clean up header file. 2018-05-11 22:04:56 +10:00
Damien George
b208aa189e stm32/README: Update to reflect current MCU support. 2018-05-11 10:36:46 +10:00
Damien George
c1115d931f stm32/usb: Use correct type for USB HID object. 2018-05-09 16:00:19 +10:00
Damien George
e1bc85416a stm32/usb: Fix broken pyb.have_cdc() so it works again. 2018-05-09 15:59:48 +10:00
Damien George
e638defff4 stm32/i2c: Make sure stop condition is sent after receiving addr nack. 2018-05-09 15:53:09 +10:00
Damien George
aea71dbde0 stm32/Makefile: Use -O2 to optimise compilation of lib/libc/string0.c. 2018-05-04 15:53:51 +10:00