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



Posted by w1res on January 7, 2016

I'm using FreeRTOS on a dsPIC33 MCU. When compiling a demo project I'm getting the following error in heap_1.c

~~~~ ../../FreeRTOS/FreeRTOSV8.2.3/FreeRTOS/Source/portable/MemMang/heap1.c: In function 'pvPortMalloc': ../../FreeRTOS/FreeRTOSV8.2.3/FreeRTOS/Source/portable/MemMang/heap1.c:124:30: warning: cast to pointer from integer of different size ~~~~

The code in question is the following

~~~~ pucAlignedHeap = ( uint8t * ) ( ( ( portPOINTERSIZETYPE ) &ucHeap[ portBYTEALIGNMENT ] ) & ( ~( ( portPOINTERSIZETYPE ) portBYTEALIGNMENTMASK ) ) ); ~~~~

When I look at the definition of portPOINTERSIZETYPE, it is uint32_t; however, the pointer size on the dsPIC33 is actually 16-bits, for both data (16 bits) or program memory (24 bits, it puts handles to functions if they aren't in the first 16-bit addreesable 64k).

Is this intentional? If so, what is the purpose of defining portPOINTERSIZETYPE that way?


Posted by rtel on January 7, 2016

portPOINTERSIZETYPE was inroduced to solve this compiler warning on some 8 and 16-bit devices that required it - so you will see ports such as MPS430X, RL78, etc. have a genuine definition. I think the dsPIC port pre-dates the introduction of the constant, so what you are seeing is it default to 32-bits if it is not otherwise defined.



Posted by w1res on January 8, 2016

Thanks for the quick reply. I'm still getting familiar with FreeRTOS, so does that mean I can safely change the portPOINTERSIZETYPE to uint16_t, or should I just leave it as it is and ignore the warning?


Posted by rtel on January 8, 2016

It is safe to leave it as it is, as the bits that get truncated cannot possibly hold any data. Setting it to uint16_t should be fine, its just not tested (assuming pointers cannot be 24-bits?).


[ 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