# Failed to build Cyclone V SoC FreeRTOS Demo

**URL:** <https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456>\
**Category:** Kernel\
**Created:** [January 25, 2016, 8:25am UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456 "2016-01-25T08:25:59Z")\
**Posts on this page:** 14\
**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 25, 2016, 8:25am UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/1 "2016-01-25T08:25:59Z")

</div>

**[anchen](https://sourceforge.net/u/anchen/)** wrote on [Monday, January 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#d99f):

[http://www.freertos.org/RTOS\_Altera\_SoC\_ARM\_Cortex-A9.html](http://www.freertos.org/RTOS_Altera_SoC_ARM_Cortex-A9.html)

Build Instructions  
Step 5:

Note: If the dialogue box tab shown in the image below is missing, or contains an error message, then it is likely your version of DS-5 does not have the CDT cross compiler plug in installed. If this is the case the plug in can be installed manually by following the instructions provided on the ARM website. It will be necessary to create a new workspace after the plug-in has been installed.

My version of DS-5 does not have the CDT cross compiler plug in installed.  
But I failed to install it manually by following the instructions provided on the ARM website.

Can anyone help me on this?

Thanks,  
Ann

---

<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 25, 2016, 8:39am UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/2 "2016-01-25T08:39:36Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, January 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#e401):

One of the best things about using Eclipse as a standard IDE is that each installation is different, and installations from the same vendor change ;o)

I can do my best to assist, but really this is a DS-5 or Eclipse issue, rather than a FreeRTOS issue, and the support request might elicit a more knowledgeable response if directed to ARM support.

Can you please post a screenshot of the tools settings dialogue, equivalent to this: [http://www.freertos.org/Setting\_the\_path\_to\_the\_Altera\_compiler.png](http://www.freertos.org/Setting_the_path_to_the_Altera_compiler.png) but for your installation.

---

<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 25, 2016, 8:41am UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/3 "2016-01-25T08:41:47Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, January 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#259a):

I just did a quite Google on this and found the following page, does it help?  
[http://ds.arm.com/debugging-on-bare-metal-targets-using-ds-5-and-gcc-compiler/](http://ds.arm.com/debugging-on-bare-metal-targets-using-ds-5-and-gcc-compiler/)

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 25, 2016, 8:56am UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/4 "2016-01-25T08:56:47Z")

</div>

**[anchen](https://sourceforge.net/u/anchen/)** wrote on [Monday, January 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#259a/a5f7):

Thanks for your response.

I can now build the RTOSDemo.axf.  
But I make it by a lot of manual efforts.

1. I have to assign all needed include paths one by one.
2. I have to remove alt\_interrupt\_armcc.c since the arm-altera-eabi-gcc can not support the instructions in it.
3. I have to remove fpga\_support.c since there is no fpga configruation file named soc\_system\_dc\_rbf which needs to be linked together.

The issue I raised is not a DS-5 or eclipse issue.

---

<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 25, 2016, 9:20am UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/5 "2016-01-25T09:20:24Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, January 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#259a/a5f7/41de):

Perhaps these are necessitated by the different DS-5 version. I’m not  
sure of the effect of the changes you are making, for example, removing  
fpga\_support.c. I think we have each other’s email addresses, so can  
converse on the changes required, and so document them too.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 18, 2016, 7:48am UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/6 "2016-10-18T07:48:02Z")

</div>

**[mojcmos](https://sourceforge.net/u/mojcmos/)** wrote on [Tuesday, October 18, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#f863):

Hi,  
I have many problems to use CORTEX\_A9\_Cyclone\_V\_SoC\_DK example. Cross GCC did not added to my compiler list in the DS-5 for Quatus 15.0.  
what is the promblem?  
best 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:** [October 18, 2016, 3:22pm UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/7 "2016-10-18T15:22:31Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, October 18, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#f863/a5ad):

Different Eclipse versions (DS-5 uses Eclipse) seem to have different  
methods of adding support for different compilers. I would recommend  
looking on the DS-5 website for an application note of post that lets  
you know how to do it.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 21, 2016, 6:16pm UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/8 "2016-10-21T18:16:54Z")

</div>

**[xkentx](https://sourceforge.net/u/xkentx/)** wrote on [Friday, October 21, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#e6dc):

Hello everyone! This is my notes “How to build and run FreeRTOS on Altera SOC kit” for this DevBoard:  
[http://www.terasic.com.tw/cgi-bin/page/archive.pl?CategoryNo=167&No=816](http://www.terasic.com.tw/cgi-bin/page/archive.pl?CategoryNo=167&No=816)  
I used:

1. Quartus || 64-bit ver 14.1 buid 186
2. DS-5 Altera Edition. Ver 5.20.0. Build 5200024
3. FreeRTOSv9.0.0 ([https://sourceforge.net/projects/freertos/files/latest/download?source=files](https://sourceforge.net/projects/freertos/files/latest/download?source=files))  
I had problem with step 5 ([http://www.freertos.org/RTOS\_Altera\_SoC\_ARM\_Cortex-A9.html](http://www.freertos.org/RTOS_Altera_SoC_ARM_Cortex-A9.html)) too. And I couldn’t find “cross GCC compiller” needed for build. Then I decided to use arm-altera-eabi-\* toolchain which installed with DS-5.  
For building SPL switch of watchdog timer and switch on checkbox “Boot from QSPI”. Another settings are default. You will need u-boot-spl file for run rtos\_arm under debugger.  
Program rtos.sof file into the board. This file only needs for blinking the LEDs from RTOS tasks (pLED). Led0 blinks when tick rtos occur. Led1 blinks when prvQueueTask is executed. Led2 blinks when prvQueueReceive is executed.  
Extract the attachment rtos\_arm.rar file next to “spl\_bsp” in the software folder of your FPGA project.  
rtos\_arm folder contain MakeFile which uses for build project. It also copys ./spl\_bsp/ uboot-socfpga/spl/ u-boot-spl to the current folder(rtos\_arm).  
In the DS-5 import project as “Existing code as makefile project”, then you can build rtos\_arm project.  
For debugging rtos in the DS-5 see dbg\_readme.docx.  
PS  
Don’t use uart0\_printf() in tasks 🙂

---

<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:** [October 21, 2016, 7:10pm UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/9 "2016-10-21T19:10:35Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Friday, October 21, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#e6dc/74c5):

Great - thanks for your effort in providing this information.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 8, 2017, 1:13pm UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/10 "2017-06-08T13:13:04Z")

</div>

**[magnuslauritsen](https://sourceforge.net/u/magnuslauritsen/)** wrote on [Thursday, June 08, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#d101):

Hi, I had this same experience, first the Cross GCC compiler unknown by DS-5. By Altera I have been told that the bare-metal GCC compiler is no longer included in DS-5, since Quartus version 15.1. Now they only rely on the arm-compiler. I have 16.1 installed. Have considdered to install quartus 15.0 and the repective DS-5 version, to be able to follow this guide.  
I found some GCC compilers available as plugin, but still they are not regognized as the same compiler, as mensioned in the project-file. If I select an other compiler, all compiler-settings are lost incl. all include-paths.  
I was able to build Stanislavs project, but I could not run the debug. Tried to convert the axf output file to a binary image-file in two steps, using -objcopy and mkimage. Somehow this file became zero-paded up to 4GB. mkimage was not able to read the giant file. I removed these ekstra zeros in a hex-editor and tried to boot the image from a sd-card with a preloader, built for a hello-world example. Got no error, but neither any action.  
It would be good to know where to find the correct compiler and whitin which version-frame this demo works.  
It would also be good if the guide continued to a bootable system.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 14, 2017, 12:29pm UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/11 "2017-06-14T12:29:36Z")

</div>

**[magnuslauritsen](https://sourceforge.net/u/magnuslauritsen/)** wrote on [Wednesday, June 14, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/ebc3a995/#d101/eafa):

Problem solved:  
I just want to share some solutions to boot the project from SD-card  
First to solve the GCC issue, install the the CDT for your version of ds-5/Eclipse from  
[CDT Downloads](https://eclipse.org/cdt/downloads.php), see help -\> Eclipse platform.  
Based on my hand off files, I have constructed a preloader, according to instructions from Altera:  
[Boot Guide](https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/an/an709.pdf), page 18  
in the embedded command shell for SoCEDS, using the command: arm-altera-eabi-readelf --sections RTOSDemo.elf I can see that the section .text is located at 0x100000 and .cs.oc\_ram with size 0xc800 is located at 0xffff0000. This explanes the huge bin-file when using the objcopy tool. The empty space is zero-padded. I used the command:  
arm-altera-eabi-objcopy -R .cs3.oc\_ram -O binary RTOSDemo.elf RTOSDemo.bin  
to generate the binary file without the .cs3.oc\_ram section. I can’t predict the effect of removing this section.  
Next I generated the image to load from 0x100000 with the command:  
mkimage -A arm -T standalone -C none -a 0x100000 -e 0 -n “baremetal image” -d RTOSDemo.bin RTOSDemo-mkimage.bin  
This gave me an image file of 51kB for the blinky compilation. I copied the image file to the fat-portion of the SD-card, plugged it in and it booted.  
I have also changed the LED-address to reflect my HW. Added some dummy functions in main\_blinky before creating tasks, to control LEDs from the debugger without the timer/interrupt.

---

<div class="post-metadata">

**Author:** ![guy](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@guy](https://forums.freertos.org/u/guy)\
**Post date:** [August 9, 2021, 11:12pm UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/12 "2021-08-09T23:12:50Z")

</div>

Hi,  
You need the following compiler, assembler and linker settings:  
-mcpu=cortex-a9  
-mfloat-abi=softfp  
-march=armv7-a  
-mfpu=vfpv3

I just run the demo application on cyclone V and had the same issue

---

<div class="post-metadata">

**Author:** ![guy](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@guy](https://forums.freertos.org/u/guy)\
**Post date:** [August 10, 2021, 4:32pm UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/13 "2021-08-10T16:32:15Z")

</div>

I also had rough times with building the demo and later debugging it until it worked, so I share here the main issues I had in hopes it would be useful.

First, importing the project into DS-5 did not import any of the include paths and the other settings and compiler flags, so they had to be added manually.

The include paths can be added one by one by compiling and searching the missing files on the disk and adding it in the compiler “include paths -I”.

The toolchain I used was arm-altera-eabi-gcc.

Compiler, assembler and linker flags that are needed in the settings page (without this you get all sorts of missing asm instructions and non-compatibility to existing libraries):  
-mcpu=cortex-a9  
-mfloat-abi=softfp  
-march=armv7-a  
-mfpu=vfpv3

As mentioned above, I needed to exclude alt\_interrupt\_armcc.c from the build as it was not assembly compatible with gcc. Further, fpga\_support.c was also excluded because symbols relating to FPGA image were missing , I assume that more complex builds that include FPGA image may not have this problem.

Next, ISR handlers also did not install correctly, giving runtime exceptions. the linker flags  
-defsym=\_\_cs3\_isr\_swi=FreeRTOS\_SWI\_Handler and -defsym=\_\_cs3\_isr\_irq=FreeRTOS\_IRQ\_Handler did nothing on my eclipse build 14 and the default compiled libraries did include an empty stubs interrupt vector. So when SWI interrupt was raised, the demo was stuck at an infinite loop.

For this I changed in portASM.s from:  
.type FreeRTOS\_IRQ\_Handler, %function  
FreeRTOS\_IRQ\_Handler:

to:  
.type \_\_cs3\_isr\_irq, %function  
\_\_cs3\_isr\_irq:

similarily for SWI I changed to:  
.type \_\_cs3\_isr\_swi, %function  
\_\_cs3\_isr\_swi:

Note that the folowing doesn’t work (crashes with undef / dabort exceptions) DONT USE:  
void **attribute** ((interrupt)) \_\_cs3\_isr\_swi(void) {  
FreeRTOS\_SWI\_Handler();  
}

void **attribute** ((interrupt)) \_\_cs3\_isr\_irq(void) {  
FreeRTOS\_IRQ\_Handler();  
}

Other than that it works, but it was a quite difficult starting point.  
Generally, I think demos should beware of parameters imports, I don’t know why it did not import any definitions even when instructed to import the example in place.

I hope sharing this information will help with other’s electronic designs  
Guy Shemesh - [ePiccolo Engineering](https://www.epiccolo.com/)

---

<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:** [August 10, 2021, 4:44pm UTC](https://forums.freertos.org/t/failed-to-build-cyclone-v-soc-freertos-demo/5456/14 "2021-08-10T16:44:28Z")

</div>

Really appreciate you taking the time to provide this information.
