FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2007 Threads] Problem found in vListInitialise ... FYI ONLYPosted by Ricky on March 26, 2007 Port: STR912 Compiler: IAR, Embedded Workbench 4.0 Kickstart (ARM) Optimize: Speed, maximum
I found a small problem in vListInitialise for the ARM9 port. This appears to be a compiler bug since the source code appears to be logically correct. This is just a FYI in case someone else is having the same problem as I am.
I created a library with the FreeRTOS ARM9 port that runs in Thumb mode. During debug, I was getting warning messages stating that an unaligned memory access was being performed and that the results were unpredictable. I traced the problem down to the vListInitialise function. The original function is shown below with a notation showing the line having the problem:
void vListInitialise( xList *pxList ) { /* The list structure contains a list item which is used to mark the end of the list. To initialise the list the list end is inserted as the only list entry. */ pxList->pxIndex = ( xListItem * ) &( pxList->xListEnd );
/* The list end value is the highest possible value in the list to ensure it remains at the end of the list. */ pxList->xListEnd.xItemValue = portMAX_DELAY;
/* The list end next and previous pointers point to itself so we know when the list is empty. */ pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd ); <<< Problem line pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );
pxList->uxNumberOfItems = 0; }
In the problem line above, the address of pxList->xListEnd wasn't being found properly. The previous line was setting register R1 to portMAX_DELAY, and the compiler was using that value in the next line as the pxList pointer, and then adding 8 to find pxList->xListEnd. portMAX_DELAY is 0xFFFFFFFF and adding 8 makes an address of 7, which was the value getting stored in pxList->xListEnd.pxNext.
I moved the "pxList->xListEnd.xItemValue = portMAX_DELAY;" line to just after the section that sets pxList->xListEnd.pxNext and pxList->xListEnd.pxPrevious and the compiler generated the correct code.
I'll be notifying IAR of this problem.
RE: Problem found in vListInitialise ... FYI ONLYPosted by Richard on March 26, 2007 Thanks for your valuable feedback.
When you have maximum optimisation on I presume the "static clustering" option is selected. I have found static clustering to cause a problem with several IAR builds. It would be interesting to see if the problem goes away when this option is deselected, while retaining all the other optimisations.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|