Merge branch 'bugfix/uart_isr_rodata' into 'master'

UART driver: Fix crash in ISR due to "UART" static array moved to flash

Ref: http://esp32.com/viewtopic.php?f=13&t=546&sid=76ff371ae2b259441a2cf355e96d74b9#p2275

This is a really subtle bug, gcc noticed the UART array elements are read-only so
implicitly moved the elements to .rodata as if it was const. However
this array is accessed from the UART ISR, so has to be in IRAM or DRAM.

See merge request !245
This commit is contained in:
Angus Gratton 2016-11-24 12:09:46 +08:00
commit 7e433ae3f4

View file

@ -84,7 +84,8 @@ typedef struct {
static uart_obj_t *p_uart_obj[UART_NUM_MAX] = {0};
static uart_dev_t* UART[UART_NUM_MAX] = {&UART0, &UART1, &UART2};
/* DRAM_ATTR is required to avoid UART array placed in flash, due to accessed from ISR */
static DRAM_ATTR uart_dev_t* const UART[UART_NUM_MAX] = {&UART0, &UART1, &UART2};
static portMUX_TYPE uart_spinlock[UART_NUM_MAX] = {portMUX_INITIALIZER_UNLOCKED, portMUX_INITIALIZER_UNLOCKED, portMUX_INITIALIZER_UNLOCKED};
esp_err_t uart_set_word_length(uart_port_t uart_num, uart_word_length_t data_bit)