esp32: sanity check ISR handler address passed into esp_intr_alloc

Return ESP_ERR_INVALID_ARG if the handler is not in IRAM (or RTC fast memory)
This commit is contained in:
Ivan Grokhotkov
2017-01-11 01:14:18 +08:00
parent 833102cbf3
commit a2e0c2432e
4 changed files with 41 additions and 3 deletions

View File

@@ -73,11 +73,13 @@ void esp_crosscore_int_init() {
portENTER_CRITICAL(&reasonSpinlock);
reason[xPortGetCoreID()]=0;
portEXIT_CRITICAL(&reasonSpinlock);
esp_err_t err;
if (xPortGetCoreID()==0) {
esp_intr_alloc(ETS_FROM_CPU_INTR0_SOURCE, ESP_INTR_FLAG_IRAM, esp_crosscore_isr, (void*)&reason[xPortGetCoreID()], NULL);
err = esp_intr_alloc(ETS_FROM_CPU_INTR0_SOURCE, ESP_INTR_FLAG_IRAM, esp_crosscore_isr, (void*)&reason[xPortGetCoreID()], NULL);
} else {
esp_intr_alloc(ETS_FROM_CPU_INTR1_SOURCE, ESP_INTR_FLAG_IRAM, esp_crosscore_isr, (void*)&reason[xPortGetCoreID()], NULL);
err = esp_intr_alloc(ETS_FROM_CPU_INTR1_SOURCE, ESP_INTR_FLAG_IRAM, esp_crosscore_isr, (void*)&reason[xPortGetCoreID()], NULL);
}
assert(err == ESP_OK);
}
void esp_crosscore_int_send_yield(int coreId) {