MicroPython on the ESP8266: beautifully easy IoT

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

MicroPython on the ESP8266: beautifully easy IoT

Post by jgriessen » Tue Feb 09, 2016 9:20 pm

I've just started using Robo's esp'ecial ESP8266 fork with an ESP8266 board from sweetpeas.se, (a recent kickstarter), and had to change the micropython/esp8266/Makefile to work with pfalcon/esp-open-sdk compiled with espressif code separate. Would those Makefile details help the new project? Does the new project use pfalcon/esp-open-sdk as is?

John Griessen
£35 supporter
.
John Griessen blog.kitmatic.com

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: MicroPython on the ESP8266: beautifully easy IoT

Post by kfricke » Tue Feb 09, 2016 10:53 pm

IMHO it should be more reasonable to wait a few weeks for the KS campaign to finish and let Damien and Paul deliver a new "release" for the ESP8266 than use the current port.

mianos
Posts: 84
Joined: Sat Aug 22, 2015 6:42 am

Re: MicroPython on the ESP8266: beautifully easy IoT

Post by mianos » Wed Feb 10, 2016 12:43 am

As the author of the fork, I agree. Wait for the official port. The port will include a makefile for pfalcon's idk and probably significantly more.
While my fork has a lot more functionality than the esp code in the official repository most of it will be duplicated in the offical port and have the official API. I'll rebase my fork to support that official port and only add device driver, functionality not already supported in the master or when I'd rather have the driver in C than python.

User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Re: MicroPython on the ESP8266: beautifully easy IoT

Post by jgriessen » Wed Feb 10, 2016 4:15 am

Wait for the official port.


OK.

The ESP fork *IS* a proof of concept.
I was able to compile it and use it, (with a little change of Makefile details)

the Makefile details were:
use an environment variable so the place on a user's file system being different did not cause editing the Makefile:
export ESP_IOT_SDK="blahblahblah" -->Something like ESP_IOT_SDK="/opt/esp-open-sdk/esp_iot_sdk_v1.5.0"

and in the Makefile:
INC += -I$(ESP_IOT_SDK)/include
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -Wno-error -ansi -std=gnu99 -nostdlib -DUART_OS=$(UART_OS) \
$(CFLAGS_XTENSA) $(COPT) $(CFLAGS_EXTRA)
LIBS = -L$(ESP_IOT_SDK)/lib -lmain -ljson -llwip -lpp -lnet80211 -lwpa -lphy -lnet80211 -lcrypto -lsmartconfig

John Griessen
John Griessen blog.kitmatic.com

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: MicroPython on the ESP8266: beautifully easy IoT

Post by pfalcon » Wed Feb 10, 2016 8:08 am

jgriessen, Since MicroPython 1.6 release, we already started working on ESP8266 development and refactors. The changes are massive, so you may expect the port to be in flux. You can report issues via Github https://github.com/micropython/micropython , but again, the port will be in flux for some time, that's expected. Stay tuned for the upcoming new port source release, then any issue reports will be very welcome! If in the meantime you'd like to flex your firmware building skills, I'd suggest to use 1.6 release instead of master (it requires ESP8266 SDK 1.4.0).

Please note that if you follow esp-open-sdk README instructions, then no changes to MicroPython esp8266/Makefile are required - everything should work out of the box.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Re: MicroPython on the ESP8266: beautifully easy IoT

Post by jgriessen » Wed Feb 10, 2016 6:37 pm

Please note that if you follow esp-open-sdk README instructions, then no changes to MicroPython esp8266/Makefile are required - everything should work out of the box.
I was using your https://github.com/pfalcon/esp-open-sdk with make STANDALONE=n

Should I use make STANDALONE=y? Also, I was building the mianos fork.

I'll try following https://github.com/pfalcon/esp-open-sdk readme and

use it to compile 1.6 release instead of master or mianos fork.
(it requires ESP8266 SDK 1.4.0).
-- I guess I need to unzip that, since it is not unzipped as cloned from the repo.

No, that's not enough. I still get the same missing includes as before...

Code: Select all

xtensa-lx106-elf-gcc -I../lib/netutils -I. -I.. -I../stmhal -I../lib/mp-readline -I../lib/netutils -I../lib/timeutils -Ibuild -I/opt/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib -DUART_OS=1 -fsingle-precision-constant -Wdouble-promotion -D__ets__ -DICACHE_FLASH -fno-inline-functions -Wl,-EL -mlongcalls -mtext-section-literals  -Os -DNDEBUG  -fdata-sections -ffunction-sections -c -MD -o build/main.o main.c
main.c:39:28: fatal error: user_interface.h: No such file or directory
 #include "user_interface.h"
                            ^
compilation terminated.
Here is the Makefile from esp-open-sdk, and it says to use 1.5 So, following the readme it does not seem to compile with 1.4 out of the box.

Code: Select all

# Whether to merge SDK into Xtensa toolchain, producing standalone
# ESP8266 toolchain. Use 'n' if you want generic Xtensa toolchain
# which can be used with multiple SDK versions.
STANDALONE = y

# Directory to install toolchain to, by default inside current dir.
TOOLCHAIN = $(TOP)/xtensa-lx106-elf


# Vendor SDK version to install, see VENDOR_SDK_ZIP_* vars below
# for supported versions.
VENDOR_SDK = 1.5.0
Do I need a different git tag of esp-open-sdk also? I left it at master...git tag shows no tags...so I guess not.

Should I change the Makefile from esp-open-sdk?
John Griessen
John Griessen blog.kitmatic.com

User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Re: MicroPython on the ESP8266: beautifully easy IoT

Post by jgriessen » Wed Feb 10, 2016 8:01 pm

Should I change the Makefile from esp-open-sdk?
Yes. When I change just this in esp-open-sdk/Makefile from git master as of today,
VENDOR_SDK = 1.5.0
-->
VENDOR_SDK = 1.4.0

then recompile esp-open-sdk, then recompile v1.6 checkout of micropython/micropython,
teh compile works.
John Griessen blog.kitmatic.com

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: MicroPython on the ESP8266: beautifully easy IoT

Post by pfalcon » Sun Feb 14, 2016 12:07 pm

jgriessen wrote:
I was using your https://github.com/pfalcon/esp-open-sdk with make STANDALONE=n

Should I use make STANDALONE=y?
You should use the default, which is STANDALONE=y, and then just "make" is enough. Perhaps, that wasn't made explicit enough, and now it should be, please re-read README at https://github.com/pfalcon/esp-open-sdk .
When I change just this in esp-open-sdk/Makefile from git master as of today,
VENDOR_SDK = 1.5.0
You don't need to change anything, you can pass any variable on the make command line, like you already did with "make STANDALONE=n". Specifically, to build with 1.4.0 SDK, use "make VENDOR_SDK=1.4.0". If you're serious about building various software projects, you may find useful to at least skim thru GNU make manual at https://www.gnu.org/software/make/manua ... index.html , to know what capabilities are available and where to look for more details later.

So, the idea is that you don't need to change anything, everything works out of the box. At most, you need to override some parameters via command line, to match requirements of different components, like MicroPython 1.6.0 requiring ESP8266 SDK 1.4.0. I also made sure that current uPy master builds with current esp-open-sdk master. But keep in mind "the port is in flux" notice above. We'll be establishing formal testing process (like, CI loop) after the source code release.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply