Wykres commitów

9072 Commity (4b3c6290678a6b812179deb23eb23cb0632a09ff)

Autor SHA1 Wiadomość Data
Damien George ddb3b84c70 stm32/boards: Add common_basic.ld for a board to have a single section. 2018-03-27 21:29:45 +11:00
Damien George ed75b2655f stm32/Makefile: Allow a board to config either 1 or 2 firmware sections.
This patch forces a board to explicitly define TEXT1_ADDR in order to
split the firmware into two separate pieces.  Otherwise the default is now
to produce only a single continuous firmware image with all ISR, text and
data together.
2018-03-27 21:24:15 +11:00
Damien George 95b2cb008e stm32/Makefile: Rename FLASH_ADDR/TEXT_ADDR to TEXT0_ADDR/TEXT1_ADDR.
To make it clearer that these addresses are both for firmware text and that
they have a prescribed ordering.
2018-03-27 21:20:04 +11:00
Damien George 7aec06ca9a stm32/boards: Allow boards to have finer control over the linker script.
This patch allows a particular board to independently specify the linker
scripts for 1) the MCU memory layout; 2) how the different firmware
sections are arranged in memory.  Right now all boards follow the same
layout with two separate firmware section, one for the ISR and one for the
text and data.  This leaves room for storage (filesystem data) to live
between the firmware sections.

