Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

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.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner