|
|
(4 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | 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:
| + | Socialledge is moving to two portals. |
| + | * The Wiki will remain here for general references about the SJ-One board, and to document student reports. |
| + | * The bookstack will now be used for SJSU assignments |
| | | |
− | <syntaxhighlight lang="c">
| + | [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/lab-assignment-freertos-tasks This article has been moved here] |
− | // 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);
| |
− | }
| |
− | </syntaxhighlight>
| |
− | | |
− | 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):
| |
− | # Relevant code
| |
− | # Your observation and explanation
| |
− | # Snapshot of the output for all scenarios.
| |
Socialledge is moving to two portals.