diff --git a/README.md b/README.md index 7bec8688..88e9cd09 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # **NodeMcu** # -version 0.9.4 +version 0.9.5 ###A lua based firmware for wifi-soc esp8266 -Build on [ESP8266 sdk 0.9.4](http://bbs.espressif.com/viewtopic.php?f=5&t=90)
+Build on [ESP8266 sdk 0.9.5](http://bbs.espressif.com/viewtopic.php?f=7&t=104)
Lua core based on [eLua project](http://www.eluaproject.net/)
File system based on [spiffs](https://github.com/pellepl/spiffs)
Open source development kit for NodeMCU [nodemcu-devkit](https://github.com/nodemcu/nodemcu-devkit)
@@ -13,6 +13,13 @@ bbs: [中文论坛Chinese bbs](http://bbs.nodemcu.com)
Tencent QQ group QQ群: 309957875
# Change log +2015-01-05
+update sdk to 0.9.5.
+pre_build bin now compiled by gcc toolchain.
+memory/heap usage optimized.
+add support for multiple platform and toolchain include eclipse.
+combine firmware for 512K, 1M, 2M, 4M flash to one. flash size auto-detected. + 2014-12-30
modify uart.on api, when run_input set to 0, uart.on now can read raw data from uart.
serial input now accept non-ascii chars.
@@ -101,10 +108,11 @@ add tmr.time() api to get rtc time and calibration. ####*GNU toolchain is not tested* ####file ./app/include/user_config.h ```c -#define FLASH_512K +// #define FLASH_512K // #define FLASH_1M // #define FLASH_2M // #define FLASH_4M +#define FLASH_AUTOSIZE ... #define LUA_USE_MODULES #ifdef LUA_USE_MODULES @@ -119,12 +127,12 @@ add tmr.time() api to get rtc time and calibration. #define LUA_USE_MODULES_ADC #define LUA_USE_MODULES_UART #define LUA_USE_MODULES_OW -//#define LUA_USE_MODULES_BIT +#define LUA_USE_MODULES_BIT #endif /* LUA_USE_MODULES */ ``` #Flash the firmware -nodemcu_512k.bin: 0x00000
+nodemcu_latest.bin: 0x00000
for most esp8266 modules, just pull GPIO0 down and restart.
You can use the [nodemcu-flasher](https://github.com/nodemcu/nodemcu-flasher) to burn the firmware. diff --git a/app/platform/flash_api.c b/app/platform/flash_api.c index c5f26d40..47a35ec6 100644 --- a/app/platform/flash_api.c +++ b/app/platform/flash_api.c @@ -171,6 +171,20 @@ uint32_t flash_get_speed(void) return speed; } +bool flash_init_data_written(void) +{ + // FLASH SEC - 4 + // Dangerous, here are dinosaur infested!!!!! + // Reboot required!!! + // It will init system data to default! + uint32_t data[2] ICACHE_STORE_ATTR; + SPIRead((flash_get_sec_num() - 4) * SPI_FLASH_SEC_SIZE, data, sizeof(data)); + if(data[0] == 0xFFFFFFFF && data[1] == 0xFFFFFFFF) { + return false; + } + return true; +} + bool flash_init_data_default(void) { // FLASH SEC - 4 diff --git a/app/platform/flash_api.h b/app/platform/flash_api.h index bbdd7530..593741c8 100644 --- a/app/platform/flash_api.h +++ b/app/platform/flash_api.h @@ -41,6 +41,7 @@ bool flash_set_size_byte(uint32_t); uint16_t flash_get_sec_num(void); uint8_t flash_get_mode(void); uint32_t flash_get_speed(void); +bool flash_init_data_written(void); bool flash_init_data_default(void); bool flash_init_data_blank(void); bool flash_self_destruct(void); diff --git a/app/user/user_main.c b/app/user/user_main.c index c6ea7d84..b6b141b8 100644 --- a/app/user/user_main.c +++ b/app/user/user_main.c @@ -96,6 +96,10 @@ void user_init(void) // test_romfs(); #elif defined ( BUILD_SPIFFS ) spiffs_mount(); + if(!flash_init_data_written()){ + NODE_ERR("Restore init data.\n"); + flash_init_data_default(); + } // test_spiffs(); #endif // endpoint_setup(); diff --git a/pre_build/0.9.5/nodemcu_20150105.bin b/pre_build/0.9.5/nodemcu_20150105.bin new file mode 100644 index 00000000..fd9f281c Binary files /dev/null and b/pre_build/0.9.5/nodemcu_20150105.bin differ diff --git a/pre_build/0.9.5/nodemcu_latest.bin b/pre_build/0.9.5/nodemcu_latest.bin new file mode 100644 index 00000000..fd9f281c Binary files /dev/null and b/pre_build/0.9.5/nodemcu_latest.bin differ diff --git a/pre_build/latest/nodemcu_512k_latest.bin b/pre_build/latest/nodemcu_512k_latest.bin index c546e899..fd9f281c 100644 Binary files a/pre_build/latest/nodemcu_512k_latest.bin and b/pre_build/latest/nodemcu_512k_latest.bin differ diff --git a/pre_build/latest/nodemcu_latest.bin b/pre_build/latest/nodemcu_latest.bin new file mode 100644 index 00000000..fd9f281c Binary files /dev/null and b/pre_build/latest/nodemcu_latest.bin differ