Skip to content

MicroPython port: stm32 builds with single-precision floats link - #8

Merged
bdbarnett merged 1 commit into
mainfrom
stm32-single-float-sqrt
Nov 6, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
stm32-single-float-sqrt

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

An stm32 firmware with LVGL and MICROPY_FLOAT_IMPL=single failed to link: LVGL's gesture recogniser (src/indev/lv_indev_gesture.c) calls the double sqrt(), and those builds link only MicroPython's single-precision libm, which has sqrtf() and no sqrt(). The MicroPython port now adds a sqrt() that calls sqrtf(), to stm32 builds with single-precision floats only. Gesture distances are in pixels, so single precision is enough. Ports that link a full libm don't get it, because a definition here would replace their own.

I hit this building for the Arduino GIGA R1 (STM32H747). That firmware, built with this change, links and runs LVGL on the GIGA Display Shield. The port's source-check tests pass, one of them new. I haven't built another stm32 board with LVGL.

LVGL's gesture recogniser calls the double sqrt(), and an stm32 firmware
built with MICROPY_FLOAT_IMPL=single links only MicroPython's
single-precision libm, which has sqrtf() and no sqrt(). The link failed
on the Arduino Giga R1. The port now adds a sqrt() that calls sqrtf() to
those builds only; gesture distances are pixels, so single precision is
enough.
@bdbarnett
bdbarnett merged commit 00bfbab into main Nov 6, 2026
5 checks passed
@bdbarnett
bdbarnett deleted the stm32-single-float-sqrt branch November 6, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant