Setting up freeRTOS for ARM-cortex- A9

Hello All!

Im trying to set up just a “hello world” project for zynqboard with cpu ARM Cortex-A9.
I’m following the steps in the link: “Creating-a-new-FreeRTOS-project” in the most smpliest way. What the tutorial on the link asks for me?

  1. As a minimum, the following source files must be included in your project:
  • FreeRTOS/Source/tasks.c
  • FreeRTOS/Source/queue.c
  • FreeRTOS/Source/list.c
  • FreeRTOS/Source/portable/[compiler]/[architecture]/port.c.
  • FreeRTOS/Source/portable/MemMang/heap_x.c [where ‘x’ is 1, 2, 3, 4 or 5].

-its done list, main, queue, tasks, port.c are added to my project.
Then it says

FreeRTOS/Source/include
FreeRTOS/Source/portable/[compiler]/[architecture].
Whichever directory contains the FreeRTOSConfig.h file to be used - see the Configuration File paragraph below.

-its done, my include path contains the two paths, and also i added FreeRTOSConfig.h with the following content (except someting.h include) :freertos.org_a00110 (sry your site says i can not add links to my posts)

And thats all, the tutorial says only the following. But im getting error messaeges during compilation (the same for different .o files):

“C:/workspace_v12/ver1_a9/FreeRTOSConfig.h”, line 72: error #41: expected an identifier
“D:/3dparty/FreeRTOSv202212.01/FreeRTOS/Source/portable/GCC/ARM_CA9/portmacro.h”, line 188: fatal error #35: #error directive: Invalid configUNIQUE_INTERRUPT_PRIORITIES setting. configUNIQUE_INTERRUPT_PRIORITIES must be set to the number of unique priorities implemented by the target hardware
1 error and 1 catastrophic error detected in the compilation of “…/list.c”.
Compilation terminated.

Why im getting these? I never met freeRTOS before, and i followed every step in the tutorial i linked above. Could somebody help me?

Thanks in advance.

Are you using this file as FreeRTOSConfig.h - FreeRTOS/FreeRTOSConfig.h at main · FreeRTOS/FreeRTOS · GitHub

Thank you for your reply!

Now it says:
“C:/Users/forgoa/workspace_v12/ver1_a9/FreeRTOSConfig.h”, line 4: fatal error #1965: cannot open source file “xparameters.h”

On the site “Creating-a-new-FreeRTOS-project”(im not able to add links) i can not see any reference to this xparameters.h especially not in the necessary configuration.

If i add it (from the mentioned ca9 demo directory ) then there is a missing reference to the file xparameters_ps.h file. Then if i add xparameters_ps, its missing xscuwdt.h., then if i add it, its missing xstatus.h, then if i add xil_types.h… then xil_asserts.h, then xscuwdt_hw.h, then…

Is tehere any user manual which makes me able to create a freertos image with 1 single hello world for cortex a9 cpu exists somewhere? The mentioned “Creating-a-new-FreeRTOS-project” page from your site is clearly not working/up to date.

Thanks in advance!

Do you have a working bare metal project without FreeRTOS? Is it possible for you to use this project as a starting point - FreeRTOS/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702 at main · FreeRTOS/FreeRTOS · GitHub

No i do not have any. We would like to try the most simple freertos image to test it for our interest. Thats why i would like to have a simple (minimal) image of freeRTOS for my zynqboard.
But i will try to compile the project you mentioned. Thank you!

Oh it says " The demo is pre-configured to build with the [Xilinx SDK]tools (version 2016.1 at the time of writing) and execute on the [ZC702] evaluation board."

It means, to have a freeRTOS image for A9 is impossible without xilinx tool? (which is now not xilinx sdk but vitis as i can see)
(e.g. code composer studio, following the steps written in :"“Creating-a-new-FreeRTOS-project”?)

As a first step, I’d suggest that get a bare metal project without FreeRTOS working and then follow the guide you mentioned to add FreeRTOS.

What do you mean “bare metal”? I created a project, which targets a9 cpu, without adding any files/include references (its only a c file about printing hello world), and its compiled without errors/warnings. Then if i add the mentioned files/include paths i wrote above, it started to show the error messages.

That is what I meant by bare metal. Now that you have it running, you should be able to add FreeRTOS files. This page contains Cortex-A specific information - RTOS for ARM Cortex-A

Unfortunately im not able. At the fist step (add queue, list, etc files from “Source” folder), add HeapX file from Memory management and add gcc\a9 reference and the FreeRTOSConfig.h you mentioned above (from github), my code which was compiled before addition of files are not compiling anymore. It missing header files. If i add the missing files, then other files are missing.

Did you read the page I shared in the above link? Can you share your project?

xparameters.h is a Xilinx specific header file included in the FreeRTOSConfig.h file for the Xilinx specific demo project. The header describes the configurable hardware to the C code. FreeRTOSConfig.h is part of the application, not part of the kernel. It describes the required kernel configuration. The website and free to download (but out of date) book describe the source files and header files you need for your project, and RTOS for ARM Cortex-A provides Cortex-A specifics.

Thanks for the answers. I gave up, downloaded xilinx’s vivado and vitis tool and use them with freertos. I created a project for arm-ca9, and run a hello world app. Now, i’d like to use the tcp stack. I followed this tutorial (because it is linked from xilinx’s website too): freertos org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Networking_Tutorial_Adding_Source_Files.

I set up everything it says: …/src/imported/Zynq/NetworkInterface.c:49:10: fatal error: Zynq/x_topology.h: No such file or directory.
Of course i understand the error message. What im not understand: I did everything the site said. Everything. Did exactly, 100% the same. Why is it not compiling?

Can you check your include search paths? I think you need to add source/portable/NetworkInterface/ to your include search paths.

I can’t find any source about this on your site ( Adding the TCP/IP Source Files to an RTOS Project), but i added it. New error messages showed :
#error Please define both ‘ipconfigZERO_COPY_RX_DRIVER’ and ‘ipconfigZERO_COPY_TX_DRIVER’ as 1
Okay its clear, lets define it → done. Still not compiling:
error: ‘ipconfigNIC_N_TX_DESC’ undeclared here . → okay, declare it (just to make it compile…).
then new error messages…: " variably modified ‘pxDMA_tx_buffers’ at file scope"

(Also the mentioned site which is a tutorial not say a single world about define those defines or create variables…)

Thank you for the feedback. Will pass this to our documentation team.

This error message is not clear. Can you paste the complete compiler output?

So, here, a Hello World template is builded. (Not added any single libraries or anything to the project):

11:02:39 **** Build of configuration Debug for project FreeRTOS_tutorial_app_system ****
make all
Generating bif file for the system project
generate_system_bif.bat 53726 C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/FreeRTOS_Tutorial.xpfm freertos10_xilinx_domain C:/Users/forgoa/workspace2/FreeRTOS_tutorial_app_system/Debug/system.bif
sdcard_gen --xpfm C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/FreeRTOS_Tutorial.xpfm --sys_config FreeRTOS_Tutorial --bif C:/Users/forgoa/workspace2/FreeRTOS_tutorial_app_system/Debug/system.bif --no_bitstream --elf C:/Users/forgoa/workspace2/FreeRTOS_tutorial_app/Debug/FreeRTOS_tutorial_app.elf,ps7_cortexa9_0
Running D:/Xilinx/Vitis/2022.2/bin/bootgen -image C:/Users/forgoa/workspace2/FreeRTOS_tutorial_app_system/Debug/sd_card_temp/boot.bif -w -o i BOOT.BIN

11:03:10 Build Finished (took 31s.445ms)

Then after i did every steps your site says and you mentioned:

11:22:31 **** Incremental Build of configuration Debug for project FreeRTOS_tutorial_app ****
make all
make --no-print-directory pre-build
a9-linaro-pre-build-step
’ ’
make --no-print-directory main-build
‘Building file: …/src/NetworkInterface/Zynq/NetworkInterface.c’
‘Invoking: ARM v7 gcc compiler’
arm-none-eabi-gcc -Wall -O0 -g3 -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include" -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\portable\NetworkInterface" -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\portable\Compiler\GCC" -c -fmessage-length=0 -MT"src/NetworkInterface/Zynq/NetworkInterface.o" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -IC:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include -MMD -MP -MF"src/NetworkInterface/Zynq/NetworkInterface.d" -MT"src/NetworkInterface/Zynq/NetworkInterface.o" -o “src/NetworkInterface/Zynq/NetworkInterface.o” “…/src/NetworkInterface/Zynq/NetworkInterface.c”
In file included from D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOS_IP.h:41,
from …/src/NetworkInterface/Zynq/NetworkInterface.c:40:
D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOSIPConfig.h:331: warning: “portINLINE” redefined
331 | #define portINLINE
|
In file included from C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/portable.h:53,
from C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/FreeRTOS.h:65,
from …/src/NetworkInterface/Zynq/NetworkInterface.c:34:
C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/portmacro.h:211: note: this is the location of the previous definition
211 | #define portINLINE __inline
|
…/src/NetworkInterface/Zynq/NetworkInterface.c:54:10: fatal error: uncached_memory.h: No such file or directory
54 | #include “uncached_memory.h”
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [src/NetworkInterface/Zynq/subdir.mk:20: src/NetworkInterface/Zynq/NetworkInterface.o] Error 1
make: *** [makefile:35: all] Error 2

11:22:35 Build Finished (took 4s.445ms)

Then it misses uncached_memory.h. I added it to the project. Then:

11:25:31 **** Incremental Build of configuration Debug for project FreeRTOS_tutorial_app ****
make all
make --no-print-directory pre-build
a9-linaro-pre-build-step
’ ’
make --no-print-directory main-build
‘Building file: …/src/NetworkInterface/Zynq/NetworkInterface.c’
‘Invoking: ARM v7 gcc compiler’
arm-none-eabi-gcc -Wall -O0 -g3 -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include" -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\portable\NetworkInterface" -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\portable\Compiler\GCC" -c -fmessage-length=0 -MT"src/NetworkInterface/Zynq/NetworkInterface.o" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -IC:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include -MMD -MP -MF"src/NetworkInterface/Zynq/NetworkInterface.d" -MT"src/NetworkInterface/Zynq/NetworkInterface.o" -o “src/NetworkInterface/Zynq/NetworkInterface.o” “…/src/NetworkInterface/Zynq/NetworkInterface.c”
In file included from D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOS_IP.h:41,
from …/src/NetworkInterface/Zynq/NetworkInterface.c:40:
D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOSIPConfig.h:331: warning: “portINLINE” redefined
331 | #define portINLINE
|
In file included from C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/portable.h:53,
from C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/FreeRTOS.h:65,
from …/src/NetworkInterface/Zynq/NetworkInterface.c:34:
C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/portmacro.h:211: note: this is the location of the previous definition
211 | #define portINLINE __inline
|
…/src/NetworkInterface/Zynq/NetworkInterface.c:94:6: error: #error Please define both ‘ipconfigZERO_COPY_RX_DRIVER’ and ‘ipconfigZERO_COPY_TX_DRIVER’ as 1
94 | #error Please define both ‘ipconfigZERO_COPY_RX_DRIVER’ and ‘ipconfigZERO_COPY_TX_DRIVER’ as 1
| ^~~~~
…/src/NetworkInterface/Zynq/NetworkInterface.c:98:6: warning: #warning Please define both ‘ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM’ and ‘ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM’ as 1 [-Wcpp]
98 | #warning Please define both ‘ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM’ and ‘ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM’ as 1
| ^~~~~~~
make[1]: *** [src/NetworkInterface/Zynq/subdir.mk:20: src/NetworkInterface/Zynq/NetworkInterface.o] Error 1
make: *** [makefile:35: all] Error 2

11:25:36 Build Finished (took 4s.632ms)

Then i defined ipconfigZERO_COPY_RX_DRIVER and ipconfigZERO_COPY_TX_DRIVER as 1. Now it says:

11:26:47 **** Incremental Build of configuration Debug for project FreeRTOS_tutorial_app ****
make all
make --no-print-directory pre-build
a9-linaro-pre-build-step
’ ’
make --no-print-directory main-build
‘Building file: …/src/NetworkInterface/Zynq/NetworkInterface.c’
‘Invoking: ARM v7 gcc compiler’
arm-none-eabi-gcc -Wall -O0 -g3 -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include" -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\portable\NetworkInterface" -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\portable\Compiler\GCC" -c -fmessage-length=0 -MT"src/NetworkInterface/Zynq/NetworkInterface.o" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -IC:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include -MMD -MP -MF"src/NetworkInterface/Zynq/NetworkInterface.d" -MT"src/NetworkInterface/Zynq/NetworkInterface.o" -o “src/NetworkInterface/Zynq/NetworkInterface.o” “…/src/NetworkInterface/Zynq/NetworkInterface.c”
In file included from D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOS_IP.h:41,
from …/src/NetworkInterface/Zynq/NetworkInterface.c:40:
D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOSIPConfig.h:331: warning: “portINLINE” redefined
331 | #define portINLINE
|
In file included from C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/portable.h:53,
from C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/FreeRTOS.h:65,
from …/src/NetworkInterface/Zynq/NetworkInterface.c:34:
C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/portmacro.h:211: note: this is the location of the previous definition
211 | #define portINLINE inline
|
…/src/NetworkInterface/Zynq/NetworkInterface.c:92: warning: “ipconfigZERO_COPY_RX_DRIVER” redefined
92 | #define ipconfigZERO_COPY_RX_DRIVER 1
|
In file included from D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOS_IP.h:42,
from …/src/NetworkInterface/Zynq/NetworkInterface.c:40:
D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOSIPConfigDefaults.h:914: note: this is the location of the previous definition
914 | #define ipconfigZERO_COPY_RX_DRIVER ( 0 )
|
…/src/NetworkInterface/Zynq/NetworkInterface.c:93: warning: “ipconfigZERO_COPY_TX_DRIVER” redefined
93 | #define ipconfigZERO_COPY_TX_DRIVER 1
|
In file included from D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOS_IP.h:41,
from …/src/NetworkInterface/Zynq/NetworkInterface.c:40:
D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOSIPConfig.h:333: note: this is the location of the previous definition
333 | #define ipconfigZERO_COPY_TX_DRIVER ( 1 )
|
…/src/NetworkInterface/Zynq/NetworkInterface.c:99:6: warning: #warning Please define both ‘ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM’ and ‘ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM’ as 1 [-Wcpp]
99 | #warning Please define both ‘ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM’ and ‘ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM’ as 1
| ^~~~~~~
‘Finished building: …/src/NetworkInterface/Zynq/NetworkInterface.c’
’ ’
‘Building file: …/src/BufferAllocation_2.c’
‘Invoking: ARM v7 gcc compiler’
arm-none-eabi-gcc -Wall -O0 -g3 -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include" -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\portable\NetworkInterface" -I"D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\portable\Compiler\GCC" -c -fmessage-length=0 -MT"src/BufferAllocation_2.o" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -IC:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include -MMD -MP -MF"src/BufferAllocation_2.d" -MT"src/BufferAllocation_2.o" -o “src/BufferAllocation_2.o” “…/src/BufferAllocation_2.c”
In file included from D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOS_IP.h:41,
from …/src/BufferAllocation_2.c:52:
D:\3dparty\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Plus-TCP\source\include/FreeRTOSIPConfig.h:331: warning: “portINLINE” redefined
331 | #define portINLINE
|
In file included from C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/portable.h:53,
from C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/FreeRTOS.h:65,
from …/src/BufferAllocation_2.c:47:
C:/Users/forgoa/workspace2/FreeRTOS_Tutorial/export/FreeRTOS_Tutorial/sw/FreeRTOS_Tutorial/freertos10_xilinx_domain/bspinclude/include/portmacro.h:211: note: this is the location of the previous definition
211 | #define portINLINE inline
|
…/src/BufferAllocation_2.c:76:58: warning: division by zero [-Wdiv-by-zero]
76 | ; enum { ASSERT_CONCAT( assert_line
, LINE ) = 1 / ( !!( e ) ) }
| ^
…/src/BufferAllocation_2.c:78:5: note: in expansion of macro ‘STATIC_ASSERT’
78 | STATIC_ASSERT( ipconfigETHERNET_MINIMUM_PACKET_BYTES <= baMINIMAL_BUFFER_SIZE );
| ^~~~~~~~~~~~~
…/src/BufferAllocation_2.c:76:29: error: enumerator value for ‘assert_line_78’ is not an integer constant
76 | ; enum { ASSERT_CONCAT( assert_line
, LINE ) = 1 / ( !!( e ) ) }
| ^~~~~~~~~~~~
…/src/BufferAllocation_2.c:73:39: note: in definition of macro 'ASSERT_CONCAT

73 | #define ASSERT_CONCAT
( a, b ) a ## b
| ^
…/src/BufferAllocation_2.c:76:14: note: in expansion of macro ‘ASSERT_CONCAT’
76 | ; enum { ASSERT_CONCAT( assert_line_, LINE ) = 1 / ( !!( e ) ) }
| ^~~~~~~~~~~~~
…/src/BufferAllocation_2.c:78:5: note: in expansion of macro ‘STATIC_ASSERT’
78 | STATIC_ASSERT( ipconfigETHERNET_MINIMUM_PACKET_BYTES <= baMINIMAL_BUFFER_SIZE );
| ^~~~~~~~~~~~~
make[1]: *** [src/subdir.mk:89: src/BufferAllocation_2.o] Error 1
make: *** [makefile:35: all] Error 2

11:26:55 Build Finished (took 7s.830ms)

Can you share your project? May be put it in a repo and share link?

Can you please check that if you have redefined ipconfigETHERNET_MINIMUM_PACKET_BYTES (maybe in your FreeRTOSIPConfig.h) to be greater than baMINIMAL_BUFFER_SIZE. It can be kept at the default definition to zero if there is no requirement for a minimum size of an outgoing Ethernet packet.

Yes i tried, the same error message occurs.