Quality RTOS & Embedded Software

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


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