Making micropython with ULAB for ESP32

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
hiro_ono
Posts: 4
Joined: Mon May 04, 2020 9:18 am

Making micropython with ULAB for ESP32

Post by hiro_ono » Mon May 04, 2020 9:38 am

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

DJShadow1966
Posts: 51
Joined: Sun Jun 23, 2019 4:55 am
Location: Gateshead, Tyne and Wear

Re: Making micropython with ULAB for ESP32

Post by DJShadow1966 » Mon May 04, 2020 10:39 am

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

hiro_ono
Posts: 4
Joined: Mon May 04, 2020 9:18 am

Re: Making micropython with ULAB for ESP32

Post by hiro_ono » Mon May 04, 2020 2:45 pm

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

User avatar
Roberthh
Posts: 1958
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Making micropython with ULAB for ESP32

Post by Roberthh » Mon May 04, 2020 3:03 pm

You could try to set in mpconfigboard.h:

#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)

hiro_ono
Posts: 4
Joined: Mon May 04, 2020 9:18 am

Re: Making micropython with ULAB for ESP32

Post by hiro_ono » Tue May 05, 2020 10:54 am

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 :?

stijn
Posts: 454
Joined: Thu Apr 24, 2014 9:13 am

Re: Making micropython with ULAB for ESP32

Post by stijn » Tue May 05, 2020 12:37 pm

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

hiro_ono
Posts: 4
Joined: Mon May 04, 2020 9:18 am

Re: Making micropython with ULAB for ESP32

Post by hiro_ono » Tue May 05, 2020 3:05 pm

It worked! thank you so much

User avatar
josverl
Posts: 9
Joined: Fri Nov 24, 2017 4:22 pm

Re: Making micropython with ULAB for ESP32

Post by josverl » Mon May 18, 2020 9:05 am

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.

stijn
Posts: 454
Joined: Thu Apr 24, 2014 9:13 am

Re: Making micropython with ULAB for ESP32

Post by stijn » Mon May 18, 2020 1:17 pm

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))

Post Reply