Skip to content

Commit c3219b2

Browse files
committed
Merge pull request #582 from tve/master
compilation issues for esp8266 target
2 parents 9cf2daf + fb2f317 commit c3219b2

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ libs/network/esp8266/network_esp8266.c
12731273

12741274
# The tool used for building the firmware and flashing
12751275
ESPTOOL_CK ?= esptool-ck
1276-
ESPTOOL ?= esptool
1276+
ESPTOOL ?= $(ESP8266_SDK_ROOT)/esptool/esptool.py
12771277

12781278
# Extra include directories specific to the ESP8266
12791279
INCLUDE += -I$(ESP8266_SDK_ROOT)/include \
@@ -1422,10 +1422,10 @@ ifndef COMPORT
14221422
$(error, "In order to flash, we need to have the COMPORT variable defined")
14231423
endif
14241424
# Handle ESP8266 flashing
1425-
@echo Disass: $(OBJDUMP) -d -l -x $(PROJ_NAME).elf
1425+
@echo Disassembly: $(OBJDUMP) -d -l -x $(PROJ_NAME).elf
14261426
-$(Q)$(ESPTOOL_CK) -eo $(PROJ_NAME).elf -bo ESP8266_0x00000.bin -bs .text -bs .data -bs .rodata -bs .iram0.text -bc -ec
14271427
-$(Q)$(ESPTOOL_CK) -eo $(PROJ_NAME).elf -es .irom0.text ESP8266_0x10000.bin -ec
1428-
-$(Q)$(ESPTOOL) --port $(COMPORT) --baud 115200 write_flash --flash_freq 40m --flash_mode qio --flash_size 4m 0x00000 ESP8266_0x00000.bin 0x10000 ESP8266_0x10000.bin
1428+
-$(Q)$(ESPTOOL) --port $(COMPORT) --baud 115200 write_flash --flash_freq 40m --flash_mode qio --flash_size 4m 0x00000 ESP8266_0x00000.bin 0x10000 ESP8266_0x10000.bin
14291429
# End of handle ESP8266 flashing
14301430
else
14311431
echo ST-LINK flash

README_Building.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,28 @@ To program the nRF52 Development Kit with Espruino:
5555

5656
-- Note that limited functionality is implemented on the nRF52. Feel free to help! Currently working on NFC touch to pair so you can tap the device with your smartphone to connect without opening the app and then scanning. Also thinking of ways to edit scripts (typing long programs on smartphone is tedious).
5757

58+
### for esp8266
59+
60+
In order to compile for the esp8266 on Linux several pre-requisites have to be installed:
61+
- the esp-open-sdk from https://github.com/pfalcon/esp-open-sdk, use make STANDALONE=n
62+
- the Espressif SDK (version 1.4.0 as of this writing) from http://bbs.espressif.com/viewforum.php?f=46
63+
- Esptool-ck from https://github.com/tommie/esptool-ck
64+
65+
Note: esptool-ck should be eliminated and replaced with esptool (.py), this will happen naturally
66+
when an OTA update is developed.
67+
68+
To run make you need to pass a number of environment variables to make, the easiest is to place
69+
the following lines into a script, adapt it to your needs and then run it.
70+
```
71+
#! /bin/bash
72+
export ESP8266_BOARD=1
73+
export ESP8266_SDK_ROOT=/esp8266/esp_iot_sdk_v1.4.0
74+
export PATH=$PATH:/esp8266/esp-open-sdk/xtensa-lx106-elf/bin/
75+
export ESPTOOL_CK=/esp8266/esptool-ck/esptool
76+
export COMPORT=/dev/ttyUSB0
77+
make $*
78+
```
79+
5880
### for Linux
5981

6082
Simple: Just run `make`

libs/network/network.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
#if defined(USE_WIZNET)
2121
#include "network_wiznet.h"
2222
#endif
23+
#if defined(USE_ESP8266_BOARD)
24+
#include "network_esp8266.h"
25+
#endif
2326
#if defined(LINUX)
2427
#include "network_linux.h"
2528
#endif
@@ -167,6 +170,9 @@ bool networkGetFromVar(JsNetwork *net) {
167170
#if defined(USE_WIZNET)
168171
case JSNETWORKTYPE_W5500 : netSetCallbacks_wiznet(net); break;
169172
#endif
173+
#if defined(USE_ESP8266_BOARD)
174+
case JSNETWORKTYPE_ESP8266_BOARD : netSetCallbacks_esp8266_board(net); break;
175+
#endif
170176
#if defined(LINUX)
171177
case JSNETWORKTYPE_SOCKET : netSetCallbacks_linux(net); break;
172178
#endif

libs/network/network.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ typedef enum {
3636
JSNETWORKTYPE_CC3000, ///< TI CC3000 support
3737
JSNETWORKTYPE_W5500, ///< WIZnet W5500 support
3838
JSNETWORKTYPE_JS, ///< JavaScript network type
39+
JSNETWORKTYPE_ESP8266_BOARD, ///< Espressif ESP8266 board support
3940
} JsNetworkType;
4041

4142
typedef struct {

0 commit comments

Comments
 (0)