Help with function pointers and xTaskCreate & xTaskCreatePinnedToCore
Posted: Sun Mar 17, 2024 2:24 am
I want to run a task on a specific core. The code is loaded from external source. The external code just does some register moves and then an ILL instruction which causes the Illegal Instruction Exception as i intended it to. Code is loaded in IRAM btw.
This works but it dispaches it to wrong core because I set exception handlers specific for core 0 and they dont get triggered.
This does not work. It just restarts esp32
This works with no issues.
I do not know why it doesn't work for xTaskCreatePinnedToCore because manually triggering execution of code works by using function pointer
This works but it dispaches it to wrong core because I set exception handlers specific for core 0 and they dont get triggered.
Code: Select all
void (*MainPtr)(void*);
MainPtr = (void(*)(void*))(FunctionAddr) ; //FunctionAddr is the Address of start of code from external source in IRAM
xTaskCreate(MainPtr,"test" ,8192, NULL, 1, NULL);
Code: Select all
void (*MainPtr)(void*);
MainPtr = (void(*)(void*))(FunctionAddr) ; //FunctionAddr is the Address of start of code from external source in IRAM
xTaskCreatePinnedToCore(MainPtr,"test" ,8192, NULL, 1, NULL, 0);
Code: Select all
void (*MainPtr)(void*);
MainPtr = (void(*)(void*))(FunctionAddr) ; //FunctionAddr is the Address of start of code from external source in IRAM
MainPtr(NULL); //Execute code