Difference between revisions of "Embedded System Tutorial Tasks"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Created page with "The objective of the assignment is to create multiple tasks and observe how they behave. Please create two tasks, and have them run the following code: <syntaxhighlight lang...")
 
Line 2: Line 2:
  
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
void task_one(void)
+
// Create a task and run this code in a while(1) loop
 +
void task_one_code(void)
 
{
 
{
 
     uart0_puts("aaaaaaaaaaaaaaaaaaaa");
 
     uart0_puts("aaaaaaaaaaaaaaaaaaaa");
Line 8: Line 9:
 
}
 
}
  
void task_one(void)
+
void task_two_code(void)
 
{
 
{
 
     uart0_puts("bbbbbbbbbbbbbbbbbbbb");
 
     uart0_puts("bbbbbbbbbbbbbbbbbbbb");

Revision as of 16:58, 13 January 2018

The objective of the assignment is to create multiple tasks and observe how they behave. Please create two tasks, and have them run the following code:

// Create a task and run this code in a while(1) loop
void task_one_code(void)
{
    uart0_puts("aaaaaaaaaaaaaaaaaaaa");
    vTaskDelay(100);
}

void task_two_code(void)
{
    uart0_puts("bbbbbbbbbbbbbbbbbbbb");
    vTaskDelay(100);
}

Further guidelines:

  • Use FreeRTOS xTaskCreate() to create tasks and use example code for reference.
    You may have to take some things for granted, such as "stack size" and 2048 bytes is enough stack size to run these tasks
  • Use vTaskDelay() to "sleep"
  • Do not use printf, instead use uart0_puts() function from #include "uart0_min.h"

Hints:

  • The printf data appears over 38400bps UART, which can roughly send 4 characters per millisecond
    When you send 20 chars (aaaaaaaaaaaaaaaaaaaa), it would take roughly 5ms to send the data
  • The SJ-One board RTOS runs at 1Khz

Observe and turn in with your assignment:

  • How come 4(or 3 sometimes) characters are printed from each task? Why not 2 or 5, or 6?
  • Alter the priority of one of the tasks, and note down the observations. Note down WHAT you see and WHY.

Turn in (to Canvas):

  1. Relevant code
  2. Your observation and explanation
  3. Snapshot of the output for all scenarios.