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.
Jim.S
Posts: 84
Joined: Fri Dec 18, 2015 7:36 pm

Problems building micropython-1.9.2 from source

Post by Jim.S » Fri Mar 02, 2018 9:00 pm

I'm trying to build Micropython 1.9.2 for the Micro:bit from source but am running into problems

To my amazement, I successfully build the default micropython v1.7.9 on my Linux Mint 17 box, from source, by following the instructions in http://microbit-micropython.readthedocs ... ation.html to the letter (big thanks to whoever wrote the instructions)

I am now trying to build Micropython-0.9 (which I assume is the same as 1.9.2) but am running into this problem when I run the command "yt build"

[98/279] Building CXX object ym/ble-nrf51822/source/CMakeFiles/ble-nrf5182...it/micropython-0.9/yotta_modules/ble-nrf51822/source/nRF5xGattServer.cpp.o
ninja: build stopped: subcommand failed.


I have tried two routes to download the source
first I tried git from the command line, i.e.
git clone -n https://github.com/bbcmicrobit/micropython/
git checkout e17de0954178d88aa2a1d70b6e6ebc43f5456607


next I downloaded micropython-0.9.zip from github website, unzipped it and then used yotta i.a.w the instructions stated above

but seem to run into the same problem - I accept I may not be using git or yotta properly, but am somewhat confused as it seems to have worked with the 1.7.9 branch

(Be warned, Once I have solved this problem I want to understand how I can include python modules in the firmware, specifically if I can and where I put them in the firmware source directory structure. Adafruit's tutorial on building micropython the source for the esp 8266 (https://learn.adafruit.com/micropython- ... en-modules) has "modules" and "scripts" directories where I assume you can put python modules and scripts for freezing into the firmware)

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Problems building micropython-1.9.2 from source

Post by jickster » Sun Mar 04, 2018 4:16 am

yt looks to be a separate executable that you need to download.


Sent from my iPhone using Tapatalk

Jim.S
Posts: 84
Joined: Fri Dec 18, 2015 7:36 pm

Re: Problems building micropython-1.9.2 from source

Post by Jim.S » Sun Mar 04, 2018 1:08 pm

Sorry, I didn't explain very well. what I did was
1. download 'micropython-master.zip" from github (using my browser, because I am not confident i know what I am doing with git from the command line)
2 unzip it
3 go to the top level directory/folder, the one with config.json in it, and use the following "yotta" commands
  • yt target bbc-microbit-classic-gcc-nosd
    yt up
    yt build
This works perfectly on my Linux Mint 17 box and makes a working 1.7.9 firmware, however if I down load, micropython-0.9.zip and try the same I get the following error (yeah, I know it is a different error to what I got the first time, as shown in my first post)
..../MicroBit/micropython-0.9/yotta_modules/ble-nrf51822/source/nRF5xGap.cpp:906:61: error: 'BLEProtocol::AddressType_t' is not a class or namespace
if (whitelistAddresses.addr_type == BLEProtocol::AddressType_t::RANDOM_PRIVATE_RESOLVABLE) {
^
[98/279] Building CXX object ym/ble-nrf51822/source/CMakeFiles/ble-nrf51.../micropython-0.9/yotta_modules/ble-nrf51822/source/nRF5xGattServer.cpp.o
ninja: build stopped: subcommand failed.

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Problems building micropython-1.9.2 from source

Post by jickster » Mon Mar 05, 2018 2:04 am

Issue appears to be version of gcc used is too old

Code: Select all

 The build works fine for me, with arm-none-eabi-gcc 6.1.1.

I think the problem is that the "old" gcc version you use can't handle the advanced C++ feature that's used by the code (BLEProtocol::AddressType_t is a typedef of an enum within a struct within a namespace). We can't fix such problems here, so please report the bug upstream at the yotta module here: https://github.com/ARMmbed/ble-nrf51822

https://github.com/ARMmbed/ble-nrf51822/issues/133



Sent from my iPhone using Tapatalk

Jim.S
Posts: 84
Joined: Fri Dec 18, 2015 7:36 pm

Re: Problems building micropython-1.9.2 from source

Post by Jim.S » Mon Mar 05, 2018 6:26 am

that makes sense, I am running an older version of Mint, so presumably has a older version of gcc, I was going to bite the bullet and upgrade, so I will do it sooner rather than later

Thanks!

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

Re: Problems building micropython-1.9.2 from source

Post by wr300000 » Tue Jul 02, 2019 4:25 am

I tried to build first 8266 firmware as first time following http://www.microdev.it/wp/en/2018/06/25 ... r-esp8266/ web on my ubutu 18.04.2 desktop 64bit. Most instructions were fine until stuck at make final firmware_combined.bin file as below list.

Code: Select all

wr30000@E6430:~/Micropython/esp8266/micropython/ports/esp8266$ make axtls
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
make: *** No rule to make target 'axtls'.  Stop.
wr30000@E6430:~/Micropython/esp8266/micropython/ports/esp8266$ make
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
mkdir -p build/genhdr
GEN build/genhdr/mpversion.h
GEN build/genhdr/moduledefs.h
make: xtensa-lx106-elf-gcc: Command not found
GEN build/genhdr/qstr.i.last
/bin/sh: 1: xtensa-lx106-elf-gcc: not found
../../py/mkrules.mk:74: recipe for target 'build/genhdr/qstr.i.last' failed
make: *** [build/genhdr/qstr.i.last] Error 127
make: *** Deleting file 'build/genhdr/qstr.i.last'
wr30000@E6430:~/Micropython/esp8266/micropython/ports/esp8266$ ls
build                 espneopixel.h   hspi.h           Makefile             posix_helpers.c
eagle.rom.addr.v6.ld  esppwm.c        hspi_register.h  makeimg.py           qstrdefsport.h
esp8266_512k.ld       esppwm.h        intr.c           modesp.c             README.md
esp8266_common.ld     ets_alt_task.c  lexerstr32.c     modmachine.c         strtoll.c
esp8266.ld            ets_alt_task.h  machine_adc.c    modmachine.h         uart.c
esp8266_ota.ld        etshal.h        machine_hspi.c   modnetwork.c         uart.h
espapa102.c           fatfs_port.c    machine_pin.c    modpyb.c             uart_register.h
espapa102.h           gccollect.c     machine_pwm.c    modules              user_config.h
esp_init_data.c       gccollect.h     machine_rtc.c    moduos.c             xtirq.h
esp_mphal.c           gchelper.s      machine_uart.c   modutime.c
esp_mphal.h           help.c          machine_wdt.c    mpconfigport_512k.h
espneopixel.c         hspi.c          main.c           mpconfigport.h
wr30000@E6430:~/Micropython/esp8266/micropython/ports/esp8266$ grep -f firmware_combined.bin
grep: firmware_combined.bin: No such file or directory
wr30000@E6430:~/Micropython/esp8266/micropython/ports/esp8266$ grep -f *.bin
grep: *.bin: No such file or directory
wr30000@E6430:~/Micropython/esp8266/micropython/ports/esp8266$ 
Could you suggest more on my first trial?

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

Re: Problems building micropython-1.9.2 from source

Post by Roberthh » Tue Jul 02, 2019 6:18 am

It seems that you did not install the tool chain or did not set PATH properly.

xtensa-lx106-elf-gcc: not found

Follow the instructions at <https://github.com/pfalcon/esp-open-sdk> carefully.

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

Re: Problems building micropython-1.9.2 from source

Post by wr300000 » Tue Jul 02, 2019 1:26 pm

Hi Robert,
Yes,I've read thru on your provided link which it's same as instruction list that I did. Anyway once I tried your provided link it's responded that all tools/directory has been done then nothing is recreated. I could go to those instruction until I stuck at
$ make -C mpy-cross
which it response the same thing as
wr30000@E6430:~/Micropython/esp8266/micropython$ make -C mpy-cross
make: Entering directory '/home/wr30000/Micropython/esp8266/micropython/mpy-cross'
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
make: Leaving directory '/home/wr30000/Micropython/esp8266/micropython/mpy-cross'

Could you see something that means for me on above stuck command and negative response?
your kind help on this is much appreciated,

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

Re: Problems building micropython-1.9.2 from source

Post by Roberthh » Tue Jul 02, 2019 1:33 pm

The initial problem was, that the cross-compiler for the ESP8266 code was not found. If you installed the tool chain, you have to extend your PATH environment for that. That is typicall done by editing the ~/.bashrc file, which contains all the setting for the command window. You then have to close the window and open it again to get effective. if you enter the command:

echo $PATH

a path with esp-open-sdk/xtensa-lx106-elf/bin should be shown, and the command:

xtensa-lx106-elf-gcc --version

should result in:

xtensa-lx106-elf-gcc (crosstool-NG crosstool-ng-1.22.0-60-g37b07f6f) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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

Re: Problems building micropython-1.9.2 from source

Post by wr300000 » Sat Aug 10, 2019 3:17 pm

Hi Roberthh,
Thank you again for your suggestion, it's working I built, flashed and run it smoothly. My next trial is add my own modules in further firmware build. I left Windows for awhile then my host computer is native ubuntu 18.04. How can I pre-compile my module scripts to .mpy ?
best regards,

Post Reply