Commit Graph

1090 Commits

Author SHA1 Message Date
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
Damien George 906fb89fd7 unix/coverage: Add test for printing literal % character. 2019-05-03 23:21:28 +10:00
Nguyen Hoan Hoang 9a6f6fd68d nrf/boards: Add support for BLYST Nano module based boards.
- IBK-BLYST-NANO: Breakout board
- IDK-BLYST-NANO: DevKit board with builtin IDAP-M CMSIS-DAP Debug JTAG,
  RGB led
- BLUEIO-TAG-EVIM: Sensor tag board (environmental sensor
  (T, H, P, Air quality) + 9 axis motion sensor)

Also, the LED module has been updated to support individual base level
configuration of each LED. If set, this will be used instead of the
common configuration, MICROPY_HW_LED_PULLUP. The new configuration,
MICROPY_HW_LEDX_LEVEL, where X is the LED number can be used to set
the base level of the specific LED.
2019-05-02 22:33:44 +02:00
Chris Mason 2a791170ce stm32/boards: Add NUCLEO_F413ZH board configuration.
The alternate function pin allocations are different to other NUCLEO-144
boards.  This is because the STM32F413 has a very high peripheral count:
10x UART, 5x SPI, 3x I2C, 3x CAN.  The pinout was chosen to expose all
these devices on separate pins except CAN3 which shares a pin with UART1
and SPI1 which shares pins with DAC.
2019-05-02 16:33:30 +10:00
Chris Mason 1b956ec817 stm32: Add support for F413 MCUs.
Includes:
- Support for CAN3.
- Support for UART9 and UART10.
- stm32f413xg.ld and stm32f413xh.ld linker scripts.
- stm32f413_af.csv alternate function mapping.
- startup_stm32f413xx.s because F413 has different interrupt vector table.
- Memory configuration with: 240K filesystem, 240K heap, 16K stack.
2019-05-02 16:26:53 +10:00
Damien George a974f2dc6e stm32/flash: Fix bug computing page number for L432 page erase. 2019-05-02 14:53:26 +10:00
Damien George 3fbf32b947 stm32/powerctrl: Support changing frequency when HSI is clock source.
This patch makes pllvalues.py generate two tables: one for when HSI is used
and one for when HSE is used.  The correct table is then selected at
compile time via the existing MICROPY_HW_CLK_USE_HSI.
2019-05-02 13:00:00 +10:00
stijn 34a7d7ebeb unix/gcollect: Make sure stack/regs get captured properly for GC.
When building with link time optimization enabled it is possible both
gc_collect() and gc_collect_regs_and_stack() get inlined into gc_alloc()
which can result in the regs variable being pushed on the stack earlier
than some of the registers. Depending on the calling convention, those
registers might however contain pointers to blocks which have just been
allocated in the caller of gc_alloc(). Then those pointers end up higher on
the stack than regs, aren't marked by gc_collect_root() and hence get
sweeped, even though they're still in use.

As reported in #4652 this happened for in 32-bit msvc release builds:
mp_lexer_new() does two consecutive allocations and the latter triggered a
gc_collect() which would sweep the memory of the first allocation again.
2019-05-01 15:06:21 +10:00
Damien George cbeac903e8 stm32/main: Increase default UART REPL rx buffer from 64 to 260 bytes.
This allows the UART to buffer at least 256 bytes (taking into account the
extra byte needed by the ring buffer, and word alignment).
2019-05-01 14:53:21 +10:00
Damien George ff0306dfa5 stm32/usb: Remove mp_hal_set_interrupt_char now that it's reset at boot. 2019-05-01 13:08:05 +10:00
Krono fbd4e61e57 esp32/machine_wdt: Add timeout arg to select interval, make WDT panic.
The machine.WDT() now accepts the "timeout" keyword argument to select the
WDT interval.  And the WDT is changed to panic mode which means it will
reset the device if the interval expires (instead of just printing an error
message).
2019-04-30 16:53:05 +10:00
Damien George 8031b7a25c stm32/powerctrl: Deselect PLLSAI as 48MHz src before turning off PLLSAI.
On the STM32F722 (at least, but STM32F767 is not affected) the CK48MSEL bit
must be deselected before PLLSAION is turned off, or else the 48MHz
peripherals (RNG, SDMMC, USB) may get stuck without a clock source.

In such "lock up" cases it seems that these peripherals are still being
clocked from the PLLSAI even though the CK48MSEL bit is turned off.  A hard
reset does not get them out of this stuck state.  Enabling the PLLSAI and
then disabling it does get them out.  A test case to see this is:

    import machine, pyb
    for i in range(100):
        machine.freq(122_000000)
        machine.freq(120_000000)
        print(i, [pyb.rng() for _ in range(4)])

On occasion the RNG will just return 0's, but will get fixed again on the
next loop (when PLLSAI is enabled by the change to a SYSCLK of 122MHz).

Fixes issue #4696.
2019-04-29 16:31:32 +10:00
Damien George d1dea4f577 javascript/library: Print data as raw bytes to stdout so unicode works. 2019-04-28 22:39:41 +10:00
Damien George bd6fed8201 javascript/Makefile: Fix unrepresentable float error by using clamp.
Otherwise converting large floats to ints will fail (as seen by the
builtin_float_hash.py test).
2019-04-28 22:17:42 +10:00
Damien George 93f5f80216 javascript: Pass (error) exit value out from script to process caller. 2019-04-28 22:16:27 +10:00
Damien George bd0bacb637 javascript/library: Use Buffer.alloc() since new Buffer() is deprecated. 2019-04-28 22:14:28 +10:00
Andrew Leech 70a28e3ad9 stm32/usb: Add USB device mode for VCP+VCP without MSC.
Selectable via pyb.usb_mode('VCP+VCP').
2019-04-28 21:31:47 +10:00
Damien George 0646e607b5 ports: Convert to use pyexec_file_if_exists() to execute boot/main.py.
The stm32 and nrf ports already had the behaviour that they would first
check if the script exists before executing it, and this patch makes all
other ports work the same way.  This helps when developing apps because
it's hard to tell (when unconditionally trying to execute the scripts) if
the resulting OSError at boot up comes from missing boot.py or main.py, or
from some other error.  And it's not really an error if these scripts don't
exist.
2019-04-26 15:22:14 +10:00
Damien George f66c4cbfa6 stm32/usbdev: Make USB device descriptors at runtime rather than static. 2019-04-26 10:07:49 +10:00
Damien George aa7b32c811 stm32/dac: Rework DAC driver to use direct register access.
This patch makes the DAC driver simpler and removes the need for the ST
HAL.  As part of it, new helper functions are added to the DMA driver,
which also use direct register access instead of the ST HAL.

Main changes to the DAC interface are:

- The DAC uPy object is no longer allocated dynamically on the heap,
  rather it's statically allocated and the same object is retrieved for
  subsequent uses of pyb.DAC(<id>).  This allows to access the DAC objects
  without resetting the DAC peripheral.  It also means that the DAC is only
  reset if explicitly passed initialisation parameters, like "bits" or
  "buffering".

- The DAC.noise() and DAC.triangle() methods now output a signal which is
  full scale (previously it was a fraction of the full output voltage).

- The DAC.write_timed() method is fixed so that it continues in the
  background when another peripheral (eg SPI) uses the DMA (previously the
  DAC would stop if another peripheral finished with the DMA and shut the
  DMA peripheral off completely).

Based on the above, the following backwards incompatibilities are
introduced:

- pyb.DAC(id) will now only reset the DAC the first time it is called,
  whereas previously each call to create a DAC object would reset the DAC.
  To get the old behaviour pass the bits parameter like: pyb.DAC(id, bits).

- DAC.noise() and DAC.triangle() are now full scale.  To get previous
  behaviour (to change the amplitude and offset) write to the DAC_CR (MAMP
  bits) and DAC_DHR12Rx registers manually.
2019-04-24 15:51:19 +10:00
Damien George 8402c26cfa stm32/powerctrl: Enable EIWUP to ensure RTC wakes device from standby. 2019-04-18 17:15:11 +10:00
Damien George 11657f2f20 stm32/system_stm32f0: Add support for using HSE and PLL as SYSCLK.
To configure the SYSCLK on an F0 enable one of:

    MICROPY_HW_CLK_USE_HSI48
    MICROPY_HW_CLK_USE_HSE
    MICROPY_HW_CLK_USE_BYPASS
