Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b0164a

Browse files
committed
Merge branch 'master' into nosizeconf
2 parents855dd34 +abdd2bd commit9b0164a

File tree

150 files changed

+2964
-1320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+2964
-1320
lines changed

‎.gitmodules‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@
1919
[submodule "tools/esptool"]
2020
path=tools/esptool
2121
url=https://github.com/espressif/esptool.git
22+
[submodule "tools/sdk/uzlib"]
23+
path=tools/sdk/uzlib
24+
url=https://github.com/earlephilhower/uzlib.git

‎.travis.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ jobs:
2424
-name:"Platformio (1)"
2525
stage:build
2626
script:$TRAVIS_BUILD_DIR/tests/platformio.sh
27+
install:
28+
-sudo apt-get install python3-pip python3-setuptools
2729
env:
2830
-BUILD_PARITY=even
2931
-name:"Platformio (2)"
3032
stage:build
3133
script:$TRAVIS_BUILD_DIR/tests/platformio.sh
34+
install:
35+
-sudo apt-get install python3-pip python3-setuptools
3236
env:
3337
-BUILD_PARITY=odd
3438

‎README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Arduino core for ESP8266 WiFi chip
33

44
#Quick links
55

6-
-[Latest release documentation](https://arduino-esp8266.readthedocs.io/en/2.6.1/)
6+
-[Latest release documentation](https://arduino-esp8266.readthedocs.io/en/2.6.3/)
77
-[Current "git version" documentation](https://arduino-esp8266.readthedocs.io/en/latest/)
88
-[Install git version](https://arduino-esp8266.readthedocs.io/en/latest/installing.html#using-git-version) ([sources](doc/installing.rst#using-git-version))
99

@@ -36,7 +36,7 @@ Starting with 1.6.4, Arduino allows installation of third-party platform package
3636
####Latest release[![Latest release](https://img.shields.io/github/release/esp8266/Arduino.svg)](https://github.com/esp8266/Arduino/releases/latest/)
3737
Boards manager link:`https://arduino.esp8266.com/stable/package_esp8266com_index.json`
3838

39-
Documentation:[https://arduino-esp8266.readthedocs.io/en/2.6.1/](https://arduino-esp8266.readthedocs.io/en/2.6.1/)
39+
Documentation:[https://arduino-esp8266.readthedocs.io/en/2.6.3/](https://arduino-esp8266.readthedocs.io/en/2.6.3/)
4040

4141
###Using git version
4242
[![Linux build status](https://travis-ci.org/esp8266/Arduino.svg)](https://travis-ci.org/esp8266/Arduino)
@@ -106,7 +106,7 @@ Arduino IDE is developed and maintained by the Arduino team. The IDE is licensed
106106

107107
ESP8266 core includes an xtensa gcc toolchain, which is also under GPL.
108108

109-
Esptool written by Christian Klippel is licensed under GPLv2,currently maintained byIvan Grokhotkov:https://github.com/igrr/esptool-ck.
109+
Esptool.py was initially created by Fredrik Ahlberg (@themadinventor,@kongo), and iscurrently maintained byAngus Gratton (@projectgus) under GPL 2.0 license.
110110

111111
Espressif SDK included in this build is under Espressif MIT License.
112112

@@ -124,6 +124,8 @@ ESP8266 core files are licensed under LGPL.
124124

125125
[LittleFS](https://github.com/ARMmbed/littlefs) library written by ARM Limited and released under the[BSD 3-clause license](https://github.com/ARMmbed/littlefs/blob/master/LICENSE.md).
126126

127+
[uzlib](https://github.com/pfalcon/uzlib) library written and (c) 2014-2018 Paul Sokolovsky, licensed under the ZLib license (https://www.zlib.net/zlib_license.html). uzlib is based on: tinf library by Joergen Ibsen (Deflate decompression); Deflate Static Huffman tree routines by Simon Tatham; LZ77 compressor by Paul Sokolovsky; with library integrated and maintained by Paul Sokolovsky.
128+
127129
###Other useful links ###
128130

129131
[Toolchain repo](https://github.com/earlephilhower/esp-quick-toolchain)

‎boards.txt‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,14 @@ generic.menu.led.15=15
414414
generic.menu.led.15.build.led=-DLED_BUILTIN=15
415415
generic.menu.led.16=16
416416
generic.menu.led.16.build.led=-DLED_BUILTIN=16
417-
generic.menu.sdk.nonosdk_191024=nonos-sdk 2.2.1+111 (191024)
418-
generic.menu.sdk.nonosdk_191024.build.sdk=NONOSDK22x_191024
419-
generic.menu.sdk.nonosdk_191105=nonos-sdk 2.2.1+113 (191105)
420-
generic.menu.sdk.nonosdk_191105.build.sdk=NONOSDK22x_191105
421417
generic.menu.sdk.nonosdk_190703=nonos-sdk 2.2.1+100 (190703)
422418
generic.menu.sdk.nonosdk_190703.build.sdk=NONOSDK22x_190703
419+
generic.menu.sdk.nonosdk_191122=nonos-sdk 2.2.1+119 (191122)
420+
generic.menu.sdk.nonosdk_191122.build.sdk=NONOSDK22x_191122
421+
generic.menu.sdk.nonosdk_191105=nonos-sdk 2.2.1+113 (191105)
422+
generic.menu.sdk.nonosdk_191105.build.sdk=NONOSDK22x_191105
423+
generic.menu.sdk.nonosdk_191024=nonos-sdk 2.2.1+111 (191024)
424+
generic.menu.sdk.nonosdk_191024.build.sdk=NONOSDK22x_191024
423425
generic.menu.sdk.nonosdk221=nonos-sdk 2.2.1 (legacy)
424426
generic.menu.sdk.nonosdk221.build.sdk=NONOSDK221
425427
generic.menu.sdk.nonosdk3v0=nonos-sdk pre-3 (180626 known issues)
@@ -6982,18 +6984,18 @@ espectro.menu.eesz.autoflash.upload.maximum_size=1044464
69826984

69836985
##############################################################
69846986
sonoff.name=ITEAD Sonoff
6985-
sonoff.build.board=SONOFF_SV
6987+
sonoff.build.board=ESP8266_SONOFF_SV
69866988
sonoff.build.extra_flags=-DESP8266
69876989
sonoff.build.flash_size=1M
69886990
sonoff.build.variant=itead
69896991
sonoff.menu.BoardModel.sonoffBasic=ITEAD Sonoff Basic
6990-
sonoff.menu.BoardModel.sonoffBasic.build.board=SONOFF_BASIC
6992+
sonoff.menu.BoardModel.sonoffBasic.build.board=ESP8266_SONOFF_BASIC
69916993
sonoff.menu.BoardModel.sonoffS20=ITEAD Sonoff S20
6992-
sonoff.menu.BoardModel.sonoffS20.build.board=SONOFF_S20
6994+
sonoff.menu.BoardModel.sonoffS20.build.board=ESP8266_SONOFF_S20
69936995
sonoff.menu.BoardModel.sonoffSV=ITEAD Sonoff SV
6994-
sonoff.menu.BoardModel.sonoffSV.build.board=SONOFF_SV
6996+
sonoff.menu.BoardModel.sonoffSV.build.board=ESP8266_SONOFF_SV
69956997
sonoff.menu.BoardModel.sonoffTH=ITEAD Sonoff TH
6996-
sonoff.menu.BoardModel.sonoffTH.build.board=SONOFF_TH
6998+
sonoff.menu.BoardModel.sonoffTH.build.board=ESP8266_SONOFF_TH
69976999
sonoff.upload.tool=esptool
69987000
sonoff.upload.maximum_data_size=81920
69997001
sonoff.upload.wait_for_upload_port=true

‎bootloaders/eboot/Makefile‎

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,57 @@ TARGET_DIR := ./
66

77
TARGET_OBJ_FILES :=\
88
eboot.o\
9-
eboot_command.o\
10-
9+
eboot_command.o
1110

1211
TARGET_OBJ_PATHS :=$(addprefix$(TARGET_DIR)/,$(TARGET_OBJ_FILES))
1312

13+
UZLIB_PATH := ../../tools/sdk/uzlib/src
14+
UZLIB_FLAGS := -DRUNTIME_BITS_TABLES
15+
1416
CC :=$(XTENSA_TOOLCHAIN)xtensa-lx106-elf-gcc
1517
CXX :=$(XTENSA_TOOLCHAIN)xtensa-lx106-elf-g++
1618
AR :=$(XTENSA_TOOLCHAIN)xtensa-lx106-elf-ar
1719
LD :=$(XTENSA_TOOLCHAIN)xtensa-lx106-elf-gcc
1820
OBJDUMP :=$(XTENSA_TOOLCHAIN)xtensa-lx106-elf-objdump
1921

20-
INC += -I../../tools/sdk/include
22+
INC += -I../../tools/sdk/include -I../../tools/sdk/uzlib/src
23+
2124
CFLAGS += -std=gnu99
2225

23-
CFLAGS += -O0 -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mno-text-section-literals
26+
CFLAGS += -Os -g -Wall -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mno-text-section-literals -ffunction-sections -fdata-sections
2427

2528
CFLAGS +=$(INC)
2629

27-
LDFLAGS+= -nostdlib -Wl,--no-check-sections -umain
30+
CFLAGS +=$(UZLIB_FLAGS)
31+
32+
LDFLAGS+= -nostdlib -Wl,--no-check-sections -Wl,--gc-sections -umain -Wl,-Map,$(@:.elf=.map)
2833

2934
LD_SCRIPT := -Teboot.ld
3035

31-
APP_OUT:= eboot.elf
32-
APP_AR := eboot.a
33-
APP_FW := eboot.bin
36+
APP_OUT:= eboot.elf
37+
APP_AR:= eboot.a
38+
APP_FW:= eboot.bin
3439

35-
all:$(APP_FW)
3640

37-
$(APP_AR):$(TARGET_OBJ_PATHS)
38-
$(AR) cru$@$^
41+
all:$(APP_OUT)
3942

43+
tinflate.o:$(UZLIB_PATH)/tinflate.c$(UZLIB_PATH)/uzlib.h$(UZLIB_PATH)/uzlib_conf.h
44+
$(CC)$(CFLAGS) -c -o tinflate.o$(UZLIB_PATH)/tinflate.c
4045

41-
$(APP_OUT):$(APP_AR)
42-
$(LD)$(LD_SCRIPT)$(LDFLAGS) -Wl,--start-group -Wl,--whole-archive$(APP_AR) -Wl,--end-group -o$@
46+
tinfgzip.o:$(UZLIB_PATH)/tinfgzip.c$(UZLIB_PATH)/uzlib.h$(UZLIB_PATH)/uzlib_conf.h
47+
$(CC)$(CFLAGS) -c -o tinfgzip.o$(UZLIB_PATH)/tinfgzip.c
4348

44-
$(APP_FW):$(APP_OUT)
45-
$(ESPTOOL) -vvv -eo$(APP_OUT) -bo$@ -bs .text -bs .data -bs .rodata -bc -ec||true
49+
$(APP_AR):$(TARGET_OBJ_PATHS) tinflate.o tinfgzip.o
50+
$(AR) cru$@$^
4651

52+
$(APP_OUT):$(APP_AR) eboot.ld | Makefile
53+
$(LD)$(LD_SCRIPT)$(LDFLAGS) -Wl,--start-group -Wl,--whole-archive$(APP_AR) -Wl,--end-group -o$@
4754

4855
clean:
4956
rm -f*.o
5057
rm -f$(APP_AR)
5158
rm -f$(APP_OUT)
59+
rm -f*.map
5260

5361

5462
.PHONY: all clean default

‎bootloaders/eboot/eboot.c‎

Lines changed: 85 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#include<string.h>
1313
#include"flash.h"
1414
#include"eboot_command.h"
15+
#include<uzlib.h>
16+
17+
externunsignedchar_gzip_dict;
1518

1619
#defineSWRST do { (*((volatile uint32_t*) 0x60000700)) |= 0x80000000; } while(0);
1720

@@ -24,10 +27,14 @@ int print_version(const uint32_t flash_addr)
2427
if (SPIRead(flash_addr+APP_START_OFFSET+sizeof(image_header_t)+sizeof(section_header_t),&ver,sizeof(ver))) {
2528
return1;
2629
}
27-
constchar*__attribute__ ((aligned (4)))fmtt="v%08x\n\0\0";
28-
uint32_tfmt[2];
29-
fmt[0]= ((uint32_t*)fmtt)[0];
30-
fmt[1]= ((uint32_t*)fmtt)[1];
30+
charfmt[7];
31+
fmt[0]='v';
32+
fmt[1]='%';
33+
fmt[2]='0';
34+
fmt[3]='8';
35+
fmt[4]='x';
36+
fmt[5]='\n';
37+
fmt[6]=0;
3138
ets_printf((constchar*)fmt,ver);
3239
return0;
3340
}
@@ -80,37 +87,96 @@ int load_app_from_flash_raw(const uint32_t flash_addr)
8087
pos+=section_header.size;
8188
}
8289

83-
registeruint32_tsp asm("a1")=0x3ffffff0;
84-
registeruint32_tpc asm("a3")=image_header.entry;
85-
__asm__ __volatile__ ("jx a3");
90+
asmvolatile("" :::"memory");
91+
asmvolatile ("mov.n a1, %0\n"
92+
"mov.n a3, %1\n"
93+
"jx a3\n" : :"r" (0x3ffffff0),"r" (image_header.entry) );
8694

95+
__builtin_unreachable();// Save a few bytes by letting GCC know no need to pop regs/return
8796
return0;
8897
}
8998

99+
uint8_tread_flash_byte(constuint32_taddr)
100+
{
101+
uint8_t __attribute__((aligned(4)))buff[4];
102+
SPIRead(addr& ~3,buff,4);
103+
returnbuff[addr&3];
104+
}
105+
unsignedchar __attribute__((aligned(4)))uzlib_flash_read_cb_buff[4096];
106+
uint32_tuzlib_flash_read_cb_addr;
107+
intuzlib_flash_read_cb(structuzlib_uncomp*m)
108+
{
109+
m->source=uzlib_flash_read_cb_buff;
110+
m->source_limit=uzlib_flash_read_cb_buff+sizeof(uzlib_flash_read_cb_buff);
111+
SPIRead(uzlib_flash_read_cb_addr,uzlib_flash_read_cb_buff,sizeof(uzlib_flash_read_cb_buff));
112+
uzlib_flash_read_cb_addr+=sizeof(uzlib_flash_read_cb_buff);
113+
return*(m->source++);
114+
}
90115

116+
unsignedchargzip_dict[32768];
91117

92118
intcopy_raw(constuint32_tsrc_addr,
93119
constuint32_tdst_addr,
94120
constuint32_tsize)
95121
{
96122
// require regions to be aligned
97-
if (src_addr&0xfff!=0||
98-
dst_addr&0xfff!=0) {
123+
if ((src_addr&0xfff)!=0||
124+
(dst_addr&0xfff)!=0) {
99125
return1;
100126
}
101127

102128
constuint32_tbuffer_size=FLASH_SECTOR_SIZE;
103129
uint8_tbuffer[buffer_size];
104-
uint32_tleft= ((size+buffer_size-1)& ~(buffer_size-1));
130+
int32_tleft= ((size+buffer_size-1)& ~(buffer_size-1));
105131
uint32_tsaddr=src_addr;
106132
uint32_tdaddr=dst_addr;
107-
108-
while (left) {
133+
structuzlib_uncompm_uncomp;
134+
boolgzip= false;
135+
136+
// Check if we are uncompressing a GZIP upload or not
137+
if ((read_flash_byte(saddr)==0x1f)&& (read_flash_byte(saddr+1)==0x8b)) {
138+
// GZIP signature matched. Find real size as encoded at the end
139+
left=read_flash_byte(saddr+size-4);
140+
left+=read_flash_byte(saddr+size-3)<<8;
141+
left+=read_flash_byte(saddr+size-2)<<16;
142+
left+=read_flash_byte(saddr+size-1)<<24;
143+
144+
uzlib_init();
145+
146+
/* all 3 fields below must be initialized by user */
147+
m_uncomp.source=NULL;
148+
m_uncomp.source_limit=NULL;
149+
uzlib_flash_read_cb_addr=src_addr;
150+
m_uncomp.source_read_cb=uzlib_flash_read_cb;
151+
uzlib_uncompress_init(&m_uncomp,gzip_dict,sizeof(gzip_dict));
152+
153+
intres=uzlib_gzip_parse_header(&m_uncomp);
154+
if (res!=TINF_OK) {
155+
return5;// Error uncompress header read
156+
}
157+
gzip= true;
158+
}
159+
while (left>0) {
109160
if (SPIEraseSector(daddr/buffer_size)) {
110161
return2;
111162
}
112-
if (SPIRead(saddr,buffer,buffer_size)) {
113-
return3;
163+
if (!gzip) {
164+
if (SPIRead(saddr,buffer,buffer_size)) {
165+
return3;
166+
}
167+
}else {
168+
m_uncomp.dest_start=buffer;
169+
m_uncomp.dest=buffer;
170+
intto_read= (left>buffer_size) ?buffer_size :left;
171+
m_uncomp.dest_limit=buffer+to_read;
172+
intres=uzlib_uncompress(&m_uncomp);
173+
if ((res!=TINF_DONE)&& (res!=TINF_OK)) {
174+
return6;
175+
}
176+
// Fill any remaining with 0xff
177+
for (inti=to_read;i<buffer_size;i++) {
178+
buffer[i]=0xff;
179+
}
114180
}
115181
if (SPIWrite(daddr,buffer,buffer_size)) {
116182
return4;
@@ -124,13 +190,12 @@ int copy_raw(const uint32_t src_addr,
124190
}
125191

126192

127-
128-
voidmain()
193+
intmain()
129194
{
130195
intres=9;
131196
boolclear_cmd= false;
132197
structeboot_commandcmd;
133-
198+
134199
print_version(0);
135200

136201
if (eboot_command_read(&cmd)==0) {
@@ -172,4 +237,7 @@ void main()
172237
}
173238

174239
while(true){}
240+
241+
__builtin_unreachable();
242+
return0;
175243
}

‎bootloaders/eboot/eboot.elf‎

24 KB
Binary file not shown.

‎bootloaders/eboot/eboot.ld‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ SECTIONS
6868

6969
.data :ALIGN(4)
7070
{
71+
*(COMMON)/* Global vars*/
72+
. =ALIGN(4);
7173
_heap_start =ABSOLUTE(.);
7274
/* _stack_sentry = ALIGN(0x8);*/
7375
} >dram0_0_seg :dram0_0_bss_phdr
@@ -150,9 +152,26 @@ SECTIONS
150152
*(.bss)
151153
*(.bss.*)
152154
*(.gnu.linkonce.b.*)
153-
*(COMMON)
154155
. =ALIGN (8);
155156
_bss_end =ABSOLUTE(.);
157+
_free_space =4096 -17 - (. - _stext);
158+
/*
159+
The boot loader checksum must be before the CRC, which is written by elf2bin.py.
160+
This leaves 16 bytes after the checksum for the CRC placed at the end of the
161+
4096-byte sector.*/
162+
_cs_here = (ALIGN((. +1),16) ==ALIGN(16)) ? (ALIGN(16)- 1) : (. +0x0F);
163+
164+
/*
165+
The filling (padding) and values for _crc_size and _crc_val are handled by
166+
elf2bin.py. With this, we give values to the symbols without explicitly
167+
assigning space. This avoids the linkers back *fill* operation that causes
168+
trouble.
169+
170+
The CRC info is stored in last 8 bytes.*/
171+
_crc_size = _stext +4096 -8;
172+
_crc_val = _stext +4096 -4;
173+
ASSERT((4096 > (17 + (. -_stext))), "Error: No spacefor CS and CRC in bootloader sector.");
174+
ASSERT((_crc_size > _cs_here),"Error: CRC must be located after CS.");
156175
} >iram1_0_seg :iram1_0_phdr
157176
158177
.lit4 : ALIGN(4)

‎bootloaders/eboot/eboot_command.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int eboot_command_read(struct eboot_command* cmd)
3737
}
3838

3939
uint32_tcrc32=eboot_command_calculate_crc32(cmd);
40-
if (cmd->magic&EBOOT_MAGIC_MASK!=EBOOT_MAGIC||
40+
if ((cmd->magic&EBOOT_MAGIC_MASK)!=EBOOT_MAGIC||
4141
cmd->crc32!=crc32) {
4242
return1;
4343
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp