Browse Source

Update to SDK 1.5.4.1 (#1390)

Arnim Läuger 7 years ago
parent
commit
84c005e85c
8 changed files with 90 additions and 15 deletions
  1. 31 6
      Makefile
  2. 3 3
      README.md
  3. 2 2
      app/include/user_version.h
  4. 4 1
      app/platform/cpu_esp8266.h
  5. 1 1
      app/spiffs/spiffs.c
  6. 45 0
      app/user/user_main.c
  7. 0 0
      docs/en/flash.md
  8. 4 2
      tools/spiffsimg/main.c

+ 31 - 6
Makefile

@@ -3,10 +3,21 @@
 .NOTPARALLEL:
 
 # SDK version NodeMCU is locked to
-SDK_VER:=1.5.4
-SDK_FILE_VER:=$(SDK_VER)_16_05_20
+SDK_VER:=1.5.4.1
+
+# no patch: SDK_BASE_VER equals SDK_VER and sdk dir depends on sdk_extracted
+#SDK_BASE_VER:=SDK_VER
+#SDK_DIR_DEPENDS:=sdk_extracted
+# with patch: SDK_BASE_VER differs from SDK_VER and sdk dir depends on sdk_patched
+SDK_BASE_VER:=1.5.4
+SDK_DIR_DEPENDS:=sdk_patched
+
+SDK_FILE_VER:=$(SDK_BASE_VER)_16_05_20
 SDK_FILE_ID:=1469
 SDK_FILE_SHA1:=868784bd37d47f31d52b81f133aa1fb70c58e17d
+SDK_PATCH_VER:=$(SDK_VER)_patch_20160704
+SDK_PATCH_ID:=1572
+SDK_PATCH_SHA1:=388d9e91df74e3b49fca126da482cf822cf1ebf1
 # Ensure we search "our" SDK before the tool-chain's SDK (if any)
 TOP_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
 SDK_DIR:=$(TOP_DIR)/sdk/esp_iot_sdk_v$(SDK_VER)
@@ -179,24 +190,38 @@ $(BINODIR)/%.bin: $(IMAGEODIR)/%.out
 # Should be done in top-level makefile only
 #
 
-all:	sdk_extracted pre_build .subdirs $(OBJS) $(OLIBS) $(OIMAGES) $(OBINS) $(SPECIAL_MKTARGETS)
+all:	$(SDK_DIR_DEPENDS) pre_build .subdirs $(OBJS) $(OLIBS) $(OIMAGES) $(OBINS) $(SPECIAL_MKTARGETS)
 
 .PHONY: sdk_extracted
+.PHONY: sdk_patched
 
-sdk_extracted: $(TOP_DIR)/sdk/.extracted-$(SDK_VER)
+sdk_extracted: $(TOP_DIR)/sdk/.extracted-$(SDK_BASE_VER)
+sdk_patched: sdk_extracted $(TOP_DIR)/sdk/.patched-$(SDK_VER)
 
-$(TOP_DIR)/sdk/.extracted-$(SDK_VER): $(TOP_DIR)/cache/esp_iot_sdk_v$(SDK_FILE_VER).zip
+$(TOP_DIR)/sdk/.extracted-$(SDK_BASE_VER): $(TOP_DIR)/cache/esp_iot_sdk_v$(SDK_FILE_VER).zip
 	mkdir -p "$(dir $@)"
-	(cd "$(dir $@)" && rm -fr esp_iot_sdk_v$(SDK_VER) ESP8266_NONOS_SDK && unzip $(TOP_DIR)/cache/esp_iot_sdk_v$(SDK_VER)*.zip ESP8266_NONOS_SDK/lib/* ESP8266_NONOS_SDK/ld/eagle.rom.addr.v6.ld ESP8266_NONOS_SDK/include/* )
+	(cd "$(dir $@)" && rm -fr esp_iot_sdk_v$(SDK_VER) ESP8266_NONOS_SDK && unzip $(TOP_DIR)/cache/esp_iot_sdk_v$(SDK_FILE_VER).zip ESP8266_NONOS_SDK/lib/* ESP8266_NONOS_SDK/ld/eagle.rom.addr.v6.ld ESP8266_NONOS_SDK/include/* )
 	mv $(dir $@)/ESP8266_NONOS_SDK $(dir $@)/esp_iot_sdk_v$(SDK_VER)
 	rm -f $(SDK_DIR)/lib/liblwip.a
 	touch $@
 
+$(TOP_DIR)/sdk/.patched-$(SDK_VER): $(TOP_DIR)/cache/esp_iot_sdk_v$(SDK_PATCH_VER).zip
+	mkdir -p "$(dir $@)/patch"
+	(cd "$(dir $@)/patch" && unzip $(TOP_DIR)/cache/esp_iot_sdk_v$(SDK_PATCH_VER)*.zip *.a && mv *.a $(SDK_DIR)/lib/)
+	rmdir $(dir $@)/patch
+	rm -f $(SDK_DIR)/lib/liblwip.a
+	touch $@
+
 $(TOP_DIR)/cache/esp_iot_sdk_v$(SDK_FILE_VER).zip:
 	mkdir -p "$(dir $@)"
 	wget --tries=10 --timeout=15 --waitretry=30 --read-timeout=20 --retry-connrefused http://bbs.espressif.com/download/file.php?id=$(SDK_FILE_ID) -O $@ || { rm -f "$@"; exit 1; }
 	(echo "$(SDK_FILE_SHA1)  $@" | sha1sum -c -) || { rm -f "$@"; exit 1; }
 
+$(TOP_DIR)/cache/esp_iot_sdk_v$(SDK_PATCH_VER).zip:
+	mkdir -p "$(dir $@)"
+	wget --tries=10 --timeout=15 --waitretry=30 --read-timeout=20 --retry-connrefused http://bbs.espressif.com/download/file.php?id=$(SDK_PATCH_ID) -O $@ || { rm -f "$@"; exit 1; }
+	(echo "$(SDK_PATCH_SHA1)  $@" | sha1sum -c -) || { rm -f "$@"; exit 1; }
+
 clean:
 	$(foreach d, $(SUBDIRS), $(MAKE) -C $(d) clean;)
 	$(RM) -r $(ODIR)/$(TARGET)/$(FLAVOR)

+ 3 - 3
README.md

@@ -1,4 +1,4 @@
-# **NodeMCU 1.5.4** #
+# **NodeMCU 1.5.4.1** #
 
 [![Join the chat at https://gitter.im/nodemcu/nodemcu-firmware](https://img.shields.io/gitter/room/badges/shields.svg)](https://gitter.im/nodemcu/nodemcu-firmware?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 [![Build Status](https://travis-ci.org/nodemcu/nodemcu-firmware.svg)](https://travis-ci.org/nodemcu/nodemcu-firmware)
@@ -7,7 +7,7 @@
 
 ### A Lua based firmware for ESP8266 WiFi SOC
 
-NodeMCU is an [eLua](http://www.eluaproject.net/) based firmware for the [ESP8266 WiFi SOC from Espressif](http://espressif.com/en/products/esp8266/). The firmware is based on the [Espressif NON-OS SDK 1.5.4](http://bbs.espressif.com/viewtopic.php?f=46&t=2198) and uses a file system based on [spiffs](https://github.com/pellepl/spiffs). The code repository consists of 98.1% C-code that glues the thin Lua veneer to the SDK.
+NodeMCU is an [eLua](http://www.eluaproject.net/) based firmware for the [ESP8266 WiFi SOC from Espressif](http://espressif.com/en/products/esp8266/). The firmware is based on the [Espressif NON-OS SDK 1.5.4.1](http://bbs.espressif.com/viewtopic.php?f=46&t=2376) and uses a file system based on [spiffs](https://github.com/pellepl/spiffs). The code repository consists of 98.1% C-code that glues the thin Lua veneer to the SDK.
 
 The NodeMCU *firmware* is a companion project to the popular [NodeMCU dev kits](https://github.com/nodemcu/nodemcu-devkit-v1.0), ready-made open source development boards with ESP8266-12E chips.
 
@@ -90,7 +90,7 @@ Edit `app/include/user_modules.h` and comment-out the `#define` statement for mo
 Identify your firmware builds by editing `app/include/user_version.h`
 
 ```c
-#define NODE_VERSION    "NodeMCU 1.5.4+myname"
+#define NODE_VERSION    "NodeMCU 1.5.4.1+myname"
 #ifndef BUILD_DATE
 #define BUILD_DATE      "YYYYMMDD"
 #endif

+ 2 - 2
app/include/user_version.h

@@ -4,9 +4,9 @@
 #define NODE_VERSION_MAJOR		1U
 #define NODE_VERSION_MINOR		5U
 #define NODE_VERSION_REVISION	4U
-#define NODE_VERSION_INTERNAL   0U
+#define NODE_VERSION_INTERNAL   1U
 
-#define NODE_VERSION	"NodeMCU 1.5.4"
+#define NODE_VERSION	"NodeMCU 1.5.4.1"
 #ifndef BUILD_DATE
 #define BUILD_DATE	  "unspecified"
 #endif

+ 4 - 1
app/platform/cpu_esp8266.h

@@ -1,11 +1,13 @@
 #ifndef __CPU_ESP8266_H__
 #define __CPU_ESP8266_H__
 
+#ifndef NO_CPU_ESP8266_INCLUDE
 #include "os_type.h"
 #include "spi_flash.h"
 #include "pin_map.h"
 #include "user_config.h"
 #include "flash_api.h"
+#endif
 // Number of resources (0 if not available/not implemented)
 #define NUM_GPIO              GPIO_PIN_NUM
 #define NUM_SPI               2
@@ -38,7 +40,8 @@
 #else
 #define FLASH_SEC_NUM 	0x80
 #endif
-#define SYS_PARAM_SEC_NUM 4
+// SDK 1.5.4.1 added 1 sector for rf_cal
+#define SYS_PARAM_SEC_NUM 5
 #define SYS_PARAM_SEC_START (FLASH_SEC_NUM - SYS_PARAM_SEC_NUM)
 
 #define INTERNAL_FLASH_SECTOR_SIZE      SPI_FLASH_SEC_SIZE

+ 1 - 1
app/spiffs/spiffs.c

@@ -55,7 +55,7 @@ static bool myspiffs_set_location(spiffs_config *cfg, int align, int offset, int
   cfg->phys_addr = (cfg->phys_addr + align - 1) & ~(align - 1);
 #endif
 #ifdef SPIFFS_SIZE_1M_BOUNDARY
-  cfg->phys_size = ((0x100000 - 16384 - ( ( u32_t )cfg->phys_addr )) & ~(block_size - 1)) & 0xfffff;
+  cfg->phys_size = ((0x100000 - (SYS_PARAM_SEC_NUM * INTERNAL_FLASH_SECTOR_SIZE) - ( ( u32_t )cfg->phys_addr )) & ~(block_size - 1)) & 0xfffff;
 #else
   cfg->phys_size = (INTERNAL_FLASH_SIZE - ( ( u32_t )cfg->phys_addr )) & ~(block_size - 1);
 #endif

+ 45 - 0
app/user/user_main.c

@@ -125,6 +125,51 @@ void user_rf_pre_init(void)
 }
 #endif
 
+/******************************************************************************
+ * FunctionName : user_rf_cal_sector_set
+ * Description  : SDK just reversed 4 sectors, used for rf init data and paramters.
+ *                We add this function to force users to set rf cal sector, since
+ *                we don't know which sector is free in user's application.
+ *                sector map for last several sectors : ABCCC
+ *                A : rf cal
+ *                B : rf init data
+ *                C : sdk parameters
+ * Parameters   : none
+ * Returns      : rf cal sector
+*******************************************************************************/
+uint32
+user_rf_cal_sector_set(void)
+{
+    enum flash_size_map size_map = system_get_flash_size_map();
+    uint32 rf_cal_sec = 0;
+
+    switch (size_map) {
+        case FLASH_SIZE_4M_MAP_256_256:
+            rf_cal_sec = 128 - 5;
+            break;
+
+        case FLASH_SIZE_8M_MAP_512_512:
+            rf_cal_sec = 256 - 5;
+            break;
+
+        case FLASH_SIZE_16M_MAP_512_512:
+        case FLASH_SIZE_16M_MAP_1024_1024:
+            rf_cal_sec = 512 - 5;
+            break;
+
+        case FLASH_SIZE_32M_MAP_512_512:
+        case FLASH_SIZE_32M_MAP_1024_1024:
+            rf_cal_sec = 1024 - 5;
+            break;
+
+        default:
+            rf_cal_sec = 0;
+            break;
+    }
+
+    return rf_cal_sec;
+}
+
 /******************************************************************************
  * FunctionName : user_init
  * Description  : entry of user application, init user function here

File diff suppressed because it is too large
+ 0 - 0
docs/en/flash.md


+ 4 - 2
tools/spiffsimg/main.c

@@ -42,6 +42,8 @@
 #include <sys/mman.h>
 #include <errno.h>
 #include "spiffs.h"
+#define NO_CPU_ESP8266_INCLUDE
+#include "../platform/cpu_esp8266.h"
 
 static spiffs fs;
 static uint8_t *flash;
@@ -267,7 +269,7 @@ int main (int argc, char *argv[])
       if (!flashsize || !used) {
 	die("Missing flashSize or Used");
       }
-      sz = flashsize - used - 4 * 4096;   // This leaves space for the parameter area
+      sz = flashsize - used - SYS_PARAM_SEC_NUM * 4096;   // This leaves space for the parameter area
       if (sz < 0x4000) {
 	die("Not enough space");
       }
@@ -276,7 +278,7 @@ int main (int argc, char *argv[])
       } else {
 	used = (used + 0x1fff) & ~0x1fff;
       }
-      sz = flashsize - used - 4 * 4096;
+      sz = flashsize - used - SYS_PARAM_SEC_NUM * 4096;
     }
     sz &= ~(0x1fff);
 

Some files were not shown because too many files changed in this diff