This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello everybody,
I am having trouble with the default freertos's setting for hercules launchpad. I wanted to have 2 task running was not successful as the task will stop working after first loop. Having 1 task running by itself will deadlock after 19 loops or some reason. What setting in halcogen am i missing. Thank you all in advance.
Regards,
Yuan Fa
Yuan,
I'm working on your problem and will be back to you as soon as possible.
Yuan,
I was able to find what I think is causing the problem in your code.
The 2 Task are created with a default stack size (configMINIMAL_STACK_SIZE) = 128.
In Task1 and Task2 you are using printf to print float value.
With this configuration, the default task stack size is too small, and after running few time, a stack overflow occurs and your code eventually crashes.
To make it work, I've increase the stack size for Task1 and Task2 to 384. Now it is working.
Also, when using printf, a new section .sysmem is created and has to be mapped to RAM. So it is necessary to add in your sys_link.cmd the following statement.
/* USER CODE BEGIN (4) */
.sysmem : {} > RAM
/* USER CODE END */
Last but not least, printf is not running real-time.
To be able to print on the console, the printf uses a break point to stop code execution, so the debugger can read the target memory to read the string and than display it on the console. To overcome this problem, I've develop a retarget routine that will use the LIN/SCI connection to replace the console.
So each time a printf is used, the data stream is send out to a window terminal.
I've attached the full project (CCS and Halcogen) to demonstrate the concept.
The window terminal is using the USB emulation, so you have just to connect your board to the PC using the micro-usb cable. The window terminal has to be configured as following:
115200bps, 8bits, no parity, 1 stop, no flow control.
Here is the project 3022.RM42_FreeRtos.zip