Skip to content

Commit 2d50160

Browse files
committed
support 1MB boards
- add make flags FLASH_1MB and NO_FOTA - add SPI1 labels to ESP8266 - fix some compiler warnings
1 parent 624d6f2 commit 2d50160

File tree

15 files changed

+99
-45
lines changed

15 files changed

+99
-45
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
Ensure it's possible to get a solid background when using 4x6 font
7676
Bangle.js: Add Bangle.showLauncher
7777
Add append optimisation for string '+', and don't append to flat/native/etc strings (fix #1746)
78+
ESP8266_4MB: add optional build flag FLASH_1MB for ESP8255 & ESP01s with 1MB flash
79+
ESP8266: add optional build flag NO_FOTA to remove flash over the air functionality
7880

7981
2v04 : Allow \1..\9 escape codes in RegExp
8082
ESP8266: reading storage is not working for boot from user2 (fix #1507)

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,13 @@ ifeq ($(USE_NET),1)
519519
INCLUDE += -I$(ROOT)/libs/network/esp8266
520520
SOURCES += \
521521
libs/network/esp8266/network_esp8266.c\
522-
libs/network/esp8266/pktbuf.c\
523-
libs/network/esp8266/ota.c
522+
libs/network/esp8266/pktbuf.c
523+
endif
524+
525+
ifndef NO_FOTA
526+
SOURCES += libs/network/esp8266/ota.c
527+
else
528+
DEFINES += -DNO_FOTA
524529
endif
525530

526531
ifdef USE_TELNET

boards/ESP8266_4MB.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ def get_pins():
125125
{ "name":"PD9", "sortingname":"D09", "port":"D", "num":"9", "functions":{}, "csv":{} },
126126
{ "name":"PD10", "sortingname":"D10", "port":"D", "num":"10", "functions":{}, "csv":{} },
127127
{ "name":"PD11", "sortingname":"D11", "port":"D", "num":"11", "functions":{}, "csv":{} },
128-
{ "name":"PD12", "sortingname":"D12", "port":"D", "num":"12", "functions":{}, "csv":{} },
129-
{ "name":"PD13", "sortingname":"D13", "port":"D", "num":"13", "functions":{}, "csv":{} },
130-
{ "name":"PD14", "sortingname":"D14", "port":"D", "num":"14", "functions":{}, "csv":{} },
128+
{ "name":"PD12", "sortingname":"D12", "port":"D", "num":"12", "functions":{"SPI1_MISO":0}, "csv":{} },
129+
{ "name":"PD13", "sortingname":"D13", "port":"D", "num":"13", "functions":{"SPI1_MOSI":0}, "csv":{} },
130+
{ "name":"PD14", "sortingname":"D14", "port":"D", "num":"14", "functions":{"SPI1_SCK":0}, "csv":{} },
131131
{ "name":"PD15", "sortingname":"D15", "port":"D", "num":"15", "functions":{}, "csv":{} },
132132
{ "name":"PD16", "sortingname":"D16", "port":"D", "num":"16", "functions":{}, "csv":{} },
133133
{ "name":"PA0", "sortingname":"A00", "port":"A", "num":"17", "functions":{ "ADC1_IN0":0 }, "csv":{} }

make/family/ESP8266.make

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ OPTIMIZEFLAGS+=-Os -std=gnu11 -fgnu89-inline -Wl,--allow-multiple-definition
1414
endif
1515

1616
ET_FM ?= qio # Valid values are keep, qio, qout, dio, dout
17+
1718
ifdef FLASH_4MB
1819
ESP_FLASH_MAX ?= 831488 # max bin file: 940KB
1920
ESP_FLASH_SIZE ?= 6 # 6->4MB (1024KB+1024KB)
@@ -23,6 +24,7 @@ ET_FS ?= 4MB-c1 # 32Mbit (4MB) flash size in esptool flash comma
2324
ET_FF ?= 80m # 80Mhz flash speed in esptool flash command
2425
ET_BLANK ?= 0x3FE000 # where to flash blank.bin
2526
ET_DEFAULTS ?= 0x3FC000 # where to flash esp_init_data_default.bin to default SDK settings
27+
CFLAGS += -mforce-l32
2628
else ifdef 2MB
2729
ESP_FLASH_MAX ?= 479232 # max bin file: 468KB
2830
ESP_FLASH_SIZE ?= 3 # 3->2MB (512KB+512KB)
@@ -46,34 +48,43 @@ ESP_FLASH_MAX ?= 479232 # max bin file: 468KB
4648
ESP_FLASH_SIZE ?= 0 # 0->512KB
4749
ESP_FLASH_MODE ?= 0 # 0->QIO
4850
ESP_FLASH_FREQ_DIV ?= 0 # 0->40Mhz
49-
ET_FS ?= 4m # 4Mbit (512KB) flash size in esptool flash command
51+
ET_FS ?= 512KB # 4Mbit (512KB) flash size in esptool flash command
5052
ET_FF ?= 40m # 40Mhz flash speed in esptool flash command
5153
ET_BLANK ?= 0x7E000 # where to flash blank.bin
5254
ET_DEFAULTS ?= 0x7C000 # where to flash esp_init_data_default.bin to default SDK settings
5355
endif
5456

55-
FLASH_BAUD ?= 115200 # The flash baud rate
57+
58+
ifdef FLASH_1MB
59+
ESP_FLASH_MAX = 831488 # max bin file: 812KB
60+
ESP_FLASH_SIZE = 2 # 2->1MB (1024)
61+
ESP_FLASH_MODE = 0 # 0->QIO, 2->DIO
62+
ESP_FLASH_FREQ_DIV = 15 # 15->80Mhz
63+
ET_FS = 1MB # 8Mbit (1MB) flash size in esptool flash command
64+
ET_FF = 80m # 80Mhz flash speed in esptool flash command
65+
ET_FM = dout # Valid values are keep, qio, qout, dio, dout
66+
ET_BLANK = 0xFE000 # where to flash blank.bin
67+
ET_DEFAULTS = 0xFC000 # where to flash esp_init_data_default.bin to default SDK settings
68+
DEFINES += -DFLASH_1MB
69+
CFLAGS += -mforce-l32
70+
endif
71+
72+
FLASH_BAUD ?= 115200 # The flash baud rate
5673

5774

5875
# move os_printf strings into flash to save RAM space
5976
DEFINES += -DUSE_OPTIMIZE_PRINTF
6077
DEFINES += -D__ETS__ -DICACHE_FLASH -DXTENSA -DUSE_US_TIMER
61-
LIBS += -lc -lgcc -lhal -lphy -lpp -lnet80211 -llwip_536 -lwpa -lmain -lpwm -lcrypto
62-
CFLAGS+= -fno-builtin \
78+
LIBS += -lc -lgcc -lhal -lphy -lpp -lnet80211 -llwip_536 -lwpa -lmain -lpwm -lcrypto
79+
CFLAGS += -fno-builtin \
6380
-Wno-maybe-uninitialized -Wno-old-style-declaration -Wno-conversion -Wno-unused-variable \
64-
-Wno-unused-parameter -Wno-ignored-qualifiers -Wno-discarded-qualifiers -Wno-float-conversion \
81+
-Wno-unused-parameter -Wno-ignored-qualifiers \
6582
-Wno-parentheses -Wno-type-limits -Wno-unused-function -Wno-unused-value \
6683
-Wl,EL -Wl,--gc-sections -nostdlib -mlongcalls -mtext-section-literals \
6784
-fno-guess-branch-probability -freorder-blocks-and-partition -fno-cse-follow-jumps \
6885
-fno-tree-fre -fno-ipa-sra -fno-signed-zeros -fno-trapping-math -fassociative-math \
6986
-fno-caller-saves -fno-move-loop-invariants -fno-tree-tail-merge -fno-tree-copy-prop
7087

71-
# only use mfore-l32 if 4MB board for now
72-
ifdef FLASH_4MB
73-
CFLAGS += -mforce-l32
74-
endif
75-
76-
#
7788
# The Root of the ESP8266_SDK distributed by Espressif
7889
# This must be supplied as a Make environment variable.
7990
ifndef ESP8266_SDK_ROOT

make/targets/ESP8266.make

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,23 @@ USER2_BIN = espruino_esp8266_user2.bin
1919
USER1_ELF = espruino_esp8266_user1.elf
2020
USER2_ELF = espruino_esp8266_user2.elf
2121
PARTIAL = espruino_esp8266_partial.o
22+
2223
ifdef FLASH_4MB
2324
ESP_COMBINED_SIZE = 4096
2425
ESP_FLASH_ADDONS = $(ET_DEFAULTS) $(INIT_DATA) $(ET_BLANK) $(BLANK)
2526
LD_SCRIPT1 = ./targets/esp8266/eagle.app.v6.new.2048.ld
2627
LD_SCRIPT2 = ./targets/esp8266/eagle.app.v6.new.2048.ld
27-
LD_RENAME = --rename-section .text=.irom.text --rename-section .literal=.irom.literal
2828
else
2929
ESP_COMBINED_SIZE = 512
3030
LD_SCRIPT1 = ./targets/esp8266/eagle.app.v6.new.1024.app1.ld
3131
LD_SCRIPT2 = ./targets/esp8266/eagle.app.v6.new.1024.app2.ld
32-
LD_RENAME = --rename-section .text=.irom.text --rename-section .literal=.irom.literal
3332
endif
33+
34+
ifdef FLASH_1MB
35+
ESP_COMBINED_SIZE = 1024
36+
endif
37+
38+
LD_RENAME = --rename-section .text=.irom.text --rename-section .literal=.irom.literal
3439
ESP_COMBINED = $(PROJ_NAME)_combined_$(ESP_COMBINED_SIZE).bin
3540
APPGEN_TOOL = $(ESP8266_SDK_ROOT)/tools/gen_appbin.py
3641
BOOTLOADER = $(ESP8266_SDK_ROOT)/bin/boot_v1.6.bin

scripts/build_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
def html(s): htmlFile.write(s+"\n");
7777

7878
def htmlify(d,current):
79-
d = markdown.markdown(d, extensions=['urlize'])
79+
d = markdown.markdown(d, extensions=['markdown_include.include'])
8080
# replace <code> with newlines with pre
8181
idx = d.find("<code>")
8282
end = d.find("</code>", idx)

src/jsdevices.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ int jshGetCharToTransmit(
272272
IOEventFlags device // The device being looked at for a transmission.
273273
) {
274274
if (DEVICE_HAS_DEVICE_STATE(device)) {
275-
JshSerialDeviceState *deviceState = &jshSerialDeviceStates[TO_SERIAL_DEVICE_STATE(device)];
275+
JshSerialDeviceState *deviceState = (JshSerialDeviceState*) &jshSerialDeviceStates[TO_SERIAL_DEVICE_STATE(device)];
276276
if ((*deviceState)&SDS_XOFF_PENDING) {
277277
(*deviceState) = ((*deviceState)&(~SDS_XOFF_PENDING)) | SDS_XOFF_SENT;
278278
return 19/*XOFF*/;
@@ -675,7 +675,7 @@ void jshSetFlowControlXON(IOEventFlags device, bool hostShouldTransmit) {
675675
if (!hostShouldTransmit)
676676
jshSerialFlowControlWasSet = true;
677677
int devIdx = TO_SERIAL_DEVICE_STATE(device);
678-
JshSerialDeviceState *deviceState = &jshSerialDeviceStates[devIdx];
678+
JshSerialDeviceState *deviceState = (JshSerialDeviceState*) &jshSerialDeviceStates[devIdx];
679679
if ((*deviceState) & SDS_FLOW_CONTROL_XON_XOFF) {
680680
if (hostShouldTransmit) {
681681
if (((*deviceState)&(SDS_XOFF_SENT|SDS_XON_PENDING)) == SDS_XOFF_SENT) {
@@ -719,7 +719,7 @@ JsVar *jshGetDeviceObject(IOEventFlags device) {
719719
void jshSetFlowControlEnabled(IOEventFlags device, bool software, Pin pinCTS) {
720720
if (DEVICE_HAS_DEVICE_STATE(device)) {
721721
int devIdx = TO_SERIAL_DEVICE_STATE(device);
722-
JshSerialDeviceState *deviceState = &jshSerialDeviceStates[devIdx];
722+
JshSerialDeviceState *deviceState = (JshSerialDeviceState*) &jshSerialDeviceStates[devIdx];
723723
if (software)
724724
(*deviceState) |= SDS_FLOW_CONTROL_XON_XOFF;
725725
else
@@ -758,7 +758,7 @@ Pin jshGetEventDataPin(IOEventFlags channel) {
758758
void jshSetErrorHandlingEnabled(IOEventFlags device, bool errorHandling) {
759759
if (DEVICE_HAS_DEVICE_STATE(device)) {
760760
int devIdx = TO_SERIAL_DEVICE_STATE(device);
761-
JshSerialDeviceState *deviceState = &jshSerialDeviceStates[devIdx];
761+
JshSerialDeviceState *deviceState = (JshSerialDeviceState*) &jshSerialDeviceStates[devIdx];
762762
if (errorHandling)
763763
(*deviceState) |= SDS_ERROR_HANDLING;
764764
else
@@ -769,7 +769,7 @@ void jshSetErrorHandlingEnabled(IOEventFlags device, bool errorHandling) {
769769
bool jshGetErrorHandlingEnabled(IOEventFlags device) {
770770
if (DEVICE_HAS_DEVICE_STATE(device)) {
771771
int devIdx = TO_SERIAL_DEVICE_STATE(device);
772-
JshSerialDeviceState *deviceState = &jshSerialDeviceStates[devIdx];
772+
JshSerialDeviceState *deviceState = (JshSerialDeviceState*) &jshSerialDeviceStates[devIdx];
773773
return (SDS_ERROR_HANDLING & *deviceState)!=0;
774774
} else
775775
return false;

src/jsflash.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ JsVar *jsfReadFile(JsfFileName name, int offset, int length) {
499499
if (offset<0) offset=0;
500500
uint32_t fileLen = jsfGetFileSize(&header);
501501
if (length<=0) length=fileLen;
502-
if (offset>fileLen) offset=fileLen;
503-
if (offset+length>fileLen) length=fileLen-offset;
502+
if ((unsigned) offset>fileLen) offset=fileLen;
503+
if ((unsigned) offset+length>fileLen) length=fileLen-offset;
504504
if (length<=0) return jsvNewFromEmptyString();
505505
// now increment address by offset
506506
addr += offset;
@@ -655,9 +655,9 @@ int jsfLoadFromFlash_readcb(uint32_t *cbdata) {
655655
jsfcbData *data = (jsfcbData*)cbdata;
656656

657657
if (data->address >= data->endAddress) return -1; // at end
658-
if (data->byteCount==0 || data->bufferCnt>=data->byteCount) {
658+
if ( (unsigned) data->byteCount==0 || data->bufferCnt>= (unsigned) data->byteCount) {
659659
data->byteCount = data->endAddress - data->address;
660-
if (data->byteCount > sizeof(data->buffer))
660+
if ( (unsigned) data->byteCount > sizeof(data->buffer))
661661
data->byteCount = sizeof(data->buffer);
662662
jshFlashRead(data->buffer, data->address, data->byteCount);
663663
data->bufferCnt = 0;

src/jsvar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3865,7 +3865,7 @@ void jsvDefragment() {
38653865
JsVarRef defragVars[DEFRAGVARS];
38663866
memset(defragVars, 0, sizeof(defragVars));
38673867
int defragVarIdx = 0;
3868-
for (int i=0;i<jsvGetMemoryTotal();i++) {
3868+
for (unsigned int i=0;i<jsvGetMemoryTotal();i++) {
38693869
JsVarRef vr = i+1;
38703870
JsVar *v = _jsvGetAddressOf(vr);
38713871
if ((v->flags&JSV_VARTYPEMASK)!=JSV_UNUSED) {
@@ -3895,7 +3895,7 @@ void jsvDefragment() {
38953895
*defragTo = *defragFrom;
38963896
defragFrom->flags = JSV_UNUSED;
38973897
// find references!
3898-
for (int i=0;i<jsvGetMemoryTotal();i++) {
3898+
for ( unsigned int i=0;i<jsvGetMemoryTotal();i++) {
38993899
JsVarRef vr = i+1;
39003900
JsVar *v = _jsvGetAddressOf(vr);
39013901
if ((v->flags&JSV_VARTYPEMASK)!=JSV_UNUSED) {

src/jswrap_espruino.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ Show fragmentation.
11251125
*/
11261126
void jswrap_e_dumpFragmentation() {
11271127
int l = 0;
1128-
for (int i=0;i<jsvGetMemoryTotal();i++) {
1128+
for ( unsigned i=0;i<jsvGetMemoryTotal();i++) {
11291129
JsVar *v = _jsvGetAddressOf(i+1);
11301130
if ((v->flags&JSV_VARTYPEMASK)==JSV_UNUSED) {
11311131
jsiConsolePrint(" ");
@@ -1161,7 +1161,7 @@ to visualise where memory is used.
11611161
void jswrap_e_dumpVariables() {
11621162
int l = 0;
11631163
jsiConsolePrintf("ref,size,name,links...\n");
1164-
for (int i=0;i<jsvGetMemoryTotal();i++) {
1164+
for ( unsigned i=0;i<jsvGetMemoryTotal();i++) {
11651165
JsVarRef ref = i+1;
11661166
JsVar *v = _jsvGetAddressOf(ref);
11671167
if ((v->flags&JSV_VARTYPEMASK)==JSV_UNUSED) continue;

src/jswrap_storage.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,14 @@ JsVar *jswrap_storage_open(JsVar *name, JsVar *modeVar) {
353353
char buf[64];
354354
bool foundEnd = false;
355355
while (!foundEnd) {
356-
int l = STORAGEFILE_CHUNKSIZE-offset;
356+
unsigned int l = STORAGEFILE_CHUNKSIZE-offset;
357357
if (l<=0) {
358358
foundEnd = true;
359359
break;
360360
}
361-
if (l>sizeof(buf)) l=sizeof(buf);
361+
if ( l>sizeof(buf)) l=sizeof(buf);
362362
jshFlashRead(buf, addr+offset, l);
363-
for (int i=0;i<l;i++) {
363+
for (unsigned int i=0;i<l;i++) {
364364
if (buf[i]==(char)255) {
365365
l = i;
366366
foundEnd = true;
@@ -480,11 +480,11 @@ JsVar *jswrap_storagefile_read_internal(JsVar *f, int len) {
480480
return result;
481481
}
482482
}
483-
int l = len;
483+
unsigned int l = len;
484484
if (l>sizeof(buf)) l=sizeof(buf);
485-
if (l>remaining) l=remaining;
485+
if (l> (unsigned) remaining) l=remaining;
486486
jshFlashRead(buf, addr+offset, l);
487-
for (int i=0;i<l;i++) {
487+
for (unsigned int i=0;i<l;i++) {
488488
if (buf[i]==(char)255) {
489489
// end of file!
490490
l = i;
@@ -597,7 +597,7 @@ void jswrap_storagefile_write(JsVar *f, JsVar *_data) {
597597
jsvUnLock(data);
598598
return;
599599
}
600-
if (len<remaining) {
600+
if (len< (unsigned) remaining) {
601601
DBG("Write Append Chunk\n");
602602
// Great, it all fits in
603603
jswrap_flash_write(data, addr+offset);

targets/esp8266/README_flash.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,16 @@ esptool.py --port [/dev/ttyUSB0|COM1] --baud 460800 write_flash \
4343
0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \
4444
0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
4545

46+
47+
Special hints for a broken device after flashing
48+
------------------------------------------------
49+
50+
newer ESP01 like ESP01s have 1MB flash size
51+
52+
try different --flash_mode values like dio or dout
53+
54+
try to use a combined file to flash like
55+
espruino_..._combined_512.bin or
56+
espruino_..._combined_4096.bin
57+
58+

targets/esp8266/jshardware.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,8 @@ JsVar *jshFlashGetFree() {
14111411
if (!jsFreeFlash) return 0;
14121412

14131413
uint32_t map = system_get_flash_size_map();
1414+
extern uint16_t espFlashKB; // in user_main,c
1415+
14141416
if ( map == 6 ) {
14151417
addFlashArea(jsFreeFlash, 0x200000, 0x100000);
14161418
addFlashArea(jsFreeFlash, 0x300000, 0x40000);
@@ -1419,9 +1421,11 @@ JsVar *jshFlashGetFree() {
14191421
addFlashArea(jsFreeFlash, 0x3C0000, 0x40000-0x5000);
14201422
return jsFreeFlash;
14211423
}
1422-
1424+
// there is no flash for running on 1MB flash without FOTA
1425+
if ( map == 2 && espFlashKB == 1024 && strcmp(PC_BOARD_ID, "ESP8266_4MB") == 0)
1426+
return jsFreeFlash;
1427+
14231428
// need 1MB of flash to have more space...
1424-
extern uint16_t espFlashKB; // in user_main,c
14251429
if (espFlashKB > 512) {
14261430
addFlashArea(jsFreeFlash, 0x80000, 0x1000);
14271431
if (espFlashKB > 1024) {

targets/esp8266/jswrap_esp8266.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,13 @@ JsVar *jswrap_ESP8266_getState() {
236236
uint32_t map = system_get_flash_size_map();
237237
extern char *flash_maps[]; // in user_main.c
238238
extern uint16_t flash_kb[]; // in user_main.c
239-
jsvObjectSetChildAndUnLock(esp8266State, "flashMap", jsvNewFromString(flash_maps[map]));
239+
extern char *flash_maps_alt[]; // in user_main.c
240+
241+
jsvObjectSetChildAndUnLock(esp8266State, "flashMap", jsvNewFromString(
242+
// ( map == 2 && flash_kb[map] == 1024 && is4MB ? flash_maps_alt[map] : flash_maps[map] )));
243+
( map == 2 && flash_kb[map] == 1024 && strcmp(PC_BOARD_ID, "ESP8266_4MB") == 0) ? flash_maps_alt[map] : flash_maps[map] ));
244+
// ( map == 2 && flash_kb[map] == 1024 ? flash_maps_alt[map] : flash_maps[map] )));
245+
240246
jsvObjectSetChildAndUnLock(esp8266State, "flashKB", jsvNewFromInteger(flash_kb[map]));
241247

242248
uint32_t fid = spi_flash_get_id();

targets/esp8266/user_main.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ typedef long long int64_t;
2727
#include <jsinteractive.h>
2828
#include <jswrap_esp8266_network.h>
2929
#include <jswrap_esp8266.h>
30-
#include <ota.h>
3130
#include <log.h>
3231
#include "ESP8266_board.h"
3332

@@ -90,6 +89,10 @@ char *flash_maps[] = { // used in jswrap_ESP8266_network.c
9089
"512KB:256/256", "256KB", "1MB:512/512", "2MB:512/512", "4MB:512/512",
9190
"2MB:1024/1024", "4MB:1024/1024"
9291
};
92+
char *flash_maps_alt[] = { // used in jswrap_ESP8266_network.c
93+
"512KB:256/256", "256KB", "1MB:1024", "2MB:1024", "4MB:512/512",
94+
"2MB:1024/1024", "4MB:1024/1024"
95+
};
9396
uint16_t flash_kb[] = { // used in jswrap_ESP8266_network.c
9497
512, 256, 1024, 2048, 4096, 2048, 4096,
9598
};
@@ -122,8 +125,9 @@ void jshPrintBanner() {
122125
os_printf("Espruino "JS_VERSION"\nFlash map %s, manuf 0x%lx chip 0x%lx\n",
123126
flash_maps[map], (long unsigned int) (fid & 0xff), (long unsigned int)chip);
124127
jsiConsolePrintf(
125-
"Flash map %s, manuf 0x%x chip 0x%x\n",
126-
flash_maps[map], fid & 0xff, chip);
128+
"Flash map %s, manuf 0x%x chip 0x%x\n",
129+
(( map == 2 && flash_kb[map] == 1024 && strcmp(PC_BOARD_ID, "ESP8266_4MB") == 0) ? flash_maps_alt[map] : flash_maps[map]),
130+
fid & 0xff, chip);
127131
if ((chip == 0x4013 && map != 0) || (chip == 0x4016 && map != 4 && map != 6)) {
128132
jsiConsolePrint("WARNING: *** Your flash chip does not match your flash map ***\n");
129133
}
@@ -238,7 +242,11 @@ static void mainLoop() {
238242
*/
239243
static void initDone() {
240244
os_printf("> initDone\n");
245+
246+
#ifndef NO_FOTA
247+
#include <ota.h>
241248
otaInit(88);
249+
#endif
242250

243251
#ifdef DEBUG
244252
extern void gdbstub_init();

0 commit comments

Comments
 (0)