2019-04-18 16:00:45 +10:00
Damien George f1774fa049 stm32/system_stm32f0: Enable PWR clock on startup.
To be consistent with how F4/F7/H7/L4 works in system_stm32.c.  The power
control peripheral is needed at least for the RTC.
2019-04-18 15:36:59 +10:00
Damien George 4ce0091449 esp32/README: Add info about pyparsing and the correct Python version.
See issue #4655.
2019-04-18 14:17:01 +10:00
Damien George 194d6b6788 stm32/timer: Correctly initialise extended break settings on F7/H7/L4.
Fixes issue #4693.
2019-04-15 11:41:03 +10:00
Damien George fd112239d6 stm32/rtc: Remove non-ASCII mu-character from source code comment.
And fix a typo in the comment on this line.
2019-04-12 11:32:24 +10:00
Damiano Mazzella 3c9f78b048 zephyr/CMakeLists.txt: Set AR to point to the Zephyr toolchain exe. 2019-04-11 12:24:05 +10:00
Damien George fc9f2ff0cd stm32/rtc: Remove unused LSE detection code. 2019-04-11 12:14:21 +10:00
Damien George 46e5d6b889 stm32/rtc: Add auto-LSE-bypass detection with fallback to LSE then LSI.
If MICROPY_HW_RTC_USE_BYPASS is enabled the RTC startup goes as follows:
- RTC is started with LSE in bypass mode to begin with
- if that fails to start (after a given timeout) then LSE is reconfigured
  in non-bypass
- if that fails to start then RTC is switched to LSI
2019-04-11 12:09:21 +10:00
Damien George 358364b45e stm32/boards/NUCLEO_L432KC: Disable complex nos and default frozen mods.
To save space, since this board only hase 256k of flash.
2019-04-09 11:23:08 +10:00
Damien George 4831e38c7e stm32/boards/NUCLEO_H743ZI: Add config options to support mboot. 2019-04-08 14:34:37 +10:00
Damien George fd13ce5e60 stm32/mboot: Add support for H7 MCUs, with H743 flash layout. 2019-04-08 14:33:57 +10:00
Damien George ae1e18a346 stm32/usbd_conf: Add support for USB HS peripheral on H7 MCUs. 2019-04-08 14:30:16 +10:00
Damien George 2c3fa4ad82 stm32/i2cslave: Add support for H7 MCUs. 2019-04-08 14:28:45 +10:00
Damien George fd523c53c3 stm32/network_wiznet5k: Automatically set MAC if device doesn't have one 2019-04-05 22:37:06 +11:00
Damien George 4f936afc44 stm32/network_wiznet5k: Add ability to set the MAC address. 2019-04-05 22:35:04 +11:00
Damien George 4410efc1e3 stm32/network_wiznet5k: Add ability to trace Ethernet TX and RX frames.
Via: nic.config(trace=2|4)
2019-04-05 22:33:49 +11:00
Damien George 69cb24a21d esp32/boards/sdkconfig: Disable WDT check of idle task on CPU1.
With dual-core enabled it's possible that the uPy task has full utilisation
of CPU1.  Fixes issue #4673.
2019-04-05 12:25:21 +11:00
Glenn Ruben Bakke 1f5d945afa nrf/Makefile: Update to match latest oofatfs version.
See corresponding commit b5f33ac2cb
2019-04-01 19:22:25 +02:00
Damien George 83f3c29d36 stm32/moduos: Allow to compile again without USB enabled. 2019-04-01 17:11:39 +11:00
Damien George 7ce2a08231 stm32: Add support for MMC driver, exposed via pyb.MMCard class.
Enable it via MICROPY_HW_ENABLE_MMCARD.
2019-04-01 17:04:43 +11:00
Damien George 9670b26526 stm32: Rename MICROPY_HW_HAS_SDCARD to MICROPY_HW_ENABLE_SDCARD.
For consistency with the majority of other MICROPY_HW_ENABLE_xxx macros.
2019-04-01 15:21:26 +11:00
Damien George 7b5bf5f6fd stm32/uart: Handle correctly the char overrun case of RXNE=0 and ORE=1.
Fixes issue #3375.
2019-04-01 13:40:35 +11:00
roland van straten edd0e0f93d stm32/timer: Expose the PWM BRK capability of Timer 1 and 8.
The break mode is configurable via the 'brk' keyword to the Timer
constructor and init method.  It's disabled by default.
2019-04-01 13:30:37 +11:00
Andrew Leech 9d6f70f715 stm32: Make default USB_VCP stream go through uos.dupterm for main REPL.
Use uos.dupterm for REPL configuration of the main USB_VCP(0) stream on
dupterm slot 1, if USB is enabled.  This means dupterm can also be used to
disable the boot REPL port if desired, via uos.dupterm(None, 1).

