# portPOINTER\_SIZE\_TYPE for dsPIC33

**URL:** <https://forums.freertos.org/t/portpointer-size-type-for-dspic33/3258>\
**Category:** Kernel\
**Created:** [January 7, 2016, 8:56pm UTC](https://forums.freertos.org/t/portpointer-size-type-for-dspic33/3258 "2016-01-07T20:56:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 7, 2016, 8:56pm UTC](https://forums.freertos.org/t/portpointer-size-type-for-dspic33/3258/1 "2016-01-07T20:56:58Z")

</div>

**[w1res](https://sourceforge.net/u/w1res/)** wrote on [Thursday, January 07, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/94c46406/#fb55):

I’m using FreeRTOS on a dsPIC33 MCU. When compiling a demo project I’m getting the following error in heap\_1.c

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

```

The code in question is the following

```auto
pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[portBYTE_ALIGNMENT] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );

```

When I look at the definition of portPOINTER\_SIZE\_TYPE, 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 portPOINTER\_SIZE\_TYPE that way?

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [January 7, 2016, 9:12pm UTC](https://forums.freertos.org/t/portpointer-size-type-for-dspic33/3258/2 "2016-01-07T21:12:06Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, January 07, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/94c46406/#2b6a):

portPOINTER\_SIZE\_TYPE 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.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 8, 2016, 3:40pm UTC](https://forums.freertos.org/t/portpointer-size-type-for-dspic33/3258/3 "2016-01-08T15:40:11Z")

</div>

**[w1res](https://sourceforge.net/u/w1res/)** wrote on [Friday, January 08, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/94c46406/#2b6a/1ded):

Thanks for the quick reply. I’m still getting familiar with FreeRTOS, so does that mean I can safely change the portPOINTER\_SIZE\_TYPE to uint16\_t, or should I just leave it as it is and ignore the warning?

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [January 8, 2016, 3:45pm UTC](https://forums.freertos.org/t/portpointer-size-type-for-dspic33/3258/4 "2016-01-08T15:45:40Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Friday, January 08, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/94c46406/#2b6a/1ded/2b9c):

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.
