aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-04-09extmod/extmod.cmake: Add support to build btree module with CMake.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09py/py.cmake: Introduce MICROPY_INC_CORE as a list with core includes.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09py/py.cmake: Move qstr helper code to micropy_gather_target_properties.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09stm32/boardctrl: Give boards control over execution of boot.py,main.py.Damien George
This commit simplifies the customisation of the main MicroPython execution loop (4 macros are reduced to 2), and allows a board to have full control over the execution (or not) of boot.py and main.py. For boards that use the default start-up code, there is no functional change in this commit. Signed-off-by: Damien George <damien@micropython.org>
2021-04-08stm32/mpconfigport.h: Add support for a board to specify root pointers.Damien George
A board can now define MICROPY_BOARD_ROOT_POINTERS to specify any custom root pointers. Signed-off-by: Damien George <damien@micropython.org>
2021-04-07stm32/boards/pllvalues.py: Relax PLLQ constraints on STM32F413 MCUs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-07stm32/powerctrl: Support using PLLI2C on STM32F413 as USB clock source.Damien George
So SYSCLK can run at more varied frequencies, eg 100MHz. Signed-off-by: Damien George <damien@micropython.org>
2021-04-07stm32/powerctrl: Allow a board to configure AHB and APB clock dividers.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-07unix: Improve command line argument processing.stijn
Per CPython everything which comes after the command, module or file argument is not an option for the interpreter itself. Hence the processing of options should stop when encountering those, and the remainder be passed as sys.argv. Note the latter was already the case for a module or file but not for a command. This fixes issues like 'micropython myfile.py -h' showing the help and exiting instead of passing '-h' as sys.argv[1], likewise for '-X <something>' being treated as a special option no matter where it occurs on the command line.
2021-04-07rp2: Import uarray instead of array in rp2 module.Tim Radvan
Some forum users noticed that `sm.exec()` took longer the more was present on the flash filesystem connected to the RP2040. They traced this back to the `array` import inside `asm_pio()`, which is causing MicroPython to scan the filesystem. uarray is a built-in module, so importing it shouldn't require scanning the filesystem. We avoid moving the import to the top-level in order to keep the namespace clean; we don't want to accidentally expose `rp2.array`.
2021-04-06extmod/re1.5: Check and report byte overflow errors in _compilecode.Jeff Epler
The generated regex code is limited in the range of jumps and counts, and this commit checks all cases which can overflow given the right kind of input regex, and returns an error in such a case. This change assumes that the results that overflow an int8_t do not overflow a platform int. Closes: #7078 Signed-off-by: Jeff Epler <jepler@gmail.com>
2021-04-06tools/metrics.py: Fix esp32 output filename due to move to CMake.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-06stm32: Include .ARM section in firmware for C++ exception handling.Damien George
Support for C++ was added in 97960dc7deb7a0e691fca5944402cd03386b744b but that commit didn't include the C++ exception handling table in the binary firmware image. This commit fixes that. Signed-off-by: Damien George <damien@micropython.org>
2021-04-06rp2/CMakeLists.txt: Enable USB enumeration fix.Damien George
This is a workaround for errata RP2040-E5, and is needed to make USB more reliable on certain USB ports. Signed-off-by: Damien George <damien@micropython.org>
2021-04-02docs/develop: Improve user C modules to properly describe how to build.Damien George
Make and CMake builds are slightly different and these changes help make it clear what to do in each case. Signed-off-by: Damien George <damien@micropython.org>
2021-04-01examples/usercmodules: Simplify user C module enabling.Damien George
It's a bit of a pitfall with user C modules that including them in the build does not automatically enable them. This commit changes the docs and examples for user C modules to encourage writers of user C modules to enable them unconditionally. This makes things simpler and covers most use cases. See discussion in issue #6960, and also #7086. Signed-off-by: Damien George <damien@micropython.org>
2021-04-01esp32: Fix multiple definition errors with mp_hal_stdout_tx functions.Michael O'Cleirigh
It was noticed that the esp32 port didn't build ulab correctly. The problem was a multiple defintion of the 'mp_hal_stdout_tx_str' and 'mp_hal_stdout_tx_strn_cooked' functions. They were defined in stdout_helpers.c but also in the ports/esp32/mphalport.c. Fixed by removing stdout_helpers.c from the build. Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
2021-04-01tools/ci.sh: Build user C modules for esp32.Michael O'Cleirigh
Builds the esp32 port against the example C and CXX modules. Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
2021-04-01esp32: Restore USER_C_MODULE support with new CMake build system.Michael O'Cleirigh
Support for User C and C++ modules was lost due to upgrading the esp32 to the latest CMake based IDF from the GNUMakefile build process. Restore the support for the esp32 port by integrating with the approach recently added for the rp2 port. Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
2021-03-31rp2: Don't advertise remote wakeup for USB serial.Liam Fraser
This USB feature is currently not supported. With this flag enabled (and the feature not implemented) the USB serial will stop working if there is a delay of more than about 2 seconds between messages, which can occur with USB autosuspend enabled. Fixes issue #6866.
2021-03-31tools/ci.sh: Add CI for CMake USER_C_MODULE support.Phil Howard
Builds the rp2 port against the example C and CXX modules. Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31docs/develop/cmodules.rst: Document C-modules and micropython.cmake.Phil Howard
Documents the micropython.cmake file required to make user C modules compatible with the CMake build system. Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31examples/usercmodule: Add micropython.cmake to the C and CPP examples.Phil Howard
examples/usercmodule/micropython.cmake: Root micropython.cmake file is responsible for including modules. examples/usercmodule/cexample/micropython.cmake: examples/usercmodule/cppexample/micropython.cmake: Module micropython.cmake files define the target and link it to usermod. Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31rp2: Add support for USER_C_MODULES to CMake build system.Phil Howard
The parts that are generic are added to py/ so they can be used by other ports that use CMake. py/usermod.cmake: * Creates a usermod target to hang user C/CXX modules from. * Gathers sources from user C/CXX modules and libs for QSTR scan. ports/rp2/CMakeLists.txt: * Includes py/usermod.cmake. * Links the resulting usermod library to the MicroPython target. py/mkrules.cmake: Add cxxflags to qstr.i.last custom command for CXX modules: * MICROPY_CPP_FLAGS so CXX modules will find includes. * -DNO_QSTR to fix fatal error missing "genhdr/qstrdefs.generated.h". Usage: The rp2 port can be linked against user C modules by running: make USER_C_MODULES=/path/to/module/micropython.cmake CMake will print a list of included modules. Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.org> Co-authored-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca> Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31rp2/mpthreadport.h: Cast core_state to _mp_state_thread_t.Phil Howard
Required for user C++ code to build successfully against ports/rp2. Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-26py: Rename remaining object types to be of the form mp_type_xxx.Damien George
For consistency with all other object types in the core. Signed-off-by: Damien George <damien@micropython.org>
2021-03-19bare-arm: Clean up the code, make it run on an F405, and add a README.Damien George
This commit simplifies and cleans up the bare-arm port, and adds just enough system and library code to make it execute on an STM32F405 MCU. The mpconfigport.h configuration is simplified to just specify those configuration values that are different from the defaults. And the addition of -fdata-sections and -ffunction-sections means the final firmware is smaller than it previously was, by about 4200 bytes. A README is also added. Signed-off-by: Damien George <damien@micropython.org>
2021-03-17py/vm: For tracing use mp_printf, and print state when thread enabled.Damien George
mp_printf should be used to print the prefix because it's also used in mp_bytecode_print2 (otherwise, depending on the system, different output streams may be used). Also print the current thread state when threading is enabled to easily see which thread executes what opcode. Signed-off-by: Damien George <damien@micropython.org>
2021-03-17stm32/Makefile: Allow QSTR_DEFS,QSTR_GLOBAL_DEPENDENCIES to be extended.Damien George
So a board can provide custom qstr definitions if needed. Signed-off-by: Damien George <damien@micropython.org>
2021-03-16tests/run-tests.py: Provide more info if script run via pyboard crashes.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-16tests/extmod/vfs_fat_fileio2.py: Close test file at end of test.Damien George
Otherwise it can lead to inconsistent results running subsequent tests. Signed-off-by: Damien George <damien@micropython.org>
2021-03-16extmod/modbluetooth: Free temp arrays in gatts register services.Damien George
This helps to reduce memory fragmentation, by freeing the heap data as soon as it is not needed. It also helps the compiler keeps a reference to the beginning of both arrays, which need to be traceable by the GC (otherwise some compilers may optimise this reference to something else). Signed-off-by: Damien George <damien@micropython.org>
2021-03-16stm32/Makefile: Fix C++ linker flags when toolchain has spaces in path.stijn
The GNU Make dir command uses spaces as item separator so it does not work for e.g building the STM32 port on Cygwin with a default Arm installation in "c:/program files (x86)/GNU Arm Embedded Toolchain". Fix by using POSIX dirname on a quoted path instead.
2021-03-15all: Add .git-blame-ignore-revs for fixing up git blame output.stijn
Add most formatting-only commits to this file so that when used with git blame, these commits are excluded and the output shows only the interesting bits.
2021-03-14rp2: Use core-provided cmake fragments instead of custom ones.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-14extmod/extmod.cmake: Add modonewire.c to MICROPY_SOURCE_EXTMOD list.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-14rp2/modmachine: Enable machine.Signal class.Damien George
Fixes issue #6863. Signed-off-by: Damien George <damien@micropython.org>
2021-03-14rp2: Enabled more core Python features.Damien George
This brings the port's configuration closer to the stm32 and esp32 ports. Signed-off-by: Damien George <damien@micropython.org>
2021-03-13rp2: Enable uerrno module.Kevin Köck
Fixes #6991.
2021-03-12tests/multi_bluetooth: Skip tests when BLE features are unsupported.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12tests/run-tests.py: Reformat with Black.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12tests: Rename run-tests to run-tests.py for consistency.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12esp32/machine_hw_spi: Use default pins when making SPI if none given.Damien George
The default pins can be optionally configured by a board. Fixes issue #6974. Signed-off-by: Damien George <damien@micropython.org>
2021-03-12lib/pico-sdk: Update to latest version 1.1.0.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12rp2/rp2_flash: Prevent MICROPY_HW_FLASH_STORAGE_BASE being set negative.Andrew Scheller
2021-03-12rp2/modmachine: Re-init UART for REPL on frequency change.robert-hh
When UART is used for REPL and the MCU frequency is changed, the UART has to be re-initialised. Besides that the UART may have to be recreated after a frequency change, but with USB REPL this is not a problem. Thanks to @HermannSW for spotting and providing the change.
2021-03-12rp2/modmachine: Allow changing CPU clock frequency.robert-hh
Using the standard machine.freq(). The safe ranges tested were 10 and 12-270MHz, at which USB REPL still worked. Requested settings can be checked with the script: pico-sdk/src/rp2_common/hardware_clocks/scripts/vcocalc.py. At frequencies like 300MHz the script still signaled OK, but USB did not work any more.
2021-03-12rp2/rp2_pio: Fix sm.get(buf) to not wait after getting last item.robert-hh
sm.get(buf) was waiting for one item more than the length of the supplied buffer. Even if this item was not stored, sm_get would block trying to get an item from the RX fifo. As part of the fix, the edge case for a zero length buffer was moved up to the section where the function arguments are handled. In case of a zero length buffer, sm.get() now returns immediately that buffer.
2021-03-12rp2/rp2_pio: Allow more than 8 consecutive pins for PIO out/set/sideset.robert-hh
The bitmasks supplied for initialization of out/set/sideset were only 8 bit instead of 32. This resulted in an error, that not more than 8 consecutive pins would get initialized. Fixes issue #6933.
2021-03-11rp2/machine_uart: Add support for inverted TX and RX lines.robert-hh
Usage as in the other ports: keyword "invert" constants: INV_TX and INV_RX Sample: uart = UART(1, invert=UART.INV_TX | UART.INV_RX)