# dsPIC30f4013 with FreeRTOS

**URL:** <https://forums.freertos.org/t/dspic30f4013-with-freertos/4897>\
**Category:** Kernel\
**Created:** [May 3, 2014, 11:41pm UTC](https://forums.freertos.org/t/dspic30f4013-with-freertos/4897 "2014-05-03T23:41:40Z")\
**Posts on this page:** 8\
**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:** [May 3, 2014, 11:41pm UTC](https://forums.freertos.org/t/dspic30f4013-with-freertos/4897/1 "2014-05-03T23:41:40Z")

</div>

**[leviatan1](https://sourceforge.net/u/leviatan1/)** wrote on [Saturday, May 03, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/d9adce06/#d9a2):

Hello, i am trying to get one simple project in FreeRTOS with a dsP30f4013 and when i build it i get this Output:

## Debug build of project `D:\TESIS\PROYECTO MICRO\Project1\dsP30v_1.mcp' started. Language tool versions: pic30-as.exe v3.31, pic30-gcc.exe v3.31, pic30-ld.exe v3.31, pic30-ar.exe v3.31 Preprocessor symbol `\_\_DEBUG’ is defined. Sat May 03 20:31:13 2014

Make: The target “D:\TESIS\PROYECTO MICRO\Project1\croutine.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\event\_groups.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\list.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\queue.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\tasks.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\timers.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\port.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\portasm\_dsPIC.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\main.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\heap\_1.o” is up to date.  
Make: The target “D:\TESIS\PROYECTO MICRO\Project1\dsP30v\_1.cof” is out of date.  
Executing: “C:\Program Files (x86)\Microchip\MPLAB C30\bin\pic30-gcc.exe” -mcpu=30F4013 “croutine.o” “event\_groups.o” “list.o” “queue.o” “tasks.o” “timers.o” “port.o” “portasm\_dsPIC.o” “main.o” “heap\_1.o” -o"dsP30v\_1.cof" -Wl,-L"C:\Program Files (x86)\Microchip\MPLAB C30\lib",-L"C:\Program Files (x86)\Microchip\MPLAB C30\lib\dsPIC30F",–script=“p30F4013.gld”,–defsym=\_\_MPLAB\_BUILD=1,–defsym=\_\_MPLAB\_DEBUG=1,-Map=“dsP30v\_1.map”,–report-mem

Program Memory [Origin = 0x100, Length = 0x7efe]

section address length (PC units) length (bytes) (dec)

* * *

.text 0x100 0xa6 0xf9 (249)  
.const 0x1a6 0x26 0x39 (57)  
.text 0x1cc 0x17f8 0x23f4 (9204)  
.dinit 0x19c4 0x40 0x60 (96)  
.text 0x1a04 0xa 0xf (15)

```
                 Total program memory used (bytes): 0x2595 (9621) 19%

```

Data Memory [Origin = 0x800, Length = 0x800]

section address alignment gaps total length (dec)

* * *

.nbss 0x800 0 0x47a (1146)  
.ndata 0xc7a 0 0x22 (34)

```
                    Total data memory used (bytes): 0x49c (1180) 57%

```

Dynamic Memory Usage

region address maximum length (dec)

* * *

heap 0 0 (0)  
stack 0xc9c 0x364 (868)

```
                    Maximum dynamic memory (bytes): 0x364 (868)

```

## **tasks.o(.text+0x7e4): In function `prvIdleTask': D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c:2603: undefined reference to `vApplicationIdleHook’ tasks.o(.text+0xd8): In function `xTaskGenericCreate': D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c:676: undefined reference to `vPortYield’ tasks.o(.text+0xda):D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c: undefined reference to `vPortYield' tasks.o(.text+0x150): In function `vTaskDelayUntil’: D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c:860: undefined reference to `vPortYield' tasks.o(.text+0x152):D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c: undefined reference to `vPortYield’ tasks.o(.text+0x184): In function `vTaskDelay': D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c:926: undefined reference to `vPortYield’ tasks.o(.text+0x186):D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c: more undefined references to `vPortYield’ follow Link step failed.**

## Debug build of project `D:\TESIS\PROYECTO MICRO\Project1\dsP30v_1.mcp' failed. Language tool versions: pic30-as.exe v3.31, pic30-gcc.exe v3.31, pic30-ld.exe v3.31, pic30-ar.exe v3.31 Preprocessor symbol `\_\_DEBUG’ is defined. Sat May 03 20:31:14 2014

BUILD FAILED

HOW CAN I GET THESE ERRORS GONE? THANK you very much

---

<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:** [May 4, 2014, 8:57am UTC](https://forums.freertos.org/t/dspic30f4013-with-freertos/4897/2 "2014-05-04T08:57:24Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Sunday, May 04, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/d9adce06/#0158):

> undefined reference tovApplicationIdleHook’

If you have configUSE\_IDLE\_HOOK set to 1 in FreeRTOSConfig.h then you must provide an application callback function called vApplicationIdleHook(). Either provide the implementation of the function or set configUSE\_IDLE\_HOOK to 0:

> **[FreeRTOS - RTOS hook (callback) functions for task stack overflows, tick...](https://www.freertos.org/a00016.html)**
>
> FreeRTOS hook (callback) functions for task stack overflows, tick interrupts, idle task and malloc failure (pvPortMalloc() returning NULL).

> undefined reference to vPortYield’

vPortYield is defined in portasm\_DSPic.S, which you are building, but your device is not a dsPIC device so the preprocessor directives prevent the function outputting any code. You should be building portasm\_PIC24.S instead.

Regards.

---

<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:** [May 4, 2014, 9:48am UTC](https://forums.freertos.org/t/dspic30f4013-with-freertos/4897/3 "2014-05-04T09:48:30Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Sunday, May 04, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/d9adce06/#6140):

> You should be building portasm\_PIC24.S instead.

Sorry - my mistake - ignore that last comment, rereading your post I see you are indeed using a dsPIC.

In which case the most likely cause is that the pre-processor is preventing the vPortYield() function from being included.

Does your project define one of the following:

```

#if defined( __dsPIC30F__ ) || defined( __dsPIC33F__ )

```

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [May 4, 2014, 2:57pm UTC](https://forums.freertos.org/t/dspic30f4013-with-freertos/4897/4 "2014-05-04T14:57:46Z")

</div>

**[leviatan1](https://sourceforge.net/u/leviatan1/)** wrote on [Sunday, May 04, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/d9adce06/#8a37):

Hello i fixed the problem with vApplicationIdleHook(). Thanks.

Now i need to know where should this line go, in wich file?:

```
#if defined( __dsPIC30F__ ) || defined( __dsPIC33F__ )
```

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [May 4, 2014, 3:02pm UTC](https://forums.freertos.org/t/dspic30f4013-with-freertos/4897/5 "2014-05-04T15:02:34Z")

</div>

**[leviatan1](https://sourceforge.net/u/leviatan1/)** wrote on [Sunday, May 04, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/d9adce06/#7e50):

here it is at port.c

```
 #endif /* __HAS_EDS__ */
 #endif /* MPLAB_PIC24_PORT */

 #if defined( __dsPIC30F__ ) || defined( __dsPIC33F__ )

 #define portRESTORE_CONTEXT()

```

So, what should i do regarding vPortYield issue? thanks in advance

---

<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:** [May 4, 2014, 4:44pm UTC](https://forums.freertos.org/t/dspic30f4013-with-freertos/4897/6 "2014-05-04T16:44:37Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Sunday, May 04, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/d9adce06/#062e):

> Now i need to know where should this line go, in wich file?:

You don’t need to add that line anywhere, it is already in portASM\_pic24.S file, therefore if neither **dsPIC30F** or **dsPIC33F** is defined then vPortYield() will be excluded from the build, and I suspect this is what your problem is.

Those definitions come from the Microchip provided architecture header files, you should not need to defined them manually as setting the correct compiler options will result in the correct header files being included, which in turn will result in the correct chip specific pre-processor macros being 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:** [May 4, 2014, 8:10pm UTC](https://forums.freertos.org/t/dspic30f4013-with-freertos/4897/7 "2014-05-04T20:10:23Z")

</div>

**[leviatan1](https://sourceforge.net/u/leviatan1/)** wrote on [Sunday, May 04, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/d9adce06/#bebc):

ok, i understand but im using a dspic30f4013 and i still getting build failed. as shown in the original post:

tasks.o(.text+0xd8): In function `xTaskGenericCreate': D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c:676: undefined reference to `vPortYield’  
tasks.o(.text+0xda):D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c: undefined reference to `vPortYield' tasks.o(.text+0x150): In function `vTaskDelayUntil’:  
D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c:860: undefined reference to `vPortYield' tasks.o(.text+0x152):D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c: undefined reference to `vPortYield’  
tasks.o(.text+0x184): In function `vTaskDelay': D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c:926: undefined reference to `vPortYield’  
tasks.o(.text+0x186):D:\TESIS\PROYECTO MICRO\FreeRTOS\Source\tasks.c: more undefined references to `vPortYield’ follow  
Link step failed.

building the original demo in a diferent directory also give me the same errors, and i also opened the portasm\_dsPIC.s file and its empty wich is very rare, in teh original demo when builded correctly i found assembler inside the .s file.

new edit: i just went to the original .s file , opened and copied then pasted into my .s file inside y project folder and it just builded correctly. can anyone understand what happened? why the filed was includes blank?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [May 5, 2014, 9:38am UTC](https://forums.freertos.org/t/dspic30f4013-with-freertos/4897/8 "2014-05-05T09:38:07Z")

</div>

**[woops\_](https://sourceforge.net/u/woops_/)** wrote on [Monday, May 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/d9adce06/#0b49):

do you set dsP30f4013 as device in MPLABX project options