For efficiency this adds a simple hook to the global uos.dupterm code to
work with streams that are known to be native streams.
2019-04-01 13:04:05 +11:00
Boris Vinogradov 6947dff7da stm32/Makefile: Allow to override CROSS_COMPILE with included Makefile. 2019-03-29 11:34:05 +11:00
Boris Vinogradov 1a608ce1e8 stm32/boards/STM32L476DISC: Enable servo support on STM32L476DISC board. 2019-03-28 15:35:58 +11:00
Damien George 92149c8a79 esp32/boards: Enable dual core support by default.
Single core is still supported, just by adding CONFIG_FREERTOS_UNICORE=y to
a custom sdkconfig file.
2019-03-27 11:20:21 +11:00
Damien George 815b79a8d0 esp32/mpthreadport: Exit vPortCleanUpTCB early if threading not init'd. 2019-03-27 11:11:06 +11:00
Damiano Mazzella 0b86ba565c unix/mpthreadport: Use named semaphores on Mac OS X.
Unnamed semaphores (via sem_init) are not supported on this OS.  See #4465.
2019-03-27 10:50:01 +11:00
Damien George 781947afdc stm32/mpconfigport.h: Remove malloc/free/realloc helper macros.
These macros are unused, and they can conflict with other entities by the
same name.  If needed they can be provided as static inline functions, or
just functions.

Fixes issue #4559.
2019-03-26 18:42:19 +11:00
roland van straten d396a7e10d stm32/system_stm32: Provide default value for HSI calibration.
If HSI is used the calibration value must be valid.  Fixes #4596.
2019-03-26 17:10:21 +11:00
Maureen Helm 2befcb8a9d zephyr/i2c: Add support for hardware i2c.
Adds support for hardware i2c to the zephyr port. Similar to other ports
such as stm32 and nrf, we only implement the i2c protocol functions
(readfrom and writeto) and defer memory operations (readfrom_mem,
readfrom_mem_into, and writeto_mem) to the software i2c implementation.
This may need to change in the future because zephyr is considering
deprecating its i2c_transfer function in favor of i2c_write_read; in this
case we would probably want to implement the memory operations directly
using i2c_write_read.

Tested with the accelerometer on frdm_k64f and bbc_microbit boards.
2019-03-26 16:16:26 +11:00
Damien George 673db939b5 esp32/machine_pin: Rework pull mode config to fix GPIO hold feature.
For gpio_hold_en() to work properly (not draw additional current) pull
up/down must be disabled when hold is enabled.  This patch makes sure this
is the case by reworking the pull constants to be a bit mask.
2019-03-26 15:21:23 +11:00
Glenn Ruben Bakke e0c6dfe90a nrf/readme: Add section about LTO.
Adding section about on how to disable use of the linker flag
-flto, by setting the LTO=0 argument to Make. Also, added a
note on recommended toolchains to use that works well with
LTO enabled.
2019-03-19 16:59:18 +01:00
Dave Hylands ec6e62efc2 stm32/mboot: Set USE_MBOOT=1 by default in the Makefile.
This allows boards that need USE_MBOOT to be built properly whether or not
USE_MBOOT=1 is specified when building mboot.
2019-03-18 14:01:43 +11:00
Glenn Ruben Bakke 696549d2e5 nrf/bluetooth: Deprecate use of SoftDevice s140 v6.0.0.
Removing linker script for nrf52840 s140 v6.0.0 as pca10056
target board now points to the new v6.1.1. Also, removing the
entry from the download_ble_stack.sh script.
2019-03-15 20:50:15 +01:00
Glenn Ruben Bakke a3a266a9c3 nrf/board: Migrate nrf52840 target to new BLE stack.
This patch moves pca10056/nrf52840 target board to use
the new SoftDevice s140 v6.1.1 instead of the legacy v6.0.0.
2019-03-15 20:50:15 +01:00
Glenn Ruben Bakke d3c1436e75 nrf/bluetooth: Add support for SoftDevice s140 version 6.1.1.
Updating download script to fetch the new SoftDevice, and
adding corresponding linker script for the BLE stack.
2019-03-15 20:50:15 +01:00
Glenn Ruben Bakke 1e5e3e3d48 nrf/bluetooth: Deprecate use of SoftDevice s132 v6.0.0.
Removing linker script for nrf52832 s132 v6.0.0 as all target
boards now points to the new v6.1.1. Also, removing the entry
from the download_ble_stack.sh script.
2019-03-15 20:50:15 +01:00
Glenn Ruben Bakke 5f26ef1112 nrf/board: Migrate all nrf52832 targets to new BLE stack.
This patch moves all the nrf52832 target boards to use the
new SoftDevice s132 v6.1.1 instead of the legacy v6.0.0.
2019-03-15 20:50:15 +01:00
Nguyen Hoan Hoang e8ed2dea71 nrf/bluetooth: Add support for SoftDevice s132 version 6.1.1.
Updating download script to fetch the new SoftDevice, and
adding corresponding linker script for the BLE stack.
2019-03-15 20:50:15 +01:00
roland van straten c9eb7eb449 stm32/stm32_it: Guard UART7_IRQHandler with check for UART7 define.
All STM32 with a UART7 also have a UART8 and vice versa, but this change
improves readability and allows for them to be independent in the future.
2019-03-14 14:02:21 +11:00
Damien George c7d19dc0ad ports/{stm32,esp8266}: Set mpy-cross native arch for frozen native code. 2019-03-14 12:22:49 +11:00
Damien George ddc934631c esp32/machine_pin: Add new PULL_HOLD pin pull mode. 2019-03-14 07:28:57 +11:00
Damien George 349b54525e esp32/machine_pin: Make it so None as pull value disables pull up/down.
Previously specifying None as the pull value would leave the pull up/down
state unchanged.  This change makes it so -1 leaves the state unchanged and
None makes the pin float, as per the docs.
2019-03-14 07:26:59 +11:00
Wolf Vollprecht ea2fcdd338 javascript: Fix Emscripten async load, and to compile with modern clang. 2019-03-13 23:52:15 +11:00
Rami Ali 7d675f3a17 javascript: Add new port targeting JavaScript via Emscripten.
In this port JavaScript is the underlying "machine" and MicroPython is
transmuted into JavaScript by Emscripten.  MicroPython can then run under
Node.js or in the browser.
2019-03-13 23:47:32 +11:00
Maureen Helm 493ee7df18 zephyr/prj_frdm_kw41z.conf: Add new board configuration.
Adds a new board configuration for the frdm_kw41z board, including support
for the fxos8700 accelerometer/magnetometer/die temperature sensor.
2019-03-12 17:12:13 +11:00
Maureen Helm 7748375b6e zephyr/prj_frdm_k64f.conf: Add fxos8700 sensor.
Adds the fxos8700 accelerometer/magnetometer/die temperature sensor to the
frdm_k64f board configuration.
2019-03-12 17:12:00 +11:00
Paul Sokolovsky 6d82499a48 zephyr/Makefile: Proxy ram_report, rom_report targets from Zephyr. 2019-03-12 17:11:52 +11:00
Paul Sokolovsky 755b0b807b zephyr/prj_minimal.conf: Switch to CONFIG_STDOUT_CONSOLE.
Prompted by code size analysis, after arduino_101 build overflowing ROM.
2019-03-12 17:11:46 +11:00
Paul Sokolovsky 21fc0c448e zephyr/modzsensor: Rename "TEMP" sensor channel to "DIE_TEMP".
I.e. on-die temperature sensor.  Upstream made more fine-grained channels
for different kinds of temperature.
2019-03-12 17:11:30 +11:00
Paul Sokolovsky a42c1d9fd5 zephyr/modzephyr: Revamp stacks_analyze() call.
Underlying k_call_stacks_analyze() was gone in Zephyr, reimplement using
k_thread_foreach().
2019-03-12 17:11:09 +11:00
Damien George 297092a76a esp32/mphalport: Use ets_delay_us for mp_hal_delay_us_fast.
The system provided one is in ROM and is more accurate.
2019-03-12 15:46:44 +11:00
Damien George fcace26d87 esp32/Makefile: Add some missing IDF source files to bootloader and app.
Functions in these files may be needed when certain features are enabled
(eg dual core mode), even if the linker does not give a warning or error
about unresolved symbols.
2019-03-11 23:17:09 +11:00
Petr Kracík 41e7ad647e esp32/modnetwork: Remove redundant esp_log include. 2019-03-08 23:36:07 +11:00
Petr Kracík 73c48b1b45 esp32/modnetwork: Implement RSSI for WiFi STA via WLAN.status('rssi'). 2019-03-08 23:35:28 +11:00
Andrew Leech 5688c9ba09 stm32/usb: Allow to override USB strings & VID/PID in app and mboot.
The override #define's should go in the board's mpconfigboard.h file.
2019-03-08 23:29:15 +11:00
Andrew Leech 0c60cb1fc4 stm32/qspi: Set pin speed to very-high and allow to config some options.
The default speed of the QSPI interface is 72Mhz whereas the standard AF
pin speed (high) is only rated to 50Mhz, so increase speed to very-high.
2019-03-08 23:17:50 +11:00
Andrew Leech 89ff506513 py: Update and rework build system for including external C modules.
How to use this feature is documented in docs/develop/cmodules.rst.
2019-03-08 22:58:42 +11:00
Andrew Leech cf22f4793c py: Allow registration of modules at their definition.
During make, makemoduledefs.py parses the current builds c files for
MP_REGISTER_MODULE(module_name, obj_module, enabled_define)

