summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-04-11stm32/adc: Factor code to optimise adc_read_channel and adc_read.Damien George
Saves 200 bytes of code space.
2018-04-11stm32/dac: Add buffering argument to constructor and init() method.Damien George
This can be used to select the output buffer behaviour of the DAC. The default values are chosen to retain backwards compatibility with existing behaviour. Thanks to @peterhinch for the initial idea to add this feature.
2018-04-11stm32/adc: Optimise read_timed_multi() by caching buffer pointers.Damien George
2018-04-11stm32/adc: Add read_timed_multi() static method, with docs and tests.Peter Hinch
2018-04-11tests/pyb/adc.py: Fix test so that it really does test ADC values.Damien George
Reading into a bytearray will truncate values to 0xff so the assertions checking read_timed() would previously always succeed. Thanks to @peterhinch for finding this problem and providing the solution.
2018-04-11stm32/adc: Fix verification of ADC channel 16 for F411 MCUs.Damien George
2018-04-10stm32/main: Guard usb_mode lines in default boot.py by relevant #if.Peter D. Gray
2018-04-10esp32/machine_uart: Remove UART event queue object.Damien George
This event queue has UART events posted to it and they need to be drained for it to operate without error. The queue is not used by the uPy UART class so it should be removed to prevent the IDF emitting errors. Fixes #3704.
2018-04-10py: Refactor how native emitter code is compiled with a file per arch.Damien George
Instead of emitnative.c having configuration code for each supported architecture, and then compiling this file multiple times with different macros defined, this patch adds a file per architecture with the necessary code to configure the native emitter. These files then #include the emitnative.c file. This simplifies emitnative.c (which is already very large), and simplifies the build system because emitnative.c no longer needs special handling for compilation and qstr extraction.
2018-04-10tests: Move recursive tests to the tests/stress/ subdir.Damien George
Keeping all the stress related tests in one place makes it easier to stress-test a given port, and to also not run such tests on ports that can't handle them.
2018-04-10tests/stress/recursive_gen: Add test for recursive gen with iter.Damien George
2018-04-10stm32/i2c: Fully support peripheral I2C4.Damien George
2018-04-10stm32/i2c: Update HAL macros to use new __HAL_RCC prefix.Damien George
2018-04-10stm32/boards/NUCLEO_H743ZI: Enable DAC peripheral.iabdalkader
2018-04-10stm32/dac: Add support for H7 MCUs.iabdalkader
Includes a fix for H7 DAC DMA requests.
2018-04-10py/objgenerator: Check stack before resuming a generator.Jeff Epler
This turns a hard crash in a recursive generator into a 'maximum recursion depth exceeded' exception.
2018-04-10extmod/re1.5: Fix compilecode.c compile problem on IAR tool chain.armink
The 2nd and 3rd args of the ternary operator are treated like they are in the same expression and must have similar types. void is not compatible with int so that's why the compiler is complaining.
2018-04-10py/stream: Switch stream close operation from method to ioctl.Damien George
This patch moves the implementation of stream closure from a dedicated method to the ioctl of the stream protocol, for each type that implements closing. The benefits of this are: 1. Rounds out the stream ioctl function, which already includes flush, seek and poll (among other things). 2. Makes calling mp_stream_close() on an object slightly more efficient because it now no longer needs to lookup the close method and call it, rather it just delegates straight to the ioctl function (if it exists). 3. Reduces code size and allows future types that implement the stream protocol to be smaller because they don't need a dedicated close method. Code size reduction is around 200 bytes smaller for x86 archs and around 30 bytes smaller for the bare-metal archs.
2018-04-10docs/library/pyb.ADC.rst: Document new features for ADCAll.T S
2018-04-05py/objstr: In find/rfind, don't crash when end < start.Jeff Epler
2018-04-05tests/micropython/extreme_exc.py: Allow to run without any emg exc buf.Damien George
2018-04-05tests/micropython/extreme_exc.py: Fix test to run on more ports/configs.Damien George
2018-04-05py/objint: Simplify LHS arg type checking in int binary op functions.Damien George
The LHS passed to mp_obj_int_binary_op() will always be an integer, either a small int or a big int, so the test for this type doesn't need to include an "other, unsupported type" case.
2018-04-05tests/micropython: Add set of tests for extreme cases of raising exc's.Damien George
2018-04-05tests/basics/string_compare.py: Add test with string that hashes to 0.Damien George
The string "Q+?" is special in that it hashes to zero with the djb2 algorithm (among other strings), and a zero hash should be incremented to a hash of 1.
2018-04-05tests/basics/class_super.py: Add tests for store/delete of super attr.Damien George
2018-04-05tests/basics: Add tests for edge cases of nan-box's 47-bit small int.Damien George
2018-04-04tests/basics: Add test for subclassing an iterable native type.Damien George
2018-04-04tests/basics/int_big1.py: Add test for big int in mp_obj_get_int_maybe.Damien George
2018-04-04py: Don't include mp_optimise_value or opt_level() if compiler disabled.Damien George
Without the compiler enabled the mp_optimise_value is unused, and the micropython.opt_level() function is not useful, so exclude these from the build to save RAM and code size.
2018-04-04py/modsys: Don't compile getsizeof function if feature is disabled.Damien George
2018-04-04tests/stress: Add test to verify the GC can trace nested objects.Damien George
2018-04-04tests/basics: Modify int-big tests to prevent constant folding.Damien George
So that these tests test the runtime behaviour, not the compiler (which may be executed offline).
2018-04-04tests/basics/int_big1.py: Add test converting str with non-print chars.Damien George
2018-04-04tests/basics: Add test for use of return within try-except.Damien George
The case of a return statement in the try suite of a try-except statement was previously only tested by builtin_compile.py, and only then in the part of this test which checked for the existence of the compile builtin. So this patch adds an explicit unit test for this case.
2018-04-04py/vm: Optimise handling of stackless mode when pystack is enabled.Damien George
When pystack is enabled mp_obj_fun_bc_prepare_codestate() will always return a valid pointer, and if there is no more pystack available then it will raise an exception (a RuntimeError). So having pystack enabled with stackless enabled automatically gives strict stackless mode. There is therefore no need to have code for strict stackless mode when pystack is enabled, and this patch optimises the VM for such a case.
2018-04-04py/vm: Don't do unnecessary updates of ip and sp variables.Damien George
Neither the ip nor sp variables are used again after the execution of the RAISE_VARARGS opcode, so they don't need to be updated.
2018-03-30tests/basics/iter1.py: Add more tests for walking a user-defined iter.Damien George
Some code in mp_iternext() was only tested by the native emitter, so the tests added here test this function using just the bytecode emitter.
2018-03-30py/runtime: Be sure that non-intercepted thrown object is an exception.Damien George
The VM expects that, if mp_resume() returns MP_VM_RETURN_EXCEPTION, then the returned value is an exception instance (eg to add a traceback to it). It's possible that a value passed to a generator's throw() is not an exception so must be explicitly checked for if the thrown value is not intercepted by the generator. Thanks to @jepler for finding the bug.
2018-03-30py/runtime: Check that keys in dicts passed as ** args are strings.Damien George
Prior to this patch the code would crash if a key in a ** dict was anything other than a str or qstr. This is because mp_setup_code_state() assumes that keys in kwargs are qstrs (for efficiency). Thanks to @jepler for finding the bug.
2018-03-29stm32/mphalport: Use MCU regs to detect if cycle counter is started.Damien George
Instead of using a dedicated variable in RAM it's simpler to use the relevant bits in the DWT register.
2018-03-29stm32/main: Only update reset_mode if board doesn't use a bootloader.Damien George
If the board is configured to use a bootloader then that bootloader will pass through the reset_mode.
2018-03-29stm32/main: Rename main to stm32_main and pass through first argument.Damien George
The main() function has a predefined type in C which is not so useful for embedded contexts. This patch renames main() to stm32_main() so we can define our own type signature for this function. The type signature is defined to have a single argument which is the "reset_mode" and is passed through as r0 from Reset_Handler. This allows, for example, a bootloader to pass through information into the main application.
2018-03-29stm32: Add custom, optimised Reset_Handler code.Damien George
The Reset_Handler needs to copy the data section and zero the BSS, and these operations should be as optimised as possible to reduce start up time. The versions provided in this patch are about 2x faster (on a Cortex M4) than the previous implementations.
2018-03-28stm32/boards/STM32L476DISC: Update to not take the address of pin objs.Damien George
2018-03-28stm32: Change pin_X and pyb_pin_X identifiers to be pointers to objects.Damien George
Rather than pin objects themselves. The actual object is now pin_X_obj and defines are provided so that pin_X is &pin_X_obj. This makes it so that code that uses pin objects doesn't need to know if they are literals or objects (that need pointers taken) or something else. They are just entities that can be passed to the map_hal_pin_xxx functions. This mirrors how the core handles constant objects (eg mp_const_none which is &mp_const_none_obj) and allows for the possibility of different implementations of the pin layer. For example, prior to this patch there was the following: extern const pin_obj_t pin_A0; #define pyb_pin_X1 pin_A0 ... mp_hal_pin_high(&pin_A0); and now there is: extern const pin_obj_t pin_A0_obj; #define pin_A0 (&pin_A0_obj) #define pyb_pin_X1 pin_A0 ... mp_hal_pin_high(pin_A0); This patch should have minimal effect on board configuration files. The only change that may be needed is if a board has .c files that configure pins.
2018-03-28stm32/boards/NUCLEO_H743ZI: Enable SD card support.iabdalkader
2018-03-28stm32/sdcard: Add H7 SD card support.iabdalkader
2018-03-28stm32/dma: Remove H7 SDMMC DMA descriptors.iabdalkader
The H7 SD peripheral has direct connection to MDMA instead.
2018-03-28stm32/boards/NUCLEO_H743ZI: Update to build with new linker management.Damien George