mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-21 00:56:38 +08:00
Merge branch 'feature/update_esp_common' into 'master'
esp_common: update esp_common See merge request sdk/ESP8266_RTOS_SDK!1294
This commit is contained in:
@ -18,7 +18,7 @@ endif()
|
||||
set(COMPONENTS bootloader esptool_py partition_table esp8266 bootloader_support log spi_flash main)
|
||||
set(BOOTLOADER_BUILD 1)
|
||||
include("${IDF_PATH}/tools/cmake/project.cmake")
|
||||
set(common_req log)
|
||||
set(common_req log esp_common)
|
||||
if(LEGACY_INCLUDE_COMMON_HEADERS)
|
||||
list(APPEND common_req soc)
|
||||
endif()
|
||||
|
@ -16,6 +16,7 @@ CXXFLAGS =
|
||||
|
||||
#We cannot include the esp8266 component directly but we need its includes.
|
||||
CFLAGS += -I $(IDF_PATH)/components/esp8266/include -I $(IDF_PATH)/components/util/include
|
||||
CFLAGS += -I $(IDF_PATH)/components/esp_common/include
|
||||
|
||||
# The bootloader pseudo-component is also included in this build, for its Kconfig.projbuild to be included.
|
||||
#
|
||||
|
@ -568,7 +568,7 @@ static void update_flash_config(const esp_image_header_t* pfhdr);
|
||||
|
||||
static void uart_console_configure(void)
|
||||
{
|
||||
#if CONFIG_UART0_SWAP_IO
|
||||
#if CONFIG_ESP_UART0_SWAP_IO
|
||||
while (READ_PERI_REG(UART_STATUS(0)) & (UART_TXFIFO_CNT << UART_TXFIFO_CNT_S));
|
||||
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_UART0_CTS);
|
||||
@ -578,25 +578,25 @@ static void uart_console_configure(void)
|
||||
SET_PERI_REG_MASK(UART_SWAP_REG, 0x4);
|
||||
#endif
|
||||
|
||||
#if CONFIG_CONSOLE_UART_NUM == 1
|
||||
#if CONFIG_ESP_CONSOLE_UART_NUM == 1
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK);
|
||||
|
||||
CLEAR_PERI_REG_MASK(UART_CONF1(CONFIG_CONSOLE_UART_NUM), UART_RX_FLOW_EN);
|
||||
CLEAR_PERI_REG_MASK(UART_CONF0(CONFIG_CONSOLE_UART_NUM), UART_TX_FLOW_EN);
|
||||
CLEAR_PERI_REG_MASK(UART_CONF1(CONFIG_ESP_CONSOLE_UART_NUM), UART_RX_FLOW_EN);
|
||||
CLEAR_PERI_REG_MASK(UART_CONF0(CONFIG_ESP_CONSOLE_UART_NUM), UART_TX_FLOW_EN);
|
||||
|
||||
WRITE_PERI_REG(UART_CONF0(CONFIG_CONSOLE_UART_NUM),
|
||||
WRITE_PERI_REG(UART_CONF0(CONFIG_ESP_CONSOLE_UART_NUM),
|
||||
0 // None parity
|
||||
| (1 << 4) // 1-bit stop
|
||||
| (3 << 2) // 8-bit data
|
||||
| 0 // None flow control
|
||||
| 0); // None Inverse
|
||||
|
||||
SET_PERI_REG_MASK(UART_CONF0(CONFIG_CONSOLE_UART_NUM), UART_RXFIFO_RST | UART_TXFIFO_RST);
|
||||
CLEAR_PERI_REG_MASK(UART_CONF0(CONFIG_CONSOLE_UART_NUM), UART_RXFIFO_RST | UART_TXFIFO_RST);
|
||||
SET_PERI_REG_MASK(UART_CONF0(CONFIG_ESP_CONSOLE_UART_NUM), UART_RXFIFO_RST | UART_TXFIFO_RST);
|
||||
CLEAR_PERI_REG_MASK(UART_CONF0(CONFIG_ESP_CONSOLE_UART_NUM), UART_RXFIFO_RST | UART_TXFIFO_RST);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CONSOLE_UART_BAUDRATE
|
||||
uart_div_modify(CONFIG_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_CONSOLE_UART_BAUDRATE);
|
||||
#ifdef CONFIG_ESP_CONSOLE_UART_BAUDRATE
|
||||
uart_div_modify(CONFIG_ESP_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_ESP_CONSOLE_UART_BAUDRATE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ else()
|
||||
"source/chip_boot.c"
|
||||
"source/backtrace.c"
|
||||
"source/esp_sleep.c"
|
||||
"source/esp_err_to_name.c"
|
||||
"source/esp_timer.c"
|
||||
"source/esp_wifi_os_adapter.c"
|
||||
"source/esp_wifi.c"
|
||||
@ -54,6 +53,7 @@ else()
|
||||
|
||||
set(include_dirs "include" "include/driver")
|
||||
|
||||
set(requires "esp_common")
|
||||
set(priv_requires "wpa_supplicant" "log" "spi_flash" "tcpip_adapter" "esp_ringbuf" "bootloader_support" "nvs_flash" "util")
|
||||
set(fragments linker.lf ld/esp8266_fragments.lf ld/esp8266_bss_fragments.lf)
|
||||
|
||||
|
@ -94,67 +94,12 @@ config SOC_IRAM_SIZE
|
||||
default 0x8000 if SOC_FULL_ICACHE
|
||||
default 0xC000 if !SOC_FULL_ICACHE
|
||||
|
||||
choice CONSOLE_UART
|
||||
prompt "UART for console output"
|
||||
default CONSOLE_UART_DEFAULT
|
||||
help
|
||||
Select whether to use UART for console output (through stdout and stderr).
|
||||
|
||||
- Default is to use UART0.
|
||||
- If "Custom" is selected, UART0 or UART1 can be chosen.
|
||||
- If "None" is selected, there will be no console output on any UART.
|
||||
|
||||
config CONSOLE_UART_DEFAULT
|
||||
bool "Default: UART0"
|
||||
config CONSOLE_UART_CUSTOM
|
||||
bool "Custom"
|
||||
config CONSOLE_UART_NONE
|
||||
bool "None"
|
||||
endchoice
|
||||
|
||||
choice CONSOLE_UART_NUM
|
||||
prompt "UART peripheral to use for console output (0-1)"
|
||||
depends on CONSOLE_UART_CUSTOM
|
||||
default CONSOLE_UART_CUSTOM_NUM_0
|
||||
help
|
||||
Configrate output console UART for "ets_printf", "printf", "ESP_LOGX" and so on.
|
||||
|
||||
config CONSOLE_UART_CUSTOM_NUM_0
|
||||
bool "UART0"
|
||||
config CONSOLE_UART_CUSTOM_NUM_1
|
||||
bool "UART1"
|
||||
endchoice
|
||||
|
||||
config CONSOLE_UART_NUM
|
||||
int
|
||||
default 0 if CONSOLE_UART_DEFAULT || CONSOLE_UART_NONE
|
||||
default 0 if CONSOLE_UART_CUSTOM_NUM_0
|
||||
default 1 if CONSOLE_UART_CUSTOM_NUM_1
|
||||
|
||||
config CONSOLE_UART_BAUDRATE
|
||||
int "UART console baud rate"
|
||||
depends on CONSOLE_UART_DEFAULT || CONSOLE_UART_CUSTOM
|
||||
default 74880
|
||||
range 1200 4000000
|
||||
|
||||
config UART0_SWAP_IO
|
||||
bool "Swap UART0 I/O pins"
|
||||
default n
|
||||
help
|
||||
Enable this option, UART0's I/O pins are swaped: TXD <-> RTS, RTX <-> CTS.
|
||||
|
||||
config DISABLE_ROM_UART_PRINT
|
||||
bool "Disable ROM UART print"
|
||||
default n
|
||||
help
|
||||
"Disable main part of ROM UART print when rom bootloader process."
|
||||
|
||||
config PANIC_FULL_STACK
|
||||
bool "Output full stack data of task"
|
||||
default n
|
||||
help
|
||||
Output full stack data of task although some stack space is not used.
|
||||
|
||||
choice ESP_PANIC
|
||||
prompt "Panic handler behaviour"
|
||||
default ESP_PANIC_PRINT_REBOOT
|
||||
@ -189,51 +134,6 @@ config ESP_PANIC_GDBSTUB
|
||||
The UART's baudrate should be 115200 or others which can be recognized by xtensa GDB.
|
||||
endchoice
|
||||
|
||||
config MAIN_TASK_STACK_SIZE
|
||||
int "Main task stack size"
|
||||
default 3584
|
||||
help
|
||||
Configure the "main task" stack size. This is the stack of the task
|
||||
which calls app_main(). If app_main() returns then this task is deleted
|
||||
and its stack memory is freed.
|
||||
|
||||
config TASK_WDT
|
||||
bool "Initialize Task Watchdog Timer on startup"
|
||||
default y
|
||||
help
|
||||
The Task Watchdog Timer can be used to make sure individual tasks are still
|
||||
running. Enabling this option will cause the Task Watchdog Timer to be
|
||||
initialized automatically at startup. The Task Watchdog timer can be
|
||||
initialized after startup as well.
|
||||
|
||||
config TASK_WDT_PANIC
|
||||
bool "Invoke panic handler on Task Watchdog timeout"
|
||||
default y
|
||||
help
|
||||
If this option is enabled, the Task Watchdog Timer will be configured to
|
||||
trigger the panic handler when it times out. And it may cost some time.
|
||||
|
||||
choice TASK_WDT_TIMEOUT_S
|
||||
prompt "Task Watchdog timeout period (seconds)"
|
||||
default TASK_WDT_TIMEOUT_15N
|
||||
help
|
||||
Timeout period configuration for the Task Watchdog Timer in seconds.
|
||||
This is also configurable at run time.
|
||||
|
||||
config TASK_WDT_TIMEOUT_13N
|
||||
bool "6.5536s"
|
||||
config TASK_WDT_TIMEOUT_14N
|
||||
bool "13.1072s"
|
||||
config TASK_WDT_TIMEOUT_15N
|
||||
bool "26.2144s"
|
||||
endchoice
|
||||
|
||||
config TASK_WDT_TIMEOUT_S
|
||||
int
|
||||
default 13 if TASK_WDT_TIMEOUT_13N
|
||||
default 14 if TASK_WDT_TIMEOUT_14N
|
||||
default 15 if TASK_WDT_TIMEOUT_15N
|
||||
|
||||
config RESET_REASON
|
||||
bool "Enable reset reason"
|
||||
default y
|
||||
@ -249,12 +149,6 @@ config WIFI_PPT_TASKSTACK_SIZE
|
||||
which calls promiscuous callback function. So if user's function is
|
||||
complex, the stack must be set larger.
|
||||
|
||||
config EVENT_LOOP_STACK_SIZE
|
||||
int "Event loop stack size"
|
||||
default 2048
|
||||
help
|
||||
Configure the Event loop task stack size per application.
|
||||
|
||||
config ESP8266_CORE_GLOBAL_DATA_LINK_IRAM
|
||||
bool "Link libcore.a internal global data to IRAM"
|
||||
default y
|
||||
@ -307,16 +201,6 @@ config ESP8266_BOOT_COPY_APP
|
||||
Enable this option, when it is that "OTA1" application is to run after update by OTA,
|
||||
bootloader will copy "OTA1" application to "OTA0" partition and run "OTA0".
|
||||
|
||||
config ESP_ERR_TO_NAME_LOOKUP
|
||||
bool "Enable lookup of error code strings"
|
||||
default "y"
|
||||
help
|
||||
Functions esp_err_to_name() and esp_err_to_name_r() return string
|
||||
representations of error codes from a pre-generated lookup table.
|
||||
This option can be used to turn off the use of the look-up table in
|
||||
order to save memory but this comes at the price of sacrificing
|
||||
distinguishable (meaningful) output string representations.
|
||||
|
||||
choice ESP8266_TIME_SYSCALL
|
||||
prompt "Timers used for gettimeofday function"
|
||||
default ESP8266_TIME_SYSCALL_USE_FRC1
|
||||
|
@ -42,7 +42,7 @@ ESP8266_COMPONENT_PATH := $(COMPONENT_PATH)
|
||||
|
||||
$(PHY_INIT_DATA_OBJ): $(ESP8266_COMPONENT_PATH)/include/internal/phy_init_data.h $(BUILD_DIR_BASE)/include/sdkconfig.h
|
||||
$(summary) CC $(notdir $@)
|
||||
printf "#include \"internal/phy_init_data.h\"\n" | $(CC) -I $(BUILD_DIR_BASE)/include -I $(ESP8266_COMPONENT_PATH) -I $(ESP8266_COMPONENT_PATH)/include -c -o $@ -xc -
|
||||
printf "#include \"internal/phy_init_data.h\"\n" | $(CC) -I $(BUILD_DIR_BASE)/include -I $(ESP8266_COMPONENT_PATH) -I $(ESP8266_COMPONENT_PATH)/include -I $(ESP8266_COMPONENT_PATH)/../esp_common/include -c -o $@ -xc -
|
||||
|
||||
$(PHY_INIT_DATA_BIN): $(PHY_INIT_DATA_OBJ)
|
||||
$(summary) BIN $(notdir $@)
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
|
||||
#define EVENT_LOOP_STACKSIZE CONFIG_EVENT_LOOP_STACK_SIZE
|
||||
#define EVENT_LOOP_STACKSIZE CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
17
components/esp8266/sdkconfig.rename
Normal file
17
components/esp8266/sdkconfig.rename
Normal file
@ -0,0 +1,17 @@
|
||||
# sdkconfig replacement configurations for deprecated options formatted as
|
||||
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||
|
||||
CONFIG_MAIN_TASK_STACK_SIZE CONFIG_ESP_MAIN_TASK_STACK_SIZE
|
||||
CONFIG_CONSOLE_UART CONFIG_ESP_CONSOLE_UART
|
||||
CONFIG_CONSOLE_UART_DEFAULT CONFIG_ESP_CONSOLE_UART_DEFAULT
|
||||
CONFIG_CONSOLE_UART_CUSTOM CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||
CONFIG_CONSOLE_UART_NONE CONFIG_ESP_CONSOLE_UART_NONE
|
||||
CONFIG_CONSOLE_UART_NUM CONFIG_ESP_CONSOLE_UART_NUM
|
||||
CONFIG_CONSOLE_UART_CUSTOM_NUM_0 CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0
|
||||
CONFIG_CONSOLE_UART_CUSTOM_NUM_1 CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1
|
||||
CONFIG_CONSOLE_UART_BAUDRATE CONFIG_ESP_CONSOLE_UART_BAUDRATE
|
||||
CONFIG_UART0_SWAP_IO CONFIG_ESP_UART0_SWAP_IO
|
||||
|
||||
CONFIG_TASK_WDT CONFIG_ESP_TASK_WDT
|
||||
CONFIG_TASK_WDT_PANIC CONFIG_ESP_TASK_WDT_PANIC
|
||||
CONFIG_TASK_WDT_TIMEOUT_S CONFIG_ESP_TASK_WDT_TIMEOUT_S
|
@ -24,17 +24,17 @@
|
||||
#include "esp8266/uart_register.h"
|
||||
#include "esp8266/rom_functions.h"
|
||||
|
||||
#ifndef CONFIG_CONSOLE_UART_NONE
|
||||
#ifndef CONFIG_ESP_CONSOLE_UART_NONE
|
||||
static void uart_putc(int c)
|
||||
{
|
||||
while (1) {
|
||||
uint32_t fifo_cnt = READ_PERI_REG(UART_STATUS(CONFIG_CONSOLE_UART_NUM)) & (UART_TXFIFO_CNT << UART_TXFIFO_CNT_S);
|
||||
uint32_t fifo_cnt = READ_PERI_REG(UART_STATUS(CONFIG_ESP_CONSOLE_UART_NUM)) & (UART_TXFIFO_CNT << UART_TXFIFO_CNT_S);
|
||||
|
||||
if ((fifo_cnt >> UART_TXFIFO_CNT_S & UART_TXFIFO_CNT) < 126)
|
||||
break;
|
||||
}
|
||||
|
||||
WRITE_PERI_REG(UART_FIFO(CONFIG_CONSOLE_UART_NUM) , c);
|
||||
WRITE_PERI_REG(UART_FIFO(CONFIG_ESP_CONSOLE_UART_NUM) , c);
|
||||
}
|
||||
#else
|
||||
#define uart_putc(_c) { }
|
||||
|
@ -72,8 +72,8 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat
|
||||
esp_err_t status = ESP_OK;
|
||||
uint8_t sta_mac[6];
|
||||
uint8_t *local_init_data = calloc(1, 256);
|
||||
#ifdef CONFIG_CONSOLE_UART_BAUDRATE
|
||||
const uint32_t uart_baudrate = CONFIG_CONSOLE_UART_BAUDRATE;
|
||||
#ifdef CONFIG_ESP_CONSOLE_UART_BAUDRATE
|
||||
const uint32_t uart_baudrate = CONFIG_ESP_CONSOLE_UART_BAUDRATE;
|
||||
#else
|
||||
const uint32_t uart_baudrate = 74880; // ROM default baudrate
|
||||
#endif
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "esp_task.h"
|
||||
|
||||
#ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
||||
#include "esp_newlib.h"
|
||||
@ -93,7 +94,7 @@ static void user_init_entry(void *param)
|
||||
esp_reset_reason_init();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TASK_WDT
|
||||
#ifdef CONFIG_ESP_TASK_WDT
|
||||
esp_task_wdt_init();
|
||||
#endif
|
||||
|
||||
@ -175,7 +176,7 @@ void call_start_cpu(size_t start_addr)
|
||||
esp_newlib_init();
|
||||
#endif
|
||||
|
||||
assert(xTaskCreate(user_init_entry, "uiT", CONFIG_MAIN_TASK_STACK_SIZE, NULL, configMAX_PRIORITIES, NULL) == pdPASS);
|
||||
assert(xTaskCreate(user_init_entry, "uiT", ESP_TASK_MAIN_STACK, NULL, configMAX_PRIORITIES, NULL) == pdPASS);
|
||||
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
static const char *TAG = "wdt";
|
||||
|
||||
#ifdef CONFIG_TASK_WDT_PANIC
|
||||
#ifdef CONFIG_ESP_TASK_WDT_PANIC
|
||||
/**
|
||||
* @brief Task watch dog interrupt function and it should do panic
|
||||
*/
|
||||
@ -43,7 +43,7 @@ esp_err_t esp_task_wdt_init(void)
|
||||
{
|
||||
CLEAR_WDT_REG_MASK(WDT_CTL_ADDRESS, BIT0);
|
||||
|
||||
#ifdef CONFIG_TASK_WDT_PANIC
|
||||
#ifdef CONFIG_ESP_TASK_WDT_PANIC
|
||||
const uint32_t panic_time_param = 11;
|
||||
|
||||
// Just for soft restart
|
||||
@ -59,9 +59,9 @@ esp_err_t esp_task_wdt_init(void)
|
||||
const uint32_t panic_time_param = 1;
|
||||
#endif
|
||||
|
||||
ESP_LOGD(TAG, "task watch dog trigger time parameter is %u", CONFIG_TASK_WDT_TIMEOUT_S);
|
||||
ESP_LOGD(TAG, "task watch dog trigger time parameter is %u", CONFIG_ESP_TASK_WDT_TIMEOUT_S);
|
||||
|
||||
WDT_REG_WRITE(WDT_OP_ADDRESS, CONFIG_TASK_WDT_TIMEOUT_S); // 2^n * 0.8ms, mask 0xf, n = 13 -> (2^13 = 8192) * 0.8 * 0.001 = 6.5536
|
||||
WDT_REG_WRITE(WDT_OP_ADDRESS, CONFIG_ESP_TASK_WDT_TIMEOUT_S); // 2^n * 0.8ms, mask 0xf, n = 13 -> (2^13 = 8192) * 0.8 * 0.001 = 6.5536
|
||||
WDT_REG_WRITE(WDT_OP_ND_ADDRESS, panic_time_param); // 2^n * 0.8ms, mask 0xf, n = 11 -> (2^11 = 2048) * 0.8 * 0.001 = 1.6384
|
||||
|
||||
SET_PERI_REG_BITS(PERIPHS_WDT_BASEADDR + WDT_CTL_ADDRESS, WDT_CTL_RSTLEN_MASK, 7 << WDT_CTL_RSTLEN_LSB, 0);
|
||||
|
@ -4,8 +4,9 @@ if(BOOTLOADER_BUILD)
|
||||
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--gc-sections")
|
||||
else()
|
||||
# Regular app build
|
||||
idf_component_register(SRCS "src/stack_check.c"
|
||||
INCLUDE_DIRS include)
|
||||
idf_component_register(SRCS "src/stack_check.c" "src/esp_err_to_name.c"
|
||||
INCLUDE_DIRS include
|
||||
PRIV_REQUIRES "tcpip_adapter")
|
||||
|
||||
set_source_files_properties(
|
||||
"src/stack_check.c"
|
||||
|
138
components/esp_common/Kconfig
Normal file
138
components/esp_common/Kconfig
Normal file
@ -0,0 +1,138 @@
|
||||
menu "Common ESP-related"
|
||||
|
||||
config ESP_ERR_TO_NAME_LOOKUP
|
||||
bool "Enable lookup of error code strings"
|
||||
default "y"
|
||||
help
|
||||
Functions esp_err_to_name() and esp_err_to_name_r() return string representations of error codes from a
|
||||
pre-generated lookup table. This option can be used to turn off the use of the look-up table in order to
|
||||
save memory but this comes at the price of sacrificing distinguishable (meaningful) output string
|
||||
representations.
|
||||
|
||||
config ESP_SYSTEM_EVENT_QUEUE_SIZE
|
||||
int "System event queue size"
|
||||
default 32
|
||||
help
|
||||
Config system event queue size in different application.
|
||||
|
||||
config ESP_SYSTEM_EVENT_TASK_STACK_SIZE
|
||||
int "Event loop task stack size"
|
||||
default 2048
|
||||
help
|
||||
Config system event task stack size in different application.
|
||||
|
||||
config ESP_MAIN_TASK_STACK_SIZE
|
||||
int "Main task stack size"
|
||||
default 3584
|
||||
help
|
||||
Configure the "main task" stack size. This is the stack of the task
|
||||
which calls app_main(). If app_main() returns then this task is deleted
|
||||
and its stack memory is freed.
|
||||
|
||||
config ESP_TIMER_TASK_STACK_SIZE
|
||||
int "High-resolution timer task stack size"
|
||||
default 3584
|
||||
range 2048 65536
|
||||
help
|
||||
Configure the stack size of esp_timer/ets_timer task. This task is used
|
||||
to dispatch callbacks of timers created using ets_timer and esp_timer
|
||||
APIs. If you are seing stack overflow errors in timer task, increase
|
||||
this value.
|
||||
|
||||
Note that this is not the same as FreeRTOS timer task. To configure
|
||||
FreeRTOS timer task size, see "FreeRTOS timer task stack size" option
|
||||
in "FreeRTOS" menu.
|
||||
|
||||
choice ESP_CONSOLE_UART
|
||||
prompt "UART for console output"
|
||||
default ESP_CONSOLE_UART_DEFAULT
|
||||
help
|
||||
Select whether to use UART for console output (through stdout and stderr).
|
||||
|
||||
- Default is to use UART0 on pins GPIO1(TX) and GPIO3(RX).
|
||||
- If "Custom" is selected, UART0 or UART1 can be chosen,
|
||||
and any pins can be selected.
|
||||
- If "None" is selected, there will be no console output on any UART, except
|
||||
for initial output from ROM bootloader. This output can be further suppressed by
|
||||
bootstrapping GPIO13 pin to low logic level.
|
||||
|
||||
config ESP_CONSOLE_UART_DEFAULT
|
||||
bool "Default: UART0, TX=GPIO1, RX=GPIO3"
|
||||
config ESP_CONSOLE_UART_CUSTOM
|
||||
bool "Custom"
|
||||
config ESP_CONSOLE_UART_NONE
|
||||
bool "None"
|
||||
endchoice
|
||||
|
||||
choice ESP_CONSOLE_UART_NUM
|
||||
prompt "UART peripheral to use for console output (0-1)"
|
||||
depends on ESP_CONSOLE_UART_CUSTOM
|
||||
default ESP_CONSOLE_UART_CUSTOM_NUM_0
|
||||
help
|
||||
Due of a ROM bug, UART2 is not supported for console output
|
||||
via ets_printf.
|
||||
|
||||
config ESP_CONSOLE_UART_CUSTOM_NUM_0
|
||||
bool "UART0"
|
||||
config ESP_CONSOLE_UART_CUSTOM_NUM_1
|
||||
bool "UART1"
|
||||
endchoice
|
||||
|
||||
config ESP_CONSOLE_UART_NUM
|
||||
int
|
||||
default 0 if ESP_CONSOLE_UART_DEFAULT || ESP_CONSOLE_UART_NONE
|
||||
default 0 if ESP_CONSOLE_UART_CUSTOM_NUM_0
|
||||
default 1 if ESP_CONSOLE_UART_CUSTOM_NUM_1
|
||||
|
||||
config ESP_CONSOLE_UART_BAUDRATE
|
||||
int "UART console baud rate"
|
||||
depends on !ESP_CONSOLE_UART_NONE
|
||||
default 74880
|
||||
range 1200 4000000
|
||||
|
||||
config ESP_UART0_SWAP_IO
|
||||
bool "Swap UART0 I/O pins"
|
||||
default n
|
||||
help
|
||||
Enable this option, UART0's I/O pins are swaped: TXD <-> RTS, RTX <-> CTS.
|
||||
|
||||
config ESP_TASK_WDT
|
||||
bool "Initialize Task Watchdog Timer on startup"
|
||||
default y
|
||||
help
|
||||
The Task Watchdog Timer can be used to make sure individual tasks are still
|
||||
running. Enabling this option will cause the Task Watchdog Timer to be
|
||||
initialized automatically at startup. The Task Watchdog timer can be
|
||||
initialized after startup as well (see Task Watchdog Timer API Reference)
|
||||
|
||||
config ESP_TASK_WDT_PANIC
|
||||
bool "Invoke panic handler on Task Watchdog timeout"
|
||||
depends on ESP_TASK_WDT
|
||||
default n
|
||||
help
|
||||
If this option is enabled, the Task Watchdog Timer will be configured to
|
||||
trigger the panic handler when it times out. This can also be configured
|
||||
at run time (see Task Watchdog Timer API Reference)
|
||||
|
||||
choice ESP_TASK_WDT_TIMEOUT_S
|
||||
prompt "Task Watchdog timeout period (seconds)"
|
||||
default TASK_WDT_TIMEOUT_15N
|
||||
help
|
||||
Timeout period configuration for the Task Watchdog Timer in seconds.
|
||||
This is also configurable at run time.
|
||||
|
||||
config ESP_TASK_WDT_TIMEOUT_13N
|
||||
bool "6.5536s"
|
||||
config ESP_TASK_WDT_TIMEOUT_14N
|
||||
bool "13.1072s"
|
||||
config ESP_TASK_WDT_TIMEOUT_15N
|
||||
bool "26.2144s"
|
||||
endchoice
|
||||
|
||||
config ESP_TASK_WDT_TIMEOUT_S
|
||||
int
|
||||
default 13 if ESP_TASK_WDT_TIMEOUT_13N
|
||||
default 14 if ESP_TASK_WDT_TIMEOUT_14N
|
||||
default 15 if ESP_TASK_WDT_TIMEOUT_15N
|
||||
|
||||
endmenu # Common ESP-related
|
47
components/esp_common/include/esp_task.h
Normal file
47
components/esp_common/include/esp_task.h
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright 2020-2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/* Notes:
|
||||
* 1. Put all task priority and stack size definition in this file
|
||||
* 2. If the task priority is less than 10, use ESP_TASK_PRIO_MIN + X style,
|
||||
* otherwise use ESP_TASK_PRIO_MAX - X style
|
||||
* 3. If this is a daemon task, the macro prefix is ESP_TASKD_, otherwise
|
||||
* it's ESP_TASK_
|
||||
* 4. If the configMAX_PRIORITIES is modified, please make all priority are
|
||||
* greater than 0
|
||||
* 5. Make sure esp_task.h is consistent between wifi lib and idf
|
||||
*/
|
||||
|
||||
#ifndef _ESP_TASK_H_
|
||||
#define _ESP_TASK_H_
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "freertos/FreeRTOSConfig.h"
|
||||
|
||||
#define ESP_TASK_PRIO_MAX (configMAX_PRIORITIES)
|
||||
#define ESP_TASK_PRIO_MIN (0)
|
||||
|
||||
#define TASK_EXTRA_STACK_SIZE (0)
|
||||
|
||||
/* idf task */
|
||||
#define ESP_TASK_TIMER_PRIO (ESP_TASK_PRIO_MAX - 3)
|
||||
#define ESP_TASK_TIMER_STACK (CONFIG_ESP_TIMER_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
|
||||
#define ESP_TASKD_EVENT_PRIO (ESP_TASK_PRIO_MAX - 5)
|
||||
#define ESP_TASKD_EVENT_STACK (CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
|
||||
#define ESP_TASK_TCPIP_PRIO (ESP_TASK_PRIO_MAX - 7)
|
||||
#define ESP_TASK_TCPIP_STACK (CONFIG_LWIP_TCPIP_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
|
||||
#define ESP_TASK_MAIN_PRIO (ESP_TASK_PRIO_MIN + 1)
|
||||
#define ESP_TASK_MAIN_STACK (CONFIG_ESP_MAIN_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
|
||||
|
||||
#endif
|
@ -17,7 +17,7 @@
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_task_wdt.h"
|
||||
|
||||
#define UART_NUM CONFIG_CONSOLE_UART_NUM
|
||||
#define UART_NUM CONFIG_ESP_CONSOLE_UART_NUM
|
||||
|
||||
void esp_gdbstub_target_init(void)
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ void esp_reent_init(struct _reent* r)
|
||||
*/
|
||||
int esp_newlib_init(void)
|
||||
{
|
||||
const char *default_uart_dev = "/dev/uart/" STR(CONFIG_CONSOLE_UART_NUM);
|
||||
const char *default_uart_dev = "/dev/uart/" STR(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
|
||||
esp_reent_init(_global_impure_ptr);
|
||||
|
||||
|
@ -52,14 +52,14 @@ static void initialize_console()
|
||||
.parity = UART_PARITY_DISABLE,
|
||||
.stop_bits = UART_STOP_BITS_1,
|
||||
};
|
||||
ESP_ERROR_CHECK( uart_param_config(CONFIG_CONSOLE_UART_NUM, &uart_config) );
|
||||
ESP_ERROR_CHECK( uart_param_config(CONFIG_ESP_CONSOLE_UART_NUM, &uart_config) );
|
||||
|
||||
/* Install UART driver for interrupt-driven reads and writes */
|
||||
ESP_ERROR_CHECK( uart_driver_install(CONFIG_CONSOLE_UART_NUM,
|
||||
ESP_ERROR_CHECK( uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM,
|
||||
256, 0, 0, NULL, 0) );
|
||||
|
||||
/* Tell VFS to use UART driver */
|
||||
esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM);
|
||||
esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
|
||||
/* Initialize the console */
|
||||
esp_console_config_t console_config = {
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#ifndef ESP_FACTORY_TEST_EXTRA_COMPONENTS
|
||||
|
||||
#define CONFIG_CONSOLE_UART_NUM 0
|
||||
#define CONFIG_ESP_CONSOLE_UART_NUM 0
|
||||
|
||||
#define TAG "factory-test"
|
||||
|
||||
@ -48,14 +48,14 @@ static void initialize_console()
|
||||
.parity = UART_PARITY_DISABLE,
|
||||
.stop_bits = UART_STOP_BITS_1,
|
||||
};
|
||||
ESP_ERROR_CHECK(uart_param_config(CONFIG_CONSOLE_UART_NUM, &uart_config));
|
||||
ESP_ERROR_CHECK(uart_param_config(CONFIG_ESP_CONSOLE_UART_NUM, &uart_config));
|
||||
|
||||
/* Install UART driver for interrupt-driven reads and writes */
|
||||
ESP_ERROR_CHECK(uart_driver_install(CONFIG_CONSOLE_UART_NUM,
|
||||
ESP_ERROR_CHECK(uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM,
|
||||
256, 0, 0, NULL, 0));
|
||||
|
||||
/* Tell VFS to use UART driver */
|
||||
esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM);
|
||||
esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
|
||||
esp_console_register_rftest_command();
|
||||
|
||||
|
@ -194,7 +194,7 @@ static void unity_run_single_test(const struct test_desc_t* test)
|
||||
printf("Running %s...\n", test->name);
|
||||
// Unit test runner expects to see test name before the test starts
|
||||
fflush(stdout);
|
||||
uart_tx_wait_idle(CONFIG_CONSOLE_UART_NUM);
|
||||
uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
|
||||
Unity.TestFile = test->file;
|
||||
Unity.CurrentDetail1 = test->desc;
|
||||
|
Reference in New Issue
Block a user