Skip to content

Commit 1027d38

Browse files
committed
ESP8266: Support building with SDK 3.0 and 2.2
1 parent a07cbde commit 1027d38

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

platforms/esp8266/Makefile.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ VPATH = $(MGOS_VPATH) $(APP_SOURCE_DIRS) $(MGOS_SRC_PATH) \
128128
$(MGOS_ESP_SRC_PATH)
129129
IPATH = $(MGOS_IPATH) $(sort $(APP_SOURCE_DIRS) $(APP_INCLUDES)) \
130130
$(MGOS_ESP8266_PATH)/include $(MGOS_ESP8266_PATH)/include/spiffs \
131-
$(BOOTLOADER_PATH)/rboot $(SDK_PATH)/include/lwip \
132-
$(SDK_PATH) $(SDK_PATH)/include \
131+
$(BOOTLOADER_PATH)/rboot \
133132
$(MGOS_ESP_SRC_PATH)
134133
LPATH = $(SDK_PATH)/lib $(BUILD_DIR)/lwip
135134

platforms/esp8266/src/esp_main.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "esp_missing_includes.h"
2121

2222
#include <user_interface.h>
23+
#include "version.h"
2324

2425
#include "common/cs_dbg.h"
2526
#include "mgos_app.h"
@@ -267,6 +268,7 @@ void user_init(void) {
267268
system_init_done_cb(sdk_init_done_cb);
268269
}
269270

271+
#if ESP_SDK_VERSION_MAJOR >= 3
270272
#if !defined(FW_RF_CAL_DATA_ADDR) || !defined(FW_SYS_PARAMS_ADDR)
271273
#error FW_RF_CAL_DATA_ADDR or FW_SYS_PARAMS_ADDR are not defined
272274
#endif
@@ -316,3 +318,19 @@ void user_pre_init(void) {
316318
__libc_init_array(); /* C++ global contructors. */
317319
mgos_app_preinit();
318320
}
321+
#else
322+
#ifndef FW_RF_CAL_DATA_ADDR
323+
#error FW_RF_CAL_DATA_ADDR is not defined
324+
#endif
325+
uint32_t user_rf_cal_sector_set(void) {
326+
/* Defined externally. */
327+
return FW_RF_CAL_DATA_ADDR / 4096;
328+
}
329+
330+
void user_rf_pre_init(void) {
331+
esp_exception_handler_init();
332+
esp_core_dump_init();
333+
__libc_init_array(); /* C++ global contructors. */
334+
mgos_app_preinit();
335+
}
336+
#endif

0 commit comments

Comments
 (0)