FreeRtos porting to netX 90

I want to port FreeRTOS to netX 90 board. Unable to understand how to port to cortex M4F processor. Please provide any reference document and Freertos don’t have any example code for netX 90 board .

How to port Freertos for different architecture

I am new to rtos porting.

FreeRTOS runs on any Cortex-M that has enough RAM - no porting is required but you will have to create your own project or adapt an existing project if we don’t have one for your specific hardware and compiler combination in the download:


If architecture differ also FreeRTOS will run on any Cortex-M4 ?
Is we need to change anything in startup.s code, memory map, timers, Register map.
user need to write BSP or vendor will provide.

what is port.c and what are the thing we need to change in port.c

Please provide any porting reference guide ( detailed steps).

FreeRTOS does not use anything outside of the Cortex-M core, and the Cortex-M core is identical on all Cortex-M processors (that is all M3 cores are alike,
all M0 cores are alike, etc.). So you can move the code from one Cortex-Mx to another Cortex-Mx without changing anything in the kernel code itself.

None of that stuff is part of FreeRTOS and will come from your vendor - please see the link I already posted regarding creating a new project.

See the links I already posted and
https://www.freertos.org/a00017.html (and the books) for information on which port.c file to use. If you want to use a Cortex-M4 that does not have floating point, then use Cortex-M3 port. If you have
a Cortex-M7 then use the Cortex-M4F port.

Thank you for your reply.

once i will try and I will let you know

I created new FreeRTOS project using netX studio (netX 90) for Cortex M4F but I am getting error as shown below.

