forked from espressif/arduino-esp32
Update IDF, tools and toolchains
This commit is contained in:
@ -18,21 +18,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
#include "esp32/rom/crc.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
#include "esp32s2/rom/crc.h"
|
||||
#endif
|
||||
|
||||
/******************* Polynomials Used in the CRC APIs ****************************
|
||||
* CRC-8 x8+x2+x1+1 0x07
|
||||
* CRC16-CCITT x16+x12+x5+1 0x1021
|
||||
* CRC32 x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x1+1 0x04c11db7
|
||||
********************************************************************************/
|
||||
// This header is only a wrapper on ROM CRC API
|
||||
#include "esp_rom_crc.h"
|
||||
|
||||
/**
|
||||
* @brief CRC32 value in little endian.
|
||||
@ -44,10 +32,9 @@ extern "C" {
|
||||
*/
|
||||
static inline uint32_t esp_crc32_le(uint32_t crc, uint8_t const *buf, uint32_t len)
|
||||
{
|
||||
return crc32_le(crc, buf, len);
|
||||
return esp_rom_crc32_le(crc, buf, len);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
/**
|
||||
* @brief CRC32 value in big endian.
|
||||
*
|
||||
@ -58,9 +45,8 @@ static inline uint32_t esp_crc32_le(uint32_t crc, uint8_t const *buf, uint32_t l
|
||||
*/
|
||||
static inline uint32_t esp_crc32_be(uint32_t crc, uint8_t const *buf, uint32_t len)
|
||||
{
|
||||
return crc32_be(crc, buf, len);
|
||||
return esp_rom_crc32_be(crc, buf, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief CRC16 value in little endian.
|
||||
@ -72,10 +58,9 @@ static inline uint32_t esp_crc32_be(uint32_t crc, uint8_t const *buf, uint32_t l
|
||||
*/
|
||||
static inline uint16_t esp_crc16_le(uint16_t crc, uint8_t const *buf, uint32_t len)
|
||||
{
|
||||
return crc16_le(crc, buf, len);
|
||||
return esp_rom_crc16_le(crc, buf, len);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
/**
|
||||
* @brief CRC16 value in big endian.
|
||||
*
|
||||
@ -86,9 +71,8 @@ static inline uint16_t esp_crc16_le(uint16_t crc, uint8_t const *buf, uint32_t l
|
||||
*/
|
||||
static inline uint16_t esp_crc16_be(uint16_t crc, uint8_t const *buf, uint32_t len)
|
||||
{
|
||||
return crc16_be(crc, buf, len);
|
||||
return esp_rom_crc16_be(crc, buf, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief CRC8 value in little endian.
|
||||
@ -100,10 +84,9 @@ static inline uint16_t esp_crc16_be(uint16_t crc, uint8_t const *buf, uint32_t l
|
||||
*/
|
||||
static inline uint8_t esp_crc8_le(uint8_t crc, uint8_t const *buf, uint32_t len)
|
||||
{
|
||||
return crc8_le(crc, buf, len);
|
||||
return esp_rom_crc8_le(crc, buf, len);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
/**
|
||||
* @brief CRC8 value in big endian.
|
||||
*
|
||||
@ -114,9 +97,8 @@ static inline uint8_t esp_crc8_le(uint8_t crc, uint8_t const *buf, uint32_t len)
|
||||
*/
|
||||
static inline uint8_t esp_crc8_be(uint8_t crc, uint8_t const *buf, uint32_t len)
|
||||
{
|
||||
return crc8_be(crc, buf, len);
|
||||
return esp_rom_crc8_be(crc, buf, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/task.h"
|
||||
@ -23,56 +24,25 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*shared_stack_function)(void);
|
||||
|
||||
#define ESP_EXECUTE_EXPRESSION_WITH_STACK(lock, stack, stack_size, expression) \
|
||||
esp_execute_shared_stack_function(lock, stack, stack_size, expression)
|
||||
|
||||
/**
|
||||
* @brief Executes a 1-line expression with a application alocated stack
|
||||
* @brief Calls user defined shared stack space function
|
||||
* @param lock Mutex object to protect in case of shared stack
|
||||
* @param stack Pointer to user alocated stack
|
||||
* @param stack_size Size of current stack in bytes
|
||||
* @param expression Expression or function to be executed using the stack
|
||||
* @param function pointer to the shared stack function to be executed
|
||||
* @note if either lock, stack or stack size is invalid, the expression will
|
||||
* be called using the current stack.
|
||||
*/
|
||||
#define ESP_EXECUTE_EXPRESSION_WITH_STACK(lock, stack, stack_size, expression) \
|
||||
({ \
|
||||
assert(lock && stack && (stack_size >= CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE)); \
|
||||
uint32_t backup; \
|
||||
xSemaphoreTake(lock, portMAX_DELAY); \
|
||||
StackType_t *top_of_stack = esp_switch_stack_setup(stack, stack_size); \
|
||||
esp_switch_stack_enter(top_of_stack, &backup); \
|
||||
{ \
|
||||
expression; \
|
||||
} \
|
||||
esp_switch_stack_exit(&backup); \
|
||||
StaticTask_t *current = (StaticTask_t *)xTaskGetCurrentTaskHandle(); \
|
||||
/* pxDummy6 is the stack base of current thread defined in TCB_t */ \
|
||||
/* place the watchpoint on current task stack after function execution*/ \
|
||||
vPortSetStackWatchpoint(current->pxDummy6); \
|
||||
xSemaphoreGive(lock); \
|
||||
})
|
||||
void esp_execute_shared_stack_function(SemaphoreHandle_t lock,
|
||||
void *stack,
|
||||
size_t stack_size,
|
||||
shared_stack_function function);
|
||||
|
||||
/**
|
||||
* @brief Fill stack frame with CPU-specifics value before use
|
||||
* @param stack Caller allocated stack pointer
|
||||
* @param stack_size Size of stack in bytes
|
||||
* @return New pointer to the top of stack
|
||||
* @note Application must not call this function directly
|
||||
*/
|
||||
StackType_t * esp_switch_stack_setup(StackType_t *stack, size_t stack_size);
|
||||
|
||||
/**
|
||||
* @brief Changes CPU sp-register to use another stack space and save the previous one
|
||||
* @param stack Caller allocated stack pointer
|
||||
* @param backup_stack Pointer to a place to save the current stack
|
||||
* @note Application must not call this function directly
|
||||
*/
|
||||
extern void esp_switch_stack_enter(StackType_t *stack, uint32_t *backup_stack);
|
||||
|
||||
/**
|
||||
* @brief Restores the previous CPU sp-register
|
||||
* @param backup_stack Pointer to the place where stack was saved
|
||||
* @note Application must not call this function directly
|
||||
*/
|
||||
extern void esp_switch_stack_exit(uint32_t *backup_stack);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#include "esp_rom_sys.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -81,9 +82,9 @@ extern "C" {
|
||||
|
||||
#warning "Enabling ESP_FAULT_ASSERT_DEBUG makes ESP_FAULT_ASSERT() less effective"
|
||||
|
||||
#define _ESP_FAULT_RESET() do { \
|
||||
ets_printf("ESP_FAULT_ASSERT %s:%d\n", __FILE__, __LINE__); \
|
||||
asm volatile("ill;"); \
|
||||
#define _ESP_FAULT_RESET() do { \
|
||||
esp_rom_printf("ESP_FAULT_ASSERT %s:%d\n", __FILE__, __LINE__); \
|
||||
asm volatile("ill;"); \
|
||||
} while(0)
|
||||
|
||||
#endif // ESP_FAULT_ASSERT_DEBUG
|
||||
|
@ -21,7 +21,7 @@ extern "C" {
|
||||
/** Major version number (X.x.x) */
|
||||
#define ESP_IDF_VERSION_MAJOR 4
|
||||
/** Minor version number (x.X.x) */
|
||||
#define ESP_IDF_VERSION_MINOR 2
|
||||
#define ESP_IDF_VERSION_MINOR 3
|
||||
/** Patch version number (x.x.X) */
|
||||
#define ESP_IDF_VERSION_PATCH 0
|
||||
|
||||
|
@ -61,6 +61,21 @@ void esp_reset_reason_set_hint(esp_reset_reason_t hint);
|
||||
*/
|
||||
esp_reset_reason_t esp_reset_reason_get_hint(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the time in microseconds since startup
|
||||
*
|
||||
* @returns time since startup in microseconds
|
||||
*/
|
||||
int64_t esp_system_get_time(void);
|
||||
|
||||
/**
|
||||
* @brief Get the resolution of the time returned by `esp_system_get_time`.
|
||||
*
|
||||
* @returns the resolution in microseconds
|
||||
*/
|
||||
uint32_t esp_system_get_time_resolution(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user