micropython/ports/bare-arm
Jim Mussared 9be0623d4c shared/libc/string0: Don't deref args for n==0 case.
C99 says that strncmp has UB for either string being NULL, so the
current behavior is technically correct, but it's an easy fix to handle
this case correctly.

7.1.4: "unless explicitly stated otherwise in the detailed
description... if an argument to a function has ...null pointer.. the
behavior is undefined".

7.21.1: "Unless explicitly stated otherwise in the description of a
particular function in this subclause, pointer arguments on such a call
shall still have valid values, as described in 7.1.4".

Also make the same change for the minimal version in bare-arm/lib.c.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-11-07 16:01:50 +11:00
..
Makefile bare-arm: Switch to use MICROPY_ERROR_REPORTING_NONE to reduce size. 2021-04-27 23:52:40 +10:00
README.md bare-arm/mpconfigport.h: Disable remaining optional features. 2021-11-01 14:23:06 +11:00
lib.c shared/libc/string0: Don't deref args for n==0 case. 2023-11-07 16:01:50 +11:00
main.c bare-arm: Clean up the code, make it run on an F405, and add a README. 2021-03-19 14:20:26 +11:00
mpconfigport.h bare-arm/mpconfigport.h: Disable remaining optional features. 2021-11-01 14:23:06 +11:00
mphalport.h
stm32f405.ld bare-arm: Clean up the code, make it run on an F405, and add a README. 2021-03-19 14:20:26 +11:00
system.c bare-arm: Clean up the code, make it run on an F405, and add a README. 2021-03-19 14:20:26 +11:00

README.md

The bare-arm port

This port is intended to be the bare-minimum amount of code and configuration required to get MicroPython compiling and running on a bare-metal ARM-based target. No external dependencies or libraries are needed for this build and it shows exactly what hardware and system functionality MicroPython needs to run.

To build, simply run make in this directory. The output will be build/firmware.elf (and also corresponding .bin and .dfu files). This firmware can run on an STM32F405-based board (eg a PYBv1.x) and make deploy will program it to such an MCU when put in USB DFU mode. The output is a UART at 115200 baud, with TX on PA0.

There are some simple demonstration code strings (see main.c) which are compiled and executed when the firmware starts. They produce output on the system's stdout.

The size of the firmware (the machine code that is programmed to the microcontroller's flash/ROM) is currently around 56500 bytes.