esp_hw_support: create esp_cpu

Create a esp_cpu header that contains CPU-related functions and
utilities.
This commit is contained in:
Renz Bagaporo
2021-02-19 20:23:32 +08:00
parent 7e0e91bf76
commit 0f03f450ff
17 changed files with 162 additions and 122 deletions

View File

@@ -14,9 +14,9 @@ static StackType_t *shared_stack_sp = NULL;
void external_stack_function(void)
{
printf("Executing this printf from external stack! sp=%p\n", get_sp());
printf("Executing this printf from external stack! sp=%p\n", esp_cpu_get_sp());
shared_stack_sp = (StackType_t *)get_sp();
shared_stack_sp = (StackType_t *)esp_cpu_get_sp();
char *res = NULL;
/* Test return value from asprintf, this could potentially help catch a misaligned
@@ -30,9 +30,9 @@ void external_stack_function(void)
void another_external_stack_function(void)
{
//We can even use Freertos resources inside of this context.
printf("We can even use FreeRTOS resources... yielding, sp=%p\n", get_sp());
printf("We can even use FreeRTOS resources... yielding, sp=%p\n", esp_cpu_get_sp());
taskYIELD();
shared_stack_sp = (StackType_t *)get_sp();
shared_stack_sp = (StackType_t *)esp_cpu_get_sp();
}
TEST_CASE("test printf using shared buffer stack", "[newlib]")
@@ -43,7 +43,7 @@ TEST_CASE("test printf using shared buffer stack", "[newlib]")
SemaphoreHandle_t printf_lock = xSemaphoreCreateMutex();
TEST_ASSERT_NOT_NULL(printf_lock);
printf("current task sp: %p\n", get_sp());
printf("current task sp: %p\n", esp_cpu_get_sp());
printf("shared_stack: %p\n", (void *)shared_stack);
printf("shared_stack expected top: %p\n", (void *)(shared_stack + SHARED_STACK_SIZE));