These are used to generate a header with the required entries for
"mp_rom_map_elem_t mp_builtin_module_table[]" in py/objmodule.c
2019-03-08 22:46:43 +11:00
Damien George e4ac104b7f stm32: Allow to build with threading with the GIL disabled. 2019-03-08 22:29:54 +11:00
Damien George c6a9bb23cd unix/Makefile: Update coverage tests to match those in Travis. 2019-03-08 16:51:09 +11:00
Damien George 7852b287df minimal/frozentest: Recompile now that mpy format and version changed. 2019-03-08 15:53:05 +11:00
Jim Mussared f2ebee9cf1 stm32/mboot: Update to match latest oofatfs version.
See corresponding commit b5f33ac2cb
2019-03-07 15:22:16 +11:00
Damien George 62483bb957 minimal/frozentest: Recompile now that mpy format changed. 2019-03-05 16:32:05 +11:00
Damien George b5f33ac2cb ports: Update to work with new oofatfs version. 2019-03-05 15:56:39 +11:00
Francisco J. Manno f938e70c69 stm32: Add compile-time option to use HSI as clock source.
To use HSI instead of HSE define MICROPY_HW_CLK_USE_HSI as 1 in the board
configuration file.  The default is to use HSE.

HSI has been made the default for the NUCLEO_F401RE board to serve as an
example, and because early revisions of this board need a hardware
modification to get HSE working.
2019-03-05 15:49:08 +11:00
Damien George e61862d063 stm32/boards: Update to use new build config for lwip component. 2019-03-04 23:34:03 +11:00
Damien George 78fe979d7d stm32: Use global lwip build config and support building without lwip. 2019-03-04 23:33:02 +11:00
Damien George 84479569de stm32/boards/STM32F769DISC: Use external QSPI flash to store some code.
This demonstrates how to use external QSPI flash in XIP (execute in place)
mode.  The default configuration has all extmod/ code placed into external
QSPI flash, but other code can easily be put there by modifying the custom
f769_qspi.ld script.
2019-03-04 22:40:15 +11:00
Damien George c8bbf2c170 stm32/Makefile: Allow a board to specify its linker sections for FW.
A board can now use the make variables TEXT0_SECTIONS and TEXT1_SECTIONS to
specify the linker sections that should go in its firmware.  Defaults are
provided which give the existing behaviour.
2019-03-04 22:26:55 +11:00
Damien George f8f2724297 stm32/qspi: Enable sample shift and disable timeout counter.
This makes the QSPI more robust, in particular the timeout counter should
not be used with memory mapped mode (see F7 errata).
2019-03-01 16:15:14 +11:00
Damien George 47e551ba59 cc3200/mpconfigport.h: Disable compiler optimisation of OrderedDict.
This port would rather keep the code size as RAM.
2019-03-01 15:24:29 +11:00
Damien George 8ce22662fe esp8266/modmachine: Call ets_event_poll after waiti in machine.idle.
Because "waiti 0" may have waited for a while (eg 500ms) and the internal
WDT may need to be fed immediately.

