Suppose you wanted to cost reduce a micropython application below even the "contributions guide" minimums for the project:
"we would like to maintain portability to much smaller MCU cores. The theoretical minimum requirements we'd like to maintain are 128K ROM/8K RAM".
Is there a way to leave off parts of micropython if they are not being used, or is that already done at linking time?
compiling for small RAM/ROM platforms
compiling for small RAM/ROM platforms
John Griessen blog.kitmatic.com
Re: compiling for small RAM/ROM platforms
One way of controlling features is by modifying mponfigport.h
Options set in py/mpconfig.h can all be overridden in mpconfigport.h
The port can choose not to include files it doesn't need.
Some places still need work. For example, I think its currently difficult to disable USB completely (on the stmhal port).
Options set in py/mpconfig.h can all be overridden in mpconfigport.h
The port can choose not to include files it doesn't need.
Some places still need work. For example, I think its currently difficult to disable USB completely (on the stmhal port).
Re: compiling for small RAM/ROM platforms
Thanks, I'll read up on that.mpconfigport.h
@dhylands I read about compiling so all the program goes in the on chip ROM, for chips that have no SD card port such as
the F401's that have 64k RAM, 128k flash. Was that you, and if so, where to find details? I am going to want to use that method along with creating a F401 platform if not done yet.
John Griessen blog.kitmatic.com
Re: compiling for small RAM/ROM platforms
There are several F401 boards supported already:
ESPRUINO_PICO, and STM32F401NUCLEO (soon to be renamed to NUCLEO_F401RE), and G30HDR are all 401 based boards (although these boards have 384K or 512K flash).
These all have internal flash filesystems (like the pyboard) just a bit smaller.
You can compile python source code into the firmware image using FROZEN modules. With PR #1811: https://github.com/micropython/micropython/pull/1811 you can have frozen bytecode as well.
I'd like to be able to build stmhal with no USB and no internal filesystem so we can target some of the smaller processors, but that still needs some work.
ESPRUINO_PICO, and STM32F401NUCLEO (soon to be renamed to NUCLEO_F401RE), and G30HDR are all 401 based boards (although these boards have 384K or 512K flash).
These all have internal flash filesystems (like the pyboard) just a bit smaller.
You can compile python source code into the firmware image using FROZEN modules. With PR #1811: https://github.com/micropython/micropython/pull/1811 you can have frozen bytecode as well.
I'd like to be able to build stmhal with no USB and no internal filesystem so we can target some of the smaller processors, but that still needs some work.
Re: compiling for small RAM/ROM platforms
What is a good way to load flash in those cases? SWD port?I'd like to be able to build stmhal with no USB and no internal filesystem
John Griessen blog.kitmatic.com
Re: compiling for small RAM/ROM platforms
Yes. With the nucleo board there is no USB connected to the processor, but it has onboard SWD. You can use also the SWD on the nucleo to program other STM porocessors.
The STM32 also has onboard bootloaders that allow programming over serial, i2c, can, and spi (varies a bit depending on the MCU) in addition to the DFU mode over USB.
I've successfuly programmed a 405 using the serial bootloader:
http://blog.davehylands.com/2014/02/ser ... m32f4.html
The stm32's also have a builtin oscillator, so you can reduce parts on a custom board by not using an external oscillator, but this means yoiu need to give up USB.
Once the firmware is flashed, I use rshell to copy files into and out of the internal file system on the nucleo board.
The STM32 also has onboard bootloaders that allow programming over serial, i2c, can, and spi (varies a bit depending on the MCU) in addition to the DFU mode over USB.
I've successfuly programmed a 405 using the serial bootloader:
http://blog.davehylands.com/2014/02/ser ... m32f4.html
The stm32's also have a builtin oscillator, so you can reduce parts on a custom board by not using an external oscillator, but this means yoiu need to give up USB.
Once the firmware is flashed, I use rshell to copy files into and out of the internal file system on the nucleo board.
-
- Posts: 81
- Joined: Fri Sep 02, 2016 9:26 am
Re: compiling for small RAM/ROM platforms
Another thing to consider is to remove unused python compile-able modules in /modules.