Problems building micropython-1.9.2 from source

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Online
User avatar
Roberthh
Posts: 1572
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Problems building micropython-1.9.2 from source

Post by Roberthh » Sat Aug 10, 2019 3:42 pm

Just add them to the directory esp8266/modules and rebuild the firmware. If you run into linker problems, like overflow of the text segment, then the size and number of embedded modules may be too large. You can then remove some modules oder drop other packages from the firmware. My personal favourite to omit is the btree module. To omit that, go into Makefile and set the btree switch to 0.

wr300000
Posts: 21
Joined: Sun Jan 14, 2018 3:54 pm

Re: Problems building micropython-1.9.2 from source

Post by wr300000 » Mon Sep 02, 2019 2:34 pm

Hi Roberthh,
Thank you for your good suggestion again. It works well with my esp8266 both 4M and 16M flash sizes. I'm gonna play with my other esp32 and esp32 with PSRAM boards which I guess that I can just release make command on particular sub directory. I can not see separated directories so how can compiler know that they are building on which type between esp32 and esp32 with PSRAM ?
best regards,

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

Re: Problems building micropython-1.9.2 from source

Post by Roberthh » Mon Sep 02, 2019 7:00 pm

For the ESP32 ports there are now a few BOARDS defined:
GENERIC
GENERIC_SPIRAM
TINYPICO

to build for one of them, just run for instance:

make BOARD=GENERIC

and to flash the code, run:

make BOARD=GENERIC deploy

You may have to specify PORT and BAUD, if you do not want the default setting. I use a GNUmakefile to set the defaults. my copy looks as follows:

Code: Select all

ESPIDF = $(HOME)/Downloads/esp-idf
BOARD = GENERIC_SPIRAM
$(info BOARD = $(BOARD))
ESPTOOL=esptool.py
MPY_CROSS_FLAGS = -march=xtensa

include Makefile
Then, I can just call make. You will use your own settings.

wr300000
Posts: 21
Joined: Sun Jan 14, 2018 3:54 pm

Re: Problems building micropython-1.9.2 from source

Post by wr300000 » Sun Sep 15, 2019 3:37 pm

Hi Roberthh,
my GNUjmakefile contents is
ESPIDF = $(HOME)/esp-idf
BOARD = GENERIC
#PORT = /dev/ttyUSB0
#FLASH_MODE = qio
#FLASH_SIZE = 4MB
#CROSS_COMPILE = xtensa-esp32-elf-
ESPTOOL=esptool.py
MPY_CROSS_FLAGS = -march=xtensa

include Makefile

BTW, Is below is normal ? it seems as I've got non supported ESP IDF. How can I get supported ESP IDF ?

(uPython) wr300000@E6430:~/micropython/ports/esp32$ make
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
** WARNING **
The git hash of ESP IDF does not match the supported version
The build may complete and the firmware may work but it is not guaranteed
ESP IDF path: /home/wr300000/esp-idf
Current git hash: 9f145ff165099f32b92b7ee022a1debc5f0a583d
Supported git hash: 6ccb4cf5b7d1fdddb8c2492f9cbc926abaf230df

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

Re: Problems building micropython-1.9.2 from source

Post by Roberthh » Sun Sep 15, 2019 3:44 pm

You have to go into the esp-idf directory and issue the commands:

git checkout 6ccb4cf5b7d1fdddb8c2492f9cbc926abaf230df
git submodule update --init

That will fix the error message. The micropython build is based on that specific commit.

wr300000
Posts: 21
Joined: Sun Jan 14, 2018 3:54 pm

Re: Problems building micropython-1.9.2 from source

Post by wr300000 » Sun Sep 15, 2019 4:50 pm

hi Roberthh,
After send make it then those error disappeared, could get 3 bin files and then make deploy to flash it. It seems to be fine as below response

(uPython) wr300000@E6430:~/micropython/ports/esp32$ make deploy
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Writing build-GENERIC/firmware.bin to the board
esptool.py v2.7
Serial port /dev/ttyUSB0
Connecting........_
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, Coding Scheme None
Crystal is 40MHz
MAC: 30:ae:a4:3a:1b:c4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0020
Compressed 1207040 bytes to 759649...
Wrote 1207040 bytes (759649 compressed) at 0x00001000 in 18.1 seconds (effective 533.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Anyway after reset and connect it it showing running screen w/o stopped. I could not read message.
I also trace back on the process and seem unusual of below response. Am I on correct sub-directory to issue make -C mpy-cross command ? Is it normal to be QSTR not updated?

uPython) wr300000@E6430:~/micropython$ make -C mpy-cross
make: Entering directory '/home/wr300000/micropython/mpy-cross'
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
GEN build/genhdr/qstrdefs.collected.h
QSTR not updated
make: Leaving directory '/home/wr300000/micropython/mpy-cross'
(uPython) wr300000@E6430:~/micropython$

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

Re: Problems building micropython-1.9.2 from source

Post by Roberthh » Sun Sep 15, 2019 6:02 pm

The messages are fine. QSTRs have only to be updated, if you change the code. You can try different flash modes, using

make FLASH_MODE=xxxx deploy

xxx stands for qio,qout,dio, or dout. The default is dio. Which ESP32 board are you using. There were some similar problems reported in the board, and all seemed to be solved.

wr300000
Posts: 21
Joined: Sun Jan 14, 2018 3:54 pm

Re: Problems building micropython-1.9.2 from source

Post by wr300000 » Mon Sep 16, 2019 2:39 am

Hi Roberthh,
Thanks, you are great....

Post Reply