11.07.2015 Views

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The following table gives an overview about the variations of the context switch time depending on the memory typeand the CPU mode:Target OS version Memory CPU mode TimeATMEL AT91SAM7S256 3.32p Flash Thumb 8.92 usATMEL AT91SAM7S256 3.32p Flash ARM 9.32 usATMEL AT91SAM7S256 3.32p RAM ARM 6.28 usATMEL AT91SAM7S256 3.32p RAM Thumb 7.12 usTable 130: embOS context switch timesAll example performance values in the following section are determined with the following system configuration:ATMEL AT91SAM7S256 running with 48 MHz clock speed. All sources are compiled with <strong>IAR</strong> EmbeddedWorkbench version 4.41A using Thumb mode with high optimization level. The example program executes in of flashmemory.MEASUREMENT WITH PORT PINS AND OSCILLOSCOPEThe example file MeasureCST_Scope.c uses the LED.c module to set and clear a port pin. This allows measuringthe context switch time with an oscilloscope.The following source code is excerpt from MeasureContextSwitchingTime_Scope.c:#include "<strong>RTOS</strong>.h"#include "LED.h"static OS_STACKPTR int StackHP[128], StackLP[128]; // Task stacksstatic OS_TASK TCBHP, TCBLP;// Task-control-blocks/*********************************************************************** HPTask*/static void HPTask(void) {while (1) {OS_Suspend(NULL); // Suspend high priority taskLED_ClrLED0(); // Stop measurement}}/*********************************************************************** LPTask*/static void LPTask(void) {while (1) {OS_Delay(100); // Syncronize to tick to avoid jitter//// Display measurement overhead//LED_SetLED0();LED_ClrLED0();//// Perform measurement//LED_SetLED0(); // Start measurementOS_Resume(&TCBHP); // Resume high priority task to force task switch}}/*********************************************************************** main*/int main(void) {OS_IncDI();// Initially disable interruptsOS_InitKern();// Initialize OSOS_InitHW();// Initialize Hardware for OSLED_Init();// Initialize LED portsOS_CREATETASK(&TCBHP, "HP Task", HPTask, 100, StackHP);OS_CREATETASK(&TCBLP, "LP Task", LPTask, 99, StackLP);OS_Start();// Start multitaskingreturn 0;}128<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>for ARM CoresPP<strong>RTOS</strong>-2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!