microPython - smartnuf/ees GitHub Wiki
I began, then, by reading doc and building some tools for microPython. It has a makefile driven build system and can be built for using a gnu arm-eabi toolchain. I have a windows laptop, and figured cygwin might be a useful option to host the tool chain.
I found some hints on how to build such a toolchain on cygwin, and followed the steps given there.
At the cygwin prompt, I changed the current directory to ports/bare-arm
and issued make
. I found that the build system expected the toolchain prefix to be arm-none-eabi-
, rather than the arm-eabi-
prefix I had used in building it. I remedied this by altering micropython/ports/bare-arm/Makefile
so:
<<<< CROSS_COMPILE = arm-none-eabi-
----
>>>> CROSS_COMPILE = arm-eabi-
I then re-issued make
and got
% make
...
LINK build/firmware.elf
text data bss dec hex filename
66440 0 412 66852 10524 build/firmware.elf
The binary built to a 66 k bytes text segment. This might have been better, but but I thought I would actually see what we've got.
I couldn't find any doc to explain the port -- nor any doc to explain design of the base code. However, it looks like it targets an STM32F405. It looks like mpconfigport.h is responsible defining what optional features to include, and that #defines <option> (0)
for most <options>
.
Looking at main, there appears to be no REPL or file system, or serial I/O; there is a local definition of a do_str() function, and that is called in main to execute some Python strings.
Even without a REPL the, size of the text segment of the bare-arm port is 66K bytes.
This port does have an REPL, by default calling pyexec_friendly_repl()
in main.c
.
Following a similar procedure (fixing up the Makefile to say CROSS_COMPILE = arm-eabi-
) and issuing make
in the ports/minimal
sub-directory I got a 70K text segment in my binary.
This build, choked for me -- but I could see some size info (317K):
LINK mpy-cross
text data bss dec hex filename
317729 2800 1248 321777 4e8f1 mpy-cross
make[1]: Leaving directory '/cygdrive/c/Users/smart/Documents/WORK/es/ees/micropython/mpy-cross'
MPY modules/dht.py
Traceback (most recent call last):
File "modules/dht.py", line 1
SyntaxError: invalid syntax
make: *** [../../py/mkrules.mk:118: build-PYBV10/frozen_mpy/dht.mpy] Error 1
It seems this is an issue with cloning the repository without symlinks (I had used TortoseGit from an Explorer shell):
Just want to add, if you enable symlinks -c core.symlinks=true while cloning the repo I'm able to successfully compile.
Using cygwin git to clone the repository, and also installing an arm-none-eabi- tool chain from launchpad to /usr/local on my cygwin installation, the stm32 port builds OK
LINK build-PYBV10/firmware.elf
text data bss dec hex filename
334488 32 27876 362396 5879c build-PYBV10/firmware.elf