Making micropython with ULAB for ESP32
Making micropython with ULAB for ESP32
I'm trying to get ulab working on my tiny-pico (has an esp32) but I'm not really sure how to get started, does anybody have a compiled version of micropython I could use? If I build my own then how would I do that?
Thanks
Thanks
-
- Posts: 60
- Joined: Sun Jun 23, 2019 4:55 am
- Location: Gateshead, Tyne and Wear
Re: Making micropython with ULAB for ESP32
Hello
You can download pre-complied binarys at https://micropython.org/download/esp32/
You can compile your own following the readme at https://github.com/micropython/micropyt ... orts/esp32
Regards Mike
You can download pre-complied binarys at https://micropython.org/download/esp32/
You can compile your own following the readme at https://github.com/micropython/micropyt ... orts/esp32
Regards Mike
Re: Making micropython with ULAB for ESP32
The pre compiled ones don't seem to have ulab on them, trying to make my own works fine when I don't include ulab, but when i run:
~/micropython/ports/esp32$ make BOARD=TINYPICO USER_C_MODULES=../../../ulab all
i get
CC machine_sdcard.c
CC ../../../ulab/code/ndarray.c
../../../ulab/code/ndarray.c: In function 'insert_binary_value':
../../../ulab/code/ndarray.c:320:78: error: implicit conversion from 'mp_float_t {aka float}' to 'double' to match other operand of binary expression [-Werror=double-promotion]
int32_t x = (int32_t)MICROPY_FLOAT_C_FUN(floor)(mp_obj_get_float(tmp)+0.5);
^
../../../ulab/code/ndarray.c:320:57: error: conversion to 'float' from 'double' may alter its value [-Werror=float-conversion]
int32_t x = (int32_t)MICROPY_FLOAT_C_FUN(floor)(mp_obj_get_float(tmp)+0
^
cc1: all warnings being treated as errors
../../py/mkrules.mk:63: recipe for target 'build-TINYPICO/code/ndarray.o' failed
make: *** [build-TINYPICO/code/ndarray.o] Error 1
~/micropython/ports/esp32$ make BOARD=TINYPICO USER_C_MODULES=../../../ulab all
i get
CC machine_sdcard.c
CC ../../../ulab/code/ndarray.c
../../../ulab/code/ndarray.c: In function 'insert_binary_value':
../../../ulab/code/ndarray.c:320:78: error: implicit conversion from 'mp_float_t {aka float}' to 'double' to match other operand of binary expression [-Werror=double-promotion]
int32_t x = (int32_t)MICROPY_FLOAT_C_FUN(floor)(mp_obj_get_float(tmp)+0.5);
^
../../../ulab/code/ndarray.c:320:57: error: conversion to 'float' from 'double' may alter its value [-Werror=float-conversion]
int32_t x = (int32_t)MICROPY_FLOAT_C_FUN(floor)(mp_obj_get_float(tmp)+0
^
cc1: all warnings being treated as errors
../../py/mkrules.mk:63: recipe for target 'build-TINYPICO/code/ndarray.o' failed
make: *** [build-TINYPICO/code/ndarray.o] Error 1
Re: Making micropython with ULAB for ESP32
You could try to set in mpconfigboard.h:
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
Re: Making micropython with ULAB for ESP32
I tried that and it just seemed to make it even more unhappy :p
If anybody has a working compiler would they be able to build a version of micropython for BOARD=TINYPICO with ulab? I'm giving up hope at this point
If anybody has a working compiler would they be able to build a version of micropython for BOARD=TINYPICO with ulab? I'm giving up hope at this point
Re: Making micropython with ULAB for ESP32
The floating point conversions are because recently extra compiler flags were introduced for MicroPython. Looks like ulab isn't up to date for that, so easiest way to get this building is to change the makefile and remove -Wdouble-promotion -Wsign-compare -Wfloat-conversion
Re: Making micropython with ULAB for ESP32
It worked! thank you so much
Re: Making micropython with ULAB for ESP32
what would be a good way to change these setting (-Wdouble-promotion -Wsign-compare -Wfloat-conversion) only for the ulab files and maintain the for the rest of the code and other C modules ?
I tried various options with the make files and find that thre is much i do not understand nor can find documented.
I tried various options with the make files and find that thre is much i do not understand nor can find documented.
Re: Making micropython with ULAB for ESP32
Principle would be to filter those flags out of CFLAGS for just the ulab source files I guess. So I assume something like this in the C module's Makefile should work (not tested):
Code: Select all
MYMODULE_OBJ = $(addprefix $(BUILD)/, $(SRC_USERMOD:.c=.o))
$(MYMODULE_OBJ): CFLAGS := $(filter-out -Wdouble-promotion -Wsign-compare -Wfloat-conversion, $(CFLAGS))
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Making micropython with ULAB for ESP32
This issue of ulab & ESP32 persists. It doesn't happen on ports/unix, ports/stm32, ports/esp8266.stijn wrote: ↑Mon May 18, 2020 1:17 pmPrinciple would be to filter those flags out of CFLAGS for just the ulab source files I guess. So I assume something like this in the C module's Makefile should work (not tested):Code: Select all
MYMODULE_OBJ = $(addprefix $(BUILD)/, $(SRC_USERMOD:.c=.o)) $(MYMODULE_OBJ): CFLAGS := $(filter-out -Wdouble-promotion -Wsign-compare -Wfloat-conversion, $(CFLAGS))
About the above suggestion : but $(MYMODULE_OBJ) should be used in some makefile (ulab 'micropython.mk' or main 'Makefile' ?) to compile/link ulab separately, no ? I don't realise the exact commands to do so.
What worked is to modify 'esp32/Makefile' :
- commenting the line :
Code: Select all
$(OBJ_MP): CFLAGS += -Wdouble-promotion -Wfloat-conversion
Code: Select all
-Wall -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable \
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).