Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12708 Discussions

Using FreeRTOS with Eclipse tools.

Altera_Forum
Honored Contributor II
3,618 Views

I have been trying to get the FreeRTOS running on my cyclone iii development board using the Nios ii 3C25. I am running altera v10.1sp1 and using FreeRTOS v6.0.5 (I initially tried the very latest version). I am using the eclsipse GUI. To date I have failed miserably at this task . I have been following the following procedures and am confident I have followed these tasks exactly. 

 

alterawiki . com / wiki / FreeRTOS 

 

 

All seems well until I get to the final steps. If I choose File->New->Nios ii Board Support Package from Eclipse then I can see the "Real Time Engineers Ltd FreeRTOS 6.0.5" in the BSP type option box. If I then choose an SOPC information file (I am using the cycloneIII_3c25_niosII_standard_sopc.sopcindo) then when I select the "Real Time Engineers Ltd FreeRTOS 6.0.5" option I note that the command field changes and is then calling "nios2-bsp ucosii ..... and not the freeRTOS bsp. 

 

Additionally if I then choose File->New->Nios ii Application and BSP from Template then I can see the FreeRTOS_Demo in the availible templates. When I select the sopcinfo file this template option then dissapears. 

 

Has anyone managed to get FreeRTOS working on the NIOS and been able to succesfully use the demo template as a starting project? Any help would be appreciated. 

Thanks 

Clive
0 Kudos
15 Replies
Altera_Forum
Honored Contributor II
1,389 Views

Hello cliver41 

 

do you still need help with FreeRTOS on Nios? I might be able to point you in the right direction since I successfully run FreeRTOS 6.1.1 on a Cyclone IV (even with C++). 

 

Regards, 

Matthias
0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

When creating a FreeRTOS BSP, copy and edit the command line displayed when choosing File->New>BSP, open a command line window in the desired directory, and run the command line after changing “ucosii” to “freertos” (e.g. nios2-bsp freertos . ../../test_sopc.sopcinfo --cpu-name cpu). Then import the resulting SBT project.

0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Hello, 

 

I have exactly the same problem with cliver41 (the person who started this post). I am using Quartus II 11.0 subscription version and FreeRTOS v7.0.1. 

I have followed the instructions in detail but unfortunately it doesn't work. Initially when I try to create a project from "nios ii application and bsp from template" the FreeRTOS demo appears. However, when I select the .sopcinfo file the FreeRTOS demo dissapears. 

When I try to create the BSP from the nios ii board support package wizard, I can see the "Real Time Engineers Ltd FreeRTOS 6.0.5" but in the command text box I see the command nios2-bsp ucosii . ../../nios_system.sopcinfo --cpu-name nios2_qsys which obviously links to MicroC/OSII another RTOS. 

 

Does anybody solved this problem? Some help from someone who found a solution to this problem will be extremely helpful. The solution from gwhite seems to be correct but I didn't manage to make it work.
0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Hello moistsam 

 

I don't have the time right now to duplicate all your steps, but I suggest that you install SP1 for Quartus 11.0: I had filed a service request regarding this problem earlier this year and was told that the issue would be fixed in SP1. By coincidence I just installed Quartus 11.0 today myself (immediately moving to SP1) and so I did a quick test on my own project that seems to indicate that indeed the problem has been solved. 

 

If you still have problems let me know and I could give you some more information regarding the way I setup my project (probably not before early next week though since I will be out of the office for the rest of this week). 

 

Good luck, 

Matthias
0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Hello Matthias, 

 

Thank you very much for your fast reply. I will give it a try and I will reply back to let you know the result. 

 

Thank you very much again.
0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Hello, 

 

I tried the SP1 for Quartus 11.0 and the problem was partially solved. 

 

When I try to create a new project through the "NIOS II application and BSP from templates" the FreeRTOS_Demo still dissapear when I select the .sopcinfo file. 

This problem seems not to be solved with the SP1. 

 

However, when I try to create a new BSP from the "NIOS II Board Support Package" the problem I had before, is solved with the SP1. Here when I select the .sopcinfo file, in the command box I can see: nios2-bsp freertos . ../../nios_system.sopcinfo --cpu-name nios2_qsys which is correct. Without the SP1 it was nios2-bsp ucosii . ../../nios_system.sopcinfo --cpu-name nios2_qsys which was obviously wrong. 

 

Even in this way it is possible for someone to create a FreeRTOS project. However I have to admit that the design template provided seems not to be working directly. Possibly needs some modifications.  

If someone had it working properly, it would be nice to provide some info about it. It would be really helpfull.
0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Hello moistsam 

 

I've attached the files that I am using (and keep under version control) in my project. Start by having a look at "ReadMe_FreeRTOSInstallation.txt". Note that the ZIP contains the files for two different programs (and their respective BSPs): 

* a minimal version of the FreeRTOS demo project 

* a basic version of my "real" project which uses some additional RTOS sources. 

 

A couple other things to be aware of: 

* my projects are still based on FreeRTOS 6.1.1 and were originally developed under Quartus v10.0 (I just did a very quick test today to verify that the code still compiles and runs under v11.0sp1 though) 

* I have added most FreeRTOS configuration parameters to the BSP Editor GUI, i.e. moved them from FreeRTOSConfig.h to FreeRTOS_demo_sw.tcl. This approach failed with a few of the parameters in v10.1 (that's why I had to leave them in FreeRTOSConfig.h), but there should be a bug fix in v11.0sp1 that fixes these problems (I didn't have time to test that though) 

* as far as I can tell porting of the interrupt code has some problems (in certain cases it ignores the fact that disabling/enabling interrupts returns/requires a context). They don't show with a single interrupt, but will probably bite you in case of nested interrupts 

 

Good luck and let me know in case you're stuck, 

Matthias
0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Re Freertos with ver 12.1 

 

Spend most of the day trying differtn options, copying files into correct locations  

 

got most of the way but stuck at the last bit to make the elf file !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 

 

Any body got an idea how to fix this ???? 

 

address 0x8098dc of FreeRTOS.elf section `.bss' is not within region `SDRAM' FreeRTOS C/C++ Problem 

 

address 0x8098dc of FreeRTOS.elf section `.SDRAM' is not within region `SDRAM' FreeRTOS C/C++ Problem 

 

make: *** [FreeRTOS.elf] Error 1 FreeRTOS C/C++ Problem 

 

the .bss is allowcated to SDRAM in the BSP file 

 

the limit of the SDRAM is 8000000 

 

it seams to be a problem with the debug settings if i look at the map  

 

 

enclosed FreeRTOS.map with txt extension as it wont accept ,map extension  

 

 

.bss 0x0000964c 0x800000 ../FreeRTOSbsp/\libfreertos_bsp.a(heap_2.o).bss 0x0080964c 0x0 ../FreeRTOSbsp/\libfreertos_bsp.a(alt_find_file.o).bss 0x0080964c 0x0 ../FreeRTOSbsp/\libfreertos_bsp.a(alt_get_fd.o).bss 0x0080964c 0x0 ../FreeRTOSbsp/\libfreertos_bsp.a(alt_icache_flush.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-atexit.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-exit.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-impure.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-int_errno.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-memcmp.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-memcpy.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-memset.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-strcmp.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-strlen.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-strncpy.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-__atexit.o).bss 0x0080964c 0x0 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-__call_atexit.o).bss 0x0080964c 0x0 ../FreeRTOSbsp/\libfreertos_bsp.a(alt_exit.o)*(COMMON)COMMON 0x0080964c 0x100 ../FreeRTOSbsp/\libfreertos_bsp.a(alt_irq_handler.o)0x0080964c alt_irqCOMMON 0x0080974c 0x190 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-atexit.o)0x0080974c _atexit00x008098dc . = ALIGN (0x4)0x008098dc __bss_end = ABSOLUTE (.).SDRAM 0x008098dc 0x00x008098dc PROVIDE (_alt_partition_SDRAM_start, ABSOLUTE (.))*(.SDRAM. SDRAM.*)0x008098dc . = ALIGN (0x4)0x008098dc PROVIDE (_alt_partition_SDRAM_end, ABSOLUTE (.))0x008098dc _end = ABSOLUTE (.)0x008098dc end = ABSOLUTE (.)0x008098dc __alt_stack_base = ABSOLUTE (.)0x008098dc PROVIDE (_alt_partition_SDRAM_load_addr, LOADADDR (.SDRAM)) 

 

.debug_alt_sim_info0x00000000 0x20 ../FreeRTOSbsp//obj/HAL/src/crt0.o0x00800000 __alt_data_end = 0x8000000x00800000 PROVIDE (__alt_stack_pointer, __alt_data_end)0x008098dc PROVIDE (__alt_stack_limit, __alt_stack_base)0x008098dc PROVIDE (__alt_heap_start, end)0x00800000 PROVIDE (__alt_heap_limit, 0x800000)OUTPUT(FreeRTOS.elf elf32-littlenios2).debug_ranges 0x00000000 0x70.debug_ranges 0x00000000 0x20 ../FreeRTOSbsp//obj/HAL/src/crt0.o.debug_ranges 0x00000020 0x38 ../FreeRTOSbsp/\libfreertos_bsp.a(port_asm.o).debug_ranges 0x00000058 0x18 c:/altera/12.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/lib\libc.a(lib_a-__call_atexit.o) 

 

jan
0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Hi Jan 

 

I think you simply got the SDRAM size wrong: you state "the limit of the SDRAM is 8000000", but according to your .bsp file it's only 0x800000: 

 

<MemoryMap> 

<slaveDescriptor>SDRAM</slaveDescriptor> 

<addressRange>0x00000000 - 0x007FFFFF</addressRange> 

<addressSpan>8388608</addressSpan> 

<attributes>memory</attributes> 

 

Once you specify the correct size (in SOPC-Builder or Qsys) and recompile your design, you should be able to generate the .elf as expected. 

Good luck, 

Matthias 

 

 

 

--- Quote Start ---  

Re Freertos with ver 12.1 

 

Spend most of the day trying differtn options, copying files into correct locations  

 

got most of the way but stuck at the last bit to make the elf file !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 

 

Any body got an idea how to fix this ???? 

 

address 0x8098dc of FreeRTOS.elf section `.bss' is not within region `SDRAM' FreeRTOS C/C++ Problem 

 

address 0x8098dc of FreeRTOS.elf section `.SDRAM' is not within region `SDRAM' FreeRTOS C/C++ Problem 

 

make: *** [FreeRTOS.elf] Error 1 FreeRTOS C/C++ Problem 

 

the .bss is allowcated to SDRAM in the BSP file 

 

the limit of the SDRAM is 8000000 

 

it seams to be a problem with the debug settings if i look at the map  

 

 

enclosed FreeRTOS.map with txt extension as it wont accept ,map extension  

 

 

jan 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

TO_BE_DONE

0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Follow on  

 

I know this fault i had a copy of port.c 7.02 version in a backup file so it was trying to use it twice  

 

I deleted this and cleared fault  

 

however  

address 0x88098dc of FreeRTOS.elf section `.bss' is not within region `SDRAM' FreeRTOS C/C++ Problem 

address 0x88098dc of FreeRTOS.elf section `.SDRAM' is not within region `SDRAM' FreeRTOS C/C++ Problem 

 

is still outside memory allowcation  

The bsp says now sdram from 8000020-87FFFFF 

if you try and make this bigger it throws and error  

 

I am not sure if freertos is setting this location somewhere or it adding an offset to the momory ??? 

 

Jan
0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Hi Jan 

 

I still think you got a problem with the SIZE (not the base address) of your memory: the error message implies that your program is larger than the SDRAM size specified in the .bsp. It could well be that the same settings work for ucosii because the overall code size might be smaller than the one for FreeRTOS. I have no idea what the actual physical size of your memory is, but if it's bigger than the currently specified size ( 0x800000 = 8MB ) then simply increase the span setting (you must do that in SOPCbuilder or Qsys and recompile the FPGA). If on the other hand your board only provides 8MB, you'll probably have to reduce the size of your code; not quite sure though why your program seems to take that much space: my current project uses just short of 10MB but includes much more than a simple demo app. 

 

Good luck, 

Matthias 

 

 

 

--- Quote Start ---  

Follow on  

 

I know this fault i had a copy of port.c 7.02 version in a backup file so it was trying to use it twice  

 

I deleted this and cleared fault  

 

however  

address 0x88098dc of FreeRTOS.elf section `.bss' is not within region `SDRAM' FreeRTOS C/C++ Problem 

address 0x88098dc of FreeRTOS.elf section `.SDRAM' is not within region `SDRAM' FreeRTOS C/C++ Problem 

 

is still outside memory allowcation  

The bsp says now sdram from 8000020-87FFFFF 

if you try and make this bigger it throws and error  

 

I am not sure if freertos is setting this location somewhere or it adding an offset to the momory ??? 

 

Jan 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

TO_BE_DONE

0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

Hi Jan 

 

your SOPC/Qsys project probably defines different names for those SYS_CLK resources. When I played around with the demo project, I modified (amongst other things) also "port.c" to resolve this kind of naming conflicts. Please have a look at the attachment to post# 8 of this discussion thread: the ZIP contains the files I considered most critical when trying to get the demo project running. 

 

Hope that helps. Good luck, 

Matthias 

 

 

--- Quote Start ---  

Hi Again,  

Do you Anywhere can i get a worknig demo program ??? 

Jan 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
1,389 Views

 

--- Quote Start ---  

When I try to create a new project through the "NIOS II application and BSP from templates" the FreeRTOS_Demo still dissapear when I select the .sopcinfo file. 

This problem seems not to be solved with the SP1. 

--- Quote End ---  

 

 

Was this issue ever solved? I have the same problem. 

 

I did use Matthias' info and resources, which got me most of the way (Thank you!), but this is where I got stuck. 

 

What would be the suggested course of action? I just want to run FreeRTOS, so I suppose I could throw together a project "manually" by adding each file and resource needed, but I rather have the demo as a template. 

 

Using Quartus 12.0 and FreeRTOS v7.4.1 and v6.1.1 (same result) 

 

EDIT: I am still having the above problem, but since I got FreeRTOS working I suppose it doesn't really matter. Thanks again for the help!
0 Kudos
Reply