diff --git a/bootloaders/eboot/eboot.c b/bootloaders/eboot/eboot.c index bf8a53115..1ca64a16a 100644 --- a/bootloaders/eboot/eboot.c +++ b/bootloaders/eboot/eboot.c @@ -21,20 +21,20 @@ extern unsigned char _gzip_dict; extern void ets_wdt_enable(void); extern void ets_wdt_disable(void); +// Converts bit of a string into a uint32 +#define S(a,b,c,d) ( (((uint32_t)a) & 0xff) | (((uint32_t)b) << 8) | (((uint32_t)c) << 16) | (((uint32_t)d)<<24) ) + int print_version(const uint32_t flash_addr) { uint32_t ver; if (SPIRead(flash_addr + APP_START_OFFSET + sizeof(image_header_t) + sizeof(section_header_t), &ver, sizeof(ver))) { return 1; } - char fmt[7]; - fmt[0] = 'v'; - fmt[1] = '%'; - fmt[2] = '0'; - fmt[3] = '8'; - fmt[4] = 'x'; - fmt[5] = '\n'; - fmt[6] = 0; + // We don't have BSS and can't print from flash, so build up string + // 4 chars at a time. Smaller code than byte-wise assignment. + uint32_t fmt[2]; + fmt[0] = S('v', '%', '0', '8'); + fmt[1] = S('x', '\n', 0, 0); ets_printf((const char*) fmt, ver); return 0; } @@ -234,26 +234,32 @@ int main() } if (cmd.action == ACTION_COPY_RAW) { - ets_putc('c'); ets_putc('p'); ets_putc(':'); + uint32_t cp = S('c', 'p', ':', 0); + ets_printf((const char *)cp); ets_wdt_disable(); res = copy_raw(cmd.args[0], cmd.args[1], cmd.args[2], false); ets_wdt_enable(); - ets_putc('0'+res); ets_putc('\n'); + cp = S('0' + res, '\n', 0, 0 ); + ets_printf((const char *)cp); #if 0 //devyte: this verify step below (cmp:) only works when the end of copy operation above does not overwrite the //beginning of the image in the empty area, see #7458. Disabling for now. //TODO: replace the below verify with hash type, crc, or similar. // Verify the copy - ets_putc('c'); ets_putc('m'); ets_putc('p'); ets_putc(':'); + uint32_t v[2]; + v[0] = S('c', 'm', 'p', ':'); + v[1] = 0; + ets_printf(const char *)v); if (res == 0) { ets_wdt_disable(); res = copy_raw(cmd.args[0], cmd.args[1], cmd.args[2], true); ets_wdt_enable(); } - ets_putc('0'+res); ets_putc('\n'); + cp = S('0' + res, '\n', 0, 0 ); + ets_printf((const char *)cp); #endif if (res == 0) { cmd.action = ACTION_LOAD_APP; @@ -268,8 +274,11 @@ int main() if (cmd.action == ACTION_LOAD_APP) { ets_putc('l'); ets_putc('d'); ets_putc('\n'); res = load_app_from_flash_raw(cmd.args[0]); - //we will get to this only on load fail - ets_putc('e'); ets_putc(':'); ets_putc('0'+res); ets_putc('\n'); + // We will get to this only on load fail + uint32_t e[2]; + e[0] = S('e', ':', '0' + res, '\n' ); + e[1] = 0; + ets_printf((const char*)e); } if (res) { diff --git a/bootloaders/eboot/eboot.elf b/bootloaders/eboot/eboot.elf index 48b354389..e7e1fc543 100755 Binary files a/bootloaders/eboot/eboot.elf and b/bootloaders/eboot/eboot.elf differ diff --git a/cores/esp8266/Schedule.cpp b/cores/esp8266/Schedule.cpp index 9cb86c8d1..5ac887ce1 100644 --- a/cores/esp8266/Schedule.cpp +++ b/cores/esp8266/Schedule.cpp @@ -1,3 +1,20 @@ +/* + Schedule.cpp - Scheduled functions. + Copyright (c) 2020 esp8266/Arduino + + This file is part of the esp8266 core for Arduino environment. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include diff --git a/cores/esp8266/Schedule.h b/cores/esp8266/Schedule.h index 48111c33e..da86e5b7f 100644 --- a/cores/esp8266/Schedule.h +++ b/cores/esp8266/Schedule.h @@ -1,3 +1,21 @@ +/* + Schedule.h - Header file for scheduled functions. + Copyright (c) 2020 esp8266/Arduino + + This file is part of the esp8266 core for Arduino environment. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + #ifndef ESP_SCHEDULE_H #define ESP_SCHEDULE_H diff --git a/libraries/EEPROM/EEPROM.cpp b/libraries/EEPROM/EEPROM.cpp index 0ea72ceca..90bc5d178 100644 --- a/libraries/EEPROM/EEPROM.cpp +++ b/libraries/EEPROM/EEPROM.cpp @@ -72,17 +72,22 @@ void EEPROMClass::begin(size_t size) { _dirty = false; //make sure dirty is cleared in case begin() is called 2nd+ time } -void EEPROMClass::end() { - if (!_size) - return; +bool EEPROMClass::end() { + bool retval; - commit(); + if(!_size) { + return false; + } + + retval = commit(); if(_data) { delete[] _data; } _data = 0; _size = 0; _dirty = false; + + return retval; } diff --git a/libraries/EEPROM/EEPROM.h b/libraries/EEPROM/EEPROM.h index e1d804425..18774c465 100644 --- a/libraries/EEPROM/EEPROM.h +++ b/libraries/EEPROM/EEPROM.h @@ -35,7 +35,7 @@ public: uint8_t read(int const address); void write(int const address, uint8_t const val); bool commit(); - void end(); + bool end(); uint8_t * getDataPtr(); uint8_t const * getConstDataPtr() const; diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp index 1df25be3e..fb23b35e8 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp @@ -254,7 +254,7 @@ void ESP8266WiFiGenericClass::_eventCallback(void* arg) * Return the current channel associated with the network * @return channel (1-13) */ -int32_t ESP8266WiFiGenericClass::channel(void) { +uint8_t ESP8266WiFiGenericClass::channel(void) { return wifi_get_channel(); } diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h b/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h index b5f307aed..815c26b6d 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h @@ -74,7 +74,7 @@ class ESP8266WiFiGenericClass { WiFiEventHandler onSoftAPModeProbeRequestReceived(std::function); WiFiEventHandler onWiFiModeChange(std::function); - int32_t channel(void); + uint8_t channel(void); bool setSleepMode(WiFiSleepType_t type, uint8_t listenInterval = 0); diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp index 65f0ea35a..0959bba7c 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp @@ -686,7 +686,7 @@ String ESP8266WiFiSTAClass::BSSIDstr(void) { * Return the current network RSSI. * @return RSSI value */ -int32_t ESP8266WiFiSTAClass::RSSI(void) { +int8_t ESP8266WiFiSTAClass::RSSI(void) { return wifi_station_get_rssi(); } diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h index cf38e1254..d845b290c 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h @@ -81,7 +81,7 @@ class ESP8266WiFiSTAClass { uint8_t * BSSID(); String BSSIDstr(); - int32_t RSSI(); + int8_t RSSI(); static void enableInsecureWEP (bool enable = true) { _useInsecureWEP = enable; } diff --git a/libraries/Netdump/library.properties b/libraries/Netdump/library.properties index 2f6ad5e22..bc23b9cee 100644 --- a/libraries/Netdump/library.properties +++ b/libraries/Netdump/library.properties @@ -6,4 +6,4 @@ sentence=tcpdump-like logger for esp8266/Arduino paragraph=Dumps input / output packets on "Print"able type, or provide a TCP server for the real tcpdump. Check examples. Some other unrelated and independant tools are included. category=Communication url=https:// -architectures=esp8266 lwip +architectures=esp8266