mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-31 22:24:28 +00:00
fix(freertos): Incorrect assert in FreeRTOS port layer when not in ISR context
This commit fixes an issue where in the FreeRTOS port layer would cause the portASSERT_IF_IN_ISR() assert check to fail even when the system is not in an interrupt context.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -58,3 +58,20 @@ TEST_CASE("xPortInIsrContext test", "[freertos]")
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if !CONFIG_FREERTOS_SMP // TODO: Enable when IDF-10540 is fixed
|
||||
|
||||
static void testint_assert(void)
|
||||
{
|
||||
esp_rom_printf("INT!\n");
|
||||
portASSERT_IF_IN_ISR();
|
||||
}
|
||||
|
||||
TEST_CASE("port must assert if in ISR context", "[ignore]")
|
||||
{
|
||||
esp_err_t err = esp_register_freertos_tick_hook_for_cpu(testint_assert, xPortGetCoreID());
|
||||
TEST_ASSERT_EQUAL_HEX32(ESP_OK, err);
|
||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||
esp_deregister_freertos_tick_hook_for_cpu(testint_assert, xPortGetCoreID());
|
||||
}
|
||||
#endif // !CONFIG_FREERTOS_SMP
|
||||
|
@@ -39,3 +39,13 @@ def test_task_notify_wait_too_high_index_fails(dut: Dut) -> None:
|
||||
dut.expect('assert failed: xTaskGenericNotifyWait', timeout=5)
|
||||
dut.expect('uxIndexToWait < [0-9]+', timeout=5)
|
||||
dut.expect_exact('Rebooting...')
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config', ['default'], indirect=True)
|
||||
def test_port_must_assert_in_isr(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests.')
|
||||
dut.write('\"port must assert if in ISR context\"')
|
||||
dut.expect('assert failed: vPortAssertIfInISR', timeout=5)
|
||||
dut.expect_exact('Rebooting...')
|
||||
|
Reference in New Issue
Block a user