Skip to content

Commit

Permalink
ESP8266: Support building with SDK 3.0 and 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rojer committed Mar 1, 2021
1 parent a07cbde commit 1027d38
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 1 addition & 2 deletions platforms/esp8266/Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ VPATH = $(MGOS_VPATH) $(APP_SOURCE_DIRS) $(MGOS_SRC_PATH) \
$(MGOS_ESP_SRC_PATH)
IPATH = $(MGOS_IPATH) $(sort $(APP_SOURCE_DIRS) $(APP_INCLUDES)) \
$(MGOS_ESP8266_PATH)/include $(MGOS_ESP8266_PATH)/include/spiffs \
$(BOOTLOADER_PATH)/rboot $(SDK_PATH)/include/lwip \
$(SDK_PATH) $(SDK_PATH)/include \
$(BOOTLOADER_PATH)/rboot \
$(MGOS_ESP_SRC_PATH)
LPATH = $(SDK_PATH)/lib $(BUILD_DIR)/lwip

Expand Down
18 changes: 18 additions & 0 deletions platforms/esp8266/src/esp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "esp_missing_includes.h"

#include <user_interface.h>
#include "version.h"

#include "common/cs_dbg.h"
#include "mgos_app.h"
Expand Down Expand Up @@ -267,6 +268,7 @@ void user_init(void) {
system_init_done_cb(sdk_init_done_cb);
}

#if ESP_SDK_VERSION_MAJOR >= 3
#if !defined(FW_RF_CAL_DATA_ADDR) || !defined(FW_SYS_PARAMS_ADDR)
#error FW_RF_CAL_DATA_ADDR or FW_SYS_PARAMS_ADDR are not defined
#endif
Expand Down Expand Up @@ -316,3 +318,19 @@ void user_pre_init(void) {
__libc_init_array(); /* C++ global contructors. */
mgos_app_preinit();
}
#else
#ifndef FW_RF_CAL_DATA_ADDR
#error FW_RF_CAL_DATA_ADDR is not defined
#endif
uint32_t user_rf_cal_sector_set(void) {
/* Defined externally. */
return FW_RF_CAL_DATA_ADDR / 4096;
}

void user_rf_pre_init(void) {
esp_exception_handler_init();
esp_core_dump_init();
__libc_init_array(); /* C++ global contructors. */
mgos_app_preinit();
}
#endif

0 comments on commit 1027d38

Please sign in to comment.