mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-19 02:41:14 +00:00
Merge branch 'bugfix/minor_fixes' into 'master'
Minor fixes and PRs cherry-picked from Github See merge request !602
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[](http://esp-idf.readthedocs.io/en/latest/?badge=latest)
|
[](http://esp-idf.readthedocs.io/en/latest/?badge=latest)
|
||||||
|
|
||||||
ESP-IDF is the official development framework for the [ESP32](https://espressif.com/en/products/hardware/esp32/overview>) chip.
|
ESP-IDF is the official development framework for the [ESP32](https://espressif.com/en/products/hardware/esp32/overview) chip.
|
||||||
|
|
||||||
# Developing With the ESP-IDF
|
# Developing With the ESP-IDF
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
menuconfig BT_ENABLED
|
menuconfig BT_ENABLED
|
||||||
bool "Bluetooth"
|
bool "Bluetooth"
|
||||||
help
|
help
|
||||||
Select this option to enable Bluetooth stack and show the submenu with Bluetooth configuration choices.
|
Select this option to enable Bluetooth and show the submenu with Bluetooth configuration choices.
|
||||||
|
|
||||||
|
config BLUEDROID_ENABLED
|
||||||
|
bool "Bluedroid Bluetooth stack enabled"
|
||||||
|
depends on BT_ENABLED
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
This enables the default Bluedroid Bluetooth stack
|
||||||
|
|
||||||
config BTC_TASK_STACK_SIZE
|
config BTC_TASK_STACK_SIZE
|
||||||
int "Bluetooth event (callback to application) task stack size"
|
int "Bluetooth event (callback to application) task stack size"
|
||||||
|
|||||||
@@ -3,7 +3,26 @@
|
|||||||
#
|
#
|
||||||
ifdef CONFIG_BT_ENABLED
|
ifdef CONFIG_BT_ENABLED
|
||||||
|
|
||||||
COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \
|
COMPONENT_SRCDIRS := .
|
||||||
|
|
||||||
|
COMPONENT_ADD_INCLUDEDIRS := include
|
||||||
|
|
||||||
|
LIBS := btdm_app
|
||||||
|
|
||||||
|
COMPONENT_ADD_LDFLAGS := -lbt -L $(COMPONENT_PATH)/lib \
|
||||||
|
$(addprefix -l,$(LIBS))
|
||||||
|
|
||||||
|
# re-link program if BT binary libs change
|
||||||
|
COMPONENT_ADD_LINKER_DEPS := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
|
||||||
|
|
||||||
|
COMPONENT_SUBMODULES += lib
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifdef CONFIG_BLUEDROID_ENABLED
|
||||||
|
|
||||||
|
COMPONENT_ADD_INCLUDEDIRS += bluedroid/bta/include \
|
||||||
bluedroid/bta/sys/include \
|
bluedroid/bta/sys/include \
|
||||||
bluedroid/btcore/include \
|
bluedroid/btcore/include \
|
||||||
bluedroid/device/include \
|
bluedroid/device/include \
|
||||||
@@ -29,17 +48,8 @@ COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \
|
|||||||
bluedroid/stack/include \
|
bluedroid/stack/include \
|
||||||
bluedroid/api/include \
|
bluedroid/api/include \
|
||||||
bluedroid/include \
|
bluedroid/include \
|
||||||
include
|
|
||||||
|
|
||||||
LIBS := btdm_app
|
COMPONENT_SRCDIRS += bluedroid/bta/dm \
|
||||||
|
|
||||||
COMPONENT_ADD_LDFLAGS := -lbt -L $(COMPONENT_PATH)/lib \
|
|
||||||
$(addprefix -l,$(LIBS))
|
|
||||||
|
|
||||||
# re-link program if BT binary libs change
|
|
||||||
COMPONENT_ADD_LINKER_DEPS := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
|
|
||||||
|
|
||||||
COMPONENT_SRCDIRS := bluedroid/bta/dm \
|
|
||||||
bluedroid/bta/gatt \
|
bluedroid/bta/gatt \
|
||||||
bluedroid/bta/hh \
|
bluedroid/bta/hh \
|
||||||
bluedroid/bta/sdp \
|
bluedroid/bta/sdp \
|
||||||
@@ -69,8 +79,5 @@ COMPONENT_SRCDIRS := bluedroid/bta/dm \
|
|||||||
bluedroid/stack \
|
bluedroid/stack \
|
||||||
bluedroid/api \
|
bluedroid/api \
|
||||||
bluedroid \
|
bluedroid \
|
||||||
.
|
|
||||||
|
|
||||||
COMPONENT_SUBMODULES += lib
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ extern "C" {
|
|||||||
* @brief Bluetooth mode for controller enable/disable
|
* @brief Bluetooth mode for controller enable/disable
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ESP_BT_MODE_ILDE = 0x00, /*!< Bluetooth is not run */
|
ESP_BT_MODE_IDLE = 0x00, /*!< Bluetooth is not running */
|
||||||
ESP_BT_MODE_BLE = 0x01, /*!< Run BLE mode */
|
ESP_BT_MODE_BLE = 0x01, /*!< Run BLE mode */
|
||||||
ESP_BT_MODE_CLASSIC_BT = 0x02, /*!< Run Classic BT mode */
|
ESP_BT_MODE_CLASSIC_BT = 0x02, /*!< Run Classic BT mode */
|
||||||
ESP_BT_MODE_BTDM = 0x03, /*!< Run dual mode */
|
ESP_BT_MODE_BTDM = 0x03, /*!< Run dual mode */
|
||||||
|
|||||||
@@ -619,22 +619,17 @@ esp_err_t rmt_fill_tx_items(rmt_channel_t channel, rmt_item32_t* item, uint16_t
|
|||||||
*
|
*
|
||||||
* @param channel RMT channel (0 - 7)
|
* @param channel RMT channel (0 - 7)
|
||||||
*
|
*
|
||||||
* @param rx_buf_size Size of RMT RX ringbuffer.
|
* @param rx_buf_size Size of RMT RX ringbuffer. Can be 0 if the RX ringbuffer is not used.
|
||||||
*
|
*
|
||||||
* @note
|
* @param intr_alloc_flags Flags for the RMT driver interrupt handler. Pass 0 for default flags. See esp_intr_alloc.h for details.
|
||||||
* If we do not need RX ringbuffer, just set rx_buf_size to 0.
|
|
||||||
*
|
|
||||||
* @note
|
|
||||||
* When we call rmt_driver_install function, it will register a driver ISR handler,
|
|
||||||
* DO NOT REGISTER ISR HANDLER AGAIN.
|
|
||||||
*
|
|
||||||
* @param rmt_intr_num RMT interrupt number.
|
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
* - ESP_ERR_INVALID_STATE Driver is already installed, call rmt_driver_uninstall first.
|
||||||
|
* - ESP_ERR_NO_MEM Memory allocation failure
|
||||||
* - ESP_ERR_INVALID_ARG Parameter error
|
* - ESP_ERR_INVALID_ARG Parameter error
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
*/
|
*/
|
||||||
esp_err_t rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int rmt_intr_num);
|
esp_err_t rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int intr_alloc_flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Uninstall RMT driver.
|
* @brief Uninstall RMT driver.
|
||||||
|
|||||||
@@ -555,7 +555,7 @@ static void IRAM_ATTR rmt_driver_isr_default(void* arg)
|
|||||||
if(p_rmt->rx_buf) {
|
if(p_rmt->rx_buf) {
|
||||||
BaseType_t res = xRingbufferSendFromISR(p_rmt->rx_buf, (void*) RMTMEM.chan[channel].data32, item_len * 4, &HPTaskAwoken);
|
BaseType_t res = xRingbufferSendFromISR(p_rmt->rx_buf, (void*) RMTMEM.chan[channel].data32, item_len * 4, &HPTaskAwoken);
|
||||||
if(res == pdFALSE) {
|
if(res == pdFALSE) {
|
||||||
ESP_LOGE(RMT_TAG, "RMT RX BUFFER FULL");
|
ESP_EARLY_LOGE(RMT_TAG, "RMT RX BUFFER FULL");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -643,15 +643,15 @@ esp_err_t rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int intr
|
|||||||
{
|
{
|
||||||
RMT_CHECK(channel < RMT_CHANNEL_MAX, RMT_CHANNEL_ERROR_STR, ESP_ERR_INVALID_ARG);
|
RMT_CHECK(channel < RMT_CHANNEL_MAX, RMT_CHANNEL_ERROR_STR, ESP_ERR_INVALID_ARG);
|
||||||
if(p_rmt_obj[channel] != NULL) {
|
if(p_rmt_obj[channel] != NULL) {
|
||||||
ESP_LOGD(RMT_TAG, "RMT DRIVER ALREADY INSTALLED");
|
ESP_LOGD(RMT_TAG, "RMT driver already installed");
|
||||||
return ESP_FAIL;
|
return ESP_ERR_INVALID_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_rmt_obj[channel] = (rmt_obj_t*) malloc(sizeof(rmt_obj_t));
|
p_rmt_obj[channel] = (rmt_obj_t*) malloc(sizeof(rmt_obj_t));
|
||||||
|
|
||||||
if(p_rmt_obj[channel] == NULL) {
|
if(p_rmt_obj[channel] == NULL) {
|
||||||
ESP_LOGE(RMT_TAG, "RMT driver malloc error");
|
ESP_LOGE(RMT_TAG, "RMT driver malloc error");
|
||||||
return ESP_FAIL;
|
return ESP_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
memset(p_rmt_obj[channel], 0, sizeof(rmt_obj_t));
|
memset(p_rmt_obj[channel], 0, sizeof(rmt_obj_t));
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ typedef struct {
|
|||||||
.magic = WIFI_INIT_CONFIG_MAGIC\
|
.magic = WIFI_INIT_CONFIG_MAGIC\
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
#define WIFI_INIT_CONFIG_DEFAULT #error Wifi is disabled in config, WIFI_INIT_CONFIG_DEFAULT will not work
|
#define WIFI_INIT_CONFIG_DEFAULT() {0}; _Static_assert(0, "please enable wifi in menuconfig to use esp_wifi.h");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void emac_reset(void)
|
|||||||
|
|
||||||
while (REG_GET_BIT(EMAC_DMABUSMODE_REG, EMAC_SW_RST) == 1) {
|
while (REG_GET_BIT(EMAC_DMABUSMODE_REG, EMAC_SW_RST) == 1) {
|
||||||
//nothing to do ,if stop here,maybe emac have not clk input.
|
//nothing to do ,if stop here,maybe emac have not clk input.
|
||||||
ESP_LOGI(TAG, "emac reseting ....");
|
ESP_LOGI(TAG, "emac resetting ....");
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_LOGI(TAG, "emac reset done");
|
ESP_LOGI(TAG, "emac reset done");
|
||||||
|
|||||||
@@ -948,14 +948,14 @@ esp_err_t esp_eth_init(eth_config_t *config)
|
|||||||
emac_set_user_config_data(config);
|
emac_set_user_config_data(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
emac_config.emac_phy_power_enable(true);
|
|
||||||
|
|
||||||
ret = emac_verify_args();
|
ret = emac_verify_args();
|
||||||
|
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emac_config.emac_phy_power_enable(true);
|
||||||
|
|
||||||
//before set emac reg must enable clk
|
//before set emac reg must enable clk
|
||||||
emac_enable_clk(true);
|
emac_enable_clk(true);
|
||||||
REG_SET_FIELD(EMAC_EX_PHYINF_CONF_REG, EMAC_EX_PHY_INTF_SEL, EMAC_EX_PHY_INTF_RMII);
|
REG_SET_FIELD(EMAC_EX_PHYINF_CONF_REG, EMAC_EX_PHY_INTF_SEL, EMAC_EX_PHY_INTF_RMII);
|
||||||
|
|||||||
@@ -197,6 +197,81 @@ config FREERTOS_MAX_TASK_NAME_LEN
|
|||||||
|
|
||||||
For most uses, the default of 16 is OK.
|
For most uses, the default of 16 is OK.
|
||||||
|
|
||||||
|
config SUPPORT_STATIC_ALLOCATION
|
||||||
|
bool "Enable FreeRTOS static allocation API"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
FreeRTOS gives the application writer the ability to instead provide the memory
|
||||||
|
themselves, allowing the following objects to optionally be created without any
|
||||||
|
memory being allocated dynamically:
|
||||||
|
|
||||||
|
- Tasks
|
||||||
|
- Software Timers
|
||||||
|
- Queues
|
||||||
|
- Event Groups
|
||||||
|
- Binary Semaphores
|
||||||
|
- Counting Semaphores
|
||||||
|
- Recursive Semaphores
|
||||||
|
- Mutexes
|
||||||
|
|
||||||
|
Whether it is preferable to use static or dynamic memory allocation is dependent on
|
||||||
|
the application, and the preference of the application writer. Both methods have pros
|
||||||
|
and cons, and both methods can be used within the same RTOS application.
|
||||||
|
|
||||||
|
Creating RTOS objects using statically allocated RAM has the benefit of providing the
|
||||||
|
application writer with more control: RTOS objects can be placed at specific memory locations.
|
||||||
|
The maximum RAM footprint can be determined at link time, rather than run time.
|
||||||
|
The application writer does not need to concern themselves with graceful handling of memory allocation failures.
|
||||||
|
It allows the RTOS to be used in applications that simply don't allow any dynamic memory allocation
|
||||||
|
(although FreeRTOS includes allocation schemes that can overcome most objections).
|
||||||
|
|
||||||
|
config ENABLE_STATIC_TASK_CLEAN_UP_HOOK
|
||||||
|
bool "Enable static task clean up hook"
|
||||||
|
depends on SUPPORT_STATIC_ALLOCATION
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable this option to make FreeRTOS call the static task clean up hook when a task is deleted.
|
||||||
|
|
||||||
|
Bear in mind that if this option is enabled you will need to implement the following function:
|
||||||
|
|
||||||
|
void vPortCleanUpTCB ( void *pxTCB ) {
|
||||||
|
// place clean up code here
|
||||||
|
}
|
||||||
|
|
||||||
|
config TIMER_TASK_PRIORITY
|
||||||
|
int "FreeRTOS timer task priority"
|
||||||
|
range 1 25
|
||||||
|
default 1
|
||||||
|
help
|
||||||
|
The timer service task (primarily) makes use of existing FreeRTOS features, allowing timer
|
||||||
|
functionality to be added to an application with minimal impact on the size of the application's
|
||||||
|
executable binary.
|
||||||
|
|
||||||
|
Use this constant to define the priority that the timer task will run at.
|
||||||
|
|
||||||
|
config TIMER_TASK_STACK_DEPTH
|
||||||
|
int "FreeRTOS timer task stack size"
|
||||||
|
range 1536 32768
|
||||||
|
default 2048
|
||||||
|
help
|
||||||
|
The timer service task (primarily) makes use of existing FreeRTOS features, allowing timer
|
||||||
|
functionality to be added to an application with minimal impact on the size of the application's
|
||||||
|
executable binary.
|
||||||
|
|
||||||
|
Use this constant to define the size (in bytes) of the stack allocated for the timer task.
|
||||||
|
|
||||||
|
config TIMER_QUEUE_LENGTH
|
||||||
|
int "FreeRTOS timer queue length"
|
||||||
|
range 5 20
|
||||||
|
default 10
|
||||||
|
help
|
||||||
|
FreeRTOS provides a set of timer related API functions. Many of these functions use a standard
|
||||||
|
FreeRTOS queue to send commands to the timer service task. The queue used for this purpose is
|
||||||
|
called the 'timer command queue'. The 'timer command queue' is private to the FreeRTOS timer
|
||||||
|
implementation, and cannot be accessed directly.
|
||||||
|
|
||||||
|
For most uses the default value of 10 is OK.
|
||||||
|
|
||||||
menuconfig FREERTOS_DEBUG_INTERNALS
|
menuconfig FREERTOS_DEBUG_INTERNALS
|
||||||
bool "Debug FreeRTOS internals"
|
bool "Debug FreeRTOS internals"
|
||||||
default n
|
default n
|
||||||
|
|||||||
@@ -248,13 +248,21 @@
|
|||||||
#define configUSE_NEWLIB_REENTRANT 1
|
#define configUSE_NEWLIB_REENTRANT 1
|
||||||
|
|
||||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||||
|
#define configSUPPORT_STATIC_ALLOCATION CONFIG_SUPPORT_STATIC_ALLOCATION
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLER__
|
||||||
|
#if CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK
|
||||||
|
extern void vPortCleanUpTCB ( void *pxTCB );
|
||||||
|
#define portCLEAN_UP_TCB( pxTCB ) vPortCleanUpTCB( pxTCB )
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Test FreeRTOS timers (with timer task) and more. */
|
/* Test FreeRTOS timers (with timer task) and more. */
|
||||||
/* Some files don't compile if this flag is disabled */
|
/* Some files don't compile if this flag is disabled */
|
||||||
#define configUSE_TIMERS 1
|
#define configUSE_TIMERS 1
|
||||||
#define configTIMER_TASK_PRIORITY 1
|
#define configTIMER_TASK_PRIORITY CONFIG_TIMER_TASK_PRIORITY
|
||||||
#define configTIMER_QUEUE_LENGTH 10
|
#define configTIMER_QUEUE_LENGTH CONFIG_TIMER_QUEUE_LENGTH
|
||||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
#define configTIMER_TASK_STACK_DEPTH CONFIG_TIMER_TASK_STACK_DEPTH
|
||||||
|
|
||||||
#define INCLUDE_xTimerPendFunctionCall 1
|
#define INCLUDE_xTimerPendFunctionCall 1
|
||||||
#define INCLUDE_eTaskGetState 1
|
#define INCLUDE_eTaskGetState 1
|
||||||
|
|||||||
@@ -3763,11 +3763,6 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
|
|||||||
|
|
||||||
static void prvDeleteTCB( TCB_t *pxTCB )
|
static void prvDeleteTCB( TCB_t *pxTCB )
|
||||||
{
|
{
|
||||||
/* This call is required specifically for the TriCore port. It must be
|
|
||||||
above the vPortFree() calls. The call is also used by ports/demos that
|
|
||||||
want to allocate and clean RAM statically. */
|
|
||||||
portCLEAN_UP_TCB( pxTCB );
|
|
||||||
|
|
||||||
/* Free up the memory allocated by the scheduler for the task. It is up
|
/* Free up the memory allocated by the scheduler for the task. It is up
|
||||||
to the task to free any memory allocated at the application level. */
|
to the task to free any memory allocated at the application level. */
|
||||||
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||||
@@ -3806,6 +3801,7 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
|
|||||||
/* Neither the stack nor the TCB were allocated dynamically, so
|
/* Neither the stack nor the TCB were allocated dynamically, so
|
||||||
nothing needs to be freed. */
|
nothing needs to be freed. */
|
||||||
configASSERT( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB )
|
configASSERT( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB )
|
||||||
|
portCLEAN_UP_TCB( pxTCB );
|
||||||
mtCOVERAGE_TEST_MARKER();
|
mtCOVERAGE_TEST_MARKER();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,8 +186,7 @@ endif
|
|||||||
@echo $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
@echo $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
||||||
|
|
||||||
|
|
||||||
# Git version of ESP-IDF (of the form v1.0-285-g5c4f707)
|
IDF_VER := $(shell git -C $(IDF_PATH) describe --always --tags --dirty)
|
||||||
IDF_VER := $(shell git -C $(IDF_PATH) describe)
|
|
||||||
|
|
||||||
# Set default LDFLAGS
|
# Set default LDFLAGS
|
||||||
|
|
||||||
@@ -411,7 +410,7 @@ define GenerateSubmoduleCheckTarget
|
|||||||
check-submodules: $(IDF_PATH)/$(1)/.git
|
check-submodules: $(IDF_PATH)/$(1)/.git
|
||||||
$(IDF_PATH)/$(1)/.git:
|
$(IDF_PATH)/$(1)/.git:
|
||||||
@echo "WARNING: Missing submodule $(1)..."
|
@echo "WARNING: Missing submodule $(1)..."
|
||||||
[ -d ${IDF_PATH}/.git ] || ( echo "ERROR: esp-idf must be cloned from git to work."; exit 1)
|
[ -e ${IDF_PATH}/.git ] || ( echo "ERROR: esp-idf must be cloned from git to work."; exit 1)
|
||||||
[ -x $(which git) ] || ( echo "ERROR: Need to run 'git submodule init $(1)' in esp-idf root directory."; exit 1)
|
[ -x $(which git) ] || ( echo "ERROR: Need to run 'git submodule init $(1)' in esp-idf root directory."; exit 1)
|
||||||
@echo "Attempting 'git submodule update --init $(1)' in esp-idf root directory..."
|
@echo "Attempting 'git submodule update --init $(1)' in esp-idf root directory..."
|
||||||
cd ${IDF_PATH} && git submodule update --init $(1)
|
cd ${IDF_PATH} && git submodule update --init $(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user