Quality RTOS & Embedded Software

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




Loading

sam7x256webserver_demo based problem

Posted by P S on June 4, 2009
Hi
I am using olimex sam7ex256 EB and Eclipse SR1 with yagarto 4.3.3, and I have quite weird problem. I have created my own freertos application using some of the files which were used in the ethernet/usb example for at91sam7x256 Eclipse.
Those files are: makefile, boot.s, atmel-rom.lds, kernel files and includes, Cstartup_sam7.c, heap2.c, port.c, portISR.c, portmacro.h, main.c
I've added my code, like creation on 2 simple tasks and communication between them and interrupt. And everything works fine, but only when in one of my source .c files there are added two lines of code, which normally were implemented in ethernet example in uIP_Task.c file in function vProcessInput(). These two lines of code are (after my modification to limit this code as much as possible) :
for example:

void MyFunc (void)
{
char *c;
if(strstr( c, "LED0=1" ) != NULL ){}
}

When those two lines are commented, project doesnt work at all, and when i run debugger, it ends id .dabt section

What is wrong? I do not use any of ethernet example files at all, those files and paths are also deleted from makefile and there is no connection between my application and demo apps.
Can someone tell me why is this happening? :]

RE: sam7x256webserver_demo based problem

Posted by Richard on June 4, 2009
A couple of possibilities spring to mind.

1) In the code the variable c is uninitialised so could contain any value and point to any memory - if the memory is invalid then you could get a data abort. Even if c happens to point to valid memory strstr will scan through the memory until it happens to find a null terminator which could again take the data pointer into invalid memory. This is just a C thing, nothing to do with FreeRTOS.

2) strstr is a standard library function which could potentially use masses of stack, so you could just be getting a stack overflow. See http://www.freertos.org/Stacks-and-stack-overflow-checking.html .

Regards.

RE: sam7x256webserver_demo based problem

Posted by P S on July 22, 2009
Thank you for your answer Richard, unfortunately i meant something different in my previous post :)

Problem is that I do not want (and do not need) to use the code presented in my previous post, but i am forced to add it, because without it my application ends in .dabt section.

Let me describe it in details what I mean.
My application was created basing on the sam7s_webserver example, but I do not have any of the webserver functionalities in it. From this demo project ii have taken such files:
makefile,
boot.s,
atmel-rom.lds,
kernel files and includes,
Cstartup_sam7.c,
heap2.c,
port.c,
portISR.c,
portmacro.h,

After i have created my own tasks etc I run my application and it entered the .dabt section.

Then i have started to analize the webserver project to discover why it is working and my application isn't.
Then I noticed that if I comment out:
1. creation of the "vuIP_Task" in main.c :
//xTaskCreate(vuIP_Task, "uIP",mainUIP_TASK_STACK_SIZE,NULL,mainUIP_PRIORITY,NULL)

2. vProcessInput() function code in uIP_Task.c file
void vProcessInput( char *pcInput )
{
/* Turn the LED on or off depending on the checkbox status. */

//c = strstr( pcInput, "?" );
//if( c )
//{
//if( strstr( c, "LED0=1" ) != NULL )
//{
//vParTestSetLED( 3, 0 );
//}
//else
//{
//vParTestSetLED( 3, 1 );
//}
//}
}

the other task in this project (USBtask) stops working and program ends in .dabt.

Then i modified and limited the code of vProcessInput( ) function to what is presented in my first post and added it to my application to MyFunc() function and then it worked fine. Note that this function is not used in my application, it is only defined.

Without these two lines of code : char *c;
if(strstr( c, "LED0=1" ) != NULL ){}

my application doesnt' work. It is very strange and so far I have to add those lines to every of my applications because without them they do not work.

Anyone have any reasonable explanation to this? :)

RE: sam7x256webserver_demo based problem

Posted by Richard on July 22, 2009
I'm not really following, but I think you have based your application on one that uses the idle hook (or was it the tick hook?) to trigger USB transfers. If you are not starting the USB task then the queue used to unblock the USB task will not get created and the hook function attempting to write to the queue will cause a crash.

Could this be the route of your problem? Try setting configUSE_IDLE_HOOK to 0 in FreeRTOSConfig.h. Also try setting configUSE_TICK_HOOK to 0.

Regards.

RE: sam7x256webserver_demo based problem

Posted by P S on July 22, 2009
Thank you for your answer Richard, unfortunately i meant something different in my previous post :)

Problem is that I do not want (and do not need) to use the code presented in my previous post, but i am forced to add it, because without it my application ends in .dabt section.

Let me describe it in details what I mean.
My application was created basing on the sam7s_webserver example, but I do not have any of the webserver functionalities in it. From this demo project ii have taken such files:
makefile,
boot.s,
atmel-rom.lds,
kernel files and includes,
Cstartup_sam7.c,
heap2.c,
port.c,
portISR.c,
portmacro.h,

After i have created my own tasks etc I run my application and it entered the .dabt section.

Then i have started to analize the webserver project to discover why it is working and my application isn't.
Then I noticed that if I comment out:
1. creation of the "vuIP_Task" in main.c :
//xTaskCreate(vuIP_Task, "uIP",mainUIP_TASK_STACK_SIZE,NULL,mainUIP_PRIORITY,NULL)

2. vProcessInput() function code in uIP_Task.c file
void vProcessInput( char *pcInput )
{
/* Turn the LED on or off depending on the checkbox status. */

//c = strstr( pcInput, "?" );
//if( c )
//{
//if( strstr( c, "LED0=1" ) != NULL )
//{
//vParTestSetLED( 3, 0 );
//}
//else
//{
//vParTestSetLED( 3, 1 );
//}
//}
}

the other task in this project (USBtask) stops working and program ends in .dabt.

Then i modified and limited the code of vProcessInput( ) function to what is presented in my first post and added it to my application to MyFunc() function and then it worked fine. Note that this function is not used in my application, it is only defined.

Without these two lines of code : char *c;
if(strstr( c, "LED0=1" ) != NULL ){}

my application doesnt' work. It is very strange and so far I have to add those lines to every of my applications because without them they do not work.

Anyone have any reasonable explanation to this? :)


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




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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

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

OpenRTOS and SafeRTOS