error in heap_1.c for IAR, ARM7 port?
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
error in heap_1.c for IAR, ARM7 port?
configTOTAL_HEAP_SIZE is also in bytes? Line 104
unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ];
error in heap_1.c for IAR, ARM7 port?
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
error in heap_1.c for IAR, ARM7 port?
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.
error in heap_1.c for IAR, ARM7 port?
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
error in heap_1.c for IAR, ARM7 port?
Make sure the processor is in Supervisor mode when main() is called. It must be in supervisor mode when vPortStartFirstTask() is executed.
Regards.