cancel
Showing results for 
Search instead for 
Did you mean: 

stm32u575 FreeRTOS

Kajol30
Associate

Hi,

I have started my hand-on experiments of FreeRTOS using stm32u575 uc with stm32u575zi-q nucleo board as non secure.

I have created 2 task and their handler. With the help of seial viewer, printed some messages.While executing the code,it does nothing.As I am newbiee,Unable to debug what's the exact issue.Kindly help me with it.

Herewith I have attached the github link of my repo for your reference.

https://github.com/soulbee30/FreeRTOS-main.

Thanks In advance.

 

6 REPLIES 6
Sarra.S
ST Employee

Hello @Kajol30, welcome to ST Community, 

I cannot see any thread creation in the project you've shared, are you sure this is the complete project? 

Also, check if the stack size for each task is sufficient and not causing a stack overflow. Your FreeRTOSConfig.h file doesn't currently have stack overflow checking enabled, you can enable it using

 

 #define configCHECK_FOR_STACK_OVERFLOW 2

 

this will call the vApplicationStackOverflowHook() function if an overflow is detected.

Please check: Stack usage and Stack Overflow Checking 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Andrew Neil
Evangelist III

@Kajol30 wrote:

As I am newbiee, Unable to debug


Is that just a newbie to FreeRTOS, or a newbie to embedded firmware development in general? Or to software development in general?

If (one of) the latter, it might be wise to spend some time gaining experience with the basics - including debugging - before moving on to more advanced topics like RTOS ...

Also, for getting started with FreeRTOS without the added complications of embedded hardware, there is are simulators (for Windows, et al) :

https://www.freertos.org/emulation-simulation/

 

SofLit
ST Employee

Hello @Kajol30 ,

Just downloaded your attached project and opened it, there is no FreeRTOS call in your application!

This is your main, it's almost void : it does almost nothing!:

 

 

int main(void)
{
  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  /* USER CODE BEGIN 2 */

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

 

Could you please clarify this point?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
STM_Thirty2
ST Employee

Hi Kajol30,

I see you're trying to use FreeRTOS on your own without STM32Cube generated code and that is fine it should work also but there are a lot more steps involved.

 

At first glance, you are creating tasks with very tiny stack depth of 20

 

 status =  xTaskCreate(task1handler,"Task1",20,"Hello World from Task1",2,&task1_handler);
 configASSERT(status == pdPASS);

 status =  xTaskCreate(task2handler,"Task2",20,"Hello World from Task2",2,&task2_handler);
 configASSERT(status == pdPASS);

 

But in freeRTOS config there is a defined stackdepth macro that you should use if you want a default stack depth

 

#define configMINIMAL_STACK_SIZE      ((uint16_t)128)

 

You also have no UART implemented so there is nowhere for printf to go, furthermore you need to retarget printf.

However the issues above alone will not solve your problems, I suggest letting Cube Setup FreeRTOS and start you off with a working default task. 

I suggest take a look at some of our articles in the knowledge base to get you up to speed. 


- Retarget printf 

- FreeRTOS MOOC (YoutTube) 

To my colleagues the code was on a different branch called task_creation in the linked github repo. 

If you feel a post has answered your question, please click "Accept as Solution"

Thank you for taking time for replying.I am using ITM feature with the help of SWO will be able to print the message.SWO and ITM is working properly. While debugging I found that 2 task  are created and the status of both  task creation is success. scheduler is started using vTaskStartScheduler and after that it goes into MemManage_Handler and stuck there in while loop. Does anything is related to the configuration which I missed.Can you help me with it?

I can take a look at this, is the updated code in the repo?

If you feel a post has answered your question, please click "Accept as Solution"