summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-06-03 23:35:52 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-06-03 23:35:52 +0200
commitfadeb06d74c3d739dc1202031e1eea1374e8917e (patch)
tree2db95dbaea94299c74ab90b2fc4ce3fc44e70acf
parent934bbf7d019e561209802f6a679b3672ce58ef1a (diff)
downloadmodern-esp-sandbox-fadeb06d74c3d739dc1202031e1eea1374e8917e.tar.gz
modern-esp-sandbox-fadeb06d74c3d739dc1202031e1eea1374e8917e.tar.bz2
modern-esp-sandbox-fadeb06d74c3d739dc1202031e1eea1374e8917e.tar.xz
modern-esp-sandbox-fadeb06d74c3d739dc1202031e1eea1374e8917e.zip
wip
-rw-r--r--ota-test/Makefile10
-rw-r--r--ota-test/main/component.mk4
-rw-r--r--ota-test/main/main.cpp52
-rw-r--r--ota-test/main/misc.c52
-rw-r--r--ota-test/sdkconfig263
5 files changed, 381 insertions, 0 deletions
diff --git a/ota-test/Makefile b/ota-test/Makefile
new file mode 100644
index 0000000..19bd536
--- /dev/null
+++ b/ota-test/Makefile
@@ -0,0 +1,10 @@
+#
+# This is a project Makefile. It is assumed the directory this Makefile resides in is a
+# project subdirectory.
+#
+
+PROJECT_NAME := ota_test
+
+IDF_PATH=../thirdparty/ESP8266_RTOS_SDK
+
+include $(IDF_PATH)/make/project.mk
diff --git a/ota-test/main/component.mk b/ota-test/main/component.mk
new file mode 100644
index 0000000..a98f634
--- /dev/null
+++ b/ota-test/main/component.mk
@@ -0,0 +1,4 @@
+#
+# "main" pseudo-component makefile.
+#
+# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
diff --git a/ota-test/main/main.cpp b/ota-test/main/main.cpp
new file mode 100644
index 0000000..a64f03f
--- /dev/null
+++ b/ota-test/main/main.cpp
@@ -0,0 +1,52 @@
+#include "esp_misc.h"
+#include "esp_sta.h"
+#include "esp_system.h"
+#include "esp_wifi.h"
+#include "esp_spiffs.h"
+#include "sdkconfig.h"
+
+#include <assert.h>
+
+extern "C"
+uint32_t user_rf_cal_sector_set();
+
+extern "C"
+void user_init();
+
+enum events {
+ EVENTS_GOT_IP = (1 << 0),
+ EVENTS_LOST_IP = (1 << 1),
+};
+
+static void set_wifi_mode() {
+ if (wifi_get_opmode_default() != NULL_MODE) {
+ printf("Setting default station mode");
+ wifi_set_opmode(NULL_MODE);
+ }
+
+ wifi_set_opmode_current(NULL_MODE);
+}
+
+void main_task(void* ctx) {
+ (void) ctx;
+
+ int count = 0;
+ while (1) {
+ printf("Hello World! %d\n", count++);
+
+ vTaskDelay(pdMS_TO_TICKS(1000));
+ }
+}
+
+#define THREAD_NAME "main"
+#define THREAD_STACK_WORDS 2048
+#define THREAD_PRIO 8
+
+TaskHandle_t main_task_handle;
+void user_init() {
+ os_printf("SDK version: %s, free: %d, app build: %s\n", system_get_sdk_version(), system_get_free_heap_size(), __TIMESTAMP__);
+
+ set_wifi_mode();
+
+ assert(xTaskCreate(main_task, THREAD_NAME, THREAD_STACK_WORDS, NULL, THREAD_PRIO, &main_task_handle) == pdPASS);
+}
diff --git a/ota-test/main/misc.c b/ota-test/main/misc.c
new file mode 100644
index 0000000..1b5119b
--- /dev/null
+++ b/ota-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/ota-test/sdkconfig b/ota-test/sdkconfig
new file mode 100644
index 0000000..12f4b7d
--- /dev/null
+++ b/ota-test/sdkconfig
@@ -0,0 +1,263 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Espressif IoT Development Framework Configuration
+#
+
+#
+# SDK tool configuration
+#
+CONFIG_TOOLPREFIX="xtensa-lx106-elf-"
+CONFIG_PYTHON="python"
+CONFIG_MAKE_WARN_UNDEFINED_VARIABLES=y
+
+#
+# Serial flasher config
+#
+CONFIG_ESPTOOLPY_PORT="/dev/ttyUSB0"
+CONFIG_ESPTOOLPY_BAUD_57600B=
+CONFIG_ESPTOOLPY_BAUD_115200B=
+CONFIG_ESPTOOLPY_BAUD_230400B=
+CONFIG_ESPTOOLPY_BAUD_256000B=
+CONFIG_ESPTOOLPY_BAUD_460800B=y
+CONFIG_ESPTOOLPY_BAUD_512000B=
+CONFIG_ESPTOOLPY_BAUD_921600B=
+CONFIG_ESPTOOLPY_BAUD_2MB=
+CONFIG_ESPTOOLPY_BAUD_OTHER=
+CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200
+CONFIG_ESPTOOLPY_BAUD=460800
+CONFIG_ESPTOOLPY_COMPRESSED=y
+CONFIG_FLASHMODE_QIO=y
+CONFIG_FLASHMODE_QOUT=
+CONFIG_FLASHMODE_DIO=
+CONFIG_FLASHMODE_DOUT=
+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_2MB_C1=y
+CONFIG_ESPTOOLPY_FLASHSIZE_4MB_C1=
+CONFIG_ESPTOOLPY_FLASHSIZE_8MB=
+CONFIG_ESPTOOLPY_FLASHSIZE_16MB=
+CONFIG_ESPTOOLPY_FLASHSIZE="2MB-c1"
+CONFIG_ESPTOOLPY_BEFORE_RESET=y
+CONFIG_ESPTOOLPY_BEFORE_NORESET=
+CONFIG_ESPTOOLPY_BEFORE="default_reset"
+CONFIG_ESPTOOLPY_AFTER_RESET=y
+CONFIG_ESPTOOLPY_AFTER_NORESET=
+CONFIG_ESPTOOLPY_AFTER="hard_reset"
+CONFIG_MONITOR_BAUD_9600B=
+CONFIG_MONITOR_BAUD_57600B=
+CONFIG_MONITOR_BAUD_74880B=y
+CONFIG_MONITOR_BAUD_115200B=
+CONFIG_MONITOR_BAUD_230400B=
+CONFIG_MONITOR_BAUD_921600B=
+CONFIG_MONITOR_BAUD_2MB=
+CONFIG_MONITOR_BAUD_OTHER=
+CONFIG_MONITOR_BAUD_OTHER_VAL=74880
+CONFIG_MONITOR_BAUD=74880
+
+#
+# Compiler options
+#
+CONFIG_OPTIMIZATION_LEVEL_DEBUG=y
+CONFIG_OPTIMIZATION_LEVEL_RELEASE=
+CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y
+CONFIG_OPTIMIZATION_ASSERTIONS_SILENT=
+CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED=
+CONFIG_CXX_EXCEPTIONS=
+CONFIG_STACK_CHECK_NONE=y
+CONFIG_STACK_CHECK_NORM=
+CONFIG_STACK_CHECK_STRONG=
+CONFIG_STACK_CHECK_ALL=
+CONFIG_STACK_CHECK=
+
+#
+# Component config
+#
+
+#
+# ESP8266
+#
+CONFIG_ESP8266_APP_START_ADDRESS=0x40202010
+CONFIG_ESP8266_APP_SIZE=0xFEFF0
+CONFIG_ESP8266_APP_FLASH_ADDRESS=0x2000
+CONFIG_ESP8266_BOOTLOADER_ESPRESSIF=
+CONFIG_ESP8266_BOOTLOADER_CUSTOM=y
+CONFIG_ESP8266_BOOTLOADER_CUSTOM_VAL="../thirdparty/rboot/firmware/rboot.bin"
+CONFIG_ESP8266_BOOTLOADER="CUSTOM"
+
+#
+# FreeRTOS
+#
+CONFIG_FREERTOS_ENABLE_REENT=
+
+#
+# Log output
+#
+CONFIG_LOG_DEFAULT_LEVEL_NONE=
+CONFIG_LOG_DEFAULT_LEVEL_ERROR=
+CONFIG_LOG_DEFAULT_LEVEL_WARN=
+CONFIG_LOG_DEFAULT_LEVEL_INFO=y
+CONFIG_LOG_DEFAULT_LEVEL_DEBUG=
+CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=
+CONFIG_LOG_DEFAULT_LEVEL=3
+CONFIG_LOG_COLORS=y
+
+#
+# LWIP
+#
+
+#
+# ARP
+#
+CONFIG_LWIP_ARP_TABLE_SIZE=10
+CONFIG_LWIP_ARP_MAXAGE=300
+
+#
+# SOCKET
+#
+CONFIG_LWIP_MAX_SOCKETS=10
+CONFIG_LWIP_SO_REUSE=y
+CONFIG_LWIP_SO_REUSE_RXTOALL=y
+CONFIG_LWIP_SO_RCVBUF=
+CONFIG_LWIP_SO_LINGER=
+CONFIG_LWIP_RECV_BUFSIZE_DEFAULT=11680
+CONFIG_LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT=10000
+CONFIG_LWIP_IP_FRAG=
+CONFIG_LWIP_IP_REASSEMBLY=
+CONFIG_LWIP_IP_REASS_MAX_PBUFS=10
+CONFIG_LWIP_IP_SOF_BROADCAST=
+CONFIG_LWIP_IP_SOF_BROADCAST_RECV=
+CONFIG_LWIP_ICMP=y
+CONFIG_LWIP_MULTICAST_PING=
+CONFIG_LWIP_BROADCAST_PING=
+CONFIG_LWIP_RAW=
+
+#
+# DHCP
+#
+CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
+CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1
+CONFIG_LWIP_DHCPS_LEASE_UNIT=60
+CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8
+CONFIG_LWIP_AUTOIP=
+CONFIG_LWIP_IGMP=y
+CONFIG_DNS_MAX_SERVERS=2
+CONFIG_LWIP_NETIF_LOOPBACK=
+
+#
+# TCP
+#
+CONFIG_LWIP_MAX_ACTIVE_TCP=5
+CONFIG_LWIP_MAX_LISTENING_TCP=8
+CONFIG_TCP_MAXRTX=12
+CONFIG_TCP_SYNMAXRTX=6
+CONFIG_TCP_MSS=1460
+CONFIG_TCP_SND_BUF_DEFAULT=2920
+CONFIG_TCP_WND_DEFAULT=5840
+CONFIG_TCP_RECVMBOX_SIZE=6
+CONFIG_TCP_QUEUE_OOSEQ=
+CONFIG_TCP_OVERSIZE_MSS=y
+CONFIG_TCP_OVERSIZE_QUARTER_MSS=
+CONFIG_TCP_OVERSIZE_DISABLE=
+CONFIG_LWIP_TCP_TIMESTAMPS=
+
+#
+# UDP
+#
+CONFIG_LWIP_MAX_UDP_PCBS=4
+CONFIG_UDP_RECVMBOX_SIZE=6
+CONFIG_TCPIP_TASK_STACK_SIZE=512
+
+#
+# LWIP RAW API
+#
+CONFIG_LWIP_MAX_RAW_PCBS=4
+CONFIG_LWIP_IPV6=y
+CONFIG_LWIP_IPV6_NUM_ADDRESSES=3
+CONFIG_LWIP_IPV6_FORWARD=
+CONFIG_LWIP_IPV6_FRAG=
+CONFIG_LWIP_STATS=
+CONFIG_LWIP_DEBUG=
+
+#
+# Newlib
+#
+CONFIG_NEWLIB_ENABLE=y
+CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL=
+CONFIG_NEWLIB_LIBRARY_LEVEL_NANO=y
+
+#
+# SSL
+#
+CONFIG_SSL_USING_MBEDTLS=y
+CONFIG_SSL_USING_AXTLS=
+CONFIG_SSL_USING_WOLFSSL=
+
+#
+# mbedTLS
+#
+CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=4096
+CONFIG_MBEDTLS_DEBUG=
+CONFIG_MBEDTLS_HAVE_TIME=y
+CONFIG_MBEDTLS_HAVE_TIME_DATE=
+CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
+CONFIG_MBEDTLS_TLS_SERVER_ONLY=
+CONFIG_MBEDTLS_TLS_CLIENT_ONLY=
+CONFIG_MBEDTLS_TLS_DISABLED=
+CONFIG_MBEDTLS_TLS_SERVER=y
+CONFIG_MBEDTLS_TLS_CLIENT=y
+CONFIG_MBEDTLS_TLS_ENABLED=y
+
+#
+# TLS Key Exchange Methods
+#
+CONFIG_MBEDTLS_PSK_MODES=
+CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y
+CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=
+CONFIG_MBEDTLS_SSL_RENEGOTIATION=
+CONFIG_MBEDTLS_SSL_PROTO_SSL3=
+CONFIG_MBEDTLS_SSL_PROTO_TLS1=y
+CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y
+CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
+CONFIG_MBEDTLS_SSL_PROTO_DTLS=
+CONFIG_MBEDTLS_SSL_ALPN=
+CONFIG_MBEDTLS_SSL_SESSION_TICKETS=
+
+#
+# Symmetric Ciphers
+#
+CONFIG_MBEDTLS_AES_C=y
+CONFIG_MBEDTLS_CAMELLIA_C=
+CONFIG_MBEDTLS_DES_C=
+CONFIG_MBEDTLS_RC4_DISABLED=y
+CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT=
+CONFIG_MBEDTLS_RC4_ENABLED=
+CONFIG_MBEDTLS_BLOWFISH_C=
+CONFIG_MBEDTLS_XTEA_C=y
+CONFIG_MBEDTLS_CCM_C=
+CONFIG_MBEDTLS_GCM_C=
+CONFIG_MBEDTLS_RIPEMD160_C=
+
+#
+# Certificates
+#
+CONFIG_MBEDTLS_PEM_PARSE_C=y
+CONFIG_MBEDTLS_PEM_WRITE_C=y
+CONFIG_MBEDTLS_X509_CRL_PARSE_C=y
+CONFIG_MBEDTLS_X509_CSR_PARSE_C=y
+CONFIG_MBEDTLS_ECP_C=
+
+#
+# OpenSSL
+#
+CONFIG_OPENSSL_DEBUG=
+CONFIG_OPENSSL_ASSERT_DO_NOTHING=y
+CONFIG_OPENSSL_ASSERT_EXIT=
+
+#
+# tcpip adapter
+#
+CONFIG_TCPIP_ADAPER_DEBUG=