The idea with this patch is to accommodate boards that don't have internal
flash storage and only need to have one continuous firmware section.  Thus
the common.ld script is renamed to common_ifs.ld to make explicit that it
is used for cases where the board has internal flash storage.
2018-03-27 21:17:48 +11:00
Damien George a6009a9e35 stm32/*bdev.c: Eliminate dependency on sys_tick_has_passed.
Explicitly writing out the implementation of sys_tick_has_passed makes
these bdev files independent of systick.c and more reusable as a general
component.  It also reduces the code size slightly.

The irq.h header is added to spibdev.c because it uses declarations in that
file (irq.h is usually included implicitly via mphalport.h but not always).
2018-03-27 20:38:57 +11:00
Damien George 6f1e857624 stm32/qspi: Don't take the address of pin configuration identifiers.
Taking the address assumes that the pin is an object (eg a struct), but it
could be a literal (eg an int).  Not taking the address makes this driver
more general for other uses.
2018-03-27 20:34:55 +11:00
Damien George 6b51eb22c8 stm32: Consolidate include of genhdr/pins.h to single location in pin.h.
genhdr/pins.h is an internal header file that defines all of the pin
objects and it's cleaner to have pin.h include it (where the struct's for
these objects are defined) rather than an explicit include by every user.
2018-03-27 20:25:24 +11:00
Damien George b63cc1e9ef stm32/Makefile: Re-enable strict aliasing optimisation for ST HAL files.
The HAL requires strict aliasing optimisation to be turned on to function
correctly (at least for the SD card driver on F4 MCUs).  This optimisation
was recently disabled with the addition of H7 support due to the H7 HAL
having errors with the strict aliasing optimisation enabled.  But this is
now fixed in the latest stm32lib and so the optimisation can now be
re-enabled.

Thanks to @chuckbook for finding that there was a problem with the SD card
on F4 MCUs with the strict aliasing optimisation disabled.
2018-03-26 00:00:47 +11:00
Damien George 23f07b77e5 lib/stm32lib: Update library for fix to H7 SPI strict aliasing error. 2018-03-25 23:58:56 +11:00
iabdalkader 7b0a020a02 stm32/boards/NUCLEO_H743ZI: Disable uSD transceiver.
There's no uSD Transceiver on this NUCLEO board.
2018-03-20 23:26:03 +11:00
iabdalkader 1e0a67f290 stm32/boards/NUCLEO_H743ZI: Enable hardware I2C support. 2018-03-20 23:25:43 +11:00
iabdalkader 24a9facd89 stm32/i2c: Add H7 I2C timing configurations.
Found the timing for full (400 KHz) and FM+ (1MHz) in the HAL examples, and
used CubeMX to calculate the standard value (100KHz).
2018-03-20 23:25:01 +11:00
iabdalkader 2ebc538d63 stm32/dma: Enable H7 DMA descriptors. 2018-03-20 23:24:45 +11:00
Damien George 22c693aa6f tests/pyb/can: Update to test pyb.CAN restart, state, info, inplace recv 2018-03-19 15:15:39 +11:00
Damien George 0abbafd424 stm32/can: Add "list" param to CAN.recv() to receive data inplace.
This API matches (as close as possible) how other pyb classes allow inplace
operations, such as pyb.SPI.recv(buf).
2018-03-19 15:12:24 +11:00
Damien George 5e1279d41a travis: Pass -j4 to make to speed up compilation.
This seems to reduce the Travis build time by roughly 1 minute / 10%.
2018-03-19 11:57:38 +11:00
Damien George e37b8ba5a5 stm32: Use STM32xx macros instead of MCU_SERIES_xx to select MCU type.
The CMSIS files for the STM32 range provide macros to distinguish between
the different MCU series: STM32F4, STM32F7, STM32H7, STM32L4, etc.  Prefer
to use these instead of custom ones.
2018-03-17 10:42:50 +11:00
Damien George 5edce4539b py/objexcept: Make MP_DEFINE_EXCEPTION public so ports can define excs. 2018-03-17 00:31:40 +11:00
Damien George f6a1f18603 py/makeqstrdefs.py: Optimise by using compiled re's so it runs faster.
By using pre-compiled regexs, using startswith(), and explicitly checking
for empty lines (of which around 30% of the input lines are), automatic
qstr extraction is speed up by about 10%.
2018-03-16 23:54:06 +11:00
Damien George 06aa13c350 stm32/can: Use explicit byte extraction instead of casting to word ptr.
Casting the Data array to a uint32_t* leads to strict aliasing errors on
older gcc compilers.
2018-03-16 23:52:13 +11:00
Damien George 9600a1f207 tests/pyb: Update CAN test to expect that auto_restart is printed. 2018-03-16 18:37:55 +11:00
Damien George b7d576d69a docs/library/pyb.CAN: Clean up documentation of data constants. 2018-03-16 18:29:43 +11:00
Damien George a25e6c6b65 stm32/can: Add CAN.info() method to retrieve error and tx/rx buf info. 2018-03-16 18:28:35 +11:00
Damien George d7e67fb1b4 stm32/can: Add CAN.state() method to get the state of the controller.
This is useful for monitoring errors on the bus and knowing when a restart
is needed.
2018-03-16 17:10:41 +11:00
Damien George 1272c3c65d stm32/can: Add CAN.restart() method so controller can leave bus-off. 2018-03-15 17:29:30 +11:00
Damien George 823ca03008 stm32/can: Add "auto_restart" option to constructor and init() method. 2018-03-15 17:17:33 +11:00
Damien George 1608c4f5be stm32/can: Use enums to index keyword arguments, for clarity. 2018-03-15 17:15:41 +11:00
Damien George 2036196d71 stm32/can: Improve can.recv() so it checks for events, eg ctrl-C.
This patch provides a custom (and simple) function to receive data on the
CAN bus, instead of the HAL function.  This custom version calls
mp_handle_pending() while waiting for messages, which, among other things,
allows to interrupt the recv() method via KeyboardInterrupt.
2018-03-15 16:34:07 +11:00
Damien George 22a9158ced stm32/boards/STM32L476DISC: Enable CAN peripheral.
This board allows to test CAN support on the L4 series.
2018-03-15 16:32:11 +11:00
Damien George d91a1989f5 docs/library/pyb.CAN: Update markup to use latest doc conventions. 2018-03-15 16:30:05 +11:00
Damien George 0db49c37a4 docs: Fix some references and RST markup to eliminate Sphinx warnings. 2018-03-15 15:50:51 +11:00
Damien George c926e72750 tests/cpydiff: Indent workaround code snippet so it formats correctly. 2018-03-15 15:49:38 +11:00
Damien George 34e224a4af esp32/machine_uart: Return None from UART read if no data is available.
This is instead of returning an empty bytes object, and matches how other
ports handle non-blocking UART read behaviour.
2018-03-14 13:18:43 +11:00
Damien George bdc875e602 drivers/memory/spiflash: Fix bugs in and clean up read/write functions.
mp_spiflash_read had a bug in it where "dest" and "addr" were incremented
twice for a certain special case.  This was fixed, which then allowed the
function to be simplified to reduce code size.

mp_spiflash_write had a bug in it where "src" was not incremented correctly
for the case where the data to be written included the caching buffer as
well as some bytes after this buffer.  This was fixed and the resulting
code simplified.
2018-03-13 14:13:30 +11:00
Damien George e0bc438e4b py/obj.h: Move declaration of mp_obj_list_init to objlist.h.
If this function is used then objlist.h is already included to get the
definition of mp_obj_list_t.
2018-03-13 14:03:15 +11:00
Damien George 9f811e9096 py/obj.h: Clean up by removing commented-out inline versions of macros. 2018-03-13 14:01:55 +11:00
Damien George d4b55eff44 py/misc.h: Remove unused count_lead_ones() inline function.
This function was never used for unicode/utf8 handling code, or anything
else, so remove it to keep things clean.
2018-03-13 13:23:30 +11:00
Damien George 033c32e694 esp8266/esp_mphal.h: Fix I2C glitching by using input mode for od_high.
Certain pins (eg 4 and 5) seem to behave differently at the hardware level
when in open-drain mode: they glitch when set "high" and drive the pin
active high for a brief period before disabling the output driver.  To work
around this make the pin an input to let it float high.
2018-03-12 12:45:09 +11:00
Tom Collins 4d3a92c67c extmod/vfs_fat: Add file size as 4th element of uos.ilistdir tuple. 2018-03-12 12:26:36 +11:00
Damien George 1345093401 stm32/qspi: Do an explicit read instead of using memory-mapped mode.
Using an explicit read eliminates the need to invalidate the D-cache after
enabling the memory mapping mode, which takes additional time.
2018-03-11 18:28:48 +11:00
Damien George cc34b087f0 drivers/memory/spiflash: Fix setting of QE bit in flash register. 2018-03-11 11:25:38 +11:00
Damien George 0d5bccad11 stm32/storage: Provide support for a second block device. 2018-03-10 01:03:27 +11:00
Damien George bb3359f357 stm32/boards/STM32L476DISC: Provide SPI-flash bdev config.
This board shows how to configure external SPI flash as the main storage
medium.  It uses software SPI.
2018-03-10 00:59:43 +11:00
Damien George 626d6c9756 stm32/storage: Introduce MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE cfg.
This config variable controls whether to support storage on the internal
flash of the MCU.  It is enabled by default and should be explicitly
disabled by boards that don't want internal flash storage.
2018-03-10 00:59:43 +11:00
Damien George d1c4bd69df stm32/storage: Remove all SPI-flash bdev cfg, to be provided per board.
If a board wants to use SPI flash for storage then it must now provide the
configuration itself, using the MICROPY_HW_BDEV_xxx macros.
2018-03-10 00:59:43 +11:00
Damien George 1803e8ef22 stm32/storage: Make spi_bdev interface take a data pointer as first arg.
This allows a board to have multiple instances of the SPI block device.
2018-03-10 00:59:43 +11:00
Damien George 1e4caf0b1e stm32/storage: Merge all misc block-dev funcs into a single ioctl func.
It makes it cleaner, and simpler to support multiple different block
devices.  It also allows to easily extend a given block device with new
ioctl operations.
2018-03-10 00:59:43 +11:00
Damien George a739b35a96 drivers/memory/spiflash: Change to use low-level SPI object not uPy one.
This patch alters the SPI-flash memory driver so that it uses the new
low-level C SPI protocol (from drivers/bus/spi.h) instead of the uPy SPI
protocol (from extmod/machine_spi.h).  This allows the SPI-flash driver to
be used independently from the uPy runtime.
2018-03-10 00:59:43 +11:00
Damien George 58ebeca6a9 drivers/bus: Pull out software SPI implementation to dedicated driver.
This patch takes the software SPI implementation from extmod/machine_spi.c
and moves it to a dedicated file in drivers/bus/softspi.c.  This allows the
SPI driver to be used independently of the uPy runtime, making it a more
general component.
2018-03-10 00:59:43 +11:00
iabdalkader ad2a6e538c stm32/system_stm32: Fix CONFIG_RCC_CR_2ND value to use bitwise or. 2018-03-09 23:37:09 +11:00