Continuing the series of the posts about my work in porting FreeRTOS for AEMB processor, this represents the third phase of the project which is running a simple FreeRTOS task. In my previous post I mentioned about a problem that I faced during simulating FreeRTOS by using Icarus Verilog.

While it has been decided to move on to the next phase of the project with either one of the memory management implementations heap1 or heap2, the problem of the unaligned data was surprisingly solved when I added the standard input and output libraries and printed a string within my main function. This behavior still vague to me but I felt motivated since the problem was solved and I could simulate FreeRTOS with heap3 which uses the standard malloc() and free() functions. If you have any experience about this, I would appreciate it if you would share it with me ^_^.

Coming back to main topic of this post, FreeRTOS tasks can be created following these steps:

  • Use the task creation macro to create, allocate memory for the task and add the task to a task list to be ran by the scheduler.
  • Make sure that the task has been created successfully by referring to the return value of the creation macro.
  • Define the task function and implement it at an infinite loop.

When it is certain that the previous is satisfied, the FreeRTOS task would have been created successfully and the scheduler can be started to execute the created task.

Since there was no interrupt implemented yet (will be in phase five), all the interrupt enabling operations were commented out. So, the output of the task is to be displayed. The following screen shot demonstrates the result of this phase.


The first string was printed to show that the stack was successfully allocated for the newly created task whereas the second string is the actual output of the task code. With this increment in the project, the third phase is accomplished and what comes next is far more interesting than what has been done!!

Till the next post, wish you all the best.


0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.