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] [April 2009 Threads] error in heap_1.c for IAR, ARM7 port?Posted by George Silvis on April 18, 2009 void *pvPortMalloc( size_t xWantedSize )
xWantedSize is in bytes, but gets compared to configTOTAL_HEAP_SIZE which is in words:
/* Check there is enough room left for the allocation. */ if( ( ( xNextFreeByte + xWantedSize ) < configTOTAL_HEAP_SIZE )) && ( ( xNextFreeByte + xWantedSize ) > xNextFreeByte ))/* Check for overflow. */
My change is: if( ( ( xNextFreeByte + xWantedSize ) < (configTOTAL_HEAP_SIZE * sizeof( portSTACK_TYPE ))) &&
George
RE: error in heap_1.c for IAR, ARM7 port?Posted by sotd on April 18, 2009 configTOTAL_HEAP_SIZE is also in bytes? Line 104 unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ];
RE: error in heap_1.c for IAR, ARM7 port?Posted by George Silvis on April 18, 2009 Thank you!
Is there another forum to which this error should be sent or will the author pick it up from here?
I don't have my application running yet under the rtos; still trying to figure why at startup it never comes out of the idle task.
Cheers, George
RE: error in heap_1.c for IAR, ARM7 port?Posted by Richard on April 18, 2009 I cannot see that there is a problem. The wanted size is specified in bytes (the stack size * the size in bytes of each stack item) and configTOTAL_HEAP_SIZE is used to dimension a char array, so is also in bytes. It would appear to be a bytes for bytes comparison. Am I missing something?
Regards.
RE: error in heap_1.c for IAR, ARM7 port?Posted by George Silvis on April 18, 2009 Greetings Richard,
My bad.
configTOTAL_HEAP_SIZE is indeed in bytes. I had been looking at the heap arguments for the createTask which is in words.
One other note on the FreeRTOSconfig.h:
#define configCPU_CLOCK_HZ should be, for the ATM7, the peripheral clock. Often, but not necessarily, the same as the CPU clock.
Its great having the source to work with, but I confess I have still not got the RTOS to go. It dies when it calls vPortStartFirstTask().
Cheers, George
RE: error in heap_1.c for IAR, ARM7 port?Posted by Richard on April 19, 2009 Make sure the processor is in Supervisor mode when main() is called. It must be in supervisor mode when vPortStartFirstTask() is executed.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|