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




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 ]    [ 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