mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 12:35:28 +00:00
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:
@@ -201,3 +201,30 @@ TEST_CASE("Intr_alloc test, shared ints", "[esp32]")
|
||||
{
|
||||
timer_test(ESP_INTR_FLAG_SHARED);
|
||||
}
|
||||
|
||||
TEST_CASE("Can allocate IRAM int only with an IRAM handler", "[esp32]")
|
||||
{
|
||||
void dummy(void* arg)
|
||||
{
|
||||
}
|
||||
IRAM_ATTR void dummy_iram(void* arg)
|
||||
{
|
||||
}
|
||||
RTC_IRAM_ATTR void dummy_rtc(void* arg)
|
||||
{
|
||||
}
|
||||
intr_handle_t ih;
|
||||
esp_err_t err = esp_intr_alloc(ETS_INTERNAL_PROFILING_INTR_SOURCE,
|
||||
ESP_INTR_FLAG_IRAM, &dummy, NULL, &ih);
|
||||
TEST_ASSERT_EQUAL_INT(ESP_ERR_INVALID_ARG, err);
|
||||
err = esp_intr_alloc(ETS_INTERNAL_PROFILING_INTR_SOURCE,
|
||||
ESP_INTR_FLAG_IRAM, &dummy_iram, NULL, &ih);
|
||||
TEST_ESP_OK(err);
|
||||
err = esp_intr_free(ih);
|
||||
TEST_ESP_OK(err);
|
||||
err = esp_intr_alloc(ETS_INTERNAL_PROFILING_INTR_SOURCE,
|
||||
ESP_INTR_FLAG_IRAM, &dummy_rtc, NULL, &ih);
|
||||
TEST_ESP_OK(err);
|
||||
err = esp_intr_free(ih);
|
||||
TEST_ESP_OK(err);
|
||||
}
|
||||
|
Reference in New Issue
Block a user