cancel
Showing results for 
Search instead for 
Did you mean: 

Terminate and restart a task ?

Davy Jones
Associate II
Posted on April 03, 2018 at 11:08

We have project in which FreeRTOS code is generated using CubeMx.   I see syntax is little different from documentation on FreeRTOS site. 

How can I terminate and restart a particular task?

Main objective is 

  • Terminate and restart a task causing HardFault
  • Restart a crashed task

Want to know how to restarting a task in FreeRTOS code generated from CubeMx 

Majerle.Tilen.001

‌

Can you please help in this regard ?

#task #restart #freertos+hal #terminate #tasks
1 ACCEPTED SOLUTION

Accepted Solutions
Tilen MAJERLE
ST Employee
Posted on April 05, 2018 at 21:44

STM32Cube adds additional layer of function for CMSIS OS compliancy (

http://www.keil.com/pack/doc/CMSIS/RTOS/html/index.html

). You can check there for FreeRTOS functions.

To terminate thread, use osThreadTerminate function and to start new thread, use osThreadCreate

In case you enter hardfault, the best is to restart your system as if your CPU jumped to unknown memory location (in terms of instructions), you might have hard time to recover it to the right instruction and stack pointer.

View solution in original post

2 REPLIES 2
Tilen MAJERLE
ST Employee
Posted on April 05, 2018 at 21:44

STM32Cube adds additional layer of function for CMSIS OS compliancy (

http://www.keil.com/pack/doc/CMSIS/RTOS/html/index.html

). You can check there for FreeRTOS functions.

To terminate thread, use osThreadTerminate function and to start new thread, use osThreadCreate

In case you enter hardfault, the best is to restart your system as if your CPU jumped to unknown memory location (in terms of instructions), you might have hard time to recover it to the right instruction and stack pointer.

I have tried terminating and creating the same thread using osThreadTerminate and osThreadNew, but i am entering into hardfault.

hardfault_fault_analyzer..png

Is there any method to recover it to the right instruction and stack pointer.