Commit Graph

2606 Commits

Author SHA1 Message Date
Peter van der Burg
771d673e5c samd/boards/SAMD21_XPLAINED_PRO: Update for flash and pins.
- mpconfigboard.h: flash and USART config
- mpconfigboard.mk: enable LFS1
- pins.c: define pins and LEDs
- pins.h: define structs and consts
2021-11-19 11:47:43 +11:00
Peter van der Burg
fb79e58636 samd/boards/ADAFRUIT_TRINKET_M0: Update for flash and pins.
- mpconfigboard.h: flash and USART config
- mpconfigboard.mk: enable LFS1
- pins.c: define pins and LEDs
- pins.h: define structs and consts
2021-11-19 11:47:19 +11:00
Peter van der Burg
3d33dbedc9 samd/boards/MINISAM_M4: Update for flash and pins.
- mpconfigboard.h: flash and USART config
- mpconfigboard.mk: enable LFS1
- pins.c: define pins and LEDs
- pins.h: define structs and consts
2021-11-19 11:46:53 +11:00
Peter van der Burg
199b6a8a8b samd/boards/ADAFRUIT_ITSYBITSY_M4_EXPRESS: Update for flash and pins.
- mpconfigboard.h: flash and USART config
- mpconfigboard.mk: enable LFS1
- pins.c: define pins and LEDs
- pins.h: define structs and consts
2021-11-19 11:46:30 +11:00
Peter van der Burg
72cb4ff596 samd/boards/ADAFRUIT_FEATHER_M0_EXPRESS: Update for flash and pins.
- mpconfigboard.h: flash and USART config
- mpconfigboard.mk: enable LFS1
- pins.c: define pins and LEDs
- pins.h: define structs and consts
2021-11-19 11:44:07 +11:00
Peter van der Burg
2f65ded1a2 samd: Add Pin and LED classes, and machine.unique_id. 2021-11-19 11:43:06 +11:00
Peter van der Burg
2121353602 samd: Add internal flash block device, filesystem and uos support. 2021-11-19 11:42:58 +11:00
Peter van der Burg
4c132614e1 samd/samd_soc: Allow a board to configure the low-level MCU config.
The board specific #defines will be moved to individual boards.
2021-11-19 11:42:47 +11:00
Peter van der Burg
cd2223b8fe samd: Integrate latest asf4, add help, more time funcs and uPy features.
- Makefile: update to use new ASF4 files, support frozen manifest, and
  include source files in upcoming commits
- boards/manifest.py: add files to freeze
- boards/samd51p19a.ld: add linker script for this MCU
- help.c: add custom help text
- main.c: execute _boot.py, boot.py and main.py on start-up
- modules/_boot.py: startup file to freeze
- modutime.c: add gmtime, localtime, mktime, time functions
- mpconfigport.h: enabled more features for sys and io and modules
- mphalport.h: add mp_hal_pin_xxx macros
- mphalport.c: add mp_hal_stdio_poll
2021-11-19 11:05:05 +11:00
stijn
5900257dd6 extmod/uplatform: Use generic custom platform string.
Don't force the 'HAL' string to be part of the platform string because
it doesn't have a sensible meaning for all possible platforms, and
swap it with the PLATFORM_ARCH string so the strings which most platforms
have come first.
2021-11-18 10:46:14 +11:00
retsyo
e5f9e2febc windows/mpconfigport.h: Enable help and help("modules").
Following a similar change to the unix port in
6430cd3e02
2021-11-17 14:52:39 +11:00
Matt van de Werken
a4c0f52714 stm32/led: Support an extra 2 LEDs in board configuration.
Although the pyboard has only 4 LEDs, there are some boards that (may) have
more.  This commit adds 2 more LEDs to the led.c file that if defined in
the board-specific config file will be compiled in.
2021-11-17 14:46:58 +11:00
Pooya Moradi
95ccd9a005 nrf/Makefile: Improve Black Magic Probe commands.
Used batch mode to get rid of the confirmation prompt on flashing.
Used 'compare-sections' to verify flash.
Removed the unnecessary `quit` at the end.
2021-11-17 14:32:02 +11:00
Henk Vergonet
d11ff0499f unix/modos: Add support for uos.urandom(n).
Use getrandom function if available, otherwise read from /dev/urandom.

Signed-off-by: Henk.Vergonet@gmail.com
2021-11-17 12:59:38 +11:00
robert-hh
5ed7a748f0 rp2/boards: Add neopixel.py to manifest.py.
Because machine.bitstream is now implemented on the rp2 port.
2021-11-17 10:02:32 +11:00
robert-hh
b73d8b045a rp2/machine_bitstream: Implement the machine.bitstream driver.
Timing error is ~20ns at 125MHz, and ~10ns at 250MHz.
2021-11-17 10:01:15 +11:00
robert-hh
7d7d29dbe2 mimxrt: Fix mp_hal_quiet_timing_enter()/exit() so timer still runs.
The initial code disabled IRQs, which caused the us-ticks timer to stop.
The change here changes the priotity level, such that the timer still runs.
2021-11-16 23:20:06 +11:00
robert-hh
7cc9b257a9 mimxrt/boards: Update the board.json files and add deploy_xx.md files.
- Add board.md files for MIMXRT1060_EVK and MIMXRT1064_EVK warning about
  their experimental state.
- Add separate deploy_teensy.md and deploy_mimxrt.md files.
2021-11-16 23:17:42 +11:00
robert-hh
d72d699dad mimxrt/boards: Add the Seeed ARCH MIX board.
The ARCH MIX board exposes the Ethernet Pins at it's connectors.  Therefore
the software is configured for using a LAN8720 PHY device.  Breakout boards
with the LAN8720 are easily available.
2021-11-16 23:11:21 +11:00
iabdalkader
c3dceb1c32 rp2/boards: Add support for Arduino Nano RP2040. 2021-11-16 15:05:10 +11:00
iabdalkader
3745c393c8 rp2: Add support for Nina-W10 WiFi/BT module.
This commit integrates the Nina-W10 driver as an optional component in the
rp2 port.
2021-11-13 23:01:37 +11:00
Mike Teachman
b6dbbbe82f rp2/machine_i2s: Add I2S protocol support.
This commit adds I2S protocol support for the rp2 port:
- I2S API is consistent with STM32 and ESP32 ports
- I2S configurations supported:
  - master transmit and master receive
  - 16-bit and 32-bit sample sizes
  - mono and stereo formats
  - sampling frequency
  - 3 modes of operation:
    - blocking
    - non-blocking with callback
    - uasyncio
  - internal ring buffer size can be tuned
- DMA IRQs are managed on an I2S object basis, allowing other
  RP2 entities to use DMA IRQs when I2S is not being used
- MicroPython documentation
- tested on Raspberry Pi Pico development board
- build metric changes for this commit: text(+4552), data(0), bss(+8)

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-11-13 12:27:42 +11:00
MikeTeachman
6d5296e65e stm32,esp32: In machine_i2s, make object reference arrays root pointers.
This change eliminates the risk of the IRQ callback accessing invalid data.
Discussed here:
https://github.com/micropython/micropython/pull/7183#discussion_r660209875

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-11-13 12:22:42 +11:00
MikeTeachman
0be3b91f11 stm32,esp32: In machine_i2s, send null samples in underflow situations.
Eliminate noise data from being sent to the I2S peripheral when the
transmitted sample stream is stopped.

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-11-12 16:50:15 +11:00
Magnus von Wachenfeldt
6d9da27c21 esp32: Support building with latest IDF v5.
The latest ESP-IDF v5.0-dev declares MAJOR_VERSION 5 and MINOR_VERSION 0.
timer_ll_set_alarm_enable() is also changed to timer_ll_set_alarm_value().
2021-11-12 16:40:46 +11:00
Damien George
ff4f1f3ab3 esp8266/boards/GENERIC: Enable f-strings.
Costs 612 bytes of code space.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-05 14:05:54 +11:00
Damien George
fa873ce67c minimal/mpconfigport.h: Disable features that are not needed.
Now that there are feature levels, and that this port uses
MICROPY_CONFIG_ROM_LEVEL_MINIMUM, it's easy to see what optional features
can be disabled.  And this commit disables them.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-05 13:12:18 +11:00
Jim Mussared
c9c55032dc minimal/Makefile: Don't force a 32-bit build.
Word-size specific configuration is now done automatically, so it no longer
requires this to match the ARM configuration.

Also it's less common to have 32-bit compilation support installed, so this
will make it work "out of the box" for more people.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-04 15:59:20 +11:00
Jim Mussared
693b927687 rp2: Enable optimisations (comp goto, map cache, fast attr).
Computed goto costs 1800 bytes for 5-10% performance.

Map caching and attr fast path costs 130 bytes for up to 30%.

Net effect of those three optimisations:
bm_chaos.py         +16.059% (+/-0.09%)
bm_fannkuch.py      +11.145% (+/-0.01%)
bm_fft.py           +14.604% (+/-0.01%)
bm_float.py         +26.849% (+/-0.08%)
bm_hexiom.py        +34.039% (+/-0.03%)
bm_nqueens.py       +18.333% (+/-0.06%)
bm_pidigits.py       +4.472% (+/-0.03%)
misc_aes.py         +28.765% (+/-0.09%)
misc_mandel.py      +27.116% (+/-0.05%)
misc_pystone.py     +40.299% (+/-0.20%)
misc_raytrace.py    +22.812% (+/-0.07%)

Also enable other EXTRA-level optimisations (module const, return_if_expr,
triple_tuple_assign, factorial, mpz bitwise).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-01 15:25:45 +11:00
Damien George
c62351fbd6 py/mpconfig.h: Revert MICROPY_REPL_INFO to disabled at all levels.
This is an stm32-specific feature that's accessed via the pyb module, so
not something that will be widely enabled.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-01 15:18:22 +11:00
Jim Mussared
b1a0ce46d1 rp2/mpconfigport.h: Use the "extra" feature level.
This commit is a no-op change to simplify existing config.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-01 15:02:58 +11:00
Jim Mussared
3041881353 stm32/mpconfigport.h: Use the "extra" feature level.
This commit is a no-op change.  Future improvements can come from making
individual boards use CORE or BASIC.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-01 15:02:22 +11:00
Damien George
ad17d9f001 bare-arm/mpconfigport.h: Disable remaining optional features.
Signed-off-by: Damien George <damien@micropython.org>
2021-11-01 14:23:06 +11:00
Damien George
b4de39c43c bare-arm/mpconfigport.h: Use MICROPY_CONFIG_ROM_LEVEL_MINIMUM.
To simplify the config.  This commit does not change the build.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-01 14:17:22 +11:00
Mike Causer
7f14344428 ports: Add images, features and urls to board.json. 2021-10-28 15:25:38 +11:00
Damien George
83827e8e63 stm32/uart: Fix race conditions and clearing status in IRQ handler.
Prior to this commit IRQs on STM32F4 could be lost because SR is cleared by
reading SR then reading DR.  For example, if both RXNE and IDLE IRQs were
active upon entry to the IRQ handler, then IDLE is lost because the code
that handles RXNE comes first and accidentally clears SR (by reading SR
then DR to get the incoming character).

This commit fixes this problem by making the IRQ handler more atomic in the
following operations:
- get current IRQ status flags
- deal with RX character
- clear remaining status flags
- call user handler

On the STM32F4 it's very hard to get this right because the only way to
clear IRQ status flags is to read SR then DR, but the read of DR may read
some data which should remain in the register until the user wants to read
it.  And it won't work to cache the read because RTS/CTS flow control will
then not work.  So instead the new code disables interrupts if the DR is
full and waits for the user to read it before reenabling the interrupts.

Fixes issue mentioned in #4599 and #6082.

Signed-off-by: Damien George <damien@micropython.org>
2021-10-28 13:14:21 +11:00
Mike Causer
07ea1afe74 esp32/boards/ESP32_S2_WROVER: Link to specific deploy_s2 instructions. 2021-10-28 12:58:58 +11:00
Mike Causer
3ace779e8e esp32/boards/LOLIN_S2_PICO: Add LOLIN_S2_PICO board definition files. 2021-10-28 12:58:50 +11:00
Damien George
1e4849557d esp32/usb: Further improve speed of USB CDC output.
Following on from ba940250a5, the change here
makes output about 15 times faster (now up to about 550 kbytes/sec).

tinyusb_cdcacm_write_queue will return the number of bytes written, so
there's no need to use tud_cdc_n_write_available.

Signed-off-by: Damien George <damien@micropython.org>
2021-10-28 11:37:35 +11:00
Seon Rozenblum
5b9c9cd097 esp32/boards: Update board and deploy metadata for UM_xxx boards. 2021-10-28 11:32:13 +11:00
Mike Causer
590ec2ca6e stm32/boards: Add images to board.json for Adafruit and VCC_GND boards. 2021-10-28 09:52:59 +11:00
Mike Causer
5bb14c4e46 esp32/boards/LOLIN_S2_MINI: Add image to board.json. 2021-10-28 09:51:04 +11:00
Jim Mussared
910e9f9111 esp32: Add specific deploy_s2.md instructions for esp32-s2.
In particular the UM S2 boards (and update the features list).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-28 09:47:47 +11:00
Jim Mussared
e359b077dd ports: Add board.json for all boards.
This will be used by https://micropython.org/download/ to generate the
full listing of boards and firmware files.

Optionally supports a board.md for additional customisation of the
download page, as well as deploy.md for flashing instructions.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-27 14:04:53 +11:00
Jim Mussared
43467b9c71 extmod/modbluetooth: Add connection interval to gap_connect.
This forwards through directly to the NimBLE and BTStack connect functions.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-26 00:16:53 +11:00
robert-hh
9f6604eb27 mimxrt: Enable the platform module. 2021-10-25 23:54:52 +11:00
robert-hh
4f89c38a6a mimxrt: Optimize the runtime speed.
By moving code to ITCM, like vm, gc, parse, runtime.  The change affects
mostly the execution speed of MicroPython code.  The speed is increased by
up to a factor of 6, especially for MCU with small cache.
2021-10-25 23:54:47 +11:00
robert-hh
90b45efa6a mimxrt/boards/make-pins.py: Allow empty lines and comments in pins.csv. 2021-10-25 23:53:51 +11:00
robert-hh
6754213a9d mimxrt/modmachine: Implement soft_reset() and unique_id() functions. 2021-10-25 23:53:48 +11:00
robert-hh
a12e318948 mimxrt/mpconfigport.h: Enable f-strings. 2021-10-25 23:52:35 +11:00
robert-hh
c827d4b7ab mimxrt: Extend the help() message and README.md. 2021-10-25 23:52:08 +11:00
robert-hh
e7572776c3 mimxrt: Add dht_readinto() to the mimxrt module, and freeze dht.py.
The change affects dht.py from the drivers directory as well to include the
logic for the mimxrt port.
2021-10-25 23:49:28 +11:00
robert-hh
99221cd118 mimxrt: Fix cycle counter for time.ticks_cpu() and machine.bitstream().
Prior to this commit mp_hal_ticks_cpu() was not started properly.  It only
started when the code was executed with a debugger attached, except for the
Teensy (i.MXRT1062) boards.  As an additional fix, the CYYCNT timer is now
started at boot time.

Also rename mp_hal_ticks_cpu_init() to mp_hal_ticks_cpu_enable().
2021-10-25 15:50:44 +11:00
robert-hh
06d1b02014 mimxrt/dma_channel: Fix the DMA channel management.
The MIMXRT1011 has only 16 channels, so size the channel list accordingly.
2021-10-25 15:50:44 +11:00
robert-hh
101d2ddea3 mimxrt/hal: Remove duplicate definitions from flexspi_hyper_flash.h. 2021-10-25 15:50:44 +11:00
robert-hh
68146aa197 mimxrt/boards: Fix the D14/D15 pin assignment of MIMXRT1050/60/64_EVK.
There are several PCB layouts in the market under the same name.
2021-10-25 15:50:38 +11:00
robert-hh
c2e4759cfa mimxrt/modmachine: Implement machine.WDT() and machine.reset_cause().
The API follows that of rp2, stm32, esp32, and the docs.

    wdt=machine.WDT(0, timeout)

        Timeout is given in ms. The valid range is 500 to 128000 (128
        seconds) with 500 ms granularity. Values outside of that range will
        be silently aligned.

    wdt.feed()

        Resets the watchdog timer (feeding).

    wdt.timeout_ms(value)

        Sets a new timeout and feeds the watchdog.

        This is a new, preliminary method which is not yet documented.

    reset_cause = machine.reset_cause()

        Values returned:

        1  Power On reset
        3  Watchdog reset
        5  Software reset: state after calling machine.reset()

More elaborate API functions are supported by the MCU, like an interrupt
called a certain time after feeding.  But for port cosistency that is not
implemented.
2021-10-25 15:43:56 +11:00
robert-hh
1866ed7e2e mimxrt/eth: Add LAN support and integrate the network module.
This commit implements 10/100 Mbit Ethernet support in the mimxrt port.

The following boards are configured without ETH network:
- MIMXRT1010_EVK
- Teensy 4.0

The following boards are configured with ETH network:
- MIMXRT1020_EVK
- MIMXRT1050_EVK
- MIMXRT1060_EVK
- MIMXRT1064_EVK
- Teensy 4.1

Ethernet support tested with TEENSY 4.1, MIMRTX1020_EVK and MIMXRT1050_EVK.
Build tested with Teensy 4.0 and MIMXRT1010_EVK to be still working.
Compiles and builds properly for MIMXRT1060_EVK and MIMXRT1064_EVK, but not
tested lacking suitable boards.

Tested functions are:
- ping works bothway
- simple UDP transfer works bothway
- ntptime works
- the ftp server works
- secure socker works
- telnet and webrepl works

The MAC address is 0x02 plus 5 bytes from the manifacturing info field,
which can be considered as unique per device.

Some boards do not wire the RESET and INT pin of the PHY transceiver.  For
operation, these are not required.  If they are defined, they will be used.
2021-10-25 15:14:26 +11:00
Philipp Ebensberger
7e62c9707a mimxrt/sdram: Add SDRAM support.
Adds support for SDRAM via `SEMC` peripheral. SDRAM support can be
enabled in the mpconfigboard.mk file by setting `MICROPY_HW_SDRAM_AVAIL`
to `1` and poviding the size of the RAM via `MICROPY_HW_FLASH_SIZE`.

When SDRAM support is enabled the whole SDRAM is currently used used
for MicroPython heap.

Signed-off-by: Philipp Ebensberger
2021-10-22 08:23:24 +02:00
Damien George
30268c93dc stm32/pendsv: Allow a board to add entries for pendsv_schedule_dispatch.
Signed-off-by: Damien George <damien@micropython.org>
2021-10-20 21:20:18 +11:00
Damien George
69522822de stm32/mpbthciport: Allow a board to hook BT HCI poll functions.
Signed-off-by: Damien George <damien@micropython.org>
2021-10-20 21:20:18 +11:00
Damien George
5f2f9044ff stm32/usbd_cdc_interface: Allow a board to hook into USBD CDC RX events.
Signed-off-by: Damien George <damien@micropython.org>
2021-10-20 21:20:18 +11:00
Andrew Leech
cc42b7c88b unix/modusocket: Support MP_STREAM_POLL in unix socket_ioctl.
Allows asyncio reading of network sockets when MICROPY_PY_USELECT is used
in the build configuration.
2021-10-19 22:48:10 +11:00
Damien George
ba940250a5 esp32/usb: Improve speed of USB CDC output.
Signed-off-by: Damien George <damien@micropython.org>
2021-10-16 00:23:59 +11:00
Damien George
549448e8bb esp32: Enable optimisations and move code to iRAM to boost performance.
This commit enables some significant optimisations for esp32:
- move the VM to iRAM
- move hot parts of the runtime to iRAM (map lookup, load global/name,
  mp_obj_get_type)
- enable MICROPY_OPT_LOAD_ATTR_FAST_PATH
- enable MICROPY_OPT_MAP_LOOKUP_CACHE
- disable assertions
- change from -Os to -O2 for compilation

It's hard to measure performance on esp32 due to external flash and
hardware caching.  But this set of changes improves performance compared to
master by (on a TinyPICO with the GENERIC build, using IDF 4.2.2, running
at 160MHz):

diff of scores (higher is better)
N=100 M=100    esp32-master -> esp32-perf       diff      diff% (error%)
bm_chaos.py           71.28 ->     268.08 :  +196.80 = +276.094% (+/-0.04%)
bm_fannkuch.py        44.10 ->      69.31 :   +25.21 = +57.166% (+/-0.01%)
bm_fft.py           1385.27 ->    2538.23 : +1152.96 = +83.230% (+/-0.01%)
bm_float.py         1060.94 ->    3900.62 : +2839.68 = +267.657% (+/-0.03%)
bm_hexiom.py          10.90 ->      32.79 :   +21.89 = +200.826% (+/-0.02%)
bm_nqueens.py       1000.83 ->    2372.87 : +1372.04 = +137.090% (+/-0.01%)
bm_pidigits.py       288.13 ->     664.40 :  +376.27 = +130.590% (+/-0.46%)
misc_aes.py          102.45 ->     345.69 :  +243.24 = +237.423% (+/-0.01%)
misc_mandel.py      1016.58 ->    2121.92 : +1105.34 = +108.731% (+/-0.01%)
misc_pystone.py      632.91 ->    1801.87 : +1168.96 = +184.696% (+/-0.08%)
misc_raytrace.py      76.66 ->     281.78 :  +205.12 = +267.571% (+/-0.05%)
viper_call0.py       210.63 ->     273.17 :   +62.54 = +29.692% (+/-0.01%)
viper_call1a.py      208.45 ->     269.51 :   +61.06 = +29.292% (+/-0.00%)
viper_call1b.py      185.44 ->     228.25 :   +42.81 = +23.086% (+/-0.01%)
viper_call1c.py      185.86 ->     228.90 :   +43.04 = +23.157% (+/-0.01%)
viper_call2a.py      207.10 ->     267.25 :   +60.15 = +29.044% (+/-0.00%)
viper_call2b.py      173.76 ->     209.42 :   +35.66 = +20.523% (+/-0.00%)

Five tests have more than 3x speed up (200%+).

The performance of the tests bm_fft, bm_pidigits and misc_aes now scale
with CPU frequency (eg changing frequency to 240MHz boosts the performance
of these by 50%), which means they are no longer influenced by timing of
external flash access.  (The viper_call* tests did previously scale with
CPU frequency, and they still do.)

Turning off assertions reduces code size by about 80k, and going from -Os
to -O2 costs about 100k, so the net change in code size (for the GENERIC
board) is about +20k.

If a board wants to enable assertions, or use -Os instead of -O2, that's
still possible by overriding the sdkconfig parameters.

Signed-off-by: Damien George <damien@micropython.org>
2021-10-16 00:07:11 +11:00
iabdalkader
eea6cd85b3 stm32/sdram: Enforce gcc opt, and use volatile and DSB in sdram_test.
Ensures consistent behaviour and resolves the D-Cache bug (the "exhaustive"
argument being lost due to cache being turned off) when O0 is used.

The changes in this commit are:

- Change -O0 to -Os because "gcc is considered broken at -O0" according to
  https://github.com/ARM-software/CMSIS_5/issues/620#issuecomment-550235656

- Use volatile for mem_base so the compiler doesn't optimise away reads or
  writes to the SDRAM, which is being tested.

- Use DSB to prevent any other compiler optimisations that would change the
  testing logic.

- Use alternating pattern/antipattern in exhaustive test to catch more
  hardware/configuration errors.

Implementation adapted by @andrewleech, taken directly from investigation
by @iabdalkader and @dpgeorge.

See #7841 and #7869 for further discussion.
2021-10-15 17:59:31 +11:00
Damien George
ea186de4c5 esp32: Split out WLAN code from modnetwork.c to network_wlan.c.
To match network_lan.c and network_ppp.c, and make it clear what code is
specifically for WLAN support.

Also provide a configuration option MICROPY_PY_NETWORK_WLAN which can be
used to fully disable network.WLAN (it's enabled by default).

Signed-off-by: Damien George <damien@micropython.org>
2021-09-24 12:41:35 +10:00
Damien George
f046b50ca5 esp32/main: Add option for a board to hook code into startup sequence.
To do this the board must define MICROPY_BOARD_STARTUP, set
MICROPY_SOURCE_BOARD then define the new start-up code.

For example, in mpconfigboard.h:

    #define MICROPY_BOARD_STARTUP board_startup
    void board_startup(void);

in mpconfigboard.cmake:

    set(MICROPY_SOURCE_BOARD
        ${MICROPY_BOARD_DIR}/board.c
    )

and in a new board.c file in the board directory:

    #include "py/mpconfig.h"

    void board_startup(void) {
        boardctrl_startup();
        // extra custom startup
    }

This follows stm32's boardctrl facilities.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-24 12:23:14 +10:00
leo chung
4fdf795efa esp32/mpthreadport: Fix TCB cleanup function so thread_mutex is ready.
Because vPortCleanUpTCB is called by the FreeRTOS idle task, and it checks
thread, but didn't check the thread_mutex.

And if thread is not NULL, but thread_mutex not ready then it will crash
with an error when calling mp_thread_mutex_lock(&thread_mutex, 1).

As suggested by @dpgeorge, move the thread = &thread_entry0 line to the end
of mp_thread_init().

Signed-off-by: leo chung <gewalalb@gmail.com>
2021-09-24 12:12:03 +10:00
Seon Rozenblum
a39a596b79 esp32/machine_pin: Block out IO16 and IO17 when using SPIRAM on ESP32.
Fixes issue #7819.
2021-09-24 10:56:09 +10:00
Seon Rozenblum
35fb90bd57 esp32/usb: Add USB host connection detection for CDC serial output.
This callback allows detecting if there is a USB host connected to the CDC
or not, in which case the stdout_tx should skip CDC TX writing and
flushing or the system will block.

Fixes issue #7820.
2021-09-22 00:42:20 +10:00
Seon Rozenblum
7bf466a281 esp32/README: Updated readme with req IDF vers for ESP32-S2, C3 and S3. 2021-09-22 00:41:02 +10:00
IhorNehrutsa
52636fa692 esp32/machine_pwm: Add support for all PWM timers and channels.
This commit allows using all the available PWM timers (up to 8) and
channels (up to 16), without affecting the PWM API.

If a new frequency is set, first it checks if another timer is using the
same frequency.  If yes, then it uses this timer, otherwise, it creates a
new one.  If all timers are used, the user should set an already used
frequency, or de-init a channel.

This work is based on #6276 and #3608.
2021-09-21 23:18:09 +10:00
Stewart Bonnick
0d9429f44c esp32/boards: Add LOLIN_S2_MINI ESP32-S2 board.
To support Lolin S2 Mini ESP32-S2 Variant board.  More information about
this board can be found at https://www.wemos.cc/en/latest/s2/s2_mini.html
2021-09-21 22:49:51 +10:00
iabdalkader
67d1dca9c2 stm32/machine_i2c: Use hardware I2C for STM32H7. 2021-09-21 18:13:28 +10:00
roland van straten
9eff4029ab stm32/boards: Add PF11-BOOT0 to stm32f091_af.csv.
PF11 is added so it can be used as GPIO.
2021-09-21 18:11:42 +10:00
Ned Konz
99bb52047c stm32/boards/NUCLEO_H743ZI: Enable VfsLfs2 on NUCLEO_H743ZI(2) boards. 2021-09-21 18:02:19 +10:00
Ned Konz
8c214ed200 stm32: Extended flash filesystem space to 512K on H743 boards.
The H743 has equal sized pages of 128k, which means the filesystem doesn't
need to be near the beginning.  This commit moves the filesystem to the
very end of flash, and extends it to 512k (4 pages).

Signed-off-by: Damien George <damien@micropython.org>
2021-09-21 18:02:14 +10:00
iabdalkader
782d5b2e53 stm32: Enable platform module.
The HAL version is based on the stm32lib version.
2021-09-19 23:35:44 +10:00
iabdalkader
38f8e852e0 rp2: Add framework for networking.
MICROPY_PY_NETWORK and MICROPY_PY_USOCKET need to be enabled by a board to
get networking.  No NICs have yet been defined.
2021-09-19 23:20:13 +10:00
iabdalkader
c973cfd2f3 rp2: Add support for bluetooth module using NimBLE. 2021-09-19 23:09:59 +10:00
Chris Fiege
6e39f2cc1e stm32/boards: Add OLIMEX H407 board definition.
This change adds the OLIMEX H407 support to the STM32 port.  The H407
(https://www.olimex.com/Products/ARM/ST/STM32-H407/) is simliar to the
already existing E407
(https://www.olimex.com/Products/ARM/ST/STM32-E407) but does not support
Ethernet and has a full-size USB-A port instead of a Mini-USB socket.

Both boards use the STM32F407ZGT6 CPU.

This port is basically a copy of the E407 but with changed pinmux:
* Removed Ethernet pin definition
* Removed UART1 (pins are used for other functions)
* Removed UART3 flow control pins (pins are used for other functions)
* Removed SD-Card detect pin (since it is not connected on the H407)

A REPL on UART3 is connected to the U3BOOT-header, a 3-pin header with RX,
TX and GND that is intended for the serial terminal.

Tested:
* Micro-SD Card is detected when inserted on RESET
* REPL on UART3 works
* Serial port on the mini USB socket

Signed-off-by: Chris Fiege <cfi@pengutronix.de>
2021-09-19 16:58:58 +10:00
patrick
4cfd85eb4a esp32/boards: Add board definition for ESP32-S2-WROVER module. 2021-09-19 16:49:35 +10:00
Seon Rozenblum
13e6e0d7f5 esp32/machine_hw_spi: Fix hardware SPI DMA channels for S2/S3. 2021-09-19 10:23:12 +10:00
Damien George
80fe25689f esp32/boards: Add new GENERIC_S3 board definition.
Thanks to Seon Rozenblum aka @UnexpectedMaker for the work.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-16 22:58:47 +10:00
Damien George
54d33b266c esp32: Add support for ESP32-S3 SoCs.
Thanks to Seon Rozenblum aka @UnexpectedMaker for the work.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-16 22:58:47 +10:00
Jim Mussared
b326edf68c all: Remove MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE.
This commit removes all parts of code associated with the existing
MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE optimisation option, including the
-mcache-lookup-bc option to mpy-cross.

This feature originally provided a significant performance boost for Unix,
but wasn't able to be enabled for MCU targets (due to frozen bytecode), and
added significant extra complexity to generating and distributing .mpy
files.

The equivalent performance gain is now provided by the combination of
MICROPY_OPT_LOAD_ATTR_FAST_PATH and MICROPY_OPT_MAP_LOOKUP_CACHE (which has
been enabled on the unix port in the previous commit).

It's hard to provide precise performance numbers, but tests have been run
on a wide variety of architectures (x86-64, ARM Cortex, Aarch64, RISC-V,
xtensa) and they all generally agree on the qualitative improvements seen
by the combination of MICROPY_OPT_LOAD_ATTR_FAST_PATH and
MICROPY_OPT_MAP_LOOKUP_CACHE.

For example, on a "quiet" Linux x64 environment (i3-5010U @ 2.10GHz) the
change from CACHE_MAP_LOOKUP_IN_BYTECODE, to LOAD_ATTR_FAST_PATH combined
with MAP_LOOKUP_CACHE is:

diff of scores (higher is better)
N=2000 M=2000       bccache -> attrmapcache      diff      diff% (error%)
bm_chaos.py        13742.56 ->   13905.67 :   +163.11 =  +1.187% (+/-3.75%)
bm_fannkuch.py        60.13 ->      61.34 :     +1.21 =  +2.012% (+/-2.11%)
bm_fft.py         113083.20 ->  114793.68 :  +1710.48 =  +1.513% (+/-1.57%)
bm_float.py       256552.80 ->  243908.29 : -12644.51 =  -4.929% (+/-1.90%)
bm_hexiom.py         521.93 ->     625.41 :   +103.48 = +19.826% (+/-0.40%)
bm_nqueens.py     197544.25 ->  217713.12 : +20168.87 = +10.210% (+/-3.01%)
bm_pidigits.py      8072.98 ->    8198.75 :   +125.77 =  +1.558% (+/-3.22%)
misc_aes.py        17283.45 ->   16480.52 :   -802.93 =  -4.646% (+/-0.82%)
misc_mandel.py     99083.99 ->  128939.84 : +29855.85 = +30.132% (+/-5.88%)
misc_pystone.py    83860.10 ->   82592.56 :  -1267.54 =  -1.511% (+/-2.27%)
misc_raytrace.py   21490.40 ->   22227.23 :   +736.83 =  +3.429% (+/-1.88%)

This shows that the new optimisations are at least as good as the existing
inline-bytecode-caching, and are sometimes much better (because the new
ones apply caching to a wider variety of map lookups).

The new optimisations can also benefit code generated by the native
emitter, because they apply to the runtime rather than the generated code.
The improvement for the native emitter when LOAD_ATTR_FAST_PATH and
MAP_LOOKUP_CACHE are enabled is (same Linux environment as above):

diff of scores (higher is better)
N=2000 M=2000        native -> nat-attrmapcache  diff      diff% (error%)
bm_chaos.py        14130.62 ->   15464.68 :  +1334.06 =  +9.441% (+/-7.11%)
bm_fannkuch.py        74.96 ->      76.16 :     +1.20 =  +1.601% (+/-1.80%)
bm_fft.py         166682.99 ->  168221.86 :  +1538.87 =  +0.923% (+/-4.20%)
bm_float.py       233415.23 ->  265524.90 : +32109.67 = +13.756% (+/-2.57%)
bm_hexiom.py         628.59 ->     734.17 :   +105.58 = +16.796% (+/-1.39%)
bm_nqueens.py     225418.44 ->  232926.45 :  +7508.01 =  +3.331% (+/-3.10%)
bm_pidigits.py      6322.00 ->    6379.52 :    +57.52 =  +0.910% (+/-5.62%)
misc_aes.py        20670.10 ->   27223.18 :  +6553.08 = +31.703% (+/-1.56%)
misc_mandel.py    138221.11 ->  152014.01 : +13792.90 =  +9.979% (+/-2.46%)
misc_pystone.py    85032.14 ->  105681.44 : +20649.30 = +24.284% (+/-2.25%)
misc_raytrace.py   19800.01 ->   23350.73 :  +3550.72 = +17.933% (+/-2.79%)

In summary, compared to MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE, the new
MICROPY_OPT_LOAD_ATTR_FAST_PATH and MICROPY_OPT_MAP_LOOKUP_CACHE options:
- are simpler;
- take less code size;
- are faster (generally);
- work with code generated by the native emitter;
- can be used on embedded targets with a small and constant RAM overhead;
- allow the same .mpy bytecode to run on all targets.

See #7680 for further discussion.  And see also #7653 for a discussion
about simplifying mpy-cross options.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 16:04:03 +10:00
Jim Mussared
60c6d5594f unix: Enable LOAD_ATTR fast path, and map lookup caching.
Enabled for all variants except minimal.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 16:02:19 +10:00
Jim Mussared
68219a295c stm32: Enable LOAD_ATTR fast path, and map lookup caching on >M0.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 16:02:19 +10:00
Jim Mussared
910e060f93 minimal/mpconfigport.h: Use MICROPY_CONFIG_ROM_LEVEL_MINIMUM.
Update minimal port to use the new "minimal" rom level config (this is a
no-op change, the binary is the same size and contains the exact same
symbols).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 13:24:33 +10:00
Damien George
0c0807e084 stm32/dma: Add functions for external users of DMA to enable clock.
Any external user of DMA (eg a board with a custom DMA driver) must call
dma_external_acquire() for their DMA controller/stream to ensure that the
DMA clock is not automatically turned off while it's still being used
externally.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-16 13:01:43 +10:00
Damien George
c51cc46bf8 stm32/boards/make-pins.py: Allow empty lines and comments in pins.csv.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-16 12:53:16 +10:00
Damien George
a6907c779a stm32/boards/make-pins.py: Allow a CPU pin to be hidden.
This change allows a CPU pin to be hidden from the user by prefixing it
with a "-" in the pins.csv file for a board.  It will still be available in
C code, just not exposed to Python.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-16 12:53:16 +10:00
Jim Mussared
e3eebc329f stm32: Suggest putting code in main.py not boot.py.
Don't want users to accidentally use boot.py (because recovering requires
knowing how to activate safe mode).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 12:40:05 +10:00
Jan Staal
9e2423e730 stm32: Add support for H7A3(Q)/H7B3(Q), and STM32H73B3I_DK board defn.
This commit is based upon prior work of @dpgeorge and @koendv.

MCU support for the STM32H7A3 and B3 families MCUs:
- STM32H7A3xx
- STM32H7A3xxQ (SMPS)
- STM32H7B3xx
- STM32H7B3xxQ (SMPS)

Support has been added for the STM32H7B3I_DK board.

Signed-off-by: Jan Staal <info@janstaal.com>
2021-09-16 12:29:28 +10:00
iabdalkader
d9749f90ad extmod/modnetwork: Remove modnetwork socket u_state member.
To simplify the socket state.

The CC3K driver (see drivers/cc3000/inc/socket.h and src/socket.c) has
socket() returning an INT16 so there is now enough room to store it
directly in the fileno member.
2021-09-15 11:29:02 +10:00
Jan Hrudka
d451dc0086 stm32: Add basic support for STM32H750. 2021-09-15 10:42:20 +10:00
iabdalkader
4dba04a50f extmod/modnetwork: Define network interfaces in port config files.
So this network implementation becomes more generic.
2021-09-15 01:29:26 +10:00
iabdalkader
7aab0dc5d8 extmod: Move modnetwork and modusocket from stm32 to extmod.
So they can be used by other ports.
2021-09-15 01:25:12 +10:00
Philipp Ebensberger
0d7366c912 mimxrt: Rework flash configuration.
- Moves definition of BOARD_FLASH_SIZE and other header files related to
	flash configuration into the Makefile.
- Adds board specific clock_config.h.
- Adds board.h, pin_mux.h, and peripherals.h as they are
	required by NXP MCU SDK in order to use our own clock_config.h.
- Renames board specific FlexSPI configuration files.
- Updates flash frequency of MIMXRT1020_EVK
- Creates separated flash_config files for QSPI NOR and
	QSPI Hyper flash.
- Unifies VFS start address to be @ 1M for 1010 and 1020 boards.
- Unifies 1050EVK boards
- Adds support to both NOR and HyperFlash on boards with
	both capabilities.
- Adds automatic FlexRAM initialization to start-up code based on
	linker script and NXP HAL.
- Applies code formatting to all files in mimxrt port.

With this change the flash configuration is restructured and
organized. This simplifies the configuration process and
provides a better overview of each board's settings. With the integration
of clock_config.h, board.h, pin_mux.h, and peripherals.h we gain better
control of the settings and clock configurations. Furthermore the
implementation of an explicit FlexRAM setup improves the system
performance and allows for performance tuning.

Signed-off-by: Philipp Ebensberger
2021-09-14 13:52:52 +02:00
Seon Rozenblum
f690fd3a47 esp32/machine_timer: Use tx_update member for IDF 4.4 and above. 2021-09-13 18:25:16 +10:00
Damien George
0a51073724 stm32/boards: Remove trailing spaces, and add newline at end of file.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-10 16:09:03 +10:00
Tobias Thyrrestrup
4c31d0ab60 stm32/boards/LEGO_HUB_NO6: Remove user paths from cc2564 init file.
Signed-off-by: Tobias Thyrrestrup <tt@LEGO.com>
2021-09-10 16:00:21 +10:00
Daniel Gorny
b71c621f46 stm32/boards/OLIMEX_E407: Add Ethernet RMII support. 2021-09-10 15:52:03 +10:00
Boris Vinogradov
97bbc0bb91 stm32/boards/VCC_GND_H743VI: Add board definition for VCC_GND_H743VI. 2021-09-10 15:49:26 +10:00
Seon Rozenblum
9a7f77bfbc esp32/boards: Add new FeatherS2-Neo board definition. 2021-09-10 15:40:32 +10:00
stijn
318c029d45 windows/README: Remove unsupported Python instructions for Cygwin.
It's not possible anymore to build MicroPython on Cygwin using a
standard Windows installation of Python so don't advertise that.
Specifically: preprocessing in makeqstrdefs.py fails on the subprocess
call with 'gcc: fatal error: no input files' because one of the flags
contains double quotes and that somehow messes up the commandline.
2021-09-10 15:19:25 +10:00
robert-hh
61b7c098b9 mimxrt/machine_bitstream: Add bitstream function to machine module.
Following the code example for ESP32 of Jim Mussard.

As a side effect:
- mp_hal_ticks_cpu() was implemented,
- mp_hal_get_cpu_freq() and mp_hal_ticks_cpu_init() were added and used.
- mp_hal_pin_high() and mp_hal_pin_low() were changed for symmetry
2021-09-10 13:32:53 +10:00
Philipp Ebensberger
87f97e490c mimxrt/sdcard: Implement SDCard driver.
- Configures `PLL2->PFD0` with **198MHz** as base clock of
	`USDHCx` peripheral.
- Adds guards for SDCard related files via `MICROPY_PY_MACHINE_SDCARD`
- Adds creation of pin defines for SDCard to make-pins.py
- Adds new configuration option for SDCard peripheral pinout
        to mpconfigport.h
- Adds interrupt handling support instead of polling
- Adds support for `ADMA2` powered data transfer
- Configures SDCard to run in HS (high-speed mode) with **50MHz** only!

SDCard support is optional and requires `USDHC` peripheral.
Thus this driver is not available on `MIMXRT1010_EVK`.
SDCard support is enabled by setting `MICROPY_PY_MACHINE_SDCARD = 1`
in mpconfigboard.mk.

Signed-off-by: Philipp Ebensberger
2021-09-07 20:45:33 +02:00
YoungJoon Chun
bbbdef4cc1 rp2/mpconfigport.h: Enable heapq module.
Fixes issue #7746.
2021-09-04 23:51:14 +10:00
Damien George
af64c2ddbd extmod/machine_pwm: Factor out machine.PWM bindings to common code.
This commit refactors machine.PWM and creates extmod/machine_pwm.c.  The
esp8266, esp32 and rp2 ports all use this and provide implementations of
the required PWM functionality.  This helps to reduce code duplication and
keep the same Python API across ports.

This commit does not make any functional changes.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-04 16:31:17 +10:00
Damien George
9792c9105f stm32/main: Don't unconditionally enable GPIO A,B,C,D clocks.
Rely on them being enabled only when needed.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 20:28:53 +10:00
Damien George
05cd17e36f stm32/pin: Enable GPIO clock of pin if it's constructed without init.
Fixes issue #7363.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 20:28:53 +10:00
Damien George
1083cb2f33 zephyr/mphalport.h: Remove unused and unimplemented C-level pin API.
It gives compile warnings.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 13:11:23 +10:00
Damien George
d41f6dde56 extmod/modonewire: Make _onewire module configurable via macro option.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 13:11:23 +10:00
Damien George
afe0634c98 extmod/machine_spi: Make SoftSPI configurable via macro option.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 13:11:23 +10:00
Damien George
122d901ef1 extmod/machine_i2c: Make SoftI2C configurable via macro option.
The zephyr port doesn't support SoftI2C so it's not enabled, and the legacy
I2C constructor check can be removed.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 13:11:23 +10:00
Damien George
25f30eb8a6 stm32/boards/LEGO_HUB_NO6: Add comment re constraints on SPI flash cfg.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 00:03:41 +10:00
Damien George
35ead0ff0f javascript/Makefile: Change variable to EXPORTED_RUNTIME_METHODS.
EXTRA_EXPORTED_RUNTIME_METHODS is deprecated.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-01 00:42:40 +10:00
David Lechner
86371781e9 tools/uncrustify: Force 1 newline at end of file.
To keep things neat and tidy, we ensure that each file has 1 and only 1
newline at the end of each file.

Signed-off-by: David Lechner <david@pybricks.com>
2021-08-31 13:14:45 +10:00
Damien George
6f19b9c08d stm32/boards/LEGO_HUB_NO6: Add make commands to backup/restore firmware.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 00:16:39 +10:00
Damien George
bac791c5fd stm32/boards/LEGO_HUB_NO6: Skip first 1MiB of SPI flash for storage.
The first 1MiB is used by the built-in bootloader and is best left as-is.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 00:16:39 +10:00
Damien George
e3eed26d0b stm32/boards/LEGO_HUB_NO6: Change SPI flash storage to use hardware SPI.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 00:16:39 +10:00
Damien George
6936f410ab stm32/storage: Make extended-block-device more configurable.
A board can now define the following to fully customise the extended block
device interface provided by the storage sub-system:
- MICROPY_HW_BDEV_BLOCKSIZE_EXT
- MICROPY_HW_BDEV_READBLOCKS_EXT
- MICROPY_HW_BDEV_WRITEBLOCKS_EXT
- MICROPY_HW_BDEV_ERASEBLOCKS_EXT

Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 00:16:39 +10:00
Patrick Van Oosterwijck
a66bd7a489 esp32/boards: Add GENERIC_C3_USB board with USB serial/JTAG support.
Add a new board type for ESP32-C3 revision 3 and up that implement the USB
serial/JTAG port on pin 18 and 19.  This variant uses the USB serial for
programming and console, leaving the UART free.

- Pins 18 and 19 are correctly reserved for this variant.  Also pins 14-17
  are reserved for flash for any ESP32-C3 so they can't be reconfigured
  anymore to crash the system.
- Added usb_serial_jtag.c and .h to implement this interface.
- Interface was tested to work correctly together with webrepl.
- Interface was tested to work correctly when sending and receiving
  large files with ampy.
- Disconnecting terminal or USB will not hang the system when it's
  trying to print.
2021-08-31 00:12:41 +10:00
iabdalkader
a3ce8f08ec rp2/mpconfigport.h: Allow boards to add root pointers. 2021-08-29 12:22:50 +10:00
iabdalkader
79baef843b rp2/CMakeLists.txt: Add option to enable double tap reset to bootrom.
* For boards a with reset switch, pressing twice resets into bootloader.
* Enabled by linking with the pico_bootsel_via_double_reset library.
2021-08-29 12:20:01 +10:00
iabdalkader
c82244a7c0 rp2/rp2_flash: Disable IRQs while calling flash_erase/program.
Flash erase/program functions disable the XIP bit.  If any code runs from
flash at the same time (eg an IRQ or code it calls) it will fail and cause
a lockup.
2021-08-29 12:15:01 +10:00
Jim Mussared
996f703166 esp32,esp8266: Remove dead code for end_ticks in machine_bitstream.
The compiler was optimising this out already so it's a no-op change.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-24 23:55:08 +10:00
Jim Mussared
b51e7e9d01 stm32: Disable computed goto on constrained boards.
Saves ~1kiB.  Add comment to this effect to mpconfig.h.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-20 20:18:52 +10:00
Damien George
61d5a8b9ce stm32/stm32_it: Support TIM17 IRQs on WB MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-20 17:04:39 +10:00
Tobias Thyrrestrup
0886bf46ca stm32/Makefile: Allow GIT_SUBMODULES and LIBS to be extended.
Signed-off-by: Tobias Thyrrestrup <tt@LEGO.com>
2021-08-19 22:56:39 +10:00
Jim Mussared
b352db7a63 rp2/Makefile: Add "submodules" target, to match other ports.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:54:57 +10:00
Jim Mussared
62fd450e62 drivers/neopixel: Add common machine.bitstream-based neopixel module.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Jim Mussared
39e9c0788f esp8266: Replace esp.neopixel with machine.bitstream.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Jim Mussared
71f4faac27 esp32: Replace esp.neopixel with machine.bitstream.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Jim Mussared
e64cda5295 stm32: Add implementation of machine.bitstream.
Hand-written version for M0, and cycle-counter version for everything else.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Jim Mussared
0c2cadf1c8 unix/Makefile: Disable error compression on arm-linux-gnueabi-gcc.
This compiler is unable to optimise out the giant strcmp match generated
by MP_MATCH_COMPRESSED.

See github.com/micropython/micropython/pull/7659#issuecomment-899479793

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-17 11:20:58 +10:00
Damien George
e25c5cb8d2 esp32/machine_pin: Make check for non-output pins respect chip variant.
Fixes issue #7631.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-16 15:24:05 +10:00
Jonathan Hogg
5b655665ab esp32/machine_hw_spi: Release GIL during transfers.
Release the GIL while waiting for SPI transfers to complete to allow other
threads to make progress.

Fixes #7662.
2021-08-16 15:21:10 +10:00
Philipp Ebensberger
a1dc7277d9 mimxrt/machine_pin: Implement ioctl for Pin.
To make machine.Signal work correctly (among other things).  The solution
is taken over from the rp2 port.

Signed-off-by: Philipp Ebensberger
2021-08-16 15:03:50 +10:00
Jim Mussared
1d9e489af3 extmod/modbluetooth: Add send_update arg to gatts_write.
This allows the write to trigger a notification or indication, but only to
subscribed clients. This is different to gatts_notify/gatts_indicate,
which will unconditionally notify/indicate.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14 22:21:55 +10:00
Jim Mussared
5733c49174 stm32,esp32,rp2: Enable MICROPY_PY_FSTRINGS by default.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14 16:58:40 +10:00
Jim Mussared
692d36d779 py: Implement partial PEP-498 (f-string) support.
This implements (most of) the PEP-498 spec for f-strings and is based on
https://github.com/micropython/micropython/pull/4998 by @klardotsh.

It is implemented in the lexer as a syntax translation to `str.format`:
  f"{a}" --> "{}".format(a)

It also supports:
  f"{a=}" --> "a={}".format(a)

This is done by extracting the arguments into a temporary vstr buffer,
then after the string has been tokenized, the lexer input queue is saved
and the contents of the temporary vstr buffer are injected into the lexer
instead.

There are four main limitations:
- raw f-strings (`fr` or `rf` prefixes) are not supported and will raise
  `SyntaxError: raw f-strings are not supported`.

- literal concatenation of f-strings with adjacent strings will fail
    "{}" f"{a}" --> "{}{}".format(a)    (str.format will incorrectly use
                                         the braces from the non-f-string)
    f"{a}" f"{a}" --> "{}".format(a) "{}".format(a) (cannot concatenate)

- PEP-498 requires the full parser to understand the interpolated
  argument, however because this entirely runs in the lexer it cannot
  resolve nested braces in expressions like
    f"{'}'}"

- The !r, !s, and !a conversions are not supported.

Includes tests and cpydiffs.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14 16:58:40 +10:00
Daniel Mizyrycki
8f45f5ee4f nrf: Set .mpy features consistent with documentation and other ports.
This allows nrf devices to load .mpy files.  And nrf52840 and nrf9160 based
boards also support compiling and loading native code.
2021-08-13 23:22:54 +10:00
Ned Konz
42d1a1635c stm32/mbedtls: Fix compile warning about uninitialized val. 2021-08-10 23:43:25 +10:00
Ned Konz
a0cd18c1a5 stm32/boards/NUCLEO_H743ZI2: Add modified version of NUCLEO_H743ZI.
This commit creates a new stm32 board for the NUCLEO_H743ZI2, which is the
current version of this from ST.  This is a modified copy of the
NUCLEO_H743ZI board, and the ZI2 board differs in a few minor ways:

- LED2 has moved from PB7 to PE1 and is now yellow rather than blue
- the USB power enable has moved from PG6 to PG10
- the USER button is now pulled down
2021-08-10 23:38:05 +10:00
iabdalkader
23531bca74 rp2/CMakeLists.txt: Allow a board's cmake to set the manifest path.
This allows boards to add frozen modules, or bypass the port manifest
entirely.
2021-08-10 11:05:33 +10:00
Damien George
3835f5f597 esp32/makeimg.py: Get bootloader and partition offset from sdkconfig.
So that it works on ESP32C3, which has the bootloader at 0x0.

Fixes issue #7565.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-10 00:19:49 +10:00
Daniel Mizyrycki
8645b7c23b nrf: Enable source line on tracebacks. 2021-08-09 15:09:33 +10:00
Glenn Ruben Bakke
77b4cfcbc9 nrf/modules/nrf: Add function to enable/disable DCDC.
This function can be used to enable and disable the DC/DC converter with or
without the Bluetooth stack enabled.  It can also be used to query the
current state of the DC/DC.

This commit also adds a definition of ARRAY_SIZE needed by nrfx HAL-layer.
2021-08-09 14:55:59 +10:00
Damien George
e5e0553224 nrf/modules/uos: Add ilistdir to uos module.
This was missed in the initial implementation of the uos module.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-08 23:17:55 +10:00
Glenn Ruben Bakke
55d4321c3e nrf/boards: Enable MICROPY_VFS_LFS2 for all target boards.
Enable LittleFS v2 for all targets, except nrf51 targets when SoftDevice is
present.
2021-08-08 23:17:55 +10:00
Glenn Ruben Bakke
23e8729d3e nrf/mphalport: Add dummy function for mp_hal_time_ns().
extmod/vfs_lfs.c needs to resolve `mp_hal_time_ns()` in order to calculate
a timestamp from 1970 epoch.  A wall clock is not available in the nrf
port, hence the function is implemented to resolve compilation linkage
error.  The function always return 0.
2021-08-08 23:17:55 +10:00
Glenn Ruben Bakke
aa857eb65e nrf/Makefile: Set default manifest file for all targets.
Set the default manifest to "modules/manifest.py".  This includes files
from the folder "modules/scripts".  The manifest default value is overriden
by all nrf51 boards that have SoftDevice present (SD=s110) to save flash.

Also add "modules/manifest.py" which is set to freeze
"modules/scripts/_mkfs.py".
2021-08-08 23:17:55 +10:00
Glenn Ruben Bakke
7b6ad0ce2e nrf/modules/scripts: Add file system formatting script.
Add a helper script _mkfs.py which automatically formats the file system if
nrf.Flash() is located and a VFS file system has been included in the
compilation.

The precedence is: first LFS1, LFS2 then FAT.
2021-08-08 23:17:55 +10:00
Glenn Ruben Bakke
ffc636de2f nrf/boards: Set FROZEN_MANIFEST blank when SD present on nrf51 targets. 2021-08-08 23:17:55 +10:00
Glenn Ruben Bakke
990341d18e nrf: Facilitate use of freeze manifest.
Update the Makefile to handle FROZEN_MANIFEST, and the README with some
small samples on how to use freeze manifests.  And add BOARD_DIR to the
Makefile which can be referenced in boards/<board>/mpconfigboard.mk to
include a board specific manifest.
2021-08-08 23:17:55 +10:00
Glenn Ruben Bakke
4326e08802 nrf/boards: Enable needed features for FAT/LFS1/LFS2.
Enable the following features for all boards except
nrf51 boards with SoftDevice present:

- MICROPY_VFS
- MICROPY_PY_NRF
- MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
2021-08-08 23:17:55 +10:00
Glenn Ruben Bakke
b0fd4372c4 nrf/main: Add auto mount and auto format hook for internal flash FS. 2021-08-08 23:17:55 +10:00
Glenn Ruben Bakke
6ff3a2afef nrf/qstrdefsport.h: Add entries for in-built FS mount points. 2021-08-08 23:17:49 +10:00
Glenn Ruben Bakke
f99aa82e85 nrf/mpconfigport.h: Enable MICROPY_PY_IO_FILEIO when an FS is enabled.
Enable MICROPY_PY_IO_FILEIO if MICROPY_VFS_FAT, MICROPY_VFS_LFS1
or MICROPY_VFS2 has been enabled.
2021-08-08 23:09:26 +10:00
Glenn Ruben Bakke
7a833edf37 nrf/modules/uos: Allow a board to configure MICROPY_VFS_FAT/LFS1/LFS2. 2021-08-08 23:09:26 +10:00
Glenn Ruben Bakke
0bde907a8b nrf/Makefile: Add _fs_size linker script override from make.
Add posibility to override linker script "_fs_size" from make by adding the
FS_SIZE parameter.  The syntax of value is linker script syntax.  For
example, the value of 131072 bytes can be written as 128K like this:
FS_SIZE=128K.

If not set, default value for "_fs_size" from linker script will be used.
2021-08-08 23:09:26 +10:00
Glenn Ruben Bakke
c9b72ba694 nrf/mpconfigport.h: Tune FAT FS configuration.
Disable MICROPY_FATFS_MULTI_PARTITION configuration because there is no
partition table in the flash for FATFS to read.

Also, set MICROPY_FATFS_MAX_SS to the size of a flash page.  For nrf51 the
value 1024 is set.  For nrf52/nrf91 the value 4096 is set.
2021-08-08 23:09:26 +10:00
Glenn Ruben Bakke
b40dfa961d nrf/README: Update README.md to reflect internal file systems.
This documents parameters that can be passed to make to enable a specific
file system to included in the build.  Also, document the Makefile override
parameter "FS_SIZE" that can be used to tune the size of the flash region
to use as internal flash file system.
2021-08-08 23:09:26 +10:00
Glenn Ruben Bakke
85cad50266 nrf/mpconfigport.h: Expose nrf module when MICROPY_PY_NRF is set. 2021-08-08 23:09:26 +10:00
Glenn Ruben Bakke
5a873e27eb nrf/drivers: Add support for using flash block device with SoftDevice.
Update flash.c to also be compiled in when
MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE is enabled and SoftDevice is
present.

Update bluetooth/ble_drv.c to forward flash events to flash.c when
MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE is enabled.
2021-08-08 23:09:26 +10:00
Glenn Ruben Bakke
127cec8cae nrf/modules/nrf: Add new nrf module with flash block device.
This commit adds the "nrf" module for port specific modules and objects.
Included in it is the "Flash" object which exposes a block device
implementation to access internal SoC flash.

Thanks to @aykevl aka Ayke van Laethem for the initial implementation.
2021-08-08 23:09:26 +10:00
Glenn Ruben Bakke
3b594f7b27 nrf/boards/common.ld: Calculate unused flash region.
Calculate the unused flash area on the target device.  The values will be
exposed by _unused_flash_start and _unused_flash_length.  The start address
and the length are not aligned to either word or pages.
2021-08-08 23:09:26 +10:00
Damien George
f834fef6bb stm32/powerctrl: Support changing frequency on WB MCUs.
This allows changing the frequency to: 100kHz, 200kHz, 400kHz, 800kHz,
1MHz, 2MHz, 4MHz, 8MHz, 16MHz, 32MHz, 64MHz.  For frequencies 2MHz and
below, low power run (LPR) mode is enabled automatically.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:41:20 +10:00
Damien George
3b32b3d1b3 stm32/usbd_cdc_interface: Rename USBD_CDC_xx opts to MICROPY_HW_USB_xx.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:13:58 +10:00
Damien George
f28e8b9073 stm32/usbd_desc: Rename USBD_xxx descriptor opts to MICROPY_HW_USB_xxx.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:13:58 +10:00
Damien George
96c6b8cae3 ports: Rename USBD_VID/PID config macros to MICROPY_HW_USB_VID/PID.
For consistency with other board-level config macros that begin with
MICROPY_HW_USB.

Also allow boards in the mimxrt, nrf and samd ports to configure these
values.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:13:55 +10:00
Damien George
8616129f2e esp8266,esp32: Include hidden networks in WLAN.scan results.
Addresses issues #2697 and #5329.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 13:28:34 +10:00
Jim Mussared
bfc8e88ce1 esp32/mpconfigport.h: Enable reverse and inplace special methods.
Reverse operations are supported on stm32 and rp2, and esp32 has enough
space to also enable inplace operations, to make it complete.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-07 13:27:09 +10:00
Patrick Van Oosterwijck
028fc815cd esp32/boards: Add Silicognition wESP32 board configuration.
For rev 7+ boards with 16MB of flash.  Partition table allocates 2.4 MiB
for MicroPython, 11 MiB for the filesystem.
2021-08-07 12:50:13 +10:00
Will Sowerbutts
a3675294ae esp32/machine_uart: Add flow kw-arg to enable hardware flow control.
This enables optional support for the hardware UART to use the RTS and/or
CTS pins for flow control.

The new "flow" constructor keyword specifies a bitmask of RTS and/or CTS.
This matches the interface used by machine.UART on stm32 and rp2.

Previously on ESP32 it was possible to specify which pins to use for the
RTS and CTS signals, but hardware flow control was never functional: CTS
was not checked before transmitting bytes, and RTS was always driven high
(signalling no buffer space available).  With this patch, CTS and RTS both
operate as expected.

This also includes an update to the machine.UART documentation.

Signed-off-by: Will Sowerbutts <will@sowerbutts.com>
2021-08-04 13:52:15 +10:00
Mike Causer
71722c84ca rp2/boards: Add Pimoroni Tiny 2040. 2021-08-01 23:07:57 +10:00
Mike Causer
042a4bebc3 rp2/boards: Add Pimoroni Pico LiPo 16MB. 2021-08-01 23:07:05 +10:00
Mike Causer
95eff8d96a rp2/boards: Add Pimoroni Pico LiPo 4MB. 2021-08-01 23:06:06 +10:00
Mike Causer
02cbe018a5 rp2/boards: Add Adafruit QT Py RP2040. 2021-08-01 23:04:59 +10:00
Mike Causer
043848158d rp2/boards: Add Adafruit ItsyBitsy RP2040. 2021-08-01 23:03:30 +10:00
Mike Causer
e7a3e6ee6a rp2/boards/SPARKFUN_THINGPLUS: Configure I2C/SPI default pins. 2021-08-01 23:02:30 +10:00
Mike Causer
6986a8d680 rp2/boards/SPARKFUN_PROMICRO: Configure UART/I2C/SPI default pins. 2021-08-01 23:01:36 +10:00
Mike Causer
49497084f1 rp2/boards/ADAFRUIT_FEATHER_RP2040: Configure I2C/SPI default pins. 2021-08-01 17:15:18 +10:00
iabdalkader
23e2e00779 rp2/boards/ADAFRUIT_FEATHER_RP2040: Configure custom VID/PID. 2021-08-01 10:51:50 +10:00
iabdalkader
7ae9e6ef69 rp2/tusb_port: Allow boards to configure USB VID and PID.
By defining MICROPY_HW_USB_VID and MICROPY_HW_USB_PID.
2021-08-01 10:51:24 +10:00
robert-hh
b2533fe479 mimxrt/boards: Add support for the MIMXRT1050_EVKB board. 2021-07-31 16:26:39 +10:00
robert-hh
1074c784b0 mimxrt: Add support for Hyperflash chips.
Hyperflash is used by the MIMXRT1050_EVKB, MIMXRT1060_EVK and
MIMXRT1064_EVK boards.

This commit includes:
- add support for Hyperflash
- modify MIMXRT1060_EVK and MIMXRT1064_EVK to change from QSPI to
  hyperflash.
- minor incidental changes to other boards so they still build

Note: Erasing a sector on the hyperflash is slow. It takes about a second,
which seems too long, but matches the data sheet.
2021-07-31 16:25:40 +10:00
Damien George
40b8ff0a6f stm32/README.md: Update supported MCUs, and submodule and mboot use.
Also mention mpremote as a way to access the REPL.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-31 15:12:13 +10:00
Tobias Thyrrestrup
60e3e51753 stm32/Makefile: Update to only pull in used Bluetooth library. 2021-07-31 15:11:46 +10:00
Tobias Thyrrestrup
7a1edb91cb stm32/boards/LEGO_HUB_NO6: Add board definition for LEGO_HUB_NO6.
Add basic support for LEGO HUB NO.6 (e.g. LEGO SPIKE Prime, LEGO MINDSTORMS
Robot Inventor).

See README.md for details.

Thanks to @dpgeorge for helping put this together.

Signed-off-by: Tobias Thyrrestrup <tt@LEGO.com>
2021-07-31 10:25:18 +10:00
Damien George
224ac355cd stm32/boards/NUCLEO_F439ZI: Add board definition for NUCLEO_F439ZI.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-27 16:46:10 +10:00
Matúš Olekšák
0f0006f4e1 stm32/boards/STM32F429DISC: Set correct UART2 pins and add UART3/6. 2021-07-26 14:38:39 +10:00
Damien George
aa0cf873bf stm32/uart: Support low baudrates on LPUART1.
By selecting a larger prescaler when needed.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-26 13:53:50 +10:00
Damien George
fef2114404 stm32/uart: Fix LPUART1 baudrate set/get.
It needs to use a different function because the formula to compute the
baudrate on LPUART1 is different to a normal UART.

Fixes issue #7466.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-26 13:53:50 +10:00
robert-hh
ee49ae8f82 rp2/machine_uart: Fix read when FIFO has chars but ringbuf doesn't.
Prior to this fix, if the UART hardware FIFO had a few chars but still
below the FIFO trigger threshold, and the ringbuf was empty, the read
function would timeout if timeout==0 (the default timeout).

This fix follows the suggestion of @iabdalkader.
2021-07-25 17:48:50 +10:00
iabdalkader
2e62e13455 rp2/machine_uart: Fix poll ioctl to also check hardware FIFO.
The RX IRQ does not trigger if the FIFO is less than the trigger level, in
which case characters may be available in the FIFO, yet not in the ringbuf,
and the ioctl returns false.
2021-07-25 17:11:03 +10:00
Chris Wilson
aecb697c72 stm32/boards: Add support for SparkFun STM32 MicroMod Processor board.
Signed-off-by: Chris Wilson <christopher.david.wilson@gmail.com>
2021-07-23 22:03:16 +10:00
Damien George
14b853eae0 minimal/Makefile: Add support for building with user C modules.
Fixes issue #5750.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-23 12:02:03 +10:00
Sashkoiv
753b08cae6 stm32/boards/NUCLEO_F446RE: Enable CAN bus support. 2021-07-23 00:06:13 +10:00
Roberto Colistete Jr
b099db4426 esp8266/Makefile: Add more libm files to build.
Allows MICROPY_PY_MATH_SPECIAL_FUNCTIONS to be enabled, and for ulab to be
built as a user C module.
2021-07-22 23:55:31 +10:00
Damien George
a5ac3d5645 samd: Add support for building with user C modules.
Fixes issue #7545.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-22 22:22:03 +10:00
iabdalkader
7649f5fbd2 stm32/sdram: Make SDRAM test cache aware, and optional failure with msg.
* Make SDRAM test cache-aware for newer MCUs.
* Use the defined data bus width (instead of the fixed 8-bits).
* Allow optional failure on error with verbose error messages.
* Test speed is now inverted (test accepts exhaustive instead fast).
2021-07-22 16:47:49 +10:00
Damien George
6214fa3f9e esp32/mphalport: Always yield at least once in delay_ms.
This helps the OS switch to and give other threads processing time during
the sleep.  It also ensures that pending events are handled, even when
sleeping for 0ms.

Fixes issue #5344.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-22 00:20:53 +10:00
Damien George
2cfbe5bc0f esp32/modmachine: Release the GIL in machine.idle().
So that other threads get a chance to run when taskYIELD() is called.

See issue #5344.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-22 00:17:59 +10:00
Josh Lloyd
6bc50c4fa9 stm32/systick: Always POLL_HOOK when delaying for milliseconds.
Call MICROPY_EVENT_POLL_HOOK even on very short delays so that busy loops
that call sleep_ms still yield to events and other threads.

See related issue #5344.
2021-07-22 00:15:36 +10:00
Mike Causer
cc77b30639 rp2/machine_spi: Allow boards to configure SPI pins using new macros. 2021-07-19 23:16:11 +10:00
Mike Causer
79da7757cc rp2/machine_i2c: Allow boards to configure I2C pins using new macros. 2021-07-19 23:16:11 +10:00
iabdalkader
4f2a10bfc9 rp2/machine_uart: Allow overriding default machine UART pins. 2021-07-19 23:14:02 +10:00
iabdalkader
8599f7a68d rp2/machine_uart: Add hardware flow control support. 2021-07-19 23:13:57 +10:00
Damien George
c77225ae5b esp32/boards/GENERIC_C3: Add generic C3-based board.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-18 23:58:24 +10:00
Damien George
6823514845 esp32: Add initial support for ESP32C3 SoCs.
Supported features for this SoC are:
- UART REPL, filesystem
- Pin, ADC, PWM, SoftI2C, SoftSPI, Timer, RTC
- OneWire, DHT, NeoPixel
- RMT
- WiFi, Bluetooth

Signed-off-by: Damien George <damien@micropython.org>
2021-07-18 23:58:24 +10:00
Damien George
59dbbe9be7 esp32: Fix use of mp_int_t, size_t and uintptr_t.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-18 23:58:16 +10:00
Damien George
0fc0ccabec esp32/machine_i2s: Add MICROPY_PY_MACHINE_I2S option, enable by default.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-18 12:31:13 +10:00
Damien George
1f9243f8d4 esp32/machine_dac: Add MICROPY_PY_MACHINE_DAC option, enable by default.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-18 12:11:10 +10:00
David P
d3f6ce7dc3 nrf/modules: Replace master/slave with controller/peripheral in SPI.
Also remove mistaken usage of MASTER/SLAVE constants in comments.
2021-07-18 11:23:41 +10:00
David P
f365025c9c stm32: Replace master/slave with controller/peripheral in I2C and SPI.
Replace "master" with "controller" and "slave" with "peripheral" in
comments, errors, and debug messages.

Add CONTROLLER and PERIPHERAL constants to pyb.SPI and pyb.I2C classes;
retain MASTER and SLAVE constants for backward compatiblity.
2021-07-18 11:23:41 +10:00
Jonathan Hogg
8be29b9b1b esp32/machine_hw_spi: Use a 2 item SPI queue for long transfers.
Using a 2-item transaction queue instead of 1 allows long transfers to 
be executed with the minimum inter-transaction delay. Limit maximum 
transaction length to ensure an integer multiple of the SPI `bits` 
setting are transferred. Fixes #7511.
2021-07-16 16:12:45 +01:00
Jonathan Hogg
eb3029c669 esp32/machine_spi: Calculate actual attained baudrate.
Calculate the actual baudrate that the hardware is capable of achieving 
and remember it so that printing the SPI object will show this. Fixes 
#7530.
2021-07-16 23:05:30 +10:00
robert-hh
98c5703027 mimxrt/machine_i2c: Add hardware-based machine.I2C to machine module.
It uses non-blocking transfer of data.  Advantage over SoftI2C:
- Higher data rate up to ~3 MHZ.
- Full protocol support.
2021-07-15 00:36:31 +10:00
Damien George
06277a9169 mimxrt/machine_led: Use mp_raise_msg_varg helper.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-15 00:12:41 +10:00
Damien George
38a204ed96 py: Introduce and use mp_raise_type_arg helper.
To reduce code size.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-15 00:12:41 +10:00
Jim Mussared
22fdb21302 windows/appveyor: Update to VS 2017 and use Python 3.8 for build/test.
MicroPython implements some 3.5+ features, and this change helps to reduce
the need for some .exp files in the test suite.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-07-15 00:10:52 +10:00
Damien George
6430cd3e02 unix/variants: Enable help and help("modules") on standard and dev.
See related #1354, #2906, #3436.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-13 16:18:15 +10:00
Damien George
240888a0d2 unix/Makefile: Add back LIB_SRC_C to list of object files.
This fixes the dev build (it needs LIB_SRC_C for Bluetooth) which was
broken by 136369d72f.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-13 15:58:39 +10:00
Damien George
831cc4a61d stm32/boards/NUCLEO_F446RE: Fix I2C1 pin assignment to match datasheet.
Thanks to @aureliano2nd.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-13 15:25:27 +10:00
Damien George
136369d72f all: Update to point to files in new shared/ directory.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-12 17:08:10 +10:00
Damien George
925878b2f8 ports: Update for move of crypto-algorithms, uzlib to lib.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-12 16:37:20 +10:00
Damien George
0613d3e356 rp2/tusb_config.h: Set CFG_TUD_CDC_EP_BUFSIZE to 256.
This improves the speed of data going out of the MCU.

See related #7479.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-08 13:20:53 +10:00
Damien George
132d93886f ports: Use common mp_hal_stdout_tx_strn_cooked instead of custom one.
To reduce code duplication.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-08 12:59:31 +10:00
Bryan Tong Minh
3d9af87721 windows/Makefile: Add .exe extension to executables name.
Uses the same logic applied in 5b57ae985f
to determine when to add .exe.

See related: #3310, #3361, #3370, #4143, #5727.
2021-07-08 12:35:08 +10:00
Julia
3966f67746 zephyr/machine_spi: Add support for hardware SPI.
Adds support for hardware SPI to the zephyr port.  Consistent with other
ports, such as rp2 and stm32, we only implement the SPI protocol functions
(init and transfer).  Explicit sck/mosi/miso selection is not supported
and new SPI instances are initialized with default values.
2021-07-06 00:00:57 +10:00
Mike Teachman
8a5bfe44a5 esp32,stm32: Add new machine.I2S class for I2S protocol support.
This commit adds I2S protocol support for the esp32 and stm32 ports, via
a new machine.I2S class.  It builds on the stm32 work of blmorris, #1361.

Features include:
- a consistent I2S API across the esp32 and stm32 ports
- I2S configurations supported:
  - master transmit and master receive
  - 16-bit and 32-bit sample sizes
  - mono and stereo formats
  - sampling frequency
  - 3 modes of operation:
    - blocking
    - non-blocking with callback
    - uasyncio
  - internal ring buffer size can be tuned
- documentation for Pyboards and esp32-based boards
- tested on the following development boards:
  - Pyboard D SF2W
  - Pyboard V1.1
  - ESP32 with SPIRAM
  - ESP32

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-07-05 23:42:25 +10:00
Damien George
031fe0f144 rp2/CMakeLists.txt: Suppress compiler errors for pico-sdk and tinyusb.
These warnings appear with GCC 11.  Keep them as warnings but not as
compiler errors so they can be dealt with properly in the future.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-05 16:18:28 +10:00
Damien George
86ef965352 stm32/adc: Simplify and generalise how pin_adcX table is defined.
The ADC_FIRST_GPIO_CHANNEL and ADC_LAST_GPIO_CHANNEL macros are no longer
needed.  Instead the pin_adcX table (X = 1, 2, 3) is now generated to be
the exact size needed for a given MCU, and MP_ARRAY_SIZE(pin_adcX) is used
to determine the upper bound.

This commit also allows CPU pins to be excluded from ADC configuration if
they are hidden by prefixing their name with a "-".

Signed-off-by: Damien George <damien@micropython.org>
2021-07-05 16:03:11 +10:00
iabdalkader
0e11966ce9 stm32/adc: Define the ADC instance used for internal channels. 2021-07-02 23:33:51 +10:00
iabdalkader
ff7be31f26 stm32/adc: Allow using ADC12 and ADC3 for H7.
* Modify common functions in adc.c to accept ADC handle.
* Most external channels are connected to ADC12 which is used by default.
* For ADCAll (internal channels) ADC3 is used instead.
* Issue #4435 is possibly related (at least partially fixed).
2021-07-02 23:33:51 +10:00
Damien George
076caf317e javascript/Makefile: Suppress compiler errors from array bounds.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-02 23:10:22 +10:00
Jonathan Hogg
18e48a71ee esp32/esp32_rmt: Enhance RMT with idle_level and write_pulses modes.
This change allows specification of the idle level and TX carrier output
level (through changed initialisation API), and more flexible specification
of pulses for write_pulses.

This is a breaking change for the esp32.RMT constructor API.  Previous code
of this form:

    esp32.RMT(..., carrier_duty_percent=D, carrier_freq=F)

will now raise an exception and should be changed to:

    esp32.RMT(..., tx_carrier=(F, D, 1))
2021-07-01 13:39:39 +10:00
robert-hh
efa97beb99 tools/autobuild: Add mimxrt port to build scripts for nightly builds.
The firmware for Teensy 4.0, Teensy 4.1 and MIMXRT1020_EVK are created.
Users of other MIMXRT10xx_EVK boards should be able to build the firmware
themselves, they might need specific DEBUG settings.

The Makefile had to be changed in order to build the .bin file as well.
2021-07-01 12:29:16 +10:00
David Lechner
8182f34584 stm32/main: Call mp_deinit() at end of main.
This adds a call to mp_deinit() in the main function of the STM32 port.
This enables the use of MICROPY_PORT_DEINIT_FUNC on that port, as well as
cleaning up the GIL if threading is enabled.
2021-07-01 12:26:40 +10:00
iabdalkader
a32a7421d6 stm32/dma: Add DMAMUX configuration for H7 to fix dma_nohal_init.
Fixes issue #5619.
2021-07-01 12:23:19 +10:00
iabdalkader
f4dce15c87 stm32/sdio: Fix undefined reference to DMA stream on H7.
Follow up to a96afae90f
2021-07-01 12:21:32 +10:00
Damien George
87985fc7e9 stm32/boardctrl: Skip running main.py if boot.py had an error.
Previous behaviour was: if boot.py had an exception then main.py would
still run, which is arguably unexpected behaviour.

This commit changes the behaviour so main.py is not run if boot.py has an
error.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-30 13:24:40 +10:00
robert-hh
cbc9a591a4 mimxrt/modmachine: Add a few minor methods to the machine module.
Mostly for compatibility reasons:
- idle()
- disable_irq()
- enable_irq()
- time_pulse_us()
2021-06-26 22:27:02 +10:00
robert-hh
552e11bf64 mimxrt/mimxrt_flash: Remove commented-out code. 2021-06-26 22:27:02 +10:00
robert-hh
c8284c9b50 mimxrt/main: Extend the information returned by help(). 2021-06-26 22:27:02 +10:00
robert-hh
4eabff53cb mimxrt/main: Skip running main.py if boot.py failed.
See related #7379.
2021-06-26 22:27:02 +10:00
robert-hh
b35566af79 mimxrt/boards: Set vfs partition start to 1 MBbyte.
This avoids the irritation of the PJRC HalfKay loader on Teensy 4.0.  Block
0 and 1 are properly erased and the additional formatting in the make
script is not required anymore.
2021-06-26 22:27:02 +10:00
robert-hh
a262faa227 mimxrt/moduos: Seed the PRNG on boot using the TRNG. 2021-06-26 22:27:02 +10:00
robert-hh
f45412793e mimxrt/machine_spi: Add the SPI class to the machine module.
This class supports SPI bus controller mode, with blocking transfers.

SPI device numbers start at 0, to comply with the pinout of the Teensy
boards.  With the configured clock frequency the fastest baud rate is
33MHz.  For messages longer 16 bytes DMA is used.  The class uses the
existing framework with extmod/machine_spi.c.

Extended driver options:

- drive=n with n being between 1 and 6 or PIN.POWER_1 to PIN.POWER_6.
  Since the pins used by the SPI are fixed, no Pin settings can be made.
  Thus the drive option is added allowing to control ringing and crosstalk
  on the connection.

- gap_ns=nnnnn is the time between sent data items in a frame given in ns.
  Default is 2 clock cycles.
2021-06-26 22:14:47 +10:00
Jonathan Hogg
30422ca7c2 esp32/esp32_rmt: Fix RMT looping in newer IDF versions.
When looping, now disable the TX interrupt after calling rmt_write_items()
function to handle change in IDF behaviour (since v4.1).  Also check length
of pulses to ensure it fits hardware limit.

Fixes issue #7403.
2021-06-25 12:05:12 +10:00
Damien George
c13853f4da javascript: Rework Makefile and GC so it works with latest Emscripten.
The GC now works correctly using asyncify and the functions
emscripten_scan_stack() and emscripten_scan_registers().  Stack/call depth
is monitored via the use of the pystack option.

Fixes issue #6738.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-25 11:29:39 +10:00
Krzysztof Adamski
feb7e2e864 rp2/machine_rtc: In RTC.datetime, compute weekday automatically.
Calculating the weekday each time you want to set a date is error prone and
tiresome.  MicroPython can do it on its own - hardware on some ports do not
support storing weekday in hardware and always computes it on the fly,
ignoring the value given to the constructor.

During discussion for #7432 the conclusion was that there seems to be no
obvious reason to let user set the weekday to an incorrect value so it
makes sense to just ignore the provided weekday value and always compute
the correct value.  This patch introduces this change for the rp2 port.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
2021-06-25 10:29:45 +10:00
Krzysztof Adamski
35b1359a3a rp2: Use 0=Monday datetime convention in RTC.
The RTC in rp2 can store any, even wrong, number as a weekday in RTC.  It
was, however, discussed in #7394 that we would like to unify all ports and
use 0 as Monday, not Sunday in the machine.RTC implementation.

This patch makes sure that the default date set in RTC is adheres to this
convention.  It also fixes the example in quickref to use proper weekday to
avoid confusion.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
2021-06-25 10:29:12 +10:00
Krzysztof Adamski
6409bbcb72 mimxrt: Move calc_weekday helper function to timeutils.
This function may be useful for other ports as well so lets move it to
timeutils so it can be reused.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
2021-06-25 10:28:32 +10:00
Amir Gonnen
cb332ddae8 unix/modffi: Add option to lock GC in callback, and cfun access.
Add an optional 'lock' kwarg to callback that locks GC and scheduler.  This
allows the callback to be invoked asynchronously in 'interrupt context',
for example as a signal handler.

Also add the 'cfun' member function to callback, that allows retrieving the
C callback function address.  This is needed when the callback should be
set to a struct field.

See related #7373.

Signed-off-by: Amir Gonnen <amirgonnen@gmail.com>
2021-06-24 23:12:26 +10:00
Damien George
0009a7dc30 esp32/main: Allow MICROPY_DIR to be overridden.
This is necessary when building a custom out-of-tree board.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-24 16:03:25 +10:00
Damien George
63b8b79610 stm32/usb: Make irq's default trigger enable all events.
Following how other .irq() methods work on other objects.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-23 16:11:37 +10:00
Damien George
38bc5a9f67 stm32: Provide a custom BTstack runloop that integrates with soft timer.
It reschedules the BT HCI poll soft timer so that it is called exactly when
the next timer expires.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-23 13:14:26 +10:00
Damien George
74c2c31811 stm32/mpbthciport: Change from systick to soft-timer for BT scheduling.
Instead of using systick the BT subsystem is now scheduled using a soft
timer.  This means it is scheduled only when it is enabled.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-23 13:14:26 +10:00
Damien George
60f1f76984 stm32/softtimer: Add soft_timer_reinsert() helper function.
And call mp_pairheap_init_node() in soft_timer_static_init() so that
reinsert can be called after static_init.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-23 13:14:26 +10:00
Michael Weiss
b3a34dde36 esp32,esp8266: Add __len__ to NeoPixel driver to support iterating.
Signed-off-by: mishafarms <github@mishafarms.us>
2021-06-22 16:33:55 +10:00
Damien George
bbf9dd849a esp32/boards/sdkconfig.base: Disable MEMPROT_FEATURE to alloc from IRAM.
Dynamically generate/loaded native code (eg from @micropython.native or
native .mpy files) needs to be able allocate from IRAM, and the memory
protection feature must be disabled for that to work.  Disabling it is
needed to get native code working on ESP32-S2 and -C3.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-20 22:54:20 +10:00
David Lechner
259d9b69fe py/mpstate: Schedule KeyboardInterrupt on main thread.
This introduces a new macro to get the main thread and uses it to ensure
that asynchronous exceptions such as KeyboardInterrupt (CTRL+C) are only
scheduled on the main thread. This is more deterministic than being
scheduled on a random thread and is more in line with CPython that only
allow signal handlers to run on the main thread.

Fixes issue #7026.

Signed-off-by: David Lechner <david@pybricks.com>
2021-06-19 09:49:00 +10:00
David Lechner
ca920f7218 py/mpstate: Make exceptions thread-local.
This moves mp_pending_exception from mp_state_vm_t to mp_state_thread_t.
This allows exceptions to be scheduled on a specific thread.

Signed-off-by: David Lechner <david@pybricks.com>
2021-06-19 09:43:44 +10:00
Damien George
eb7ae538f9 esp8266/boards/GENERIC_512K: Add custom minimal _boot.py.
Commit 0abf6f830c removed _boot.py from the
manifest for the GENERIC_512K board because the build does not include a
filesystem.  But the main code expects _boot.py to be there and prints an
error if it's not.  So add a custom _boot.py, which just sets the
gc.threshold().

Signed-off-by: Damien George <damien@micropython.org>
2021-06-18 14:13:18 +10:00
Damien George
4eb13c50cd esp32/machine_sdcard: Use deinit_p to deinit SD bus in SPI mode.
Fixes issue #7352.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-18 09:55:22 +10:00
Jonathan Hogg
89945b1989 esp32/machine_hw_spi: Allow None for unused pins in initializer.
Make the hardware SPI initializer method match the `init()` method by 
allowing `None` to be given for `sck`/`mosi`/`miso` to specify an unused 
signal.
2021-06-17 18:52:22 +10:00
Thomas Wenrich
060066804a esp32/modnetwork: Add "reconnects" option to WLAN STA interface.
This adds a wlan.config(reconnects=N) option to set the number of reconnect
attempts that will be made if the WLAN connection goes down.  The default
is N=-1 (infinite retries, current behavior).  Setting
wlan.config(reconnects=0) will disable the reconnect attempts.

A nice side effect of reconnects=0 is that wlan.status() will report the
disconnect reason now.  See related issue #5326.
2021-06-17 18:48:06 +10:00
Tobias Eydam
48437cec45 esp32/network_lan: Add Ethernet support for IDF v4.1 and above.
Ethernet-PHYs from ESP-IDF (LAN8720, IP101, RTL8201, DP83848) are now
supported in IDF v4.1 and above.  PHY_KSZ8041 is only for ESP-IDF 4.3 and
above.  ESP32S2 is not supported.

Signed-off-by: Tobias Eydam <eydam-prototyping@outlook.com>
2021-06-17 15:36:14 +10:00
robert-hh
8edc3aacdd mimxrt/modutime: Extend the time module.
Methods added:
- time.time()
- time.time_ns()
- time.gmtime()
- time.localtime()
- time.mktime()

The rp2 port was uses as the template for the change.
2021-06-16 01:50:09 +10:00
robert-hh
7417c6ac91 mimxrt/machine_pin: Implement pin.irq() functionality. 2021-06-16 01:42:10 +10:00
robert-hh
689476c576 mimxrt/machine_uart: Add the UART class to the machine module.
The implementation uses the LPUARTx devices.  Up to 8 UARTs can be used,
given that the pins are accessible.  E.g. 8 on Teensy 4.1, 5 on
MIMXRT1020_EVK.

For Tennsy 4.0 and 4.1 the UART numbers are as printed on the pinout 1..N.
The MIMXRT10xx-EVK boards have only one UART named, which gets the number
1.  All other UART are assigned to different Pins:

MIMXRT1010-EVK:
    D0/D1   UART 1
    D6/D7   UART 2
    A0/D4   UART 3

MIMXRT1020-EVK:
    D0/D1   UART 1
    D6/D9   UART 2
    D10/D12 UART 3
    D14/D15 UART 4
    A0/A1   UART 5

MIMXRT1050-EVK, MIMXRT1060-EVK, MIMXRT1064-EVK:
    D0/D1   UART 1
    D7/D6   UART 2
    D8/D9   UART 3
    A1/A0   UART 4
2021-06-16 01:21:15 +10:00
Pavol Rusnak
95048129b1 unix: Fix build on arm64-darwin due to integer cast.
This fixes error: cast to smaller integer type 'int' from 'pthread_t'.
pthread_t is defined as long, not as int.

Signed-off-by: Pavol Rusnak <pavol@rusnak.io>
2021-06-15 00:08:24 +10:00
Krzysztof Adamski
e7f7094ef6 rp2/machine_rtc: Check return value from rtc_set_datetime.
The rtc_set_datetime() from pico-sdk will validate the values in the
datetime_t structure and refuse to set the time if they aren't valid. It
makes sense to raise an exception if this happens instead of failing
silently which might be confusing (as an example, see:
https://github.com/micropython/micropython/pull/6928#issuecomment-860166044
).
2021-06-15 00:06:26 +10:00
iabdalkader
66115a3744 stm32/eth: Fix eth_link_status function to use correct BSR bit.
Fixes #7346.
2021-06-13 12:29:11 +10:00
iabdalkader
51614ce365 stm32/eth: Add low-power mode configuration option.
Add low power functionality configurable with:

    lan.config(low_power=True/False)
2021-06-13 12:27:33 +10:00
robert-hh
3ab8806c0d mimxrt/machine_rtc: Maintain microsecond offset.
The supplied value for microseconds in datetime() will be treated as a
starting value for the reported microseconds.  Due to internal processing
in setting the time, there is an offset about 1 ms.
2021-06-12 23:20:12 +10:00
robert-hh
fd4eec5555 mimxrt/machine_rtc: Change RTC.datetime() tuple to match other ports.
This change moves the datetime tuple format back to the one used by all the
other ports:

    (year, month, day, weekday, hour, minute, second, microsecond)

Weekday is a number between 0 and 6, with 0 assigned to Monday.  It has to
be provided when setting the RTC with datetime(), but will be ignored on
entry and calculated when needed.

The weekday() method was removed, since that is now again a part of the
datetime tuple.

The now() method was updated so it continues to return a tuple that matches
CPython's datetime module.
2021-06-12 23:15:05 +10:00
Krzysztof Adamski
37d01d4be3 rp2/machine_rtc: Add initial support for RTC.
Initial support for machine.RTC on rp2 port. It only supports datetime()
method and nothing else. The method gets/returns a tuple of 8 items, just
like esp32 port, for example, but the usec parameter is ignored as the RP2
RTC only works up to seconds precision.

The Pico RTC isn't very useful as the time is lost during reset and there
seems to be no way to easily power up just the RTC clock with a low current
voltage, but still there seems to be use-cases for that, see issues #6831,
and a Thonny issue #1592. It was also requested for inclusion on v1.15
roadmap on #6832.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
2021-06-12 23:02:54 +10:00
IhorNehrutsa
da8aad18a4 esp32/README: Describe how to select compatible version of existing IDF. 2021-06-11 19:52:10 +10:00
noslaver
f314cac604 esp32/partitions-2MiB.csv: Update table so firmware fits.
The current MicroPython app size is larger than the size allocated in the
partitions table.
2021-06-11 17:57:40 +10:00
Damien George
865abba197 esp32/makeimg.py: Load sizes from partition table and verify data fits.
Changes introduced are:
- the application offset is now loaded from the partition table instead of
  being hard-coded to 0x10000
- maximum size of all sections is computed using the partition table
- an error is generated if any section overflows its allocated space
- remaining bytes are printed for each section

Signed-off-by: Damien George <damien@micropython.org>
2021-06-11 15:43:49 +10:00
Damien George
61f91de361 stm32/sdram: Prevent array-bounds warnings with GCC 11.
Signed-off-by: Damien George <damien@micropython.org>
2021-06-10 22:48:54 +10:00
Damien George
cf849d84b9 stm32/boards: Enable MICROPY_HW_SPIFLASH_ENABLE_CACHE on VCC_GND boards.
Because these boards use the SPI flash cache in their bdev.c configuration.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-10 22:48:17 +10:00
Damien George
71e3538a32 stm32/usb: Add USB_VCP.irq method, to set a callback on USB data RX.
Usage:

    usb = pyb.USB_VCP()
    usb.irq(lambda u:print(u, u.read()), usb.IRQ_RX)

Signed-off-by: Damien George <damien@micropython.org>
2021-06-10 15:26:21 +10:00
Zoltán Vörös
8c02b94946 nrf: Add more math sources to Makefile, and enable log2 implementation.
This commit adds a few math functions to the source list in the Makefile,
and implements the log2f function, so that ulab can be compiled on the nrf
boards.  It also addresses part of #5162.
2021-06-08 16:39:47 +10:00
Abilio Marques
525a920ca5 unix/modffi: Fix conversion between Python integers and ffi types.
This commit fixes the following problems converting to/from Python integers
and ffi types:
- integers of 8 and 16 bits not working on big endian
- integers of 64 bits not working on 32 bits architectures
- unsigned returns were converted to signed Python integers

Fixes issue #7269.
2021-06-08 13:06:17 +10:00
Damien George
d00523ba0c zephyr/boards: Enable ubluetooth on nucleo_wb55rg board.
Signed-off-by: Damien George <damien@micropython.org>
2021-06-06 21:57:44 +10:00
Damien George
80e79a777d zephyr: Add initial ubluetooth module integration.
Currently only advertising and scanning are supported, using the ring
buffer for events (ie not synchronous events at this stage).

The ble_gap_advertise.py multi-test passes (tested on a nucleo_wb55rg
board).

Signed-off-by: Damien George <damien@micropython.org>
2021-06-06 21:57:06 +10:00
Maureen Helm
5cb2ade65b zephyr: Update to Zephyr v2.6.0.
Updates the zephyr port build instructions and CI to use the latest
zephyr release tag.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-06-06 20:17:42 +10:00
Maureen Helm
3331b1811d zephyr: Disable CONFIG_NET_SOCKETS_POSIX_NAMES.
Zephyr's default value for CONFIG_NET_SOCKETS_POSIX_NAMES was changed
from false to true between Zephyr v2.5.0 and v2.6.0. This caused
conflicts in MicroPython, which uses the zsock_ prefixed functions, so
disable it.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-06-06 20:17:42 +10:00
Maureen Helm
f17c0db5f7 zephyr: Update disk access configuration for Zephyr v2.6.0.
Zephyr's Kconfig symbols and defaults for SDHC/SDMMC disk drivers and
the disk access subsystem were reworked between Zephyr v2.5.0 and
v2.6.0. Update MicroPython accordingly.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-06-06 20:17:42 +10:00
Damien George
36cb365cad unix/main: Increase stack limit on ARM architectures.
Signed-off-by: Damien George <damien@micropython.org>
2021-06-05 11:03:09 +10:00
leo chung
fad0efdcf2 esp32/Makefile: Fix wrong target for partition-table.bin.
"$(BUILD)/partition_table/partition  -table.bin" is typing mistake.

Signed-off-by: leo chung <gewalalb@gmail.com>
2021-06-04 01:04:35 +10:00
robert-hh
53fea8598e mimxrt/boards: Add board configuration files for Teensy 4.1.
These are at the moment more or less identical to the Teensy 4.0 files,
except for the pins.csv file and the flash size.
2021-06-04 01:00:39 +10:00
Philipp Ebensberger
b8c65b174f mimxrt/machine_adc: Add the ADC class to the machine module.
This adds the machine.ADC class with the read_u16() method.  make-pins.py
and supporting files are updated to generate ADC information.
2021-06-04 00:51:58 +10:00