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

pvPortMalloc failure on first create - Cortex r4 - TMS570LS1227

Posted by ronemcd on February 11, 2014

I am using the CORTEX-R4TICCS5 port with v8.0.0 FreeRTOS. This is Demo for cortex R4 processors and the TMS570 series. The port uses heap_4.c and appears to never initialize the heap. When the first call to pvPortMalloc is called, the pvReturn var is never accessed. Obviously I am missing something. Any help would be appreciated.

Thanks, Ron M.


pvPortMalloc failure on first create - Cortex r4 - TMS570LS1227

Posted by davedoors on February 11, 2014

The heap is initialized if pxEnd is found to be NULL, which it should be the first time pvPortMalloc is called because it is initialized to NULL where it is declared. If you find it is not NULL then I guess you have a start up code or linker script problem which is either not setting it to NULL before main() is called or clobbering the value after main() is called.


pvPortMalloc failure on first create - Cortex r4 - TMS570LS1227

Posted by ronemcd on February 11, 2014

Thanks Dave, That does appear to be the case, the pxEnd is never being set to Null. Looking at the value, I don't think it is being clobbered but don't know for sure. Do you have any idea how to make sure all the necessary initialization is taking place before the first call from main?

Thanks, Ron


pvPortMalloc failure on first create - Cortex r4 - TMS570LS1227

Posted by rtel on February 11, 2014

NULL is zero, so the variable should get allocated by the linker into the bss section, then cleared to zero by the compiler or chip vendor supplied C start up code before main() is called. This is a normal part of setting up the C run time environment.

The C start up code is normally called something like boot.s or crt0.s - but can have any name and may even have a different file extension (such as .asm). If you set your debug interface to break on entry rather than breaking on the first instruction of main() then you will be able to step through the C start up code and see why it is not working as would be expected.

Regards.


pvPortMalloc failure on first create - Cortex r4 - TMS570LS1227

Posted by ronemcd on February 11, 2014

First, thanks for the help. I'm not sure exactly how to set the debugger in CCS to break on entry but I will figure it out. There was a similar problem with an MSP430 application some time back and there was a function you could invoke that assured the initialization completed before the WD timer hit. Perhaps there is something like that going on here. Thanks again - I'll keep after it.

Ron


[ 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