Porting FreeRTOS on ML605

Hi guys, I have a project with soft core Microblaze and I would like to use FreeRTOS on it. I’m using a specific Hardware and BSP. I tried to add the follow sources files FreeRTOS into project: -list.c -queue.c -task.c -timers.c and heap3.c Then, I added (then to execute reateProjectDirectoryStructure.bat) the follow paths into my include path: MicroBlazeSpartan-6EthernetLiteSDKProjectsRTOSDemoFreeRTOSSourceinclude MicroBlazeSpartan-6EthernetLiteSDKProjectsRTOSDemoFreeRTOSSourceportableGCCMicroBlazeV8 In include path i putted also the FreeRTOSConfig.h. I included these paths in all configuration and languages. When i try to compile i have the follow erros: C:/R/MicroBlazeSpartan-6EthernetLite/SDKProjects/RTOSDemo/FreeRTOSSource/include/FreeRTOSConfig.h:73:2: error: #error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above. make: *** [src/heap_3.o] Error 1 Are there other steps that I have to do? Thanks.

Porting FreeRTOS on ML605

ok I removed the error line in FreeRTOSConfig.h but I have a lot of errors in FreeRTOS c files.

Porting FreeRTOS on ML605

If you can’t clear the errors post the output generated by the compiler.

Porting FreeRTOS on ML605

No, I can’t. The output is here https://gist.github.com/anonymous/7872068 And I have posted also an image with the directory structure. Thanks for answare.

Porting FreeRTOS on ML605

Looks like you didn’t include port.c in your build. freertos/source/portable/gcc/[chip]/port.c.

Porting FreeRTOS on ML605

Yes, I did. I included all the follow directory MicroBlazeSpartan-6EthernetLiteSDKProjectsRTOSDemoFreeRTOS_Source portableGCCMicroBlazeV8

Porting FreeRTOS on ML605

No one can help me?

Porting FreeRTOS on ML605

Is the image you posted a clean build? If so, it does not appear to be building port.c as already mentioned, so I’m not sure what else I can add. If that is not a clean build please post an image of a clean build so we can see port.c too. If it is a clean build, then please ensure port.c is getting built as you expect it to be, then post the errors that are generated once you are 100% sure it is being built. Regards.

Porting FreeRTOS on ML605

Sorry, I don’t understand where I must put port.c. I inculded path in “Includes” (in path and symbols) and now I included port.c also in src. Where is my fault? Here there is a build. https://gist.github.com/anonymous/7874243 Thanks a lot

Porting FreeRTOS on ML605

That looks better. See my comments below:
C:RworkspaceDaUDPaRTOSlwipechoserver0Debug/../src/heap3.c:105: undefined reference to `vApplicationMallocFailedHook’
This is complaining that you have configUSEMALLOCFAILED_HOOK set to 1 in FreeRTOSConfig.h, but have not defined a function called vApplicationMallocFailedHook() in your code. http://www.freertos.org/a00016.html
./src/port.o: In function xPortStartScheduler': C:RworkspaceDaUDPaRTOSlwip_echo_server_0Debug/../src/port.c:277: undefined reference tovApplicationSetupTimerInterrupt’
Search for vApplicationSetupTimerInterrupt() on the documentation page for your port: http://www.freertos.org/Free-RTOS-for-Xilinx-MicroBlaze-on-Spartan-6-FPGA.html
C:RworkspaceDaUDPaRTOSlwipechoserver_0Debug/../src/port.c:288: undefined reference to `vPortStartFirstTask’
vPortStartFirstTask() is defined in port.S, which is in the same directory and port.c, and must also be included in your build.
./src/port.o: In function vPortYield': C:RworkspaceDaUDPaRTOSlwip_echo_server_0Debug/../src/port.c:315: undefined reference toVPortYieldASM’
vPortYieldASM is also in Port.S
./src/port.o: In function vPortTickISR': C:RworkspaceDaUDPaRTOSlwip_echo_server_0Debug/../src/port.c:424: undefined reference tovApplicationClearTimerInterrupt’
Refer to port documentation page – link provided already above.
./src/port.o: In function prvInitialiseInterruptController': C:RworkspaceDaUDPaRTOSlwip_echo_server_0Debug/../src/port.c:447: undefined reference tovPortExceptionsInstallHandlers’
Refer to port documentation page – link provided already above.
./src/tasks.o: In function vTaskStartScheduler': C:RworkspaceDaUDPaRTOSlwip_echo_server_0Debug/../src/tasks.c:1239: undefined reference tovMainConfigureTimerForRunTimeStats’ ./src/tasks.o: In function uxTaskGetSystemState': C:RworkspaceDaUDPaRTOSlwip_echo_server_0Debug/../src/tasks.c:1510: undefined reference toulMainGetRunTimeCounterValue’ ./src/tasks.o: In function xTaskIncrementTick': C:RworkspaceDaUDPaRTOSlwip_echo_server_0Debug/../src/tasks.c:1683: undefined reference toulMainGetRunTimeCounterValue’
These three are complaining that you have your FreeRTOSConfig.h header file set to use run time stats gathering, but have not provided the kernel with the source of the run time counter. http://www.freertos.org/rtos-run-time-stats.html
./src/tasks.o: In function vTaskSwitchContext': C:RworkspaceDaUDPaRTOSlwip_echo_server_0Debug/../src/tasks.c:1842: undefined reference tovApplicationStackOverflowHook’
This is complaining that you have configCHECKFORSTACK_OVERFLOW set to a non-zero value, but you have not provided the vApplicationStackOverflowHook() function. http://www.freertos.org/Stacks-and-stack-overflow-checking.html
C:RworkspaceDaUDPaRTOSlwipechoserver_0Debug/../src/tasks.c:2088: undefined reference to `vApplicationIdleHook’
This is complaining that you have configUSEIDLEHOOK set to a non-zero value in FreeRTOSConfig.h, but have not provided the vApplicationIdleHook() function – see the same link already provided somewhere above to the kernel hook functions documentation page. A lot of these look like you have taken a FreeRTOSConfig.h header file from an application that defined quite a rich set of functionality, but your current application does not currently provide the same hooks into that functionality. Regards.

Porting FreeRTOS on ML605

Thanks a lot. I cleaned errors outputs. Now the error is one and it refers to interrupthendler. It says there is a multiple definition of `interrupthandler’. In fact There are two errors in the project, one in portasm.c and one in BSP–>libsrcstandalonev301a–>src–>microblazeinterrupthandler.c C:RworkspaceDaUDPaRTOSlwipechoserverbsp0microblaze0libsrcstandalonev301asrc/microblazeinterrupthandler.c:79: multiple definition of `interrupthandler’ ./src/portasm.o:C:RworkspaceDaUDPaRTOSlwipechoserver0Debug/../src/portasm.S:272: first defined here c:xilinx13.2isedsedkgnumicroblazentbin..libgccmicroblaze-xilinx-elf4.1.2........microblaze-xilinx-elfbinld.exe: Disabling relaxation: it will not work with multiple definitions collect2: ld returned 1 exit status make: *** [lwipechoserver_0.elf] Error 1 What can I do? Regards.

Porting FreeRTOS on ML605

You need to use the one defined in port.S – so presumably need to exclude the file that contains the other implementation from the build – but check what the official demo project does in this respect. Regards.

Porting FreeRTOS on ML605

sorry, maybe I resolved some error. Now, only the port.c has error. The error is show below. C:RworkspaceDaUDPaRTOSlwipechoserver0Debug/../src/port.c:284: undefined reference to vPortStartFirstTask' ./src/port.o: In functionvPortYield’: C:RworkspaceDaUDPaRTOSlwipechoserver0Debug/../src/port.c:311: undefined reference to `VPortYieldASM’ collect2: ld returned 1 exit status make: *** [lwipechoserver_0.elf] Error 1 What can I do? Sorry I’m e new user and I don’t Know how I can resolve alone. Thanks

