Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

how do I get the string to be printed once

Posted by Angel Eyes on September 2, 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;

}


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;

}





}
}



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;

}





}
}

RE: how do I get the string to be printed once

Posted by Richard on September 3, 2008
I'm not exactly sure what the question is, but it looks like your tasks are just free running so will only get switched out each tick interrupt. They may print out the string many times between each tick. If you want it to run only once then switch to the other task add a call to taskYIELD() at the bottom of each of the two task loops.

Regards.

RE: how do I get the string to be printed once

Posted by Angel Eyes on September 3, 2008
Hi Richard ,

You are right , thats what I meant , but my problem is that any function like vTakdelay or taskYIELD if called after the loop suspends the task indefinitely . I am using the skyeye simulator for Samsung S3C4510 .

Regards


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists