Skip to content

Commit b0ef919

Browse files
authored
Merge branch 'master' into wifi_mesh_update_2.2
2 parents 86025c7 + dd73a18 commit b0ef919

File tree

192 files changed

+17911
-14601
lines changed

Some content is hidden

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

192 files changed

+17911
-14601
lines changed

.travis.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
language: bash
22
os: linux
3-
dist: trusty
3+
dist: bionic
44

55
git:
66
depth: 1
77
submodules: false
88

9-
addons:
10-
apt:
11-
sources:
12-
- ubuntu-toolchain-r-test
13-
packages:
14-
- g++-7
15-
- gcc-7
16-
179
before_install:
1810
- git submodule update --init # no recursive update
1911

@@ -87,14 +79,14 @@ jobs:
8779
- name: "Host tests"
8880
stage: build
8981
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
90-
install: sudo apt-get install valgrind lcov
91-
env: CC=gcc-7 CXX=g++-7
82+
install:
83+
- sudo apt-get install valgrind lcov
9284

9385
- name: "Docs"
9486
stage: build
9587
script: $TRAVIS_BUILD_DIR/tests/ci/build_docs.sh
9688
install:
97-
- sudo apt-get install python3-pip
89+
- sudo apt-get install python3-pip python3-setuptools
9890
- pip3 install --user -r doc/requirements.txt;
9991

10092
- name: "Style check"
@@ -105,7 +97,6 @@ jobs:
10597
- name: "Mock trivial test"
10698
stage: build
10799
script: $TRAVIS_BUILD_DIR/tests/buildm.sh
108-
env: CC=gcc-7 CXX=g++-7
109100

110101
- name: "Mac OSX can build sketches"
111102
os: osx

README.md

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and
1616
# Contents
1717
- Installing options:
1818
- [Using Boards Manager](#installing-with-boards-manager)
19-
- [Using git version](#using-git-version-basic-instructions)
19+
- [Using git version](#using-git-version)
2020
- [Using PlatformIO](#using-platformio)
2121
- [Building with make](#building-with-make)
2222
- [Documentation](#documentation)
@@ -38,35 +38,13 @@ Boards manager link: `https://arduino.esp8266.com/stable/package_esp8266com_inde
3838

3939
Documentation: [https://arduino-esp8266.readthedocs.io/en/2.5.2/](https://arduino-esp8266.readthedocs.io/en/2.5.2/)
4040

41-
### Using git version (basic instructions)
41+
### Using git version
4242
[![Linux build status](https://travis-ci.org/esp8266/Arduino.svg)](https://travis-ci.org/esp8266/Arduino)
4343

44+
Also known as latest git or master branch.
45+
4446
- Install the current upstream Arduino IDE at the 1.8 level or later. The current version is on the [Arduino website](https://www.arduino.cc/en/main/software).
45-
- Go to Arduino directory
46-
- For Mac OS X, it is `Arduino.app` showing as the Arduino icon.
47-
This location may be your `~/Downloads`, `~/Desktop` or even `/Applications`.
48-
```bash
49-
cd <application-directory>/Arduino.app/Contents/Java
50-
```
51-
- For Linux, it is ~/Arduino by default.
52-
```bash
53-
cd ~/Arduino
54-
```
55-
- Clone this repository into hardware/esp8266com/esp8266 directory (or clone it elsewhere and create a symlink)
56-
```bash
57-
cd hardware
58-
mkdir esp8266com
59-
cd esp8266com
60-
git clone https://github.com/esp8266/Arduino.git esp8266
61-
cd esp8266
62-
git submodule update --init
63-
```
64-
- Download binary tools (you need Python 2.7)
65-
```bash
66-
cd esp8266/tools
67-
python get.py
68-
```
69-
- Restart Arduino
47+
- Follow the [instructions in the documentation](https://arduino-esp8266.readthedocs.io/en/latest/installing.html#using-git-version).
7048

7149
### Using PlatformIO
7250

boards.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ generic.menu.FlashFreq.40=40MHz
7676
generic.menu.FlashFreq.40.build.flash_freq=40
7777
generic.menu.FlashFreq.80=80MHz
7878
generic.menu.FlashFreq.80.build.flash_freq=80
79+
generic.menu.FlashFreq.20=20MHz
80+
generic.menu.FlashFreq.20.build.flash_freq=20
81+
generic.menu.FlashFreq.26=26MHz
82+
generic.menu.FlashFreq.26.build.flash_freq=26
7983
generic.menu.FlashMode.dout=DOUT (compatible)
8084
generic.menu.FlashMode.dout.build.flash_mode=dout
8185
generic.menu.FlashMode.dout.build.flash_flags=-DFLASHMODE_DOUT
@@ -370,11 +374,13 @@ generic.menu.led.15=15
370374
generic.menu.led.15.build.led=-DLED_BUILTIN=15
371375
generic.menu.led.16=16
372376
generic.menu.led.16.build.led=-DLED_BUILTIN=16
373-
generic.menu.sdk.nonosdk222_100=nonos-sdk 2.2.1+100 (testing)
374-
generic.menu.sdk.nonosdk222_100.build.sdk=NONOSDK22y
377+
generic.menu.sdk.nonosdk222_100=nonos-sdk 2.2.1+100 (190703 approved)
378+
generic.menu.sdk.nonosdk222_100.build.sdk=NONOSDK22x_190703
379+
generic.menu.sdk.nonosdk222_111=nonos-sdk 2.2.1+111 (191024 testing)
380+
generic.menu.sdk.nonosdk222_111.build.sdk=NONOSDK22x_191024
375381
generic.menu.sdk.nonosdk221=nonos-sdk 2.2.1 (legacy)
376382
generic.menu.sdk.nonosdk221.build.sdk=NONOSDK221
377-
generic.menu.sdk.nonosdk3v0=nonos-sdk pre-3 (known issues)
383+
generic.menu.sdk.nonosdk3v0=nonos-sdk pre-3 (180626 known issues)
378384
generic.menu.sdk.nonosdk3v0.build.sdk=NONOSDK3V0
379385
generic.menu.ip.lm2f=v2 Lower Memory
380386
generic.menu.ip.lm2f.build.lwip_include=lwip2/include
@@ -4758,6 +4764,10 @@ wifinfo.menu.FlashFreq.40=40MHz
47584764
wifinfo.menu.FlashFreq.40.build.flash_freq=40
47594765
wifinfo.menu.FlashFreq.80=80MHz
47604766
wifinfo.menu.FlashFreq.80.build.flash_freq=80
4767+
wifinfo.menu.FlashFreq.20=20MHz
4768+
wifinfo.menu.FlashFreq.20.build.flash_freq=20
4769+
wifinfo.menu.FlashFreq.26=26MHz
4770+
wifinfo.menu.FlashFreq.26.build.flash_freq=26
47614771
wifinfo.menu.eesz.1M64=1MB (FS:64KB OTA:~470KB)
47624772
wifinfo.menu.eesz.1M64.build.flash_size=1M
47634773
wifinfo.menu.eesz.1M64.build.flash_size_bytes=0x100000
@@ -5778,6 +5788,10 @@ wifi_slot.menu.FlashFreq.40=40MHz
57785788
wifi_slot.menu.FlashFreq.40.build.flash_freq=40
57795789
wifi_slot.menu.FlashFreq.80=80MHz
57805790
wifi_slot.menu.FlashFreq.80.build.flash_freq=80
5791+
wifi_slot.menu.FlashFreq.20=20MHz
5792+
wifi_slot.menu.FlashFreq.20.build.flash_freq=20
5793+
wifi_slot.menu.FlashFreq.26=26MHz
5794+
wifi_slot.menu.FlashFreq.26.build.flash_freq=26
57815795
wifi_slot.menu.FlashMode.dout=DOUT (compatible)
57825796
wifi_slot.menu.FlashMode.dout.build.flash_mode=dout
57835797
wifi_slot.menu.FlashMode.dout.build.flash_flags=-DFLASHMODE_DOUT

cores/esp8266/Arduino.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,15 @@ long secureRandom(long);
275275
long secureRandom(long, long);
276276
long map(long, long, long, long, long);
277277

278-
extern "C" void configTime(long timezone, int daylightOffset_sec,
279-
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
278+
void configTime(int timezone, int daylightOffset_sec, const char* server1,
279+
const char* server2 = nullptr, const char* server3 = nullptr);
280280

281-
#endif
281+
void configTime(const char* tz, const char* server1,
282+
const char* server2 = nullptr, const char* server3 = nullptr);
282283

283-
#include "pins_arduino.h"
284+
#endif // __cplusplus
284285

285-
#ifndef PUYA_SUPPORT
286-
#define PUYA_SUPPORT 1
287-
#endif
286+
#include "pins_arduino.h"
288287

289288
#endif
290289

cores/esp8266/Esp.cpp

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1919
*/
2020

21-
#include "Arduino.h"
21+
#include "Esp.h"
2222
#include "flash_utils.h"
2323
#include "eboot_command.h"
2424
#include <memory>
@@ -36,6 +36,14 @@ extern struct rst_info resetInfo;
3636

3737
//#define DEBUG_SERIAL Serial
3838

39+
#ifndef PUYA_SUPPORT
40+
#define PUYA_SUPPORT 1
41+
#endif
42+
#ifndef PUYA_BUFFER_SIZE
43+
// Good alternative for buffer size is: SPI_FLASH_SEC_SIZE (= 4k)
44+
// Always use a multiple of flash page size (256 bytes)
45+
#define PUYA_BUFFER_SIZE 256
46+
#endif
3947

4048
/**
4149
* User-defined Literals
@@ -494,7 +502,7 @@ uint32_t EspClass::getSketchSize() {
494502

495503
image_header_t image_header;
496504
uint32_t pos = APP_START_OFFSET;
497-
if (spi_flash_read(pos, (uint32_t*) &image_header, sizeof(image_header))) {
505+
if (spi_flash_read(pos, (uint32_t*) &image_header, sizeof(image_header)) != SPI_FLASH_RESULT_OK) {
498506
return 0;
499507
}
500508
pos += sizeof(image_header);
@@ -506,7 +514,7 @@ uint32_t EspClass::getSketchSize() {
506514
++section_index)
507515
{
508516
section_header_t section_header = {0, 0};
509-
if (spi_flash_read(pos, (uint32_t*) &section_header, sizeof(section_header))) {
517+
if (spi_flash_read(pos, (uint32_t*) &section_header, sizeof(section_header)) != SPI_FLASH_RESULT_OK) {
510518
return 0;
511519
}
512520
pos += sizeof(section_header);
@@ -577,26 +585,27 @@ bool EspClass::flashEraseSector(uint32_t sector) {
577585
}
578586

579587
#if PUYA_SUPPORT
580-
static int spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
588+
static SpiFlashOpResult spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
581589
if (data == nullptr) {
582-
return 1; // SPI_FLASH_RESULT_ERR
590+
return SPI_FLASH_RESULT_ERR;
583591
}
584592
// PUYA flash chips need to read existing data, update in memory and write modified data again.
585593
static uint32_t *flash_write_puya_buf = nullptr;
586-
int rc = 0;
587-
uint32_t* ptr = data;
588594

589595
if (flash_write_puya_buf == nullptr) {
590596
flash_write_puya_buf = (uint32_t*) malloc(PUYA_BUFFER_SIZE);
591597
// No need to ever free this, since the flash chip will never change at runtime.
592598
if (flash_write_puya_buf == nullptr) {
593599
// Memory could not be allocated.
594-
return 1; // SPI_FLASH_RESULT_ERR
600+
return SPI_FLASH_RESULT_ERR;
595601
}
596602
}
603+
604+
SpiFlashOpResult rc = SPI_FLASH_RESULT_OK;
605+
uint32_t* ptr = data;
597606
size_t bytesLeft = size;
598607
uint32_t pos = offset;
599-
while (bytesLeft > 0 && rc == 0) {
608+
while (bytesLeft > 0 && rc == SPI_FLASH_RESULT_OK) {
600609
size_t bytesNow = bytesLeft;
601610
if (bytesNow > PUYA_BUFFER_SIZE) {
602611
bytesNow = PUYA_BUFFER_SIZE;
@@ -605,7 +614,7 @@ static int spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
605614
bytesLeft = 0;
606615
}
607616
rc = spi_flash_read(pos, flash_write_puya_buf, bytesNow);
608-
if (rc != 0) {
617+
if (rc != SPI_FLASH_RESULT_OK) {
609618
return rc;
610619
}
611620
for (size_t i = 0; i < bytesNow / 4; ++i) {
@@ -620,7 +629,7 @@ static int spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
620629
#endif
621630

622631
bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size) {
623-
int rc = 0;
632+
SpiFlashOpResult rc = SPI_FLASH_RESULT_OK;
624633
#if PUYA_SUPPORT
625634
if (getFlashChipVendorId() == SPI_FLASH_VENDOR_PUYA) {
626635
rc = spi_flash_write_puya(offset, data, size);
@@ -630,12 +639,12 @@ bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size) {
630639
{
631640
rc = spi_flash_write(offset, data, size);
632641
}
633-
return rc == 0;
642+
return rc == SPI_FLASH_RESULT_OK;
634643
}
635644

636645
bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size) {
637-
int rc = spi_flash_read(offset, (uint32_t*) data, size);
638-
return rc == 0;
646+
auto rc = spi_flash_read(offset, (uint32_t*) data, size);
647+
return rc == SPI_FLASH_RESULT_OK;
639648
}
640649

641650
String EspClass::getSketchMD5()

cores/esp8266/Esp.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,6 @@
2323

2424
#include <Arduino.h>
2525

26-
#ifndef PUYA_SUPPORT
27-
#define PUYA_SUPPORT 0
28-
#endif
29-
#ifndef PUYA_BUFFER_SIZE
30-
// Good alternative for buffer size is: SPI_FLASH_SEC_SIZE (= 4k)
31-
// Always use a multiple of flash page size (256 bytes)
32-
#define PUYA_BUFFER_SIZE 256
33-
#endif
34-
3526
// Vendor IDs taken from Flashrom project
3627
// https://review.coreboot.org/cgit/flashrom.git/tree/flashchips.h?h=1.0.x
3728
typedef enum {

0 commit comments

Comments
 (0)