esp-idf/components/freertos/test/test_tasks_snapshot.c
Sudeep Mohanty e22b4007d3 esp_hw_support: Removed deprecated CPU util functions
The following files were deleted:
- components/esp_hw_support/include/soc/cpu.h
- components/soc/esp32s3/include/soc/cpu.h

The following functions are deprecated:
- get_sp()

The following functions declared in soc/cpu.h are now moved to esp_cpu.h:
- esp_cpu_configure_region_protection()

The following functions declared in soc/cpu.h are now moved to components/xtensa/include/esp_cpu_utils.h:
- esp_cpu_process_stack_pc()

All files with soc/cpu.h inclusion are updated to include esp_cpu.h instead.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-12-28 16:58:37 +05:30

39 lines
1.2 KiB
C

/*
Test FreeRTOS support for core dump.
*/
#include <stdio.h>
#include "esp_cpu.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task_snapshot.h"
#include "unity.h"
#include "sdkconfig.h"
#define TEST_MAX_TASKS_NUM 32
/* simple test to check that in normal conditions uxTaskGetSnapshotAll does not generate exception */
TEST_CASE("Tasks snapshot", "[freertos]")
{
TaskSnapshot_t tasks[TEST_MAX_TASKS_NUM];
UBaseType_t tcb_sz;
#ifndef CONFIG_FREERTOS_UNICORE
int other_core_id = xPortGetCoreID() == 0 ? 1 : 0;
#endif
// uxTaskGetSnapshotAll is supposed to be called when all tasks on both CPUs are
// inactive and can not alter FreeRTOS internal tasks lists, e.g. from panic handler
unsigned state = portSET_INTERRUPT_MASK_FROM_ISR();
#ifndef CONFIG_FREERTOS_UNICORE
esp_cpu_stall(other_core_id);
#endif
UBaseType_t task_num = uxTaskGetSnapshotAll(tasks, TEST_MAX_TASKS_NUM, &tcb_sz);
#ifndef CONFIG_FREERTOS_UNICORE
esp_cpu_unstall(other_core_id);
#endif
portCLEAR_INTERRUPT_MASK_FROM_ISR(state);
printf("Dumped %d tasks. TCB size %d\n", task_num, tcb_sz);
TEST_ASSERT_NOT_EQUAL(0, task_num);
TEST_ASSERT_NOT_EQUAL(0, tcb_sz);
}