Commit Graph

711 Commits

Author SHA1 Message Date
Damien George 79f404a287 stmhal: Fix USB_VCP.recv so that it returns actual amount of bytes read.
Addresses issue #1529.
2015-10-25 21:43:07 +00:00
Paul Sokolovsky 4a9c60cdfb stmhal: Typo fix in comment. 2015-10-24 21:58:58 +03:00
Paul Sokolovsky 81a1e17238 stmhal/ffconf.h: Include py/mpconfig.h.
mpconfigport.h is a private, partial header not providing correct settings
unless included by py/mpconfig.h.
2015-10-24 18:33:43 +03:00
Paul Sokolovsky 0dbd928cee Makefiles: Remove duplicate object files when linking.
Scenario: module1 depends on some common file from lib/, so specifies it
in its SRC_MOD, and the same situation with module2, then common file
from lib/ eventually ends up listed twice in $(OBJ), which leads to link
errors.

Make is equipped to deal with such situation easily, quoting the manual:
"The value of $^ omits duplicate prerequisites, while $+ retains them and
preserves their order." So, just use $^ consistently in all link targets.
2015-10-24 15:46:53 +03:00
Damien George 9d0192de4a stmhal: Enable "all special methods" configuration option. 2015-10-20 23:55:27 +01:00
Damien George 60401d461a stmhal/rtc: Fix indentation to use spaces rather than tabs. 2015-10-20 12:05:27 +01:00
Peter Hinch b106532b32 stmhal/rtc: Init uses YMD rather than backup register to detect powerup. 2015-10-20 12:05:16 +01:00
Damien George 2f96b1982a stmhal: Bring Pin class close to new machine module specification.
Looks like we can use the same Pin class for legacy pyb module and new
machine module.
2015-10-19 22:50:59 +01:00
Paul Sokolovsky bedab235f9 stmhal/uart: If char is not received within timeout, return EAGAIN error.
Instead of return 0, which means EOF. There's no good way to detect EOF on
continuously active bus like UART, and treat timeout as just temporary
unvailability of data. .read() method of UART object will return None in
this case (instead of 0, which again measn EOF). This is fully compliant
with unix port.
2015-10-20 00:27:07 +03:00
Damien George 83158e0e7f stmhal: Implement os.dupterm (was pyb.repl_uart).
pyb.repl_uart still exists but points to os.dupterm.
2015-10-19 21:57:41 +01:00
Damien George d8066e999d stmhal: Add sleep_{ms,us} and ticks_{ms,us,cpu,diff} to time module.
pyb module still has pyb.delay and pyb.udelay, but these now point to
time.sleep_ms and time.sleep_us respectively.
2015-10-19 21:45:51 +01:00
Dave Hylands 504420c51d stmhal: Early version of machine module for stmhal. 2015-10-19 21:12:42 +01:00
Paul Sokolovsky e0f5df579b all: Make netutils.h available to all ports by default.
Generally, ports should inherit INC from py.mk, append to it, not
overwrite it. TODO: Likely should do the same for other vars too.
2015-10-19 18:32:42 +03:00
Dave Hylands affcbe4139 stmhal: Make USB serial number actually be unique. 2015-10-17 22:02:57 +01:00
Damien George b5c43be135 stmhal: Allow to set bits resolution for DAC; 8 is default, can have 12.
This patch allows to configure the DAC resolution in the constructor and
in the init function, eg:

dac = DAC(1, bits=12).

The default resolution is 8 bits for backwards compatibility.  The bits
sets the maximum value accepted by write and write_timed methods, being
2**bits - 1.

When using write_timed with 12-bit resolution, the input buffer is
treated as an unsigned half-word array, typecode 'H'.