C:\Users\Admin\AppData\Local\Temp\cc8XcF45.s: Assembler messages:
C:\Users\Admin\AppData\Local\Temp\cc8XcF45.s:50: Error: selected processor does not support Thumb mode msr basepri,r3' C:\Users\Admin\AppData\Local\Temp\cc8XcF45.s:51: Error: selected processor does not support Thumb mode isb ’
C:\Users\Admin\AppData\Local\Temp\cc8XcF45.s:52: Error: selected processor does not support Thumb mode `dsb ’

90% certain this will be because the command line you are passing to GCC does not match the chip architecture you are targeting. If you are using the M4F port because your chip has a floating point unit then you need to tell GCC you have a floating point unit, and which floating point unit it is.

Hello,
@kumuda I have same requiremet to port netX90 on FreeRtos. So, can you provide any simple example for it?.
I tried it my as my understanding to do it but have facing following error:

C:\Users\Admin\AppData\Local\Temp\ccWRCdd3.s:799: Error: selected processor does not support Thumb mode vstmdbeq r0!,{s16-s31}' C:\Users\Admin\AppData\Local\Temp\ccWRCdd3.s:801: Error: instruction not allowed in IT block -- stmdb r0!,{r4-r11,r14}’
C:\Users\Admin\AppData\Local\Temp\ccWRCdd3.s:821: Error: selected processor does not support Thumb mode vldmiaeq r0!,{s16-s31}' C:\Users\Admin\AppData\Local\Temp\ccWRCdd3.s:823: Error: instruction not allowed in IT block -- msr psp,r0’

Can you please help on it?.

Hello @rtel Can you please help on this?.

This is an extract form the ARM GCC compiler readme:

--------------------------------------------------------------------------
| Arm core   | Command Line Options                       | multilib     |
|------------|--------------------------------------------|--------------|
| Cortex-M0+ | -mthumb -mcpu=cortex-m0plus                | thumb        |
| Cortex-M0  | -mthumb -mcpu=cortex-m0                    | /v6-m        |
| Cortex-M1  | -mthumb -mcpu=cortex-m1                    |              |
|------------|--------------------------------------------|--------------|
| Cortex-M3  | -mthumb -mcpu=cortex-m3                    | thumb        |
|            |                                            | /v7-m        |
|------------|--------------------------------------------|--------------|
| Cortex-M4  | -mthumb -mcpu=cortex-m4                    | thumb        |
| (No FP)    |                                            | /v7e-m       |
|------------|--------------------------------------------|--------------|
| Cortex-M4  | -mthumb -mcpu=cortex-m4 -mfloat-abi=softfp | thumb        |
| (Soft FP)  |                                            | /v7e-m+fp    |
|            |                                            | /softfp      |
|------------|--------------------------------------------|--------------|
| Cortex-M4  | -mthumb -mcpu=cortex-m4 -mfloat-abi=hard   | thumb        |
| (Hard FP)  |                                            | /v7e-m+fp    |
|            |                                            | /hard        |
|------------|--------------------------------------------|--------------|
| Cortex-M7  | -mthumb -mcpu=cortex-m7                    | thumb        |
| (No FP)    |                                            | /v7e-m       |
|            |                                            | /nofp        |
|------------|--------------------------------------------|--------------|
| Cortex-M7  | -mthumb -mcpu=cortex-m7 -mfloat-abi=softfp | thumb        |
| (Soft FP)  |                                            | /v7e-m+dp    |
|            |                                            | /softfp      |
|------------|--------------------------------------------|--------------|
| Cortex-M7  | -mthumb -mcpu=cortex-m7 -mfloat-abi=hard   | thumb        |
| (Hard FP)  | -mfpu=fpv5-sp-d16                          | /v7e-m+dp    |
|            |                                            | /hard        |
|------------|--------------------------------------------|--------------|
| Cortex-M23 | -mthumb -mcpu=cortex-m23                   | thumb        |
|            |                                            | /v8-m.base   |
|------------|--------------------------------------------|--------------|
| Cortex-M33 | -mthumb -mcpu=cortex-m33                   | thumb        |
|  (No FP)   |                                            | /v8-m.main   |
|            |                                            | /nofp        |
|------------|--------------------------------------------|--------------|
| Cortex-M33 | -mthumb -mcpu-cortex-m33                   | thumb        |
| (Soft FP)  | -mfloat-abi=softfp                         | /v8-m.main+fp|
|            |                                            | /softfp      |
|------------|--------------------------------------------|--------------|
| Cortex-M33 | -mthumb -mcpu=cortex-m33                   | thumb        |
| (Hard FP)  | -mfloat-abi=hard                           | /v8-m.main+fp|
|            |                                            | /hard        |
|------------|--------------------------------------------|--------------|
| Cortex-R4  | [-mthumb] -mcpu=cortex-r?                  | thumb        |
| Cortex-R5  |                                            | /v7          |
| Cortex-R7  |                                            | /nofp        |
| Cortex-R8  |                                            |              |
| (No FP)    |                                            |              |
|------------|--------------------------------------------|--------------|
| Cortex-R5  | [-mthumb] -mcpu=cortex-r?                  | thumb        |
| Cortex-R7  | -mfloat-abi=softfp                         | /v7+fp       |
| Cortex-R8  |                                            | /softfp      |
| (Soft FP)  |                                            |              |
|------------|--------------------------------------------|--------------|
| Cortex-R5  | [-mthumb] -mcpu=cortex-r?                  | thumb        |
| Cortex-R7  | -mfloat-abi=hard                           | /v7+fp       |
| Cortex-R8  |                                            | /hard        |
| (Hard FP)  |                                            |              |
|------------|--------------------------------------------|--------------|
| Cortex-R52 | [-mthumb] -mcpu=cortex-r52                 | thumb        |
| (No FP)    |                                            | /v7          |
|            |                                            | /nofp        |
|------------|--------------------------------------------|--------------|
| Cortex-R52 | [-mthumb] -mcpu=cortex-r52                 | thumb        |
| (Soft FP)  | -mfloat-abi=softfp                         | /v7+fp       |
|            |                                            | /softfp      |
|------------|--------------------------------------------|--------------|
| Cortex-R52 | [-mthumb] -mcpu=cortex-r52                 | thumb        |
| (Soft FP)  | -mfloat-abi=hard                           | /v7+fp       |
|            |                                            | /hard        |
|------------|--------------------------------------------|--------------|
| Cortex-A*  | [-mthumb] -mcpu=cortex-a*                  | thumb        |
| (No FP)    |                                            | /v7          |
|            |                                            | /nofp        |
|------------|--------------------------------------------|--------------|
| Cortex-A*  | [-mthumb] -mcpu=cortex-a*                  | thumb        |
| (Soft FP)  | -mfloat-abi=softfp                         | /v7+fp       |
|            |                                            | /softfp      |
|------------|--------------------------------------------|--------------|
| Cortex-A*  | [-mthumb] -mcpu=cortex-a*                  | thumb        |
| (Hard FP)  | -mfloat-abi=hard                           | /v7+fp       |
|            |                                            | /hard        |
--------------------------------------------------------------------------

@rtel Thank you for your response…!!!
I tried same with my build system but for netX90 platform they are used WAF script instead of makefile to build the project. I do not have experience into it. For that, I tried to add these linker flags into the WAF script to build the project however, it is not solving the my problem. The netX Studio IDE does not have the option to add these flags directly by choosing the project properties -> build settings.
If any idea how to add these flags into the WAF script? please help to do it.

If you are using the netx studio CDT.
Then there should be a directory called WAF.
In that directory is a waf file called hilscher-toolchain.py, you can change the toolchain for the what ever netX chip that you use. For the netx90 find "@device(‘netx90’…) and scoll down to to for x in ‘CFLAG’CXXFLAGS ASFLAG LINKFLAGS’ and comment f(x, [’-mfloat-abi=soft’]) and uncomment f(x, [’-mfpu=fpv4-sp-d16’, ‘-mfloat-abi=hard’]).

After that, the 3 interrupt (Systick, SVC og PendSV) needs to be implemented correct. SVC and pend SV can be implemented in hilshcers handler.c file, just remove their fault trap, and insert FreeRTOS handlers insted. Systick is a bit more tricky. I went up in the component CMSIS. Though the directory “Device” i found a GCC source folder, which contained a startup_netxXX_app.s where the interrupt vector is defined, and change the standart hilscher to FreeRTOS. If you want you can also change the SVC and pnedSV here to FreeRTOS’s instead of doing it in handler.c

The next problem i faces is that i get som hard fault errors - usage fault with the INVSTAT bit high. I have yet to figure that out, but i hope that some one can help me as well.

1 Like

Hello @Bjoerk, Thanks for sharing your idea…!!!
I will try your suggestion when I will get time.
Let’s wait, someone can help on your problem so, we can have proper way to port the FreeRTOS on netX90 platform.

Hey agian

I have been fiddeling with it some time agian today, and i found that my previouse statement was somewhat wrong.

The handler.c dont use for anything at all. change the interrupt vector manually. Go to the startup_netx90_app.s and change systick handler, svc handler and the pendSV handler to that of FreeRTOS.

after i did that the classical blinking LED’s ( i have 2 leds running in 2 seperate task) workes as i should.

Hello!

I am new to this forum and new to freeRTOS. I need some help for my Netx90 project.
Could anybody support me with an example project for netX Studio?
I am not able to find any in the RTOS download.

If you have a bare metal project, you should be able to use the FreeRTOS standard Cortex-M4 port. This page contains instructions for creating a new project: Creating a new RTOS project

Thanks.

Thank you, i found that m4f port.c file and managed to get RTOS up and running. Had some problems with my tasks first but that was because of the vector tabel entries.
Now everything is running quite well.

Glad to hear that it is working for you.

Hello!

I need some help,I just try to porting CM4F to my project.
But when I build the project , it show me there are 7 Errors.
Such as :

Description Resource Path Location Type
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘ulPortRaiseBASEPRI’ portmacro.h /netX90_EISV5_extendedConfig/Components/FreeRTOS/port/RVDS/ARM_CM4F line 214 C/C++ Problem

However there was no problem when i port it to mine STM32 project in the same way ,anybody know what these problems means?And how can i solve these problems?Thanks!


here the whole errors