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


Heap and FreeRtos new

Posted by wiwix on May 1, 2017


I'm facing strange issues in initialization phasis which begins to go out of my field of expertise. I searched for any recommandations on FreeRtos website about C++ integration but I didn't find any good information about my issue (if it exists please point me to the right direction).

The fact is that when I use a C++ "new" statement, the constructor runs (checked with debugger), but several instructions latter (for instance after having build a parent class), I suddenly see the members to change value.

I think something is badly configured with my memory management, but I can't figure out what. Could anyone help ?

I'm using heap1.c and I have overloading the new operators like this : ~~~ void * operator new( sizet size ) { return pvPortMalloc( size ); }

void * operator new { return pvPortMalloc(size); }

void operator delete( void * ptr ) { vPortFree ( ptr ); }

void operator delete { vPortFree ( ptr ); } ~~~

I also have made a call to _libcinitarray() see my reset handler : ~~~ void ResetHandler(void) { uint32_t *pSrc, *pDest;

/* Initialize the relocate segment */
pSrc = &_etext;
pDest = &_srelocate;

if (pSrc != pDest) {
	for (; pDest < &_erelocate;) {
		*pDest++ = *pSrc++;

/* Clear the zero segment */
for (pDest = &_szero; pDest < &_ezero;) {
	*pDest++ = 0;

/* Set the vector table base address */
pSrc = (uint32_t *) & _sfixed;
SCB->VTOR = ((uint32_t) pSrc & SCB_VTOR_TBLOFF_Msk);

if (((uint32_t) pSrc >= IRAM0_ADDR) && ((uint32_t) pSrc < NFC_RAM_ADDR)) {


// Set Systick to 1ms interval, common to all SAM3 variants
if (SysTick_Config(SystemCoreClock / 1000))
  // Capture error
  while (1);

// Initialize board

//Wait 1 ms
uint32_t start = GetTickCount();
do {
} while (GetTickCount() - start < 1);

// Initialize C library

/* Branch to main function */

/* Infinite loop */
while (1);

} ~~~

Heap and FreeRtos new

Posted by edwards3 on May 1, 2017

heap1 has no free(), so if you have descructors use heap4.

[ 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