diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-03 12:39:57 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-03 12:39:57 +0200 |
commit | 934bbf7d019e561209802f6a679b3672ce58ef1a (patch) | |
tree | a558a8344aabfdf98d4a8bf0a1776bcc500bad39 | |
parent | 1ab751428b65cab4d31f323eb3c31789321a0db6 (diff) | |
download | modern-esp-sandbox-934bbf7d019e561209802f6a679b3672ce58ef1a.tar.gz modern-esp-sandbox-934bbf7d019e561209802f6a679b3672ce58ef1a.tar.bz2 modern-esp-sandbox-934bbf7d019e561209802f6a679b3672ce58ef1a.tar.xz modern-esp-sandbox-934bbf7d019e561209802f6a679b3672ce58ef1a.zip |
wip. Making room for other apps.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | mqtt-test/Makefile (renamed from Makefile) | 2 | ||||
-rw-r--r-- | mqtt-test/main/Kconfig (renamed from main/Kconfig) | 0 | ||||
-rw-r--r-- | mqtt-test/main/component.mk (renamed from main/component.mk) | 0 | ||||
-rw-r--r-- | mqtt-test/main/main.cpp (renamed from main/main.cpp) | 75 | ||||
-rw-r--r-- | mqtt-test/main/misc.c | 52 | ||||
-rw-r--r-- | mqtt-test/sdkconfig (renamed from sdkconfig) | 25 | ||||
m--------- | thirdparty/ESP8266_RTOS_SDK | 0 |
8 files changed, 71 insertions, 85 deletions
@@ -1,4 +1,4 @@ build sdkconfig.old -main/include/main-config.h +ignored diff --git a/Makefile b/mqtt-test/Makefile index a8e792b..73ada74 100644 --- a/Makefile +++ b/mqtt-test/Makefile @@ -5,6 +5,6 @@ PROJECT_NAME := mqtt_test -IDF_PATH=thirdparty/ESP8266_RTOS_SDK +IDF_PATH=../thirdparty/ESP8266_RTOS_SDK include $(IDF_PATH)/make/project.mk diff --git a/main/Kconfig b/mqtt-test/main/Kconfig index 11b89dc..11b89dc 100644 --- a/main/Kconfig +++ b/mqtt-test/main/Kconfig diff --git a/main/component.mk b/mqtt-test/main/component.mk index e102e7e..e102e7e 100644 --- a/main/component.mk +++ b/mqtt-test/main/component.mk diff --git a/main/main.cpp b/mqtt-test/main/main.cpp index 1a021b2..952982e 100644 --- a/main/main.cpp +++ b/mqtt-test/main/main.cpp @@ -11,14 +11,6 @@ #include <assert.h> -/* -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> -*/ - // Allow overriding configuration from Kconfig. #ifndef WIFI_SSID #define WIFI_SSID CONFIG_MAIN_DEFAULT_WIFI_SSID @@ -71,55 +63,6 @@ static const char *failok(int ret) { return ret ? "FAIL" : "OK"; } -/****************************************************************************** - * 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_t user_rf_cal_sector_set() -{ - flash_size_map size_map = system_get_flash_size_map(); - uint32_t 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; - case FLASH_SIZE_64M_MAP_1024_1024: - rf_cal_sec = 2048 - 5; - break; - case FLASH_SIZE_128M_MAP_1024_1024: - rf_cal_sec = 4096 - 5; - break; - default: - rf_cal_sec = 0; - break; - } - - return rf_cal_sec; -} - static int on_config_item(void *ctx, const char* key, const char* value) { struct config *config = (struct config *)ctx; @@ -346,13 +289,6 @@ static int mqtt_connect() { // printf("%s: network connected\n", __FUNCTION__); -#if defined(MQTT_TASK) - if ((ret = MQTTStartTask(&mqtt_client)) != pdPASS) { - printf("%s: MQTTStartTask:%d\n", __FUNCTION__, ret); - goto fail; - } -#endif - cd.MQTTVersion = 4; cd.clientID.cstring = main_config.mqtt_client_id; @@ -362,6 +298,13 @@ static int mqtt_connect() { } // printf("%s: mqtt connected\n", __FUNCTION__); +#if defined(MQTT_TASK) + if ((ret = MQTTStartTask(&mqtt_client)) != pdPASS) { + printf("%s: MQTTStartTask:%d\n", __FUNCTION__, ret); + goto fail; + } +#endif + return 0; fail: @@ -501,9 +444,7 @@ void main_task(void* ctx) { void user_init() { int ret; - os_printf("SDK version: %s, free: %d\n", system_get_sdk_version(), system_get_free_heap_size()); - os_printf("App: instace: " CONFIG_ESPTOOLPY_APP_NUM ", build: %s\n", __TIMESTAMP__); - os_printf("Upgrade: boot mode: %d, version: %d, user addr=%08x, flash map: %d\n", system_get_boot_mode(), system_get_boot_version(), system_get_userbin_addr(), system_get_flash_size_map()); + os_printf("SDK version: %s, free: %d, app build: %s\n", system_get_sdk_version(), system_get_free_heap_size(), __TIMESTAMP__); fs_init(); diff --git a/mqtt-test/main/misc.c b/mqtt-test/main/misc.c new file mode 100644 index 0000000..1b5119b --- /dev/null +++ b/mqtt-test/main/misc.c @@ -0,0 +1,52 @@ +#include <esp_system.h> + +/****************************************************************************** + * 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_t user_rf_cal_sector_set() +{ + flash_size_map size_map = system_get_flash_size_map(); + uint32_t 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; + case FLASH_SIZE_64M_MAP_1024_1024: + rf_cal_sec = 2048 - 5; + break; + case FLASH_SIZE_128M_MAP_1024_1024: + rf_cal_sec = 4096 - 5; + break; + default: + rf_cal_sec = 0; + break; + } + + return rf_cal_sec; +} + + diff --git a/sdkconfig b/mqtt-test/sdkconfig index 4dd998e..eb55e2c 100644 --- a/sdkconfig +++ b/mqtt-test/sdkconfig @@ -14,36 +14,29 @@ CONFIG_MAKE_WARN_UNDEFINED_VARIABLES=y # Serial flasher config # CONFIG_ESPTOOLPY_PORT="/dev/ttyUSB0" -CONFIG_ESPTOOLPY_BAUD_115200B= +CONFIG_ESPTOOLPY_BAUD_115200B=y CONFIG_ESPTOOLPY_BAUD_230400B= CONFIG_ESPTOOLPY_BAUD_921600B= CONFIG_ESPTOOLPY_BAUD_2MB= -CONFIG_ESPTOOLPY_BAUD_OTHER=y -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=460800 -CONFIG_ESPTOOLPY_BAUD=460800 +CONFIG_ESPTOOLPY_BAUD_OTHER= +CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 +CONFIG_ESPTOOLPY_BAUD=115200 CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_FLASHMODE_QIO= +CONFIG_FLASHMODE_QIO=y CONFIG_FLASHMODE_QOUT= -CONFIG_FLASHMODE_DIO=y +CONFIG_FLASHMODE_DIO= CONFIG_FLASHMODE_DOUT= -CONFIG_ESPTOOLPY_FLASHMODE="dio" +CONFIG_ESPTOOLPY_FLASHMODE="qio" CONFIG_ESPTOOLPY_FLASHFREQ_80M= CONFIG_ESPTOOLPY_FLASHFREQ_40M=y CONFIG_ESPTOOLPY_FLASHFREQ_26M= CONFIG_ESPTOOLPY_FLASHFREQ_20M= CONFIG_ESPTOOLPY_FLASHFREQ="40m" -CONFIG_ESPTOOLPY_FLASHSIZE_512KB= -CONFIG_ESPTOOLPY_FLASHSIZE_1MB= -CONFIG_ESPTOOLPY_FLASHSIZE_2MB= -CONFIG_ESPTOOLPY_FLASHSIZE_2MB_C1= -CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_ESPTOOLPY_FLASHSIZE_2MB_C1=y CONFIG_ESPTOOLPY_FLASHSIZE_4MB_C1= CONFIG_ESPTOOLPY_FLASHSIZE_8MB= CONFIG_ESPTOOLPY_FLASHSIZE_16MB= -CONFIG_ESPTOOLPY_FLASHSIZE="4MB" -CONFIG_ESPTOOLPY_APP_NUM_APP1=y -CONFIG_ESPTOOLPY_APP_NUM_APP2= -CONFIG_ESPTOOLPY_APP_NUM="app1" +CONFIG_ESPTOOLPY_FLASHSIZE="2MB-c1" CONFIG_ESPTOOLPY_BEFORE_RESET=y CONFIG_ESPTOOLPY_BEFORE_NORESET= CONFIG_ESPTOOLPY_BEFORE="default_reset" diff --git a/thirdparty/ESP8266_RTOS_SDK b/thirdparty/ESP8266_RTOS_SDK -Subproject e9ad8ab6ef2c1b7b7d8e3d6961873ec1966fcaf +Subproject c388e60abc42b404d22d8f0523678250346aa66 |