micropython/minimal
Damien George dd11af209d py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls.
This patch allows the following code to run without allocating on the heap:

    super().foo(...)

Before this patch such a call would allocate a super object on the heap and
then load the foo method and call it right away.  The super object is only
needed to perform the lookup of the method and not needed after that.  This
patch makes an optimisation to allocate the super object on the C stack and
discard it right after use.

Changes in code size due to this patch are:

   bare-arm: +128
    minimal: +232
   unix x64: +416
unix nanbox: +364
     stmhal: +184
    esp8266: +340
     cc3200: +128
2017-04-22 23:39:20 +10:00
..
Makefile all: Use full path name when including mp-readline/timeutils/netutils. 2017-03-31 22:29:39 +11:00
README.md minimal: Add ability and description to build without the compiler. 2017-02-27 15:09:15 +11:00
frozentest.mpy py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls. 2017-04-22 23:39:20 +10:00
frozentest.py minimal: Add example of frozen persistent bytecode (.mpy file). 2016-04-13 16:07:47 +01:00
main.c minimal/main: Make Cortex-M vector table constant. 2017-04-18 10:17:24 +10:00
mpconfigport.h all: Move BYTES_PER_WORD definition from ports to py/mpconfig.h 2017-04-01 11:39:38 +11:00
mphalport.h all: Add py/mphal.h and use it in all ports. 2015-10-31 19:14:30 +03:00
qstrdefsport.h minimal: New port, intended to represent minimal working code. 2015-01-13 03:17:47 +02:00
stm32f405.ld minimal: Add enough code to run minimal build on STM32F4xx hardware. 2016-01-07 17:43:07 +00:00
uart_core.c minimal: Add enough code to run minimal build on STM32F4xx hardware. 2016-01-07 17:43:07 +00:00

README.md

The minimal port

This port is intended to be a minimal MicroPython port that actually runs. It can run under Linux (or similar) and on any STM32F4xx MCU (eg the pyboard).

Building and running Linux version

By default the port will be built for the host machine:

$ make

To run a small test script do:

$ make run

Building for an STM32 MCU

The Makefile has the ability to build for a Cortex-M CPU, and by default includes some start-up code for an STM32F4xx MCU and also enables a UART for communication. To build:

$ make CROSS=1

If you previously built the Linux version, you will need to first run make clean to get rid of incompatible object files.

Building will produce the build/firmware.dfu file which can be programmed to an MCU using:

$ make CROSS=1 deploy

This version of the build will work out-of-the-box on a pyboard (and anything similar), and will give you a MicroPython REPL on UART1 at 9600 baud. Pin PA13 will also be driven high, and this turns on the red LED on the pyboard.

Building without the built-in MicroPython compiler

This minimal port can be built with the built-in MicroPython compiler disabled. This will reduce the firmware by about 20k on a Thumb2 machine, and by about 40k on 32-bit x86. Without the compiler the REPL will be disabled, but pre-compiled scripts can still be executed.

To test out this feature, change the MICROPY_ENABLE_COMPILER config option to "0" in the mpconfigport.h file in this directory. Then recompile and run the firmware and it will execute the frozentest.py file.