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


AT91SAM7S64 IAR port

Posted by Jokke on September 20, 2005
I discovered a problem with crashing system. The cause showed up to be that IAR expects stack to be initiated to 0, but freeRTOS initates to 01010101, 02020202 ...

Therefore I have made a change to port.c, in "pxPortInitialiseStack":
*pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa;/* R14 */
*pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
for (i = 0; i < 12; ++i) {
*pxTopOfStack = ( portSTACK_TYPE ) 0x0;/* R12...R1 */


After that it works.



RE: AT91SAM7S64 IAR port

Posted by Richard on September 20, 2005
This is definitely not the case. When a task starts it does not make any assumptions as to the stack or register states.

I suspect you are calling main() in the wrong processor mode. main() must be called in supervisor mode. Are you using the startup code that came with the demo project?

RE: AT91SAM7S64 IAR port

Posted by Jokke on September 20, 2005
This has nothing to do with main. In a normal task I discovered (looking at the assembler listing) that the compiler places a read in a vector, using an index that is in some cases still not initialized. This works fine as long as the index is 0 until it is used, but I got problems with reads out of defined memory, since, in this case, R5 was 0x05050505, as is initialised in port.c.
Maybe this is a compiler error, but my guess was that they made this assumption.
The code is a state machine, and it might not be obvious enough for the compiler that it starts in a state where the index is set, before moving to the state where it is used. On the other hand I do not get any warning of "used before set"(maybe IAR does not give such warnings?).
I am using the startup from the demo project, and I made a lot of versions of the software before this came up.
I guess I will have to send you the code and the assembler listing before we reach consensus on this...

RE: AT91SAM7S64 IAR port

Posted by Richard on September 20, 2005
If you could send me the smallest project possible that exhibits this behaviour I would be very grateful! Send it to the email address from the FreeRTOS WEB site Contacts page (r dot barry at fr.....org). Thanks.

RE: AT91SAM7S64 IAR port

Posted by Richard on September 20, 2005
From the received code it looks as if there could be a compiler error - I will post the results but might take a while.

RE: AT91SAM7S64 IAR port

Posted by Jokke on September 26, 2005
I upgraded the IAR tools to lates version (4.30), and there the compiler bug seems to be solved!
No problem with freeRTOS!

[ 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