Commits (364)

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -15,16 +15,13 @@
# These should also not be modified by git.
tests/basics/ -text
tests/basics/ -text
stmhal/pybcdc.inf_template -text
stmhal/usbd_* -text
stmhal/boards/*/stm32f4xx_hal_conf.h -text
stmhal/cmsis/** -text
stmhal/hal/** -text
stmhal/usbdev/** -text
stmhal/usbhost/** -text
cc3200/hal/aes.c -text
cc3200/hal/aes.h -text
cc3200/hal/des.c -text
cc3200/hal/i2s.c -text
cc3200/hal/i2s.h -text
cc3200/version.h -text
ports/stm32/pybcdc.inf_template -text
ports/stm32/usbd_* -text
ports/stm32/usbdev/** -text
ports/stm32/usbhost/** -text
ports/cc3200/hal/aes.c -text
ports/cc3200/hal/aes.h -text
ports/cc3200/hal/des.c -text
ports/cc3200/hal/i2s.c -text
ports/cc3200/hal/i2s.h -text
ports/cc3200/version.h -text
......@@ -9,7 +9,7 @@
# Packages
# Packages
# Logs and Databases
......@@ -11,3 +11,7 @@
[submodule "lib/berkeley-db-1.xx"]
path = lib/berkeley-db-1.xx
url =
[submodule "lib/stm32lib"]
path = lib/stm32lib
url =
branch = work-F4-1.13.1+F7-1.5.0+L4-1.3.0
......@@ -19,48 +19,48 @@ before_script:
- sudo apt-get install -y --force-yes gcc-arm-none-eabi
# For teensy build
- sudo apt-get install realpath
# For coverage testing
- sudo pip install cpp-coveralls
# For coverage testing (upgrade is used to get latest urllib3 version)
- sudo pip install --upgrade cpp-coveralls
- gcc --version
- arm-none-eabi-gcc --version
- python3 --version
- make -C mpy-cross
- make -C minimal CROSS=1 build/firmware.bin
- ls -l minimal/build/firmware.bin
- make -C ports/minimal CROSS=1 build/firmware.bin
- ls -l ports/minimal/build/firmware.bin
- tools/
- mkdir -p ${HOME}/persist
# Save new firmware for reference, but only if building a main branch, not a pull request
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp minimal/build/firmware.bin ${HOME}/persist/; fi'
- make -C unix deplibs
- make -C unix
- make -C unix nanbox
- make -C bare-arm
- make -C qemu-arm test
- make -C stmhal
- make -C stmhal BOARD=STM32F769DISC
- make -C stmhal BOARD=STM32L476DISC
- make -C teensy
- make -C cc3200 BTARGET=application BTYPE=release
- make -C cc3200 BTARGET=bootloader BTYPE=release
- make -C windows CROSS_COMPILE=i686-w64-mingw32-
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp ports/minimal/build/firmware.bin ${HOME}/persist/; fi'
- make -C ports/unix deplibs
- make -C ports/unix
- make -C ports/unix nanbox
- make -C ports/bare-arm
- make -C ports/qemu-arm test
- make -C ports/stm32
- make -C ports/stm32 BOARD=STM32F769DISC
- make -C ports/stm32 BOARD=STM32L476DISC
- make -C ports/teensy
- make -C ports/cc3200 BTARGET=application BTYPE=release
- make -C ports/cc3200 BTARGET=bootloader BTYPE=release
- make -C ports/windows CROSS_COMPILE=i686-w64-mingw32-
# run tests without coverage info
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests)
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native)
# run tests with coverage info
- make -C unix coverage
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests)
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests -d thread)
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --emit native)
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --via-mpy -d basics float)
- make -C ports/unix coverage
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests)
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -d thread)
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --emit native)
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --via-mpy -d basics float)
# run coveralls coverage analysis (try to, even if some builds/tests failed)
- (cd unix && coveralls --root .. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)
- (cd ports/unix && coveralls --root ../.. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)
- (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done)
- (grep "FAIL" qemu-arm/build/console.out)
- (grep "FAIL" ports/qemu-arm/build/console.out)
For ESA Contract No. 4000114080/15/NL/FE/as
Porting of MicroPython to LEON platforms
Task 2: Implementation and Testing of the MicroPython VM for LEON
This is the port of MicroPython to LEON platforms.
This document describes the directory structure and building and running the
example code.
Directory structure
There are 2 main components in this package, the existing MicroPython code
with patches to make improvements for LEON, and the LEON specific directories.
Existing MicroPython code with patches includes:
py/ core MicroPython source
extmod/ extension modules
lib/ generic C libraries
tools/ miscellaneous helper scripts
docs/ includes to get version number
mpy-cross/ MicroPython cross compiler to produce .mpy files
LEON specific directories:
leon-common/ common code for leon port
leon-ex-minimal/ a minimal example of MicroPython
leon-ex-tasks/ an example of MicroPython using multiple tasks
leon-ex-manager/ an example of MicroPython that uses the VM manager
leon-ex-pystone/ an example of MicroPython that runs pystone benchmark
leon-for-tests/ a version of MicroPython for running LEON tests
leon-tests/ the LEON tests
leon-obcp/ OBCP example system
To build and run the code you will need:
- make, bash, and Python (2.6+ or 3.3+)
- a local/host C compiler and linker (usually gcc et al)
- a cross compiler for SPARC V8 (eg sparc-rtems-gcc)
- the RTEMS library (rtems-4.8 is supported)
- a SPARC emulator (for running the code, eg leon2-emu)
It is assumed that the host C compiler is in your path.
The location of the SPARC compiler and the RTEMS library are configured in the
leon-common/ file.
To optimise the built-in hash tables you also need to configure the location of
the SPARC cc1 executable in the tools/cc1 file, with the variable "cc1_path".
Alternatively, you can disable hash-table optimisation by commenting out the
line in Makefile that reads: CFLAGS += -no-integrated-cpp -B$(shell pwd)/../tools
To run the compiled code (eg for the tests) it is assumed that the "leon2-emu"
executable is in your path. This executable is referenced in some Makefile's
under the "run" target, as well as in the leon-tests/ script.
The first thing to build is the cross compiler which is used to turn Python
scripts (.py) into precompiled MicroPython bytecode (.mpy). Build using:
$ cd mpy-cross
$ make
Next you can build and run the minimal example:
$ cd ../leon-ex-minimal
$ make
You can then run the example scripts:
$ make run
The example scripts are and in the leon-ex-minimal directory.
These can be edited and then `make run` executed again to see the changes.
The scripts are run one after the other. The Makefile will convert the scripts
to .mpy first, and then convert the .mpy files into a C header file so they
can be compiled into the binary. To perform these steps by hand you can do:
$ ../mpy-cross/mpy-cross
$ ../mpy-cross/mpy-cross
$ ../tools/ tohdr ex1.mpy ex2.mpy > build/scripts.h
The file scripts.h is included in main.c and the bytecode is accessed simply
as an array of bytes.
In the directory leon-ex-tasks is an example that spawns 4 scripts. Build
and run using:
$ cd../leon-ex-tasks
$ make
$ make run
In this example the scripts are not compiled into the binary but are instead
loaded into RAM directly using a .srec file (see build/scripts.srec). To
build the .mpy files and scripts.srec file by hand use (this is done
automatically by the Makefile):
$ ../mpy-cross/mpy-cross
$ ../mpy-cross/mpy-cross
$ ../mpy-cross/mpy-cross
$ ../mpy-cross/mpy-cross
$ ../tools/ tosrec 0x40100000 ex1.mpy 0x40110000 ex2.mpy \
0x40120000 ex3.mpy 0x40130000 ex4.mpy > build/scripts.srec
Another example is given using the VM manager. To build and run do:
$ cd ../leon-ex-manager
$ make
$ make run
Look at the main.c file, in the function mp_manager_task, to see how the
manager task can manage the worker scripts.
To build the binary for the test framework do:
$ cd ../leon-for-tests
$ make
To run the core tests do:
$ cd ../leon-tests
$ ./
MicroPython has many configuration variables found in mpconfigport.h. They have
been chosen to provide a good balance of features and performance. One to
notice is:
If this is defined to (0) then the normal garbage collector is used. If this
variable is (1) then a simpler memory manager is used which does not include a
garbage collector, but rather just has a simple immortal heap whereby only
allocation is possible. Allocation is implemented as incrementing a pointer
to the heap.
In main.c there are also some configuration variables of note:
#define MICROPY_RTEMS_HEAP_SIZE (16 * 1024)
These can be used to adjust the stack and heap size (per task) as well as the
number of tasks.
Code size
Code size for a bare LEON binary with RTEMS but no MicroPython is about 100k.
MicroPython with 64-bit NaN boxing costs about 200k extra (so 300k total for the
binary). Without 64-bit NaN boxing MicroPython costs about 166k extra.
......@@ -73,7 +73,7 @@ White space:
keyword and the opening parenthesis.
- Put 1 space after a comma, and 1 space around operators.
- Use braces for all blocks, even no-line and single-line pieces of
- Put opening braces on the end of the line it belongs to, not on
For ESA Contract No. 4000114080/15/NL/FE/as
Porting of MicroPython to LEON platforms
Task 2: Implementation and Testing of the MicroPython VM for LEON
This is the port of MicroPython to LEON platforms.
This document provide some guidance on programming Python scripts for the LEON
port of MicroPython.
Further information can be found in document D7: GRL-MPLEON-D7.
Development environment
The most efficient work flow is to use a unix-like command line. This will
allow to easily compile Python scripts to bytecode and then execute them in
the LEON simulator.
To develop Python scripts there are three recommended options:
1. For the command line, use vim/emacs/other to edit .py files.
Use pylint ( to check Python scripts for errors
before executing (not all errors can be caught but it helps to find basic
mistakes and speeds up development).
2. For a powerful stand-alone IDE, use PyCharm (
3. For integration with Eclipse, use PyDev (
To speed up the development cycle one can use standard Python (also known as
CPython) to execute the Python scripts before they are run on LEON. One should
use CPython version 3.3 or later. Running under CPython will allow to test
features of the script that are generic Python code and don't require special
LEON-only modules. To enable more code to be tested this way, it is recommended
to split the script into parts that are generic (eg some functions, some classes)
and isolate parts that are LEON specific. One could also consider writing dummy
LEON modules that execute on the host machine so that scripts can be tested to
a larger extent with CPython, before running on the LEON platform.
Using MicroPython without the heap
If heap allocation is allowed then one can use all features of Python to write
If heap allocation is not allowed during the main executing of the script then
one must use a restricted set of language features. The general idea is to
allocate the required memory at the start of the script, then lock the heap, and
then execute the main loop using the restricted set of features outlined below.
Heap locking can be done using the heap_lock() function of the micropython
A simple example to demonstrate the structure of a script that needs to lock the
heap during execution:
# import all needed modules
import micropython
import time
import math
import rtems
# create global variables
lst = [1, 2, 3, 4]
dct = {'x':[1, 2], 'y':[3, 4]}
# define functions
def foo(x, y=1):
print(x, y)
# define main function
def main():
# create local objects
l = 100 * [0]
buf = bytearray(100)
# lock the heap; from now on we are restricted in what we can do
# any attempt to allocate on the heap will raise a MemoryError
# execute the main loop
while True:
buf[0] += 1
# and so on
# run the main function
Further examples can be found by looking at the LEON-specific test scripts.
Most of them use the heap_lock() function.
Tips and Tricks
It is good practice to execute the main part of a script in a function (eg
main). This is because local variables in a function are more efficient to
access than global variables, and they are stored on the stack rather than
on the heap in a dictionary.
If integers grow beyond the limit of -2^30 or 2^30-1 then they require the
heap to be stored. It is best to prevent such "overflow" by guarantee of
the algorithm, or by using bit masking to keep within a set range, eg:
x = (x + 1) & 0xffff
If a function needs some local state then it can be pre-allocated by using
default arguments. Default arguments are evaluated only when the function
is first defined, not when the function is called. Eg, the following two
functions do not allocate on the heap when called:
def foo(localstate=[0,0,0,0]):
localstate[0] += 1
def bar(localbuf=bytearray(10)):
n = queue.receive(localbuf)
Language features that do not need the heap
- expressions
- accessing variables
- assignment to existing global variables
- assignment to local variables
- loading attributes
- storing to existing (writable) attributes
- calling functions (except use of * or **)
- calling methods (except use of * or **)
- if statements
- while statements
- for statements
- try/except blocks
- raise (will use emergency exception buffer to create exception object)
Basic types that do not need the heap
- immediate construction (eg having "True" in the code)
- all logic operations
- immediate construction (eg having 'abc' or b'abc' in the code)
- access character using []
- binary comparison: == < > <= >=
- built-in functions: bool, hash, len, print
- iterate over in a for loop
- load element using []
- store element using []
- inplace operators accessing elements using [] (eg b[0] += 2)
- built-in functions: print, bool, len
- iterate over in a for loop
int (must be between -2^30 and 2^30-1 inclusive):
- immediate construction (eg having "123" in the code)
- conversion from string
- unary operators: + - ~
- binary logic: & | ^ << >>
- binary arithmetic: + - * // / % **
- binary comparison: == < > <= >=
- built-in functions: all, any, abs, bool, min, max, print, sum
- immediate construction (eg having "1.23" in the code)
- conversion from int, string
- unary operators: + -
- binary arithmetic: + - * // / % **
- binary comparison: == < > <= >=
- built-in functions: all, any, abs, bool, min, max, print, round, sum
- create empty tuple
- load element using []
- binary comparison: == < > <= >=
- methods: count, index
- built-in functions: print, bool, hash, len
- iterate over in a for loop
- load element using []
- store element using []
- inplace operators accessing elements using [] (eg l[0] += 2)
- binary comparison: == < > <= >=
- methods: count, index, reverse, sort
- built-in functions: print, bool, len
- iterate over in a for loop
- load element using []
- store to existing element using []
- methods: get, setdefault (with existing element), update (with existing elements)
- built-in functions: print, len
- iterate over in a for loop
- iterate over keys and values if these methods are called prior to locking the heap
Built-in functions that do not need the heap
- abs
- all (with tuple, list, iterator, comprehension)
- any (with tuple, list, iterator, comprehension)
- callable
- getattr
- globals
- hasattr
- hash
- isinstance
- issubclass
- len
- locals
- max (with args, tuple, list, iterator, comprehension)
- min (with args, tuple, list, iterator, comprehension)
- ord
- pow
- print
- sum (with tuple, list, iterator, comprehension)
Some common things that need heap allocation
- importing
workaround: import all modules before locking the heap
- assiging global variables for the first time
workaround: create all global variables by assigning None to them
before locking the heap
- defining functions
workaround: define all functions before locking the heap
- defining classes
workaround: define all classes before locking the heap
- creating instances of objects
workaround: create all instances before locking the heap
- creating tuples
workaround: create before locking the heap, or use a pre-created
list instead
- creating lists
workaround: create list of desired size before locking the heap
- extending lists
workaround: none
- creating dicts
workaround: create dict with desired keys before locking the heap
- adding new elements to dicts
workaround: none
- formatting strings
workaround: none
......@@ -34,10 +34,10 @@ Major components in this repository:
core library.
- mpy-cross/ -- the MicroPython cross-compiler which is used to turn scripts
into precompiled bytecode.
- unix/ -- a version of MicroPython that runs on Unix.
- stmhal/ -- a version of MicroPython that runs on the PyBoard and similar
- ports/unix/ -- a version of MicroPython that runs on Unix.
- ports/stm32/ -- a version of MicroPython that runs on the PyBoard and similar
STM32 boards (using ST's Cube HAL drivers).
- minimal/ -- a minimal MicroPython port. Start with this if you want
- ports/minimal/ -- a minimal MicroPython port. Start with this if you want
to port MicroPython to another microcontroller.
- tests/ -- test framework and test scripts.
- docs/ -- user documentation in Sphinx reStructuredText format. Rendered
......@@ -45,13 +45,13 @@ Major components in this repository:
to select needed board/port at the bottom left corner).
Additional components:
- bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used
- ports/bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used
mostly to control code size.
- teensy/ -- a version of MicroPython that runs on the Teensy 3.1
- ports/teensy/ -- a version of MicroPython that runs on the Teensy 3.1
(preliminary but functional).
- pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
- cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
- esp8266/ -- an experimental port for ESP8266 WiFi modules.
- ports/pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
- ports/cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
- ports/esp8266/ -- an experimental port for ESP8266 WiFi modules.
- extmod/ -- additional (non-core) modules implemented in C.
- tools/ -- various tools, including the module.
- examples/ -- a few example Python scripts.
......@@ -72,7 +72,8 @@ Alternatively, fallback implementation based on setjmp/longjmp can be used.
To build (see section below for required dependencies):
$ cd unix
$ git submodule update --init
$ cd ports/unix
$ make axtls
$ make
......@@ -104,44 +105,49 @@ Standard library modules come from
External dependencies
Building Unix version requires some dependencies installed. For
Building MicroPython ports may require some dependencies installed.
For Unix port, `libffi` library and `pkg-config` tool are required. On
Debian/Ubuntu/Mint derivative Linux distros, install `build-essential`
(includes toolchain and make), `libffi-dev`, and `pkg-config` packages.
Other dependencies can be built together with MicroPython. Oftentimes,
you need to do this to enable extra features or capabilities. To build
Other dependencies can be built together with MicroPython. This may
be required to enable extra features or capabilities, and in recent
versions of MicroPython, these may be enabled by default. To build
these additional dependencies, first fetch git submodules for them:
$ git submodule update --init
Use this same command to get the latest versions of dependencies, as
they are updated from time to time. After that, in `unix/` dir, execute:
Use the same command to get the latest versions of dependencies, as
they are updated from time to time. After that, in the port directory
(e.g. `ports/unix/`), execute:
$ make deplibs
This will build all available dependencies (regardless whether they
are used or not). If you intend to build MicroPython with additional
options (like cross-compiling), the same set of options should be passed
to `make deplibs`. To actually enabled use of dependencies, edit
`unix/` file, which has inline descriptions of the options.
For example, to build SSL module (required for `upip` tool described above),
set `MICROPY_PY_USSL` to 1.
to `make deplibs`. To actually enable/disable use of dependencies, edit
`ports/unix/` file, which has inline descriptions of the options.
For example, to build SSL module (required for `upip` tool described above,
and so enabled by dfeault), `MICROPY_PY_USSL` should be set to 1.
In `unix/`, you can also disable some dependencies enabled
by default, like FFI support, which requires libffi development files to
be installed.
For some ports, building required dependences is transparent, and happens
automatically. They still need to be fetched with the git submodule command
The STM version
The STM32 version
The "stmhal" port requires an ARM compiler, arm-none-eabi-gcc, and associated
The "stm32" port requires an ARM compiler, arm-none-eabi-gcc, and associated
bin-utils. For those using Arch Linux, you need arm-none-eabi-binutils and
arm-none-eabi-gcc packages. Otherwise, try here:
To build:
$ cd stmhal
$ git submodule update --init
$ cd ports/stm32
$ make
You then need to get your board into DFU mode. On the pyboard, connect the
......@@ -155,4 +161,4 @@ Then to flash the code via USB DFU to your device:
This will use the included `tools/` script. If flashing the firmware
does not work it may be because you don't have the correct permissions, and
need to use `sudo make deploy`.
See the file in the stmhal/ directory for further details.
See the file in the ports/stm32/ directory for further details.
CORE_COVERAGE results (file, lines, covered):
py/argcheck.c 45 97.78%
py/bc.c 84 100.00%
py/binary.c 162 85.19%
py/obj.h 17 100.00%
py/builtinevex.c 48 100.00%
py/runtime.h 4 100.00%
py/builtinimport.c 152 87.50%
py/compile.c 1638 98.78%
py/emitbc.c 543 99.45%
py/emitcommon.c 30 100.00%
py/emitglue.c 28 92.86%
py/formatfloat.c 159 78.62%
py/frozenmod.c 11 81.82%
py/gc.c 222 89.64%
py/lexer.c 372 92.74%
py/lexerstr.c 18 88.89%
py/lexerunix.c 33 87.88%
py/malloc.c 55 81.82%
py/map.c 202 91.58%
py/modbuiltins.c 252 94.84%
py/modcmath.c 34 100.00%
py/modgc.c 17 100.00%
py/modmath.c 62 100.00%
py/modmicropython.c 20 100.00%
py/modstruct.c 91 100.00%
py/modsys.c 24 100.00%
py/mpprint.c 265 98.49%
py/mpz.c 647 96.91%
py/objarray.c 223 96.86%
py/objattrtuple.c 31 100.00%
py/objbool.c 27 96.30%
py/objboundmeth.c 33 96.97%
py/obj.c 218 93.12%
py/objcell.c 20 95.00%
py/objclosure.c 32 96.88%
py/objcomplex.c 108 99.07%
py/objdict.c 286 95.80%
py/objenumerate.c 15 100.00%
py/objexcept.c 143 91.61%
py/objfilter.c 17 100.00%
py/objfloat.c 83 98.80%
py/objfun.c 87 97.70%
py/objgenerator.c 84 86.90%
py/objgetitemiter.c 18 100.00%
py/objint.c 107 96.26%
py/objint\_mpz.c 188 96.81%
py/objlist.c 265 97.74%
py/objmap.c 20 100.00%
py/objmodule.c 57 89.47%
py/objnamedtuple.c 67 100.00%
py/objnone.c 10 90.00%
py/objobject.c 13 100.00%
py/objpolyiter.c 3 100.00%
py/objproperty.c 33 100.00%
py/objrange.c 78 98.72%
py/objreversed.c 17 100.00%
py/objset.c 269 98.88%
py/objsingleton.c 4 100.00%
py/objslice.c 34 97.06%
py/objstr.c 954 99.79%
py/objstringio.c 53 100.00%
py/objstrunicode.c 119 96.64%
py/objtuple.c 131 93.89%
py/objtype.c 446 98.21%
py/objzip.c 21 100.00%
py/opmethods.c 12 100.00%
py/parse.c 481 88.57%
py/parsenumbase.c 28 100.00%
py/parsenum.c 126 99.21%
py/qstr.c 111 96.40%
py/runtime.c 554 92.06%
py/scope.c 76 93.42%
py/sequence.c 110 100.00%
py/smallint.c 25 100.00%
py/stackctrl.c 14 100.00%
py/stream.c 173 90.17%
py/unicode.c 54 85.19%
py/vm.c 479 98.33%
py/vstr.c 193 87.56%
py/warning.c 10 60.00%
pass CORE_BASICS/0prelim
pass CORE_BASICS/andor
pass CORE_BASICS/array1
pass CORE_BASICS/array_add
pass CORE_BASICS/array_construct2
pass CORE_BASICS/array_construct_endian
pass CORE_BASICS/array_construct
pass CORE_BASICS/array_q
pass CORE_BASICS/assign1
pass CORE_BASICS/attrtuple1
pass CORE_BASICS/bool1
pass CORE_BASICS/boundmeth1
pass CORE_BASICS/break
pass CORE_BASICS/builtin_abs
pass CORE_BASICS/builtin_allany
pass CORE_BASICS/builtin_bin
pass CORE_BASICS/builtin_callable
pass CORE_BASICS/builtin_chr
pass CORE_BASICS/builtin_dict
pass CORE_BASICS/builtin_dir
pass CORE_BASICS/builtin_divmod
pass CORE_BASICS/builtin_ellipsis
pass CORE_BASICS/builtin_hash
pass CORE_BASICS/builtin_hex
pass CORE_BASICS/builtin_id
pass CORE_BASICS/builtin_issubclass
pass CORE_BASICS/builtin_len1
pass CORE_BASICS/builtin_minmax
pass CORE_BASICS/builtin_oct
pass CORE_BASICS/builtin_ord
pass CORE_BASICS/builtin_pow
pass CORE_BASICS/builtin_property
pass CORE_BASICS/builtin_range
pass CORE_BASICS/builtin_reversed
pass CORE_BASICS/builtin_round
pass CORE_BASICS/builtin_slice
pass CORE_BASICS/builtin_sorted
pass CORE_BASICS/builtin_sum
pass CORE_BASICS/builtin_type
pass CORE_BASICS/bytearray1
pass CORE_BASICS/bytearray_add
pass CORE_BASICS/bytearray_construct_endian
pass CORE_BASICS/bytearray_construct
pass CORE_BASICS/bytearray_longint
pass CORE_BASICS/bytearray_slice_assign
pass CORE_BASICS/bytes_add_endian
pass CORE_BASICS/bytes_add
pass CORE_BASICS/bytes_compare2
pass CORE_BASICS/bytes_compare
pass CORE_BASICS/bytes_construct_endian
pass CORE_BASICS/bytes_construct
pass CORE_BASICS/bytes_count
pass CORE_BASICS/bytes
pass CORE_BASICS/bytes_find
pass CORE_BASICS/bytes_format_modulo
pass CORE_BASICS/bytes_gen
pass CORE_BASICS/bytes_large
pass CORE_BASICS/bytes_mult
pass CORE_BASICS/bytes_partition
pass CORE_BASICS/bytes_replace
pass CORE_BASICS/bytes_split
pass CORE_BASICS/bytes_strip
pass CORE_BASICS/bytes_subscr
pass CORE_BASICS/class1
pass CORE_BASICS/class2
pass CORE_BASICS/class3
pass CORE_BASICS/class_bind_self
pass CORE_BASICS/class_binop
pass CORE_BASICS/class_call
pass CORE_BASICS/class_contains
pass CORE_BASICS/class_emptybases
pass CORE_BASICS/class_getattr
pass CORE_BASICS/class_inherit1
pass CORE_BASICS/class_inherit_mul
pass CORE_BASICS/class_instance_override
pass CORE_BASICS/class_item
pass CORE_BASICS/class_new
pass CORE_BASICS/class_number
pass CORE_BASICS/class_staticclassmethod
pass CORE_BASICS/class_store_class
pass CORE_BASICS/class_store
pass CORE_BASICS/class_str
pass CORE_BASICS/class_super
pass CORE_BASICS/class_super_object
pass CORE_BASICS/class_use_other
pass CORE_BASICS/closure1
pass CORE_BASICS/closure2
pass CORE_BASICS/closure_defargs
pass CORE_BASICS/closure_manyvars
pass CORE_BASICS/closure_namedarg
pass CORE_BASICS/compare_multi
pass CORE_BASICS/comprehension1
pass CORE_BASICS/containment
pass CORE_BASICS/continue
pass CORE_BASICS/decorator
pass CORE_BASICS/del_attr
pass CORE_BASICS/del_deref
pass CORE_BASICS/del_global
pass CORE_BASICS/del_local
pass CORE_BASICS/del_name
pass CORE_BASICS/del_subscr
pass CORE_BASICS/dict1
pass CORE_BASICS/dict2
pass CORE_BASICS/dict_clear
pass CORE_BASICS/dict_construct
pass CORE_BASICS/dict_copy
pass CORE_BASICS/dict_del
pass CORE_BASICS/dict_from_iter
pass CORE_BASICS/dict_fromkeys
pass CORE_BASICS/dict_get
pass CORE_BASICS/dict_intern
pass CORE_BASICS/dict_iterator
pass CORE_BASICS/dict_pop
pass CORE_BASICS/dict_popitem
pass CORE_BASICS/dict_setdefault
pass CORE_BASICS/dict_specialmeth
pass CORE_BASICS/dict_update
pass CORE_BASICS/dict_views
pass CORE_BASICS/enumerate
pass CORE_BASICS/equal_class
pass CORE_BASICS/equal
pass CORE_BASICS/exception1
pass CORE_BASICS/exception_chain
pass CORE_BASICS/except_match_tuple
pass CORE_BASICS/exceptpoly
pass CORE_BASICS/filter
pass CORE_BASICS/floordivide
pass CORE_BASICS/for1
pass CORE_BASICS/for2
pass CORE_BASICS/for3
pass CORE_BASICS/for_break
pass CORE_BASICS/for_range
pass CORE_BASICS/for_return
pass CORE_BASICS/frozenset1
pass CORE_BASICS/frozenset_add
pass CORE_BASICS/frozenset_binop
pass CORE_BASICS/frozenset_copy
pass CORE_BASICS/frozenset_difference
pass CORE_BASICS/frozenset_set
pass CORE_BASICS/fun1
pass CORE_BASICS/fun2
pass CORE_BASICS/fun3
pass CORE_BASICS/fun_annotations
pass CORE_BASICS/fun_calldblstar
pass CORE_BASICS/fun_callstardblstar
pass CORE_BASICS/fun_callstar
pass CORE_BASICS/fun_defargs2
pass CORE_BASICS/fun_defargs
pass CORE_BASICS/fun_error
pass CORE_BASICS/fun_kwargs
pass CORE_BASICS/fun_kwonlydef
pass CORE_BASICS/fun_kwonly
pass CORE_BASICS/fun_kwvarargs
pass CORE_BASICS/fun_largestate
pass CORE_BASICS/fun_name
pass CORE_BASICS/fun_str
pass CORE_BASICS/fun_varargs
pass CORE_BASICS/gc1
pass CORE_BASICS/generator1
pass CORE_BASICS/generator2
pass CORE_BASICS/generator_args
pass CORE_BASICS/generator_close
pass CORE_BASICS/generator_closure
pass CORE_BASICS/generator_exc
pass CORE_BASICS/generator_return
pass CORE_BASICS/generator_send
pass CORE_BASICS/gen_yield_from_close
pass CORE_BASICS/gen_yield_from_ducktype
pass CORE_BASICS/gen_yield_from_exc
pass CORE_BASICS/gen_yield_from
pass CORE_BASICS/gen_yield_from_iter
pass CORE_BASICS/gen_yield_from_send
pass CORE_BASICS/gen_yield_from_throw
pass CORE_BASICS/getattr1
pass CORE_BASICS/getattr
pass CORE_BASICS/getitem
pass CORE_BASICS/globals_del
pass CORE_BASICS/hasattr1
pass CORE_BASICS/ifcond
pass CORE_BASICS/int1
pass CORE_BASICS/int2
pass CORE_BASICS/int_big_and
pass CORE_BASICS/int_big_cmp
pass CORE_BASICS/int_big_div
pass CORE_BASICS/int_big_error
pass CORE_BASICS/int_big_lshift
pass CORE_BASICS/int_big_mod
pass CORE_BASICS/int_big_mul
pass CORE_BASICS/int_big_or
pass CORE_BASICS/int_big_pow
pass CORE_BASICS/int_big_rshift
pass CORE_BASICS/int_big_unary
pass CORE_BASICS/int_big_xor
pass CORE_BASICS/int_big_zeroone
pass CORE_BASICS/int_bytes
pass CORE_BASICS/int_constfolding
pass CORE_BASICS/int_divmod
pass CORE_BASICS/int_divzero
pass CORE_BASICS/int_long
pass CORE_BASICS/int_mpz
pass CORE_BASICS/int_small
pass CORE_BASICS/is_isnot
pass CORE_BASICS/iter0
pass CORE_BASICS/iter1
pass CORE_BASICS/iter2
pass CORE_BASICS/iter_of_iter
pass CORE_BASICS/lambda1
pass CORE_BASICS/lambda_defargs
pass CORE_BASICS/list1
pass CORE_BASICS/list_clear
pass CORE_BASICS/list_compare
pass CORE_BASICS/list_copy
pass CORE_BASICS/list_count
pass CORE_BASICS/list_extend
pass CORE_BASICS/list_index
pass CORE_BASICS/list_insert
pass CORE_BASICS/list_mult
pass CORE_BASICS/list_pop
pass CORE_BASICS/list_remove
pass CORE_BASICS/list_reverse
pass CORE_BASICS/list_slice_3arg
pass CORE_BASICS/list_slice_assign
pass CORE_BASICS/list_slice_assign_grow
pass CORE_BASICS/list_slice
pass CORE_BASICS/list_sort
pass CORE_BASICS/list_sum
pass CORE_BASICS/map
pass CORE_BASICS/memoryerror
pass CORE_BASICS/memoryview1
pass CORE_BASICS/memoryview_gc
pass CORE_BASICS/module1
pass CORE_BASICS/module2
pass CORE_BASICS/namedtuple1
pass CORE_BASICS/object1
pass CORE_BASICS/object_dict
pass CORE_BASICS/object_new
pass CORE_BASICS/op_error
pass CORE_BASICS/ordereddict1
pass CORE_BASICS/print
pass CORE_BASICS/return1
pass CORE_BASICS/scope
pass CORE_BASICS/self_type_check
pass CORE_BASICS/seq_unpack
pass CORE_BASICS/set1
pass CORE_BASICS/set_add
pass CORE_BASICS/setattr1
pass CORE_BASICS/set_binop
pass CORE_BASICS/set_clear
pass CORE_BASICS/set_copy
pass CORE_BASICS/set_difference
pass CORE_BASICS/set_discard
pass CORE_BASICS/set_intersection
pass CORE_BASICS/set_isdisjoint
pass CORE_BASICS/set_isfooset
pass CORE_BASICS/set_iter
pass CORE_BASICS/set_pop
pass CORE_BASICS/set_remove
pass CORE_BASICS/set_specialmeth
pass CORE_BASICS/set_symmetric_difference
pass CORE_BASICS/set_union
pass CORE_BASICS/set_unop
pass CORE_BASICS/set_update
pass CORE_BASICS/slots_bool_len
pass CORE_BASICS/string1
pass CORE_BASICS/string_compare
pass CORE_BASICS/string_count
pass CORE_BASICS/string_cr_conversion
pass CORE_BASICS/string_crlf_conversion
pass CORE_BASICS/string_endswith
pass CORE_BASICS/string_escape
pass CORE_BASICS/string_find
pass CORE_BASICS/string_format
pass CORE_BASICS/string_format_modulo
pass CORE_BASICS/string_index
pass CORE_BASICS/string_istest
pass CORE_BASICS/string_join
pass CORE_BASICS/string_large
pass CORE_BASICS/string_mult
pass CORE_BASICS/string_partition
pass CORE_BASICS/string_replace
pass CORE_BASICS/string_repr
pass CORE_BASICS/string_rfind
pass CORE_BASICS/string_rindex
pass CORE_BASICS/string_rpartition
pass CORE_BASICS/string_rsplit
pass CORE_BASICS/string_slice
pass CORE_BASICS/string_split
pass CORE_BASICS/string_splitlines
pass CORE_BASICS/string_startswith
pass CORE_BASICS/string_strip
pass CORE_BASICS/string_upperlow
pass CORE_BASICS/struct1
pass CORE_BASICS/subclass_classmethod
pass CORE_BASICS/subclass_native1
pass CORE_BASICS/subclass_native2_list
pass CORE_BASICS/subclass_native2_tuple
pass CORE_BASICS/subclass_native3
pass CORE_BASICS/subclass_native4
pass CORE_BASICS/subclass_native5
pass CORE_BASICS/subclass_native_buffer
pass CORE_BASICS/subclass_native_cmp
pass CORE_BASICS/subclass_native_specmeth
pass CORE_BASICS/sys1
pass CORE_BASICS/true_value
pass CORE_BASICS/try1
pass CORE_BASICS/try2
pass CORE_BASICS/try3
pass CORE_BASICS/try4
pass CORE_BASICS/try_as_var
pass CORE_BASICS/try_error
pass CORE_BASICS/try_finally1
pass CORE_BASICS/try_finally_loops
pass CORE_BASICS/try_finally_return2
pass CORE_BASICS/try_finally_return
pass CORE_BASICS/try_reraise2
pass CORE_BASICS/try_reraise
pass CORE_BASICS/tuple1
pass CORE_BASICS/tuple_compare
pass CORE_BASICS/tuple_count
pass CORE_BASICS/tuple_index
pass CORE_BASICS/tuple_mult
pass CORE_BASICS/types1
pass CORE_BASICS/types2
pass CORE_BASICS/unary_op
pass CORE_BASICS/unboundlocal
pass CORE_BASICS/unpack1
pass CORE_BASICS/while1
pass CORE_BASICS/while_cond
pass CORE_BASICS/while_nest_exc
pass CORE_BASICS/with1
pass CORE_BASICS/with_break
pass CORE_BASICS/with_continue
pass CORE_BASICS/with_return
pass CORE_BASICS/zip
334 tests performed (11714 individual testcases)
334 tests passed
pass CORE_UNICODE/unicode_chr
pass CORE_UNICODE/unicode
pass CORE_UNICODE/unicode_id
pass CORE_UNICODE/unicode_index
pass CORE_UNICODE/unicode_iter
pass CORE_UNICODE/unicode_ord
pass CORE_UNICODE/unicode_pos
pass CORE_UNICODE/unicode_str_format
pass CORE_UNICODE/unicode_str_modulo
9 tests performed (189 individual testcases)
9 tests passed
pass CORE_FLOAT/array_construct
pass CORE_FLOAT/builtin_float_minmax
pass CORE_FLOAT/builtin_float_round
pass CORE_FLOAT/bytearray_construct
pass CORE_FLOAT/bytes_construct
pass CORE_FLOAT/cmath_fun
pass CORE_FLOAT/complex1
pass CORE_FLOAT/float1
pass CORE_FLOAT/float2int_doubleprec
pass CORE_FLOAT/float2int
pass CORE_FLOAT/float_array
pass CORE_FLOAT/float_divmod
pass CORE_FLOAT/float_divmod_relaxed
pass CORE_FLOAT/float_struct
pass CORE_FLOAT/int_big_float
pass CORE_FLOAT/int_divzero
pass CORE_FLOAT/int_power
pass CORE_FLOAT/list_index
pass CORE_FLOAT/math_fun_bool
pass CORE_FLOAT/math_fun
pass CORE_FLOAT/string_format
pass CORE_FLOAT/string_format_modulo
pass CORE_FLOAT/true_value
pass CORE_FLOAT/types
24 tests performed (2715 individual testcases)
24 tests passed
pass CORE_EXTMOD/ubinascii_a2b_base64
pass CORE_EXTMOD/ubinascii_b2a_base64
pass CORE_EXTMOD/ubinascii_hexlify
pass CORE_EXTMOD/ubinascii_unhexlify
pass CORE_EXTMOD/ujson_dumps
pass CORE_EXTMOD/ujson_dumps_extra
pass CORE_EXTMOD/ujson_dumps_float
pass CORE_EXTMOD/ujson_loads
pass CORE_EXTMOD/ujson_loads_float
9 tests performed (76 individual testcases)
9 tests passed
pass CORE_MISC/features
pass CORE_MISC/non_compliant
pass CORE_MISC/recursion
pass CORE_MISC/recursive_iternext
pass CORE_MISC/rge_sm
5 tests performed (114 individual testcases)
5 tests passed
pass CORE_MICROPYTHON/decorator
pass CORE_MICROPYTHON/heapalloc
3 tests performed (14 individual testcases)
3 tests passed
pass leon_t1/DATAPOOL_01
pass leon_t1/DATAPOOL_02
pass leon_t1/DATAPOOL_03
pass leon_t1/DATAPOOL_04
pass leon_t1/MODMEM_01
pass leon_t1/NOHEAP_01
pass leon_t1/NOHEAP_02
pass leon_t1/NOHEAP_03
pass leon_t1/NOHEAP_04
pass leon_t1/NOHEAP_05
pass leon_t1/NOHEAP_06
pass leon_t1/ROB_HEAP_01
pass leon_t1/ROB_INPUT_01
pass leon_t1/ROB_INPUT_02
pass leon_t1/ROB_INPUT_03
pass leon_t1/ROB_INPUT_04
pass leon_t1/ROB_STACK_01
pass leon_t1/ROB_STACK_02
FAIL leon_t1/ROB_STACK_03
pass leon_t1/ROB_STACK_04
pass leon_t1/RTEMS_01
pass leon_t1/RTEMS_CONST_01
pass leon_t1/RTEMS_QUEUE_01
pass leon_t1/RTEMS_SEM_01
pass leon_t1/RTEMS_SEM_02
pass leon_t1/RTEMS_TASK_01
26 tests performed (354 individual testcases)
25 tests passed
1 tests failed - ROB_STACK_03
pass leon_t2/DATAPOOL_05
pass leon_t2/ROB_TASK_01
pass leon_t2/RTEMS_QUEUE_02
pass leon_t2/RTEMS_QUEUE_03
pass leon_t2/RTEMS_QUEUE_04
pass leon_t2/RTEMS_QUEUE_05
pass leon_t2/RTEMS_QUEUE_06
pass leon_t2/RTEMS_QUEUE_07
pass leon_t2/RTEMS_SEM_03
pass leon_t2/RTEMS_TASK_02
pass leon_t2/RTEMS_TASK_03
11 tests performed (181 individual testcases)
11 tests passed
pass leon_t10/ROB_TASK_02
1 tests performed (20 individual testcases)
1 tests passed
Pystone(1.2) time for 500 passes = 23.7942
This machine benchmarks at 21.0135 pystones/second
time: 0.02709293365478516
time: 1.510602951049805
-- calling f1 --
stack: 1712 out of 10240
GC: total: 48512, used: 1024, free: 47488
No. of 1-blocks: 12, 2-blocks: 3, max blk sz: 4
stack: 2248 out of 10240
GC: total: 48512, used: 1024, free: 47488
No. of 1-blocks: 12, 2-blocks: 3, max blk sz: 4
stack: 2784 out of 10240
GC: total: 48512, used: 1024, free: 47488
No. of 1-blocks: 12, 2-blocks: 3, max blk sz: 4
stack: 3320 out of 10240
GC: total: 48512, used: 1024, free: 47488
No. of 1-blocks: 12, 2-blocks: 3, max blk sz: 4
stack: 3856 out of 10240
GC: total: 48512, used: 1024, free: 47488
No. of 1-blocks: 12, 2-blocks: 3, max blk sz: 4
-- calling f2 --
stack: 1720 out of 10240
GC: total: 48512, used: 1056, free: 47456
No. of 1-blocks: 13, 2-blocks: 3, max blk sz: 4
stack: 2264 out of 10240
GC: total: 48512, used: 1056, free: 47456
No. of 1-blocks: 13, 2-blocks: 3, max blk sz: 4
stack: 2808 out of 10240
GC: total: 48512, used: 1056, free: 47456
No. of 1-blocks: 13, 2-blocks: 3, max blk sz: 4
stack: 3352 out of 10240
GC: total: 48512, used: 1056, free: 47456
No. of 1-blocks: 13, 2-blocks: 3, max blk sz: 4
stack: 3896 out of 10240
GC: total: 48512, used: 1056, free: 47456
No. of 1-blocks: 13, 2-blocks: 3, max blk sz: 4
Running test: VM_MANAGER
test passed
Running test: OBCP_01
test passed
include ../py/
# qstr definitions (must come before including
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include ../py/
CROSS_COMPILE = arm-none-eabi-
INC += -I.
INC += -I..
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -ggdb
LDFLAGS = -nostdlib -T stm32f405.ld -Map=$ --cref
SRC_C = \
main.c \
# printf.c \
string0.c \
malloc0.c \
gccollect.c \
SRC_S = \
# startup_stm32f40xx.s \
gchelper.s \
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o))
all: $(BUILD)/firmware.elf
$(BUILD)/firmware.elf: $(OBJ)
$(ECHO) "LINK $@"
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
$(Q)$(SIZE) $@
include ../py/
#include <stdint.h>
// options to control how Micro Python is built
#define MICROPY_EMIT_X64 (0)
#define MICROPY_PY___FILE__ (0)
#define MICROPY_PY_GC (0)
#define MICROPY_PY_ARRAY (0)
#define MICROPY_PY_MATH (0)
#define MICROPY_PY_CMATH (0)
#define MICROPY_PY_IO (0)
#define MICROPY_PY_SYS (0)
// type definitions for the specific machine
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
#define UINT_FMT "%lu"
#define INT_FMT "%ld"
typedef int32_t mp_int_t; // must be pointer size
typedef uint32_t mp_uint_t; // must be pointer size
typedef long mp_off_t;
// dummy print
#define MP_PLAT_PRINT_STRN(str, len) (void)0
// extra built in names to add to the global namespace
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
// We need to provide a declaration/definition of alloca()
#include <alloca.h>
GNU linker script for STM32F405
/* Specify the memory areas */
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x100000 /* entire flash, 1 MiB */
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 0x004000 /* sector 0, 16 KiB */
FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 0x080000 /* sectors 5,6,7,8, 4*128KiB = 512 KiB (could increase it more) */
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0x010000 /* 64 KiB */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x020000 /* 128 KiB */
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM);
/* RAM extents for the garbage collector */
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_end = 0x2001c000; /* tunable */
/* define output sections */
/* The startup code goes first into FLASH */
.isr_vector :
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
/* The program code and other data goes into FLASH */
.text :
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
/* *(.glue_7) */ /* glue arm to thumb code */
/* *(.glue_7t) */ /* glue thumb to arm code */
. = ALIGN(4);
_etext = .; /* define a global symbol at end of code */
_sidata = _etext; /* This is used by the startup in order to initialize the .data secion */
.ARM.extab :
*(.ARM.extab* .gnu.linkonce.armextab.*)
.ARM :
__exidx_start = .;
__exidx_end = .;
/* This is the initialized data section
The program executes knowing that the data is in the RAM
but the loader puts the initial values in the FLASH (inidata).
It is one task of the startup to copy the initial values from FLASH to RAM. */
.data : AT ( _sidata )
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
_ram_start = .; /* create a global symbol at ram start for garbage collector */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
} >RAM
/* Uninitialized data section */
.bss :
. = ALIGN(4);
_sbss = .; /* define a global symbol at bss start; used by startup code */
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end; used by startup code */
} >RAM
/* this is to define the start of the heap, and make sure we have a minimum size */
.heap :
. = ALIGN(4);
_heap_start = .; /* define a global symbol at heap start */
} >RAM
/* this just checks there is enough RAM for the stack */
.stack :
. = ALIGN(4);
} >RAM
/* Remove information from the standard libraries */
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
.ARM.attributes 0 : { *(.ARM.attributes) }
# Select the board to build for: if not given on the command line,
# then default to WIPY
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
# Make 'release' the default build type
BTYPE ?= release
# Port for flashing firmware
PORT ?= /dev/ttyUSB1
# If the build directory is not given, make it reflect the board name.
BUILD ?= build/$(BOARD)/$(BTYPE)
include ../py/
-include ../../
CROSS_COMPILE ?= arm-none-eabi-
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -march=armv7e-m -mabi=aapcs -mcpu=cortex-m4 -msoft-float -mfloat-abi=soft -fsingle-precision-constant -Wdouble-promotion
CFLAGS = -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib $(CFLAGS_CORTEX_M4) -Os
CFLAGS += -g -ffunction-sections -fdata-sections -fno-common -fsigned-char -mno-unaligned-access
CFLAGS += -Iboards/$(BOARD)
LDFLAGS = -Wl,-nostdlib -Wl,--gc-sections -Wl,-Map=$
ifeq ($(BTARGET), application)
# qstr definitions (must come before including
QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
# include MicroPython make definitions
include ../py/
ifeq ($(BTARGET), bootloader)
include bootmgr/
$(error Invalid BTARGET specified)
# always include MicroPython make rules
include ../py/
cc3200tool -p $(PORT) format_flash --size $(FLASH_SIZE_$(BOARD))
cc3200tool -p $(PORT) \
write_file bootmgr/build/$(BOARD)/$(BTYPE)/bootloader.bin /sys/mcuimg.bin \
write_file build/$(BOARD)/$(BTYPE)/mcuimg.bin /sys/factimg.bin
# Files *.ucf and *ucf.signed.bin come from CC3200SDK-SERVICEPACK
# package from
cc3200tool -p $(PORT) \
write_file --file-size=0x20000 --signature ota_1.0.1.6- \
ota_1.0.1.6- /sys/servicepack.ucf
* This file is part of the Micro Python project,
* The MIT License (MIT)
* Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2015 Daniel Campora
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
#define LAUNCHXL
#define MICROPY_HW_BOARD_NAME "LaunchPad"
#define MICROPY_HW_MCU_NAME "CC3200"
* This file is part of the Micro Python project,
* The MIT License (MIT)
* Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2015 Daniel Campora
* Permission is hereby granted, free of charge, to any person obtaining a copy