aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-08-08drivers/cc3000: Use cc3000_time_t instead of time_t for custom typedef.roland
Otherwise it can clash with time_t from the C standard include headers.
2018-08-07py/emitnative: Allocate space for local stack info as it's needed.Damien George
2018-08-06py/emitnative: Simplify handling of exception objects from nlr_buf_t.Damien George
There is no need to have three copies of the exception object on the top of the native value stack. Instead, the values on the stack should be the first two items in an nlr_buf_t: the prev pointer and the ret_val pointer. This is all that is needed and is what the rest of the native emitter expects is on the stack. This patch is essentially an optimisation. Behaviour is unchanged, although the stack layout for native exception handling now makes more sense.
2018-08-04py/emitnative: Fix native locals stack to start at correct location.Damien George
A native function allocates space on its C stack for mp_code_state_t, followed by its Python stack, then its locals. This patch makes sure that the native function actually starts at the start of its Python stack, rather than at the start of mp_code_state_t (which didn't lead to any issues so far because the mp_code_state_t is unused after the native function sets itself up).
2018-08-04py/asmx86: Use generic emit function to simplify cmp emit function.Damien George
2018-08-04tests/run-tests: Enable bool1.py test with native emitter.Damien George
It should work reliably now.
2018-08-04tests/micropython/viper_cond: Add test for large int as bool.Damien George
2018-08-04py/emitnative: Fix x86 native zero checks by comparing full word.Damien George
On x86 archs (both 32 and 64 bit) a bool return value only sets the 8-bit al register, and the higher bits of the ax register have an undefined value. When testing the return value of such cases it is required to just test al for zero/non-zero. On the other hand, checking for truth or zero/non-zero on an integer return value requires checking all bits of the register. These two cases must be distinguished and handled correctly in generated native code. This patch makes sure of this. For other supported native archs (ARM, Thumb2, Xtensa) there is no such distinction and this patch does not change anything for them.
2018-08-04py/emitnative: Factor common code for native jump helper.Damien George
2018-08-04docs/library/machine.I2C.rst: Clarify availability of primitive I2C ops.Peter Hinch
2018-08-04tools/pyboard: Run exec: command as a string.Ayke van Laethem
The Python documentation recommends to pass the command as a string when using Popen(..., shell=True). This is because "sh -c <string>" is used to execute the command and additional arguments after the command string are passed to the shell itself (not the executing command). https://docs.python.org/3.5/library/subprocess.html#subprocess.Popen
2018-08-04tests: Make tests work on targets without float support.Ayke van Laethem
2018-08-04stm32/adc: Fix ADC reading on F0 MCUs to only sample a single channel.Damien George
And increase sampling time to get better results for internal channels.
2018-08-04stm32/adc: Disable VBAT in read channel helper function.Damien George
Prior to this patch, if VBAT was read via ADC.read() or ADCAll.read_channel(), then it would remain enabled and subsequent reads of TEMPSENSOR or VREFINT would not work. This patch makes sure that VBAT is disabled for all cases that it could be read.
2018-08-02nrf/uart: Fix UART.writechar() to write just 1 byte.Ayke van Laethem
2018-08-02nrf/uart: Remove unused UART.char_width field.Ayke van Laethem
Also, clean up some code. Code size change: nrf51: -24 nrf52: -28
2018-08-02nrf: Use separate config for each PWM instance.Stig Bjørlykke
The hard_configs table has entries for each PWM instance. Use them.
2018-08-02py: Fix compiling with debug enabled and make more use of DEBUG_printf.Damien George
DEBUG_printf and MICROPY_DEBUG_PRINTER is now used instead of normal printf, and a fault is fixed in mp_obj_class_lookup with debugging enabled; see issue #3999. Debugging can now be enabled on all ports including when nan-boxing is used.
2018-08-02py/mpconfig.h: Introduce MICROPY_DEBUG_PRINTER for debugging output.Damien George
This patch in effect renames MICROPY_DEBUG_PRINTER_DEST to MICROPY_DEBUG_PRINTER, moving its default definition from lib/utils/printf.c to py/mpconfig.h to make it official and documented, and makes this macro a pointer rather than the actual mp_print_t struct. This is done to get consistency with MICROPY_ERROR_PRINTER, and provide this macro for use outside just lib/utils/printf.c. Ports are updated to use the new macro name.
2018-08-01nrf: Correct index checking of ADC/PWM/RTCounter instances.Stig Bjørlykke
Avoid trying to use ADC, PWM and RTCounter instances which is one past last available, because this will give a HardFault.
2018-08-01nrf: Enable all PWM, RTC and Timer instances for nrf52840.Stig Bjørlykke
The NRF52 define only covers nrf52832, so update the define checks to use NRF52_SERIES to cover both nrf52832 and nrf52840. Fixed machine_hard_pwm_instances table in modules/machine/pwm.c This enables PWM(0) to PWM(3), RTCounter(2), Timer(3) and Timer(4), in addition to NFC reset cause, on nrf52840.
2018-08-01nrf/uos: Add mbfs __enter__ and __exit__ handlers.Stig Bjørlykke
This will make 'with open('file', 'r') as f:' work by properly close the file after the suite is finished.
2018-08-01tools/mpy-tool: Set sane initial dynamic qstr pool size with frozen modsRich Barlow
The first dynamic qstr pool is double the size of the 'alloc' field of the last const qstr pool. The built in const qstr pool (mp_qstr_const_pool) has a hardcoded alloc size of 10, meaning that the first dynamic pool is allocated space for 20 entries. The alloc size must be less than or equal to the actual number of qstrs in the pool (the 'len' field) to ensure that the first dynamically created qstr triggers the creation of a new pool. When modules are frozen a second const pool is created (generally mp_qstr_frozen_const_pool) and linked to the built in pool. However, this second const pool had its 'alloc' field set to the number of qstrs in the pool. When freezing a large quantity of modules this can result in thousands of qstrs being in the pool. This means that the first dynamically created qstr results in a massive allocation. This commit sets the alloc size of the frozen qstr pool to 10 or less (if the number of qstrs in the pool is less than 10). The result of this is that the allocation behaviour when a dynamic qstr is created is identical with an without frozen code. Note that there is the potential for a slight memory inefficiency if the frozen modules have less than 10 qstrs, as the first few dynamic allocations will have quite a large overhead, but the geometric growth soon deals with this.
2018-08-01stm32/modmachine: Get machine.sleep working on L4 MCUs.Damien George
When waking from stop mode most of the system is still in the same state as before entering stop, so only minimal configuration is needed to bring the system clock back online.
2018-08-01stm32/extint.h: Use correct EXTI lines for RTC interrupts.Damien George
2018-07-31docs: Move WiPy specific Timer class to separate doc file.Damien George
The WiPy machine.Timer class is very different to the esp8266 and esp32 implementations which are better candidates for a general Timer class. By moving the WiPy Timer docs to a completely separate file, under a new name machine.TimerWiPy, it gives a clean slate to define and write the docs for a better, general machine.Timer class. This is with the aim of eventually providing documentation that does not have conditional parts to it, conditional on the port. While the new docs are being defined it makes sense to keep the WiPy docs, since they describe its behaviour. Once the new Timer behaviour is defined the WiPy code can be changed to match it, and then the TimerWiPy docs would be removed.
2018-07-31stm32/modmachine: Get machine.sleep working on F0 MCUs.Damien George
2018-07-31stm32/rtc: Get rtc.wakeup working on F0 MCUs.Damien George
The problem was that the EXTI line for the RTC wakeup event is line 20 on the F0, so the interrupt was not firing.
2018-07-31py/asmthumb: Optimise native code calling runtime glue functions.Damien George
This patch makes the Thumb-2 native emitter use wide ldr instructions to call into the runtime, when the index into the native glue function table is 32 or greater. This reduces the generated assembler code from 10 bytes to 6 bytes, saving RAM and making native code run about 0.8% faster.
2018-07-30stm32/Makefile: Use -Wno-attributes for ll_usb.c HAL source file.Damien George
A recent version of arm-none-eabi-gcc (8.2.0) will warn about unused packed attributes in USB_WritePacket and USB_ReadPacket. This patch suppresses such warnings for this file only.
2018-07-30stm32/sdcard: Get SDMMC alt func macro names working with F4,F7,H7 MCUs.Damien George
2018-07-30py/objstr: In format error message, use common string with %s for type.Damien George
This error message did not consume all of its variable args, a bug introduced long ago in baf6f14deb567ab626c1b05213af346108f41700. By fixing it to use %s (instead of keeping the string as-is and deleting the last arg) the same error message string is now reused three times in this format function and gives a code size reduction of around 130 bytes. It also now gives a better error message when a non-string is passed in as an argument to format, eg '{:d}'.format([]).
2018-07-30tests/extmod/ujson_dump_iobase.py: Return number of bytes written.Damien George
Otherwise returning None indicates that the write would block and nothing was actually written. Fixes issue #3990.
2018-07-27tools/pydfu.py: Make the DFU tool work again with Python 2.roland
This patch will work for both Python 2 and 3.
2018-07-23stm32/boards/STM32F429DISC: Enable onboard SDRAM.Andrew Leech
2018-07-23stm32/sdram: On F7 MCUs enable MPU on external SDRAM.Andrew Leech
This prevents hard-faults on non-aligned accesses. Reference: http://www.keil.com/support/docs/3777.htm
2018-07-23stm32/sdram: Integrate SDRAM driver into rest of code.Andrew Leech
If SDRAM is configured and enabled for a board then it is used for the MicroPython GC heap.
2018-07-23stm32/sdram: Add SDRAM driver from OpenMV project.Andrew Leech
Taken from https://github.com/openmv/openmv/blob/7fbe54ad4e9dc1c527d9297a3f4c69c365dc9b2c/src/omv/sdram.c Code is is MIT licensed.
2018-07-23nrf/drivers/flash: Fix incorrect page alignment check.Ayke van Laethem
2018-07-23nrf: Update nrfjprog links to allow to download any version.roland
Instead of downloading "a" version, these links point to history from where you can download the verson you like.
2018-07-20docs/library/machine: Remove conditionals in machine class index.Damien George
The machine module should be standard across all ports so should have the same set of classes in the docs. A special warning is added to the top of the machine.SD class because it is not standardised and only available on the cc3200 port.
2018-07-20docs/reference/index: Remove conditional for inline asm docs.Damien George
The heading of this section makes it clear it is for Thumb-2 architectures only.
2018-07-20docs/library/index: Add hint about using help('modules') for discovery.Damien George
2018-07-20docs/library/index: Remove all conditionals from library index.Damien George
It's fair to just provide a link to all available modules, regardless of the port. Most of the existing ports (unix, stm32, esp8266, esp32) share most of the same set of modules anyway, so no need to maintain separate lists for them. And there's a big discussion at the start of this index about modules not being available on a given port. For port-specific modules, they can also be listed unconditionally because they have headings that explicitly state they are only available on certain ports.
2018-07-20tools/pydfu.py: Use getfullargspec instead of getargspec for newer pyusbroland
pyusb v1.0.2 warns about `getargspec` as being deprecated.
2018-07-20tools/dfu.py: Pad image data to 8 byte alignment to support L476.roland
Thanks to @dhylands for this patch to pad the image to 8-byte boundaries.
2018-07-20travis: Add nrf port to Travis CI build.Damien George
2018-07-20nrf/boards/microbit: Use MICROPY_PY_BUILTINS_FLOAT to detect FP support.Damien George
This works for both single and double precision float.
2018-07-20nrf: Properly use (void) instead of () for function definitions.Damien George
2018-07-20nrf/Makefile: Make sure dependencies for pins_gen.c are correct.Damien George