Porting FreeRTOS on ML605

Both these functions are defined in port.S – are you building port.S? Regards.

Porting FreeRTOS on ML605

No, I don’t have this file. I searched into previous (correct) projects but it is missing. In all project I’ve only portasm.S Regards

Porting FreeRTOS on ML605

Sorry – I meant portasm.S. Have you included that file. If you look in the file you will see it implements the functions the linker is complaining are missing. Regards.

Porting FreeRTOS on ML605

Yes, I included portasm.S and I find the implementation as above:
.text
.align  2
vPortStartFirstTask:
portRESTORE_CONTEXT
You can see my portasm.S at link above: https://gist.github.com/anonymous/7925419 Regards.

Porting FreeRTOS on ML605

Sorry, I think that I resolved somethings. Now i have only a problem with interrupthendler, because maybe both portasm.c and microblazeinterrupt_hendler.c want to handle interrupt. Is it correct? How can i resolve? C:RworkspacePORTRTOS2lwipechoserverbsp0microblaze0libsrcstandalonev301asrc/microblazeinterrupthandler.c:79: multiple definition of `interrupthandler’ ./src/portasm.o:C:RworkspacePORTRTOS2lwipechoserver0Debug/../src/portasm.S:272: first defined here c:xilinx13.2isedsedkgnumicroblazentbin..libgccmicroblaze-xilinx-elf4.1.2........microblaze-xilinx-elfbinld.exe: Disabling relaxation: it will not work with multiple definitions collect2: ld returned 1 exit status make: *** [lwipechoserver_0.elf] Error 1 Regards regards

Porting FreeRTOS on ML605

Circle back in the thread – you have already asked this and it has already been answered http://sourceforge.net/p/freertos/discussion/382005/thread/57a9ea8f/#f754 Regards.

Porting FreeRTOS on ML605

Sorry, I can’t understand. In a correct project I see that in a portasm.S the handler of interrupt is MICROBLAZE, because in above line configINTERRUPTCONTROLLERTOUSE is a deviceID of Microblaze /* The parameter to the interrupt handler. */ ori r5, r0, configINTERRUPTCONTROLLERTOUSE so the different with this project is in platform_config.h that is not blank but contains the above lines.

define PLATFORMEMACBASEADDR XPARETHERNETLITE_BASEADDR

define PLATFORMTIMERBASEADDR XPARAXITIMER0BASEADDR

define PLATFORMTIMERINTERRUPTINTR XPARMICROBLAZE0INTCAXITIMER0INTERRUPT_INTR

define PLATFORMTIMERINTERRUPTMASK (1 << XPARMICROBLAZE0INTCAXITIMER0INTERRUPT_INTR)

so the error is with timer_interrupt You can see my portasm.S at : https://gist.github.com/anonymous/7946037 I have this file microblazeinterrupthandler.c that contains a void interrupt_handler (void) __attribute ((interrupt_handler)); but I don’t know how to risolve. If you prefer i can attach enteire preject 🙂 Regards