dsPIC30f4013 with FreeRTOS

leviatan1 wrote on Saturday, May 03, 2014:

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

rtel wrote on Sunday, May 04, 2014:

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:

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.

rtel wrote on Sunday, May 04, 2014:

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.

leviatan1 wrote on Sunday, May 04, 2014:

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__ )

leviatan1 wrote on Sunday, May 04, 2014:

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

rtel wrote on Sunday, May 04, 2014:

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.

leviatan1 wrote on Sunday, May 04, 2014:

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?

woops_ wrote on Monday, May 05, 2014:

do you set dsP30f4013 as device in MPLABX project options