See PR #1130 for discussion.
2015-10-13 14:33:04 +01:00
Damien George 0334058fa4 Rename "Micro Python" to "MicroPython" in REPL, help, readme's and misc. 2015-10-12 00:06:25 +01:00
Damien George 6206f431cf stmhal: Enable REPL auto indent; document paste mode in help(). 2015-10-11 23:33:46 +01:00
Damien George 46a1102852 repl: Add paste mode to friendly REPL, entered via CTRL-E.
Use CTRL-E to enter paste mode.  Prompt starts with "===" and accepts
all characters verbatim, echoing them back.  Only control characters are
CTRL-C which cancels the input and returns to normal REPL, and CTRL-D
which ends the input and executes it.  The input is executed as though
it were a file.  The input is not added to the prompt history.
2015-10-11 23:30:22 +01:00
Paul Sokolovsky 1b586f3a73 py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming. 2015-10-11 15:18:15 +03:00
Dave Hylands 01d64914c5 stmhal: Fix USB CDC-only mode under Windows.
This fix adds PIDs 9801 and 9802 to the pybcdc.inf file.

When in CDC only mode, it presents itself as a Communcations
device rather than as a composite device. Presenting as a
composite device with only the CDC interface seems to confuse
windows.

To test and make sure that the correct pybcdc.inf was being used,
I used USBDeview from http://www.nirsoft.net/utils/usb_devices_view.html
to uninstall any old pyboard drivers (Use Control-F and search
for pyboard). I found running USBDeview as administrator worked best.

Installing the driver in CDC+MSC mode first is recommended (since the
pybcdc.inf file in on the internal flash drive). Then when you switch
modes everything seems to work properly.

I used https://github.com/dhylands/upy-examples/blob/master/boot_switch.py
to easily switch the pyboard between the various USB modes for testing.
2015-10-09 00:18:01 +01:00
Damien George 2a8d7ee0f8 stmhal: Fix RTC.wakeup so it correctly calculates WUT for large periods.
Thanks to Peter Hinch.  Addresses issue #1488.
2015-10-08 12:41:12 +01:00
Damien George fa391eed9d stmhal: In RTC.wakeup, fix setting of wucksel to get correct period.
Thanks to Peter Hinch.  See issue #1490.
2015-10-06 23:39:57 +01:00
Damien George 58e0f4ac50 py: Allocate parse nodes in chunks to reduce fragmentation and RAM use.
With this patch parse nodes are allocated sequentially in chunks.  This
reduces fragmentation of the heap and prevents waste at the end of
individually allocated parse nodes.

Saves roughly 20% of RAM during parse stage.
2015-10-02 00:11:11 +01:00
Tom Soulanille aeb62f9ae3 py/objslice: Make slice attributes (start/stop/step) readable.
Configurable with MICROPY_PY_BUILTINS_SLICE_ATTRS.  Disabled by default.
2015-09-15 21:59:20 +01:00
Damien George d80174d7c3 stmhal: Use polling, not DMA, for 1 byte SPI transfers.
There is an issue sending 1 byte on the SPI bus using DMA, but it only
occurs when the transmit is done for the first time after initialising
the SPI and DMA peripherals.  All other cases (sending 2 or more bytes,
doing send_recv, doing recv first) work okay.  We sidestep this issue by
using polling (not DMA) for all 1 byte transfers.  This is fine because
a 1 byte transfer can't be interrupted and doesn't need the benefits of
DMA (and using polling for this case is more efficient).