Fixes issue #4459.
2019-02-28 15:44:37 +11:00
Damien George 823b31e528 stm32/boards/NUCLEO_F429ZI: Enable lwIP and Ethernet peripheral. 2019-02-26 23:32:19 +11:00
Damien George ed0a530614 stm32/boards/STM32F769DISC: Enable lwIP and Ethernet peripheral. 2019-02-26 23:32:19 +11:00
Damien George b3513f54d3 stm32/boards/STM32F7DISC: Enable lwIP and Ethernet peripheral. 2019-02-26 23:32:19 +11:00
Damien George 8daec24168 stm32/boards/NUCLEO_F767ZI: Enable lwIP and Ethernet peripheral. 2019-02-26 23:32:19 +11:00
Damien George ac3e2f380d stm32/modnetwork: Don't call NIC callback if it's NULL. 2019-02-26 23:32:19 +11:00
Damien George 08a24c5f41 stm32/mpconfigport.h: Enable lwIP concurrency protection mechanism. 2019-02-26 23:32:19 +11:00
Damien George c55709bf29 stm32/network_lan: Add high-level network.LAN interface to ETH driver. 2019-02-26 23:32:19 +11:00
Damien George c950a1a35d stm32/eth: Add low-level Ethernet MAC driver. 2019-02-26 23:32:19 +11:00
Damien George cc63e19332 stm32/mphalport: Add mp_hal_get_mac() helper function. 2019-02-26 23:32:07 +11:00
Damien George 75a35448e1 stm32/boards/NUCLEO_F767ZI: Fix up comments about HCLK computation. 2019-02-26 22:44:27 +11:00
Petr Kracík 21f9329d5d esp32/modnetwork: Fix wifi.isconnected to return False after disconnect.
esp_wifi_connect will return ESP_OK for the normal path of execution which
just means the reconnect is started, not that it is actually reconnected.
In such a case wifi.isconnected() should return False until the
reconnection is complete.  After reconnect a GOT_IP event is called and it
will change wifi_sta_connected back to True.
2019-02-26 00:49:40 +11:00
Damien George 55ff562c70 unix/modffi: Eliminate unused-argument warning when debugging disabled. 2019-02-25 14:53:17 +11:00
Petr Kracík 5801a003f0 esp32/network_lan: Make power arg to constructor optional.
A value of None for this argument is already supported, so the argument can
be made optional.
2019-02-21 23:29:10 +11:00
Petr Kracík 01c1432e32 esp32/modnetwork: Catch and report Ethernet events. 2019-02-21 23:28:51 +11:00
Petr Kracík 7d8c71c222 esp32/network_lan: Add arg to constructor to set clock mode for ETH PHY.
This optional parameter for network.LAN clock_mode can be used for cases
where the clock source is different from the default GPIO0.  Fixes #4502.
2019-02-21 23:28:17 +11:00
Stig Bjørlykke c72391c4ce nrf/pwm: Remove superfluous NULL in machine_hard_pwm_instances.
Remove unneeded NULL entry in machine_hard_pwm_instances[] when not
building for NRF52_SERIES.
2019-02-20 22:52:18 +01:00
Stig Bjørlykke 6ca03fe8bd nrf/readme: Update make flash command when defining board.
Update the "make flash" command sample to include BOARD parameter
when building for a specific target board.
2019-02-20 22:34:08 +01:00
Glenn Ruben Bakke ca2bb66127 nrf/bluetooth: Resolve compilation warning in ble_drv.c.
This patch makes sure that the char_data.props is first
assigned a value before other flags are OR'd in.
Resolves compilation warning on possible unitialized variable.
2019-02-20 07:25:51 +01:00
Glenn Ruben Bakke 0c6f5bc529 nrf/bluetooth: Improve advertisment behavior for nrf52 targets.
This patch makes sure that advertisment data is located in
persistent static RAM memory throughout the advertisment.

Also, setting m_adv_handle to predifined
BLE_GAP_ADV_SET_HANDLE_NOT_SET value to indicate first time
usage of the handle. Upon first advertisment configuration
this will be populated with a handle value returned by the
stack (s132/s140).
2019-02-20 07:25:51 +01:00
Glenn Ruben Bakke ee3a01f25c nrf/readme: Update link to nrfjprog download.
After new layout of nordicsemi.com the direct links to
command line tools (nrfjprog) has changed to become dynamic.
This patch removes the old direct links to each specific OS
variant and is replaced with one single link to the download
landing page instead.
2019-02-20 07:13:36 +01:00
Andrew Leech 8ed4a28dae stm32/sdram: Increase GPIO speed for SDRAM interface to "very high".
Currently all usages of mp_hal_pin_config_alt_static() set the pin speed to
"high" (50Mhz).  The SDRAM interface typically runs much faster than this
so should be set to the maximum pin speed.

This commit adds mp_hal_pin_config_alt_static_speed() which allows setting
the pin speed along with the other alternate function details.
2019-02-20 16:54:32 +11:00
Dave Hylands a270cf280b stm32/stm32_it: Fix RTC IRQ handler to handle all EXTI IRQs on F0 MCUs. 2019-02-19 15:17:47 +11:00
Dave Hylands 67b326d97e stm32/extint: Remove unused (and incorrect) EXTI defines. 2019-02-19 15:17:32 +11:00
Dave Hylands 3d17d9b578 stm32/extint: Add non-GPIO EXTI IRQ sources for F0. 2019-02-19 15:17:28 +11:00
Dave Hylands 92fec603d0 stm32/make-stmconst.py: Improve regex to parse more constants.
A few RTC constants weren't being parsed properly due to whitespace
differences, and this patch makes certain whitespace optional.  Changes
made:

- allow for no space between /*!< and EXTI, eg for:
  __IO uint32_t IMR; /*!<EXTI Interrupt mask register, Address offset: 0x00 */

- allow for no space between semicolon and start of comment, eg for:
  __IO uint32_t ALRMASSR;/*!< RTC alarm A sub second register, Address offset: 0x44 */
2019-02-19 15:17:28 +11:00
Dave Hylands 9441f4b682 stm32/extint: Fix RTC Alarm/FS USB EXTI constants for L4. 2019-02-19 15:17:28 +11:00
Dave Hylands 363900be5d stm32/extint: Fix ExtInt to work with non-GPIO pins. 2019-02-19 15:17:20 +11:00
Damien George 303f27f656 esp32/modsocket: Change socket.socket to be socket type rather than fun.
To make all ports consistent.  Addresses issue #4514.
2019-02-18 23:20:13 +11:00
Damien George c65e5c88b8 stm32/boards/stm32f429.ld: Increase uPy heap size by 64k for F429 MCU.
The F429 has 256k total RAM, with 64k already set aside for flash write
cache, so the uPy heap can be increased this much.
2019-02-18 13:18:59 +11:00
Damien George ed09e13943 esp32/modsocket: Fix usocket.send to accept anything with buffer proto. 2019-02-18 12:38:38 +11:00
Damien George c551169bd8 stm32/mboot: Add hook to run board-specific code early on startup. 2019-02-15 15:34:05 +11:00
Damien George 65b1fefa31 stm32/modmachine: Add ability to pass through user data to mboot. 2019-02-15 15:10:04 +11:00
Damien George 3669198403 stm32/mboot: Add support script which can program mboot and application. 2019-02-15 15:09:59 +11:00
Damien George 3d0c31e60e stm32/mboot: Move some BSS vars to new section that isn't zeroed out.
Zeroing out data on startup takes time and is not necessary for certain
variables.  So provide a declaration for such variables and use it.
2019-02-15 15:09:54 +11:00
Damien George ff04b78ffd stm32/mboot: Add support for loading gzip'd firmware from a filesystem.
This adds support to mboot to load and program application firmware from
a .dfu.gz file on the board's filesystem.  See mboot/README.md for details.
2019-02-15 15:09:48 +11:00
Andrew Leech 4daee31706 stm32/qspi: Use static af functions for pin configuration.
This allows qspi pin configuration to work on any supported platform.
2019-02-14 13:42:08 +11:00
Damien George be4e5b1f87 stm32/mboot/mphalport.h: Include genhdr/pins.h for access to pin names.
So that mboot configuration can use names like pyb_pin_X1.
2019-02-14 13:39:13 +11:00
Damien George f38397ba8d stm32/mboot/Makefile: Generate all pin header files from board pins.csv. 2019-02-14 13:36:32 +11:00
Damien George 7b2dc96251 stm32/boards/make-pins.py: Add cmdline options to support use by mboot. 2019-02-14 13:35:39 +11:00
Yonatan Goldschmidt bc4f8b438b extmod/moduwebsocket: Refactor `websocket` to `uwebsocket`.
As mentioned in #4450, `websocket` was experimental with a single intended
user, `webrepl`. Therefore, we'll make this change without a weak
link `websocket` -> `uwebsocket`.
2019-02-14 00:35:45 +11:00
Jolatomme d1acca3c71 stm32/boards/NUCLEO_L476RG: Add support for RNG, DAC and CAN1.
PLLQ is changed to get CAN working, and I2C1 pins are changed to those
prescribed by the board.
2019-02-14 00:28:28 +11:00
Damien George 26a1ae295f stm32/mboot/Makefile: Support specifying BOARD_DIR for custom board. 2019-02-14 00:01:14 +11:00
Yonatan Goldschmidt 66f0afc91d unix/modmachine: Handle repeated /dev/mem open errors.
If opening of /dev/mem has failed an `OSError` is appropriately raised, but
the next time `mem8/16/32` is accessed the invalid file descriptor is used
and the program gets a SIGSEGV.
2019-02-12 15:29:11 +11:00
Mike Causer 812969d615 all: Change PYB message prefix to MPY.
Replaces "PYB: soft reboot" with "MPY: soft reboot", etc.

Having a consistent prefix across ports reduces the difference between
ports, which is a general goal.  And this change won't break pyboard.py
because that tool only looks for "soft reboot".
2019-02-12 15:18:33 +11:00