FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2016 Threads]
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?
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.
Regards.
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?
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?).
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.