aeyes wrote on Tuesday, September 02, 2008:
Hi in the below pasted code which I am running on a simulator (Skyeye ) , I see for the currentlyrunning task, it is printing out the string multiple times , since it is in the ‘for’ loop ,the output looks like this
T1
T1
T1
T1
the above goes on for sometime until it switches to the below output .
T2
T2
T2
T2
the above goes on for sometime until it switches back to T1. This repeats .
I am using preemptive multitasking …
However in demos I see that the output comes out only once when a printf statement is used even in a for loop . How to block the printing after once ? I tried seaphores too but I do not see any change .
The code is pasted below …
#include "S3C4510.h"
/* Standard includes. */
#include <stdlib.h>
#include <string.h>
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Demo application includes. */
#include "partest.h"
#include "flash.h"
#include "integer.h"
#include "PollQ.h"
#include "comtest2.h"
#include "semtest.h"
#include "flop.h"
#include "dynamic.h"
#include "BlockQ.h"
#include "serial.h"
int counter = 0 ;
#define mainCHECK_TASK_PRIORITY 3
#define mainCHECK_TASK_PRIORITY1 3
static void vErrorChecks( void *pvParameters );
static void vErrorChecks1( void *pvParameters );
void timersetup (void );
int main(void)
{
int i;
xTaskCreate( vErrorChecks, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
xTaskCreate( vErrorChecks1, ( signed portCHAR * ) "Check1", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY1, NULL );
char * hellostr=" Hi this is mr y here, Starting Scheduler! \n ";
long* paddr=(long*)0x3ffd00c;
for(i=0;i<45;i++)
{
* paddr=hellostr[i];
}
vTaskStartScheduler();
return 0;
}
void vErrorChecks( void * pvParameters )
{
for (; {
// Task code goes here.
int i
char * hellostr="T1 \n ";
long* paddr=(long*)0x3ffd00c;
for(i=0;i<8;i++)
{
* paddr=hellostr[i];
}
}
}
void vErrorChecks1( void * pvParameters )
{
for (; {
// Task code goes here.
char * hellostr="T2 \n ";
long* paddr=(long*)0x3ffd00c;
for(i=0;i<8;i++)
{
* paddr=hellostr[i];
}
}
}