Commit Graph

1265 Commits

Author SHA1 Message Date
Mike Causer
53a9b45da1 esp8266: Add per-board configs, following other ports.
The specific board can be selected with the BOARD makefile variable.  This
defaults (if not specified) to BOARD=GENERIC, which is the original default
firmware build.  For the 512k target use BOARD=GENERIC_512K.
2019-10-10 16:32:25 +11:00
Damien George
2863dcdf4f nrf: Add support to activate MICROPY_PY_SYS_STDFILES.
Fixes issue #5162.
2019-10-08 16:38:04 +11:00
Andrew Leech
04fe62d06f stm32/mboot: Add option to automatically reset when USB is disconnected.
Enable in board config with: #define MBOOT_USB_RESET_ON_DISCONNECT (1)
2019-10-08 16:07:32 +11:00
Jim Mussared
cd8bbf4cfc esp32/boards: Enable BLE by default when building with IDF 4.x. 2019-10-08 14:50:01 +11:00
Jim Mussared
6a9bd1c1ab esp32: Implement BLE using Nimble from IDF 4.x. 2019-10-08 14:50:01 +11:00
Jim Mussared
902bb4ceae stm32: Extract port-specific Nimble implementation.
On other ports (e.g. ESP32) they provide a complete Nimble implementation
(i.e. we don't need to use the code in extmod/nimble). This change
extracts out the bits that we don't need to use in other ports:
 - malloc/free/realloc for Nimble memory.
 - pendsv poll handler
 - depowering the cywbt

Also cleans up the root pointer management.
2019-10-08 14:40:35 +11:00
Damien George
4a6974bea5 stm32/boards/PYBD_SF2: Put nimble library in external QSPI XIP flash.
The BLE stack is not performance critical, so put it in external
memory-mapped flash to save internal flash for other things (like frozen
bytecode).
2019-10-05 23:51:33 +10:00
Martin Fischer
a0ce01f62e stm32/usbdev: Fix compile error if MICROPY_HW_USB_CDC_NUM is set to 2.
Fixes regression introduced by 6705767da1
2019-10-05 23:33:38 +10:00
Damien George
917f027c0b esp32: Enable native emitter. 2019-10-05 13:45:25 +10:00
Chris Mason
0096041c99 stm32/{adc,machine_adc}: Change ADC clock and sampling time for F0 MCUs.
STM32F0 has PCLK=48MHz and maximum ADC clock is 14MHz so use PCLK/4=12MHz
to stay within spec of the ADC peripheral.  In pyb.ADC set common sampling
time to approx 4uS for internal and external sources.  In machine.ADC
reduce sample time to approx 1uS for external source, leave internal at
maximum sampling time.
2019-10-04 21:39:17 +10:00
Damien George
26e90a0514 stm32/boards: Enable MICROPY_HW_RTC_USE_LSE on L4 boards.
The previous commit changed the default configuration on L4 MCUs to use
LSI, so configure these boards to use LSE again.
2019-10-04 16:10:13 +10:00
hahmadi
266146ad64 stm32/system_stm32: Support selection of HSE and LSI on L4 MCUs.
This commit adds the option to use HSE or MSI system clock, and LSE or LSI
RTC clock, on L4 MCUs.

Note that prior to this commit the default clocks on an L4 part were MSI
and LSE.  The defaults are now MSI and LSI.

In mpconfigboard.h select the clock source via:

    #define MICROPY_HW_RTC_USE_LSE (0) or (1)
    #define MICROPY_HW_CLK_USE_HSE (0) or (1)

and the PLLSAI1 N,P,Q,R settings:

    #define MICROPY_HW_CLK_PLLSAIN (12)
    #define MICROPY_HW_CLK_PLLSAIP (RCC_PLLP_DIV7)
    #define MICROPY_HW_CLK_PLLSAIQ (RCC_PLLQ_DIV2)
    #define MICROPY_HW_CLK_PLLSAIR (RCC_PLLR_DIV2)
2019-10-04 16:09:06 +10:00
roland van straten
a069340c1e nrf/main: Update the way the LED is used on startup.
In case of LED1 being present, do a short blink during startup
instead of turning it on and leave it on.
2019-10-02 22:17:54 +02:00
roland van straten
226399bcef nrf/led: Expose public API for LED manipulation.
Aligned implementation with the STM32 port.
Added empty functions to be used when no LED is available.
2019-10-02 22:09:43 +02:00
Glenn Ruben Bakke
cf383412ef nrf/flash: Update flash driver to use nrfx_nvmc driver.
The the nrfx driver is aware of chip specific registers, while
the raw HAL abstraction is not. This driver enables use of NVMC
in non-secure domain for nrf9160.
2019-10-02 21:28:34 +02:00
Glenn Ruben Bakke
c561ae61a1 nrf/uart: Add support for UARTE (EasyDMA). 2019-10-02 21:20:56 +02:00
Glenn Ruben Bakke
02a8c31eef nrf/temp: Move module configuration guard.
This patch moves the check for MICROPY_PY_MACHINE_TEMP to come
before the inclusion of nrf_temp.h. The nrf_temp.h depends on
the NRF_TEMP_Type which might not be defined for all nRF devices.
2019-10-02 21:15:48 +02:00
Glenn Ruben Bakke
d2e730b727 nrf/i2c: Add support for TWIM (EasyDMA). 2019-10-02 20:42:06 +02:00
Damien George
fd9b7efe39 minimal/frozentest.mpy: Update due to change in bytecode. 2019-10-01 12:26:22 +10:00
Damien George
4c5e1a0368 py/bc: Change mp_code_state_t.exc_sp to exc_sp_idx.
Change from a pointer to an index, to make space in mp_code_state_t.
2019-10-01 12:26:22 +10:00
Jim Mussared
fafa9d35dd stm32/boards/PYBD: Enable BLE for Pyboard D. 2019-10-01 09:51:02 +10:00
Jim Mussared
6f35f214d3 stm32/mpconfigport.h: Add modbluetooth module to stm32. 2019-10-01 09:51:02 +10:00
Jim Mussared
f67fd95f8d unix/coverage: Add coverage tests for ringbuf. 2019-10-01 09:51:02 +10:00
Jim Mussared
d72dbb822c stm32: Provide port-specific implementation for Nimble on STM32. 2019-10-01 09:51:02 +10:00
Andrew Leech
4ba0aff472 stm32/uart: Add RTS/CTS pin configuration support to UART4. 2019-09-27 13:24:01 +10:00
Chris Mason
eb12fa3862 stm32/powerctrlboot: Add support for HSI at 8MHz on F0 MCUs.
For use with F0 MCUs that don't have HSI48.  Select the clock source
explicitly in mpconfigboard.h.

On the NUCLEO_F091RC board use HSE bypass when HSE is chosen because the
NUCLEO clock source is STLINK not a crystal.
2019-09-26 17:34:04 +10:00
Chris Mason
f16e4be3fa stm32/powerctrlboot: Fix clock and PLL selection for HSI48 on F0 MCUs.
Before this patch the UART baudrate on F0 MCUs was wrong because the
stm32lib SystemCoreClockUpdate sets SystemCoreClock to 8MHz instead of
48MHz if HSI48 is routed directly to SYSCLK.

The workaround is to use HSI48 -> PREDIV (/2) -> PLL (*2) -> SYSCLK.

Fixes issue #5049.
2019-09-26 17:32:22 +10:00
Damien George
3328b7d71f stm32: Support disabling the compiler.
Disable via "#define MICROPY_ENABLE_COMPILER (0)" in the board's
mpconfigboard.h file.
2019-09-26 17:05:40 +10:00
Damien George
9abfe85ace minimal/frozentest: Recompile now that mpy version has changed. 2019-09-26 16:40:54 +10:00
Josh Lloyd
7d58a197cf py: Rename MP_QSTR_NULL to MP_QSTRnull to avoid intern collisions.
Fixes #5140.
2019-09-26 16:04:56 +10:00
Andrew Leech
2397b44062 stm32/usbd_cdc_interface: Add CTS flow control option for USB VCP.
Enabled by default, but disabled when REPL is connected to the VCP (this is
the existing behaviour).  Can be configured at run-time with, eg:

    pyb.USB_VCP().init(flow=pyb.USB_VCP.RTS | pyb.USB_VCP.CTS)
2019-09-26 13:50:24 +10:00
Damien George
6b4666f8cf stm32/can: Guard header file by MICROPY_HW_ENABLE_CAN.
Because not all MCU series have a CAN peripheral.
2019-09-23 23:45:07 +10:00
Damien George
ca8ff99e8c stm32: Use mp_printf with MICROPY_ERROR_PRINTER for uncaught exceptions. 2019-09-23 17:15:07 +10:00
iabdalkader
4f78ba3cf4 stm32/boards/NUCLEO_H743ZI: Enable FDCAN on this board. 2019-09-23 17:00:54 +10:00
iabdalkader
f7a07b3605 stm32: Add support for FDCAN peripheral, exposed as pyb.CAN.
The new fdcan.c file provides the low-level C interface to the FDCAN
peripheral, and pyb_can.c is updated to support both traditional CAN and
FDCAN, depending on the MCU being compiled for.
2019-09-23 17:00:54 +10:00
Damien George
d06fd384c2 stm32/can: Factor CAN driver into low-level and Python bindings.
can.c now contains the low-level C interface to the CAN peripheral, and
pyb_can.c the Python-level class/methods/constants.
2019-09-23 16:58:08 +10:00
Chris Liechti
6f7e774d12 stm32/machine_i2c: Add ability to specify I2C(4) by name. 2019-09-23 15:08:24 +10:00
Jim Mussared
c33a4cc213 esp32/Makefile: Fix printing of supported git hash. 2019-09-20 14:37:53 +10:00
stijn
d96391aca3 mpy-cross,windows: Add msvc build of mpy-cross.
Add the project file to the mpy-cross directory, which is also where the
executable ends up, and change the Appveyor settings to build mpy-cross
with both msvc and mingw-w64 and verify this all works by running tests
with --via-mpy.
2019-09-18 22:16:36 +10:00
stijn
bc86c6252a windows: Default to binary mode for files.
If this is not set it might default to calls to open() to use text mode
which is usually not wanted, and even wrong and leading to incorrect
results when loading binary .mpy files.

This also means that text files written and read will not have line-ending
translation from \n to \r\n and vice-versa anymore.  This shouldn't be much
of a problem though since most tools dealing with text files adapt
automatically to any of the 2 formats.
2019-09-18 22:15:48 +10:00
stijn
6957939604 windows/msvc: Change the way sources are listed.
Reserve sources.props for listing just the MicroPython core and extmod
files, similar to how py.mk lists port-independent source files.  This
allows reusing the source list, for instance for building mpy-cross.  The
sources for building the executable itself are listed in the corresponding
project file, similar to how the other ports specify the source files in
their Makefile.
2019-09-18 22:15:10 +10:00
stijn
146c32a141 windows/msvc: Enable overriding directories used in the build.
Append to PyIncDirs, used to define include directories specific to
MicroPython, instead of just overwriting it so project files importing this
file can define additional directories.  And allow defining the target
directory for the executable instead of hardcoding it to the windows
directory.  Main reason for this change is that it will allow building
mpy-cross with msvc.
2019-09-18 22:14:37 +10:00
stijn
94873a4826 windows/msvc: Move build options from .vcxproj to .props files.
We want the .vcxproj to be just a container with the minimum content for
making it work as a project file for Visual Studio and MSBuild, whereas the
actual build options and actions get placed in separate reusable files.
This was roughly the case already except some compiler options were
overlooked; fix this here: we'll need those common options when adding a
project file for building mpy-cross.
2019-09-18 22:14:11 +10:00
stijn
b2b21839d3 windows/msvc: Remove unneeded definitions for qstr generation.
These were probably added to detect more qstrs but as long as the
micropython executable itself doesn't use the same build options the qstrs
would be unused anyway.  Furthermore these definitions are for internal use
and get enabled when corresponding MICROPY_EMIT_XXX are defined, in which
case the compiler would warn about symbol redefinitions since they'd be
defined both here and in the source.
2019-09-18 22:13:26 +10:00
Jim Mussared
62d78e231c esp32/main: Use both 3.3 and 4.0 config vars to enable SPIRAM. 2019-09-18 15:49:45 +10:00
iabdalkader
73c94bbbd4 stm32/modusocket: Fix NULL deref when accept() an unbound socket. 2019-09-17 12:30:10 +10:00
Jim Mussared
f469634c0c esp32: Add check to Makefile that the toolchain is in PATH. 2019-09-17 12:26:47 +10:00
Jim Mussared
970f798ea9 esp32: Add check to Makefile for pyparsing version. 2019-09-17 12:26:42 +10:00
Jim Mussared
96008ff59a esp32: Support building with ESP IDF 4.0-beta1.
This commit adds support for a second supported hash (currently set to the
4.0-beta1 tag).  When this hash is detected, the relevant changes are
applied.

This allows to start using v4 features (e.g. BLE with Nimble), and also
start doing testing, while still supporting the original, stable, v3.3 IDF.

Note: this feature is experimental, not well tested, and network.LAN and
network.PPP are currently unsupported.
2019-09-17 12:25:36 +10:00
Damien George
b45f9de809 bare-arm, minimal: Set CSUPEROPT=-Os to get minimal firmware size.
This option affects py/vm.c and py/gc.c and using -Os gets them compiling a
bit smaller, and small firmware is the aim of these two ports.  Also,
having these files compiled with -Os on these ports, and -O3 as the default
on other ports, gives a better understanding of code-size changes when
making changes to these files.
2019-09-17 11:43:52 +10:00