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

Recommendation for optimization level in Atmel Studio for FreeRTOS+FAT SL

Posted by owaisfazal on January 28, 2015

Hello everyone,

I am running FreeRTOS v8.2.0 with FreeRTOS+FAT SL on Atmel Cortex M4 SAM4SD16C. I am using Atmel Studio for my project. Recently I have noticed that if I change the optimization level in Atmel Studio to None(-O0) from Optimize(-O1) the FreeRTOS+FAT SL is unable to open a file on SD card. However, If I use Optimize (-O1) the file system can access the file on SD card without any problem. Is there some recommendation for optimization level in Atmel Studio while useg FreeRTOS+FAT SL or FreeRTOS in general? Has anyone experienced this issue before? Please do share.

Regards, Owais


Recommendation for optimization level in Atmel Studio for FreeRTOS+FAT SL

Posted by rtel on January 28, 2015

Hi Owais,

I have never noticed this before. It should work at all optimisation levels, but if there is ever a problem it is normally the other way around - things working with no optimisation but failing at high optimisation.

As it is low optimisation that is causing the problem could it be a stack issue? Low optimisation will presumably use more stack. Do you have stack checking turned on?

Which driver are you using? SD card driver from the ASF?

Can you step through the code to see where it fails? It might be in the FAT code itself, or possibly in the driver.

Regards.


Recommendation for optimization level in Atmel Studio for FreeRTOS+FAT SL

Posted by owaisfazal on January 28, 2015

Thanks for the response,

I am using the FreeRTOS+FAT FS so the file system is designed for RAM but I have modified it to work with SD card by providing read and write low level functions. i am not sure how to do the stack checking if you could please guide me in this regard. Also the problem does not occur while initializing the SD card which is the following part

void vInitializeSDCard( void ) { unsigned char ucStatus; //! Initialize the SD card and create the volume //! @code ucStatus = finitvolume( sdinit ); //! @endcode

// It is expected that the volume is not formatted.
if( ucStatus == F_ERR_NOTFORMATTED )
{
	//! Format the created volume with FAT32 FS.
	//! @code
	ucStatus = f_format( F_FAT32_MEDIA );
	//! @endcode
}

if( ucStatus == F_NO_ERROR )
{
	pstring("SD card initialized");
}
else if( ucStatus != F_NO_ERROR )
{
	printf("Error No. %d occurred in SD Card initialization\r\n", ucStatus);
}

}

after this I try to open a file on my SD card which in case of optimization level (-O1) opens successfully whereas in case of optimization set to None(-O0) the following call returns a NULL

pxFile = f_open( cFileName, "r" );

I believe there is something I am missing. If so, please do let me know.

Regards.


Recommendation for optimization level in Atmel Studio for FreeRTOS+FAT SL

Posted by rtel on January 28, 2015

Can you step through the f_open() call to see if it gives a clue as to why it is not happy - that might give a clue as to what went wrong with the initialisation (mounting, formatting, etc.). With optimisation 0 it should be easy to step through.

Regards.


Recommendation for optimization level in Atmel Studio for FreeRTOS+FAT SL

Posted by owaisfazal on January 28, 2015

Thanks again,

One more thing I should mention is that I am accessing the file before the scheduler is started and once I run it on optimization level 1 it is running without any problem until i change the optimization to None and rebuild the project. Note that if i change optimization to None from Level 1 and without rebuilding the solution directly start the project it also runs.

That being said i have stepped into the code and found out that the function

rc = fn_open( filename, mode );

is returning a 0.

Any clue what could be happening?

Regards.


Recommendation for optimization level in Atmel Studio for FreeRTOS+FAT SL

Posted by rtel on January 28, 2015

If you are accessing the file before the scheduler has started then I think you will need to have FFSTHREAD_AWARE set to 0. Is that the case?

Regards.


Recommendation for optimization level in Atmel Studio for FreeRTOS+FAT SL

Posted by owaisfazal on January 29, 2015

Yes that is exactly the case I have set the FFSTHREAD_AWARE to 0.

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