# Problems with compiling \*pxPortInitialiseStac

**URL:** <https://forums.freertos.org/t/problems-with-compiling-pxportinitialisestac/4493>\
**Category:** Kernel\
**Created:** [September 15, 2008, 7:17pm UTC](https://forums.freertos.org/t/problems-with-compiling-pxportinitialisestac/4493 "2008-09-15T19:17:15Z")\
**Posts on this page:** 7\
**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:** [September 15, 2008, 7:17pm UTC](https://forums.freertos.org/t/problems-with-compiling-pxportinitialisestac/4493/1 "2008-09-15T19:17:15Z")

</div>

**[simfr](https://sourceforge.net/u/simfr/)** wrote on [Monday, September 15, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/c2e0aef6/#e3eb):

Hi!

I am trying to adjust the PPC405 port of FreeRTOS to the Freescale MPC5516 microcontroller. I am using Codewarrior IDE v5.9.0.

When trying to build the project, there always occours a "declaration syntax error" because of:

portSTACK\_TYPE \*pxPortInitialiseStack( portSTACK\_TYPE \*pxTopOfStack,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pdTASK\_CODE pxCode, void \*pvParameters )

It seems that it is not possible because of the "portSTACK\_TYPE", which is defined in portmacro.h as unsigned long.

In the function "pxPortInitialiseStack" itself I use someting like:

\*pxTopOfStack = 0xDEADBEEF;  
&nbsp;&nbsp;&nbsp; pxTopOfStack–;

This also causes an error message "undefined identifier".

I am not very familiar with the CodeWarrior IDE. Can somebody help me?

Thank you very much in advance.

Regards, simfr

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 15, 2008, 7:35pm UTC](https://forums.freertos.org/t/problems-with-compiling-pxportinitialisestac/4493/2 "2008-09-15T19:35:12Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Monday, September 15, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/c2e0aef6/#e3eb/8792):

Each port has its own portmacro.h file and each project must ensure it includes the correct one.&nbsp; Look in source/include/portable.h to see how this is done. Normally you define a macro in the project to tell the compiler which portmacro.h to include. The alternative is to simply ensure the correct include path is within your project.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 15, 2008, 8:03pm UTC](https://forums.freertos.org/t/problems-with-compiling-pxportinitialisestac/4493/3 "2008-09-15T20:03:58Z")

</div>

**[simfr](https://sourceforge.net/u/simfr/)** wrote on [Monday, September 15, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/c2e0aef6/#e3eb/f430):

Thank you very much for your answer, Dave.

But unforunately this is not the problem. If I substitute portSTACK\_TYPE with "unsigned long" in port.c to let the function look as follows, the same error messages "declaration syntax error" and "undefined identifier ´pxTopOfStack´ occur:

unsigned long \*pxPortInitialiseStack( unsigned long \*pxTopOfStack, pdTASK\_CODE pxCode, void \*pvParameters )

portmacro.h is already included, too.

Am I not allowed to use the type unsigned long in this case?

Regards, simfr

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 15, 2008, 8:10pm UTC](https://forums.freertos.org/t/problems-with-compiling-pxportinitialisestac/4493/4 "2008-09-15T20:10:09Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Monday, September 15, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/c2e0aef6/#e3eb/f430/1503):

unsigned long should not be a problem. Are you certain it is not pdTASK\_CODE that is causing the problem?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 15, 2008, 8:17pm UTC](https://forums.freertos.org/t/problems-with-compiling-pxportinitialisestac/4493/5 "2008-09-15T20:17:37Z")

</div>

**[simfr](https://sourceforge.net/u/simfr/)** wrote on [Monday, September 15, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/c2e0aef6/#e3eb/6eab):

I already checked that.

pdTASK\_CODE is defined in projdefs.h as:

typedef void (\*pdTASK\_CODE)( void \* );

Even if I include projdefs.h explicitly in port.c the same error messages occur. Is this the right typedef for pdTASK\_CODE?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 15, 2008, 8:22pm UTC](https://forums.freertos.org/t/problems-with-compiling-pxportinitialisestac/4493/6 "2008-09-15T20:22:54Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Monday, September 15, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/c2e0aef6/#e3eb/6eab/e913):

Nothing wrong with the definition. You have a strange one. Could you be editing the wrong file?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 15, 2008, 8:50pm UTC](https://forums.freertos.org/t/problems-with-compiling-pxportinitialisestac/4493/7 "2008-09-15T20:50:17Z")

</div>

**[simfr](https://sourceforge.net/u/simfr/)** wrote on [Monday, September 15, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/c2e0aef6/#e3eb/a014):

Thats nearly impossible. I made a project build in the codewarrior IDE and edit the files straight from there. Do you think it´s more problem of the FreeRTOS port or the compiler?
