Merge branch 'bugfix/fixes_for_building_with_amazon_freertos' into 'master'

Fixes for building with amazon freertos

See merge request idf/esp-idf!2523
This commit is contained in:
Angus Gratton 2018-06-12 14:47:34 +08:00
commit 4eda1b7a25
5 changed files with 20 additions and 8 deletions

View file

@ -96,6 +96,7 @@ The driver of FIFOs works as below:
#include "freertos/FreeRTOS.h"
#include "soc/dport_access.h"
#include "soc/dport_reg.h"
#include "soc/io_mux_reg.h"
#include "freertos/semphr.h"
#include "xtensa/core-macros.h"
#include "driver/periph_ctrl.h"

View file

@ -5,3 +5,5 @@
COMPONENT_ADD_LDFLAGS += -Wl,--undefined=uxTopUsedPriority
COMPONENT_ADD_INCLUDEDIRS := include
COMPONENT_PRIV_INCLUDEDIRS := include/freertos
tasks.o event_groups.o timers.o queue.o ringbuf.o: CFLAGS += -D_ESP_FREERTOS_INTERNAL

View file

@ -233,7 +233,11 @@ typedef enum
*
* \ingroup SchedulerControl
*/
#ifdef _ESP_FREERTOS_INTERNAL
#define taskENTER_CRITICAL(mux) portENTER_CRITICAL(mux)
#else
#define taskENTER_CRITICAL(mux) _Pragma("GCC warning \"'taskENTER_CRITICAL(mux)' is deprecated in ESP-IDF, consider using 'portENTER_CRITICAL(mux)'\"") portENTER_CRITICAL(mux)
#endif
#define taskENTER_CRITICAL_ISR(mux) portENTER_CRITICAL_ISR(mux)
/**
@ -247,7 +251,11 @@ typedef enum
*
* \ingroup SchedulerControl
*/
#ifdef _ESP_FREERTOS_INTERNAL
#define taskEXIT_CRITICAL(mux) portEXIT_CRITICAL(mux)
#else
#define taskEXIT_CRITICAL(mux) _Pragma("GCC warning \"'taskEXIT_CRITICAL(mux)' is deprecated in ESP-IDF, consider using 'portEXIT_CRITICAL(mux)'\"") portEXIT_CRITICAL(mux)
#endif
#define taskEXIT_CRITICAL_ISR(mux) portEXIT_CRITICAL_ISR(mux)
/**

View file

@ -36,6 +36,7 @@
#include "freertos/xtensa_api.h"
#include "freertos/task.h"
#include "sdkconfig.h"
#include "limits.h"
#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 )
#define WITH_RTC 1

View file

@ -335,28 +335,28 @@ static esp_err_t uart_start_select(int nfds, fd_set *readfds, fd_set *writefds,
const int max_fds = MIN(nfds, UART_NUM);
taskENTER_CRITICAL(uart_get_selectlock());
portENTER_CRITICAL(uart_get_selectlock());
if (_readfds || _writefds || _errorfds || _readfds_orig || _writefds_orig || _errorfds_orig || _signal_sem) {
taskEXIT_CRITICAL(uart_get_selectlock());
portEXIT_CRITICAL(uart_get_selectlock());
uart_end_select();
return ESP_ERR_INVALID_STATE;
}
if ((_readfds_orig = malloc(sizeof(fd_set))) == NULL) {
taskEXIT_CRITICAL(uart_get_selectlock());
portEXIT_CRITICAL(uart_get_selectlock());
uart_end_select();
return ESP_ERR_NO_MEM;
}
if ((_writefds_orig = malloc(sizeof(fd_set))) == NULL) {
taskEXIT_CRITICAL(uart_get_selectlock());
portEXIT_CRITICAL(uart_get_selectlock());
uart_end_select();
return ESP_ERR_NO_MEM;
}
if ((_errorfds_orig = malloc(sizeof(fd_set))) == NULL) {
taskEXIT_CRITICAL(uart_get_selectlock());
portEXIT_CRITICAL(uart_get_selectlock());
uart_end_select();
return ESP_ERR_NO_MEM;
}
@ -382,7 +382,7 @@ static esp_err_t uart_start_select(int nfds, fd_set *readfds, fd_set *writefds,
FD_ZERO(writefds);
FD_ZERO(exceptfds);
taskEXIT_CRITICAL(uart_get_selectlock());
portEXIT_CRITICAL(uart_get_selectlock());
// s_one_select_lock is not released on successfull exit - will be
// released in uart_end_select()
@ -391,7 +391,7 @@ static esp_err_t uart_start_select(int nfds, fd_set *readfds, fd_set *writefds,
static void uart_end_select()
{
taskENTER_CRITICAL(uart_get_selectlock());
portENTER_CRITICAL(uart_get_selectlock());
for (int i = 0; i < UART_NUM; ++i) {
uart_set_select_notif_callback(i, NULL);
}
@ -416,7 +416,7 @@ static void uart_end_select()
free(_errorfds_orig);
_errorfds_orig = NULL;
}
taskEXIT_CRITICAL(uart_get_selectlock());
portEXIT_CRITICAL(uart_get_selectlock());
_lock_release(&s_one_select_lock);
}