Skip to content

Commit 01c6e5f

Browse files
authored
Merge branch 'master' into master
2 parents 7ef8ede + cc84a64 commit 01c6e5f

Some content is hidden

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

74 files changed

+914
-166
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ python get.py
6464

6565
[PlatformIO](http://platformio.org) is an open source ecosystem for IoT
6666
development with cross platform build system, library manager and full support
67-
for Espressif (ESP8266) development. It works on the popular host OS: Mac OS X, Windows,
67+
for Espressif (ESP8266) development. It works on the popular host OS: macOS, Windows,
6868
Linux 32/64, Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).
6969

70-
- [What is PlatformIO?](http://docs.platformio.org/en/stable/what-is-platformio.html)
70+
- [What is PlatformIO?](http://docs.platformio.org/page/what-is-platformio.html)
7171
- [PlatformIO IDE](http://platformio.org/platformio-ide)
72-
- Quick Start with [PlatformIO IDE](http://docs.platformio.org/en/stable/ide/atom.html#quick-start) or [PlatformIO CLI](http://docs.platformio.org/en/stable/quickstart.html)
73-
- [Advanced using](http://docs.platformio.org/en/stable/platforms/espressif.html) -
72+
- Quick Start with [PlatformIO IDE](http://docs.platformio.org/page/ide/atom.html#quick-start) or [PlatformIO Core](http://docs.platformio.org/page/core.html)
73+
- [Advanced using](http://docs.platformio.org/page/platforms/espressif.html) -
7474
custom settings, uploading to SPIFFS, Over-the-Air (OTA) or using stage version
75-
- [Integration with other IDE](http://docs.platformio.org/en/stable/ide.html) -
76-
Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM and Visual Studio
77-
- [Project Examples](http://docs.platformio.org/en/stable/platforms/espressif.html#examples)
75+
- [Integration with Cloud and Standalone IDEs](http://docs.platformio.org/page/ide.html) -
76+
Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM and Visual Studio
77+
- [Project Examples](http://docs.platformio.org/page/platforms/espressif.html#examples)
7878

7979
### Building with make
8080

cores/esp8266/Esp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ EspClass ESP;
8383

8484
void EspClass::wdtEnable(uint32_t timeout_ms)
8585
{
86+
(void) timeout_ms;
8687
/// This API can only be called if software watchdog is stopped
8788
system_soft_wdt_restart();
8889
}
@@ -432,7 +433,7 @@ uint32_t EspClass::getSketchSize() {
432433
section_index < image_header.num_segments;
433434
++section_index)
434435
{
435-
section_header_t section_header = {0};
436+
section_header_t section_header = {0, 0};
436437
if (spi_flash_read(pos, (uint32_t*) &section_header, sizeof(section_header))) {
437438
return 0;
438439
}

cores/esp8266/Schedule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ static int sCount = 0;
1616

1717
static void init_lists()
1818
{
19+
(void) init_lists;
1920
if (sCount != 0) {
2021
return;
2122
}

cores/esp8266/abi.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ void __throw_bad_alloc()
104104

105105
void __throw_logic_error(const char* str)
106106
{
107+
(void) str;
107108
panic();
108109
}
109110

110111
void __throw_out_of_range(const char* str)
111112
{
113+
(void) str;
112114
panic();
113115
}
114116
}

cores/esp8266/cont_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void ICACHE_RAM_ATTR cont_init(cont_t* cont) {
3232
cont->struct_start = (unsigned*) cont;
3333

3434
// fill stack with magic values to check high water mark
35-
for(int pos = 0; pos < sizeof(cont->stack) / 4; pos++)
35+
for(int pos = 0; pos < (int)(sizeof(cont->stack) / 4); pos++)
3636
{
3737
cont->stack[pos] = CONT_STACKGUARD;
3838
}

cores/esp8266/core_esp8266_main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const char* core_release =
5252
} // extern "C"
5353

5454
int atexit(void (*func)()) {
55+
(void) func;
5556
return 0;
5657
}
5758

@@ -125,6 +126,7 @@ static void loop_wrapper() {
125126
}
126127

127128
static void loop_task(os_event_t *events) {
129+
(void) events;
128130
g_micros_at_task_start = system_get_time();
129131
cont_run(&g_cont, &loop_wrapper);
130132
if (cont_check(&g_cont) != 0) {

cores/esp8266/core_esp8266_phy.c

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <stdbool.h>
2626
#include <string.h>
2727
#include "c_types.h"
28+
#include "ets_sys.h"
29+
#include "spi_flash.h"
2830

2931
static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
3032
{
@@ -228,7 +230,7 @@ static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
228230
// 3: auto measure frequency offset and correct it, bbpll is 160M, it only can correct + frequency offset.
229231
// 5: use 113 byte force_freq_offset to correct frequency offset, bbpll is 168M, it can correct + and - frequency offset.
230232
// 7: use 113 byte force_freq_offset to correct frequency offset, bbpll is 160M , it only can correct + frequency offset.
231-
[112] = 3,
233+
[112] = 0,
232234

233235
// force_freq_offset
234236
// signed, unit is 8kHz
@@ -250,14 +252,20 @@ static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
250252
#define __get_rf_mode _Z13__get_rf_modev
251253
#define __run_user_rf_pre_init _Z22__run_user_rf_pre_initv
252254

253-
extern int __real_register_chipv6_phy(uint8_t* init_data);
254-
extern int __wrap_register_chipv6_phy(uint8_t* init_data)
255+
static bool spoof_init_data = false;
256+
257+
extern int __real_spi_flash_read(uint32_t addr, uint32_t* dst, size_t size);
258+
extern int ICACHE_RAM_ATTR __wrap_spi_flash_read(uint32_t addr, uint32_t* dst, size_t size);
259+
260+
extern int ICACHE_RAM_ATTR __wrap_spi_flash_read(uint32_t addr, uint32_t* dst, size_t size)
255261
{
256-
if (init_data != NULL) {
257-
memcpy(init_data, phy_init_data, sizeof(phy_init_data));
258-
init_data[107] = __get_adc_mode();
262+
if (!spoof_init_data || size != 128) {
263+
return __real_spi_flash_read(addr, dst, size);
259264
}
260-
return __real_register_chipv6_phy(init_data);
265+
266+
memcpy(dst, phy_init_data, sizeof(phy_init_data));
267+
((uint8_t*)dst)[107] = __get_adc_mode();
268+
return 0;
261269
}
262270

263271
extern int __get_rf_mode(void) __attribute__((weak));
@@ -278,10 +286,16 @@ extern void __run_user_rf_pre_init(void)
278286
return; // default do noting
279287
}
280288

289+
uint32_t user_rf_cal_sector_set(void)
290+
{
291+
spoof_init_data = true;
292+
return flashchip->chip_size/SPI_FLASH_SEC_SIZE - 4;
293+
}
294+
281295
void user_rf_pre_init()
282296
{
283297
// *((volatile uint32_t*) 0x60000710) = 0;
284-
298+
spoof_init_data = false;
285299
volatile uint32_t* rtc_reg = (volatile uint32_t*) 0x60001000;
286300
if((rtc_reg[24] >> 16) > 4) {
287301
rtc_reg[24] &= 0xFFFF;
@@ -295,3 +309,7 @@ void user_rf_pre_init()
295309
}
296310
__run_user_rf_pre_init();
297311
}
312+
313+
314+
void ICACHE_RAM_ATTR user_spi_flash_dio_to_qio_pre_init() {}
315+

cores/esp8266/core_esp8266_postmortem.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ static void print_stack(uint32_t start, uint32_t end);
4646
//static void print_pcs(uint32_t start, uint32_t end);
4747

4848
extern void __custom_crash_callback( struct rst_info * rst_info, uint32_t stack, uint32_t stack_end ) {
49+
(void) rst_info;
50+
(void) stack;
51+
(void) stack_end;
4952
}
5053

5154
extern void custom_crash_callback( struct rst_info * rst_info, uint32_t stack, uint32_t stack_end ) __attribute__ ((weak, alias("__custom_crash_callback")));
@@ -183,6 +186,7 @@ void abort(){
183186
}
184187

185188
void __assert_func(const char *file, int line, const char *func, const char *what) {
189+
(void) what;
186190
s_panic_file = file;
187191
s_panic_line = line;
188192
s_panic_func = func;

cores/esp8266/core_esp8266_timer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
static volatile timercallback timer1_user_cb = NULL;
3131

3232
void ICACHE_RAM_ATTR timer1_isr_handler(void *para){
33+
(void) para;
3334
if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
3435
T1I = 0;
3536
if (timer1_user_cb) {
@@ -77,6 +78,7 @@ void ICACHE_RAM_ATTR timer1_disable(){
7778
static volatile timercallback timer0_user_cb = NULL;
7879

7980
void ICACHE_RAM_ATTR timer0_isr_handler(void* para){
81+
(void) para;
8082
if (timer0_user_cb) {
8183
// to make ISR compatible to Arduino AVR model where interrupts are disabled
8284
// we disable them before we call the client ISR

cores/esp8266/core_esp8266_wiring.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static uint32_t micros_overflow_count = 0;
3636
#define REPEAT 1
3737

3838
void delay_end(void* arg) {
39+
(void) arg;
3940
esp_schedule();
4041
}
4142

@@ -53,6 +54,7 @@ void delay(unsigned long ms) {
5354
}
5455

5556
void micros_overflow_tick(void* arg) {
57+
(void) arg;
5658
uint32_t m = system_get_time();
5759
if(m < micros_at_last_overflow_tick)
5860
++micros_overflow_count;

cores/esp8266/core_esp8266_wiring_digital.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ static interrupt_handler_t interrupt_handlers[16];
115115
static uint32_t interrupt_reg = 0;
116116

117117
void ICACHE_RAM_ATTR interrupt_handler(void *arg) {
118+
(void) arg;
118119
uint32_t status = GPIE;
119120
GPIEC = status;//clear them interrupts
120121
uint32_t levels = GPI;

cores/esp8266/heap.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,60 @@
1010

1111
void* _malloc_r(struct _reent* unused, size_t size)
1212
{
13+
(void) unused;
1314
return malloc(size);
1415
}
1516

1617
void _free_r(struct _reent* unused, void* ptr)
1718
{
19+
(void) unused;
1820
return free(ptr);
1921
}
2022

2123
void* _realloc_r(struct _reent* unused, void* ptr, size_t size)
2224
{
25+
(void) unused;
2326
return realloc(ptr, size);
2427
}
2528

2629
void* _calloc_r(struct _reent* unused, size_t count, size_t size)
2730
{
31+
(void) unused;
2832
return calloc(count, size);
2933
}
3034

3135
void* ICACHE_RAM_ATTR pvPortMalloc(size_t size, const char* file, int line)
3236
{
37+
(void) file;
38+
(void) line;
3339
return malloc(size);
3440
}
3541

3642
void ICACHE_RAM_ATTR vPortFree(void *ptr, const char* file, int line)
3743
{
44+
(void) file;
45+
(void) line;
3846
free(ptr);
3947
}
4048

4149
void* ICACHE_RAM_ATTR pvPortCalloc(size_t count, size_t size, const char* file, int line)
4250
{
51+
(void) file;
52+
(void) line;
4353
return calloc(count, size);
4454
}
4555

4656
void* ICACHE_RAM_ATTR pvPortRealloc(void *ptr, size_t size, const char* file, int line)
4757
{
58+
(void) file;
59+
(void) line;
4860
return realloc(ptr, size);
4961
}
5062

5163
void* ICACHE_RAM_ATTR pvPortZalloc(size_t size, const char* file, int line)
5264
{
65+
(void) file;
66+
(void) line;
5367
return calloc(1, size);
5468
}
5569

cores/esp8266/libc_replacements.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ int ICACHE_RAM_ATTR _read_r(struct _reent* unused, int file, char *ptr, int len)
8383
}
8484

8585
int ICACHE_RAM_ATTR _write_r(struct _reent* r, int file, char *ptr, int len) {
86+
(void) r;
8687
if (file == STDOUT_FILENO) {
8788
while(len--) {
8889
ets_putc(*ptr);
@@ -93,6 +94,7 @@ int ICACHE_RAM_ATTR _write_r(struct _reent* r, int file, char *ptr, int len) {
9394
}
9495

9596
int ICACHE_RAM_ATTR _putc_r(struct _reent* r, int c, FILE* file) {
97+
(void) r;
9698
if (file->_file == STDOUT_FILENO) {
9799
return ets_putc(c);
98100
}

cores/esp8266/spiffs/spiffs_hydrogen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh);
2222

2323
#if SPIFFS_BUFFER_HELP
2424
u32_t SPIFFS_buffer_bytes_for_filedescs(spiffs *fs, u32_t num_descs) {
25+
(void) fs;
2526
return num_descs * sizeof(spiffs_fd);
2627
}
2728
#if SPIFFS_CACHE

cores/esp8266/spiffs_api.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ class SPIFFSImpl : public FSImpl
4949
{
5050
public:
5151
SPIFFSImpl(uint32_t start, uint32_t size, uint32_t pageSize, uint32_t blockSize, uint32_t maxOpenFds)
52-
: _fs({0})
53-
, _start(start)
52+
: _start(start)
5453
, _size(size)
5554
, _pageSize(pageSize)
5655
, _blockSize(blockSize)
5756
, _maxOpenFds(maxOpenFds)
5857
{
58+
memset(&_fs, 0, sizeof(_fs));
5959
}
6060

6161
FileImplPtr open(const char* path, OpenMode openMode, AccessMode accessMode) override;
@@ -176,7 +176,8 @@ class SPIFFSImpl : public FSImpl
176176

177177
bool _tryMount()
178178
{
179-
spiffs_config config = {0};
179+
spiffs_config config;
180+
memset(&config, 0, sizeof(config));
180181

181182
config.hal_read_f = &spiffs_hal_read;
182183
config.hal_write_f = &spiffs_hal_write;
@@ -242,6 +243,11 @@ class SPIFFSImpl : public FSImpl
242243
static void _check_cb(spiffs_check_type type, spiffs_check_report report,
243244
uint32_t arg1, uint32_t arg2)
244245
{
246+
(void) type;
247+
(void) report;
248+
(void) arg1;
249+
(void) arg2;
250+
245251
// TODO: spiffs doesn't pass any context pointer along with _check_cb,
246252
// so we can't do anything useful here other than perhaps
247253
// feeding the watchdog
@@ -268,9 +274,9 @@ class SPIFFSFileImpl : public FileImpl
268274
SPIFFSFileImpl(SPIFFSImpl* fs, spiffs_file fd)
269275
: _fs(fs)
270276
, _fd(fd)
271-
, _stat({0})
272277
, _written(false)
273278
{
279+
memset(&_stat, 0, sizeof(_stat));
274280
_getStat();
275281
}
276282

@@ -376,7 +382,7 @@ class SPIFFSFileImpl : public FileImpl
376382
auto rc = SPIFFS_fstat(_fs->getFs(), _fd, &_stat);
377383
if (rc != SPIFFS_OK) {
378384
DEBUGV("SPIFFS_fstat rc=%d\r\n", rc);
379-
_stat = {0};
385+
memset(&_stat, 0, sizeof(_stat));
380386
}
381387
_written = false;
382388
}

cores/esp8266/time.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ void configTime(int timezone, int daylightOffset_sec, const char* server1, const
7777

7878
int clock_gettime(clockid_t unused, struct timespec *tp)
7979
{
80+
(void) unused;
8081
tp->tv_sec = millis() / 1000;
8182
tp->tv_nsec = micros() * 1000;
8283
return 0;
@@ -94,6 +95,8 @@ time_t time(time_t * t)
9495

9596
int _gettimeofday_r(struct _reent* unused, struct timeval *tp, void *tzp)
9697
{
98+
(void) unused;
99+
(void) tzp;
97100
if (tp)
98101
{
99102
ensureBootTimeIsSet();

cores/esp8266/uart.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ bool uart_rx_enabled(uart_t* uart)
480480

481481
static void uart_ignore_char(char c)
482482
{
483+
(void) c;
483484
}
484485

485486
static void uart0_write_char(char c)

libraries/ESP8266WebServer/src/Parsing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ uint8_t ESP8266WebServer::_uploadReadByte(WiFiClient& client){
361361
}
362362

363363
bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){
364-
364+
(void) len;
365365
#ifdef DEBUG_ESP_HTTP_SERVER
366366
DEBUG_OUTPUT.print("Parse Form: Boundary: ");
367367
DEBUG_OUTPUT.print(boundary);

0 commit comments

Comments
 (0)