Micropython esp8266 firmware build

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
Nikunj_Vadher
Posts: 13
Joined: Mon Dec 10, 2018 6:37 am

Micropython esp8266 firmware build

Post by Nikunj_Vadher » Sun Dec 16, 2018 7:36 am

Respected Forum Members,

I am looking for compiling micropython firmware guide for linux (Ubuntu). lots of guides available but every guide showing different error so not able to compile it properly.

I also want to know how to remove unnecessary packages ( modules) from firmware so I can free some more space and use memory for my modules.

I am using nodemcu with esp8266 4MB memory.

Thank You.

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

Re: Micropython esp8266 firmware build

Post by Roberthh » Sun Dec 16, 2018 8:43 am

The README.md in ports/esp8266 is sufficient. You only have to follow the instructions literally, not skipping a step or ignoring a word, including the README in the installed esp-idf.

About not installing modules:
in the esp8266 directory there is a file called mpconfigport.h, which includes defines for a lot of options. Other places to look for is the initial section of Makefile, where the support for BTREE, AXTLS and USSL is activated. Not building BTREE for instance saves about 25k flash space. You may also look into esp8266/modules and consider, which of them you need. Although there is little space to gather.

Nikunj_Vadher
Posts: 13
Joined: Mon Dec 10, 2018 6:37 am

Re: Micropython esp8266 firmware build

Post by Nikunj_Vadher » Tue Dec 18, 2018 4:53 am

Roberthh wrote:
Sun Dec 16, 2018 8:43 am
The README.md in ports/esp8266 is sufficient. You only have to follow the instructions literally, not skipping a step or ignoring a word, including the README in the installed esp-idf.

About not installing modules:
in the esp8266 directory there is a file called mpconfigport.h, which includes defines for a lot of options. Other places to look for is the initial section of Makefile, where the support for BTREE, AXTLS and USSL is activated. Not building BTREE for instance saves about 25k flash space. You may also look into esp8266/modules and consider, which of them you need. Although there is little space to gather.
Thank you for guiding and giving response. Compiled it sucessfully.

KakaTek
Posts: 1
Joined: Mon Jul 15, 2019 3:25 am

Re: Micropython esp8266 firmware build

Post by KakaTek » Mon Jul 15, 2019 4:39 am

Hi,have you ever successfully built esp8266 firmware with BTree module?

I got the source code yesterday and successfully compiled a firmware without SSL and BTree.
But when I tried to implement the Btree module on the NodeMCU board, the compiler reported an error like this:

xtensa-lx106-elf-gcc -I../../lib/berkeley-db-1.xx/PORT/include -I. -I../.. -Ibuild -I/home/tek/Desktop/IOT/ESP8266/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib -DUART_OS=0 -fsingle-precision-constant -Wdouble-promotion -D__ets__ -DICACHE_FLASH -fno-inline-functions -Wl,-EL -mlongcalls -mtext-section-literals -mforce-l32 -DLWIP_OPEN_SRC -DFFCONF_H=\"lib/oofatfs/ffconf.h\" -DMICROPY_PY_BTREE=1 -Os -DNDEBUG -fdata-sections -ffunction-sections -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ "-Dvirt_fd_t=void*" -DDEFPSIZE=1024 -DMINCACHE=3 -c -MD -o build/extmod/modbtree.o ../../extmod/modbtree.c

In file included from ../../lib/berkeley-db-1.xx/PORT/include/../../btree/btree.h:44:0,
from ../../extmod/modbtree.c:38:
../../lib/berkeley-db-1.xx/PORT/include/mpool.h:50:2: error: expected specifier-qualifier-list before 'CIRCLEQ_ENTRY'
CIRCLEQ_ENTRY(_bkt) hq; /* hash queue */
^
../../lib/berkeley-db-1.xx/PORT/include/mpool.h:61:2: error: expected specifier-qualifier-list before 'CIRCLEQ_HEAD'
CIRCLEQ_HEAD(_lqh, _bkt) lqh; /* lru queue head */
^

I think "CIRCLE HEAD" should be defined by the <sys/queue.h>, but header files under "xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include" and "xtensa-lx106-elf/include/sys" did not have this definition, while other files under "micropython/lib/berkeley-db -1.xx/PORT" did,
Now,I'm puzzled that which header file should be included? Or what should I do to fix this problem?

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

Re: Micropython esp8266 firmware build

Post by Roberthh » Mon Jul 15, 2019 6:12 am

No problem with both btree and axtls included. Did you run
git submodule update --init
after cloning?

Post Reply