Resolves #1456.
2015-09-15 20:45:37 +01:00
Tom Soulanille 7731edf2f5 stmhal: Add "opt" arg to pyb.main, to set mp_optimise_value.
Use this to set the global optimisation value when executing the main
script (and all scripts it imports).
2015-09-12 22:53:54 +01:00
Tony Abboud 8d8fdcb4be stmhal: add option to query for the current usb mode
Fetch the current usb mode and return a string representation when
pyb.usb_mode() is called with no args. The possible string values are interned
as qstr's. None will be returned if an incorrect mode is set.
2015-09-03 23:30:43 +01:00
Bob Clough 86e6ad76cb stmhal: Add support for STM32F411 Discovery Board (STM32F411E-DISCO). 2015-08-29 22:50:58 +01:00
tobbad 1abb449dfb stmhal: Fixed some typos in stm32f411_af.csv. 2015-08-17 16:51:19 +01:00
Dave Hylands c6f1d47dcb stmhal: Enable I & D caches for M7 2015-08-15 10:58:24 -07:00
blmorris bdd78c31b6 py: Add stream_tell method, and use for unix and stmhal file tell. 2015-08-13 22:56:32 +01:00
Dave Hylands 872f9af6ae stmhal: Use CMSIS_MCU definition from mpconfigboard.mk
This needs to land afte #1407 lands, since #1407 is where
the CMSIS_MCU was defined.
2015-08-07 08:54:14 +01:00
Dave Hylands 8f59bacb92 stamhal: Add definitions for MCU_SERIES_F4 and MCU_SERIES_F7 2015-08-07 08:52:42 +01:00
Dave Hylands be66a9ecf6 stmhal: Generate modstm constants per build
This causes unnecessary constants to no longer be generated.
Some constants (like UART_BRR) are different between the F4 and F7
2015-08-07 08:46:43 +01:00
Damien George 4836bcc957 stmhal/cmsis: Replace non-ascii apostrophe with ascii apostrophe. 2015-08-07 08:46:43 +01:00
Dave Hylands 8a1a5c236d stmhal: Fix hardfault when configured as a SPI slave 2015-08-05 23:42:05 +01:00
Dave Hylands 5e11d2b349 stmhal: Enable SPI support for F7 MCUs. 2015-08-05 23:38:49 +01:00
Dave Hylands 34fe5a30c6 stmhal: Enable I2C support for F7 MCUs. 2015-08-05 23:38:24 +01:00
Damien George 4434e43fa1 stmhal: Add HALCOMMITS file with list of commits that touch the hal.
This file should be kept up to date with list of hal commits.
2015-08-03 00:55:36 +01:00
Dave Hylands 7a55c1a884 stmhal: Port of f4 hal commit 1d7fb82 to f7 hal 2015-08-03 00:49:36 +01:00
Dave Hylands 28e51c9eb1 stmhal: Port of f4 hal commit 09de030 to f7 hal 2015-08-03 00:49:36 +01:00
Dave Hylands af9d885f8c stmhal: Port of f4 hal commit c568a2b to f7 hal 2015-08-03 00:49:35 +01:00
Dave Hylands 9e8eba797e stmhal: M7 Reset clocksources changed by DFU bootloader
The DFU bootloader on the ST32F7 chip changes the clocksource
for various possible boot sources (UART1, UART3, I2C1-3).
This commit resets those clock sources back to their cold
reset values.
2015-08-03 00:46:31 +01:00
Dave Hylands 8f1eced69d stmhal: Add STM32F7 support for USB serial and storage.
USB serial is now working for F7.

Internal file storage is now working for F7.  The flash is laid out a bit
differently to the F4 - 4 x 32K, 1 x 128K with the rest 256K, so the
internal storage is 96K.

Added more pind definitions for STM32F7DISC board.  Made USART1 be the
default HWUART repl.  The STLINK usb connector also looks like a USB
serial port which is attached to USART1 on the STM32F7DISC.
2015-08-03 00:39:27 +01:00
Damien George 751485fe6b stmhal: Add support for USART1 and conditional pins in make-pins.py.
Thanks to Dave Hylands for the patch.
2015-08-03 00:23:47 +01:00
Damien George a632037866 stmhal: Add better support for UART having Tx and Rx on different ports.
Thanks to Dave Hylands for the patch.
2015-08-03 00:22:16 +01:00
Damien George c0e39864c6 stmhal: Fix make-pins.py to allow Port K.
Thanks to Dave Hylands for the patch.
2015-08-03 00:18:40 +01:00
Damien George 6e552e15fa stmhal: Add debug capability to print out info about a hard fault.
Capability is #if'd off by default.

Thanks to Dave Hylands for the patch.
2015-08-03 00:14:51 +01:00
Damien George 0851751615 stmhal: Factor GPIO clock enable logic into mp_hal_gpio_clock_enable.
Extracted GPIO clock enable logic into mp_hal_gpio_clock_enable
and called from anyplace which might need to use GPIO functions
on ports other than A-D.

Thanks to Dave Hylands for the patch.
2015-08-03 00:14:48 +01:00
Damien George 6f1c00869c stmhal: Factor out USRSW boot-up code and support boards with 1 LED.
Thanks to Dave Hylands for the patch.
2015-08-03 00:14:44 +01:00