FreeRTOS on Atmel SAMB11

kev1 wrote on Tuesday, June 28, 2016:

Hello !

I’m quite new to FreeRTOS and I would like to use it on an Atmel SAMB11 SoC (arm cortex M0), and more precisely on an Samb11Xplained board. For now I used provided example for SAMD21 SoC.

My first question is the following: does FreeRTOS port depends on the SoC (e.g. SAMB11) or only the processor (arm cortex M0) ? My understanding leads me to the second one.

Next, what are the steps to adapt an example to my board ?

Currently, I’m able to compile FreeRTOS sources in my project. I’ve first created only one task, and after starting the scheduler, the task was processing correctly (even though I observed that it doesn’t work if timer use is enabled in FreeRTOSConfig.h).
I am now trying to create two tasks and check that they both process. The problem is that only one task is executed. I suspect an issue with the systick timer but I don’t know how to fix it.

Thanks for your help !

rtel wrote on Tuesday, June 28, 2016:

My first question is the following: does FreeRTOS port depends on the
SoC (e.g. SAMB11) or only the processor (arm cortex M0) ? My
understanding leads me to the second one.

Then you are correct :o) FreeRTOS does not rely on anything outside of
the Cortex-M core unless you are going to write a port specific low
power tickless mode, in which case you need a clock source which is
external to the core.

Next, what are the steps to adapt an example to my board ?

The following links might help:

In your case adapting the SAMD20 demo might be your best option.

Currently, I’m able to compile FreeRTOS sources in my project. I’ve
first created only one task, and after starting the scheduler, the
task was processing correctly (even though I observed that it doesn’t
work if timer use is enabled in FreeRTOSConfig.h). I am now trying to
create two tasks and check that they both process. The problem is
that only one task is executed. I suspect an issue with the systick
timer but I don’t know how to fix it.

Have you installed the interrupt handlers? See the “special note for
ARM Cortex-M users” in bullet point #1 on this page of the FAQ:

kev1 wrote on Tuesday, June 28, 2016:

Thank you for your fast answer !

In your case adapting the SAMD20 demo might be your best option.

Ok I will test this demo.

Have you installed the interrupt handlers? See the “special note for
ARM Cortex-M users” in bullet point #1 on this page of the FAQ:
FreeRTOS - Open Source RTOS Kernel for small embedded systems

Effectively I have seen this point. I tried different configurations without any success for now. Maybe I misunderstood how to set correctly these interrupt handlers.
Does the board clock configuration have an importance for FreeRTOS ? For example, basic code of SAMD20 in atmel studio have a specific function that configures the clock, but SAMB11 doesn’t seem to have one.

kev1 wrote on Friday, July 01, 2016:

I finally get FreeRTOS working on the soc. I used atmel api which allows to register isr like this:

system_register_isr(RAM_ISR_TABLE_SYSTICK_INDEX, (uint32_t)xPortSysTickHandler);
system_register_isr(RAM_ISR_TABLE_PENDSV_INDEX, (uint32_t)xPortPendSVHandler);
system_register_isr(RAM_ISR_TABLE_SVC_INDEX, (uint32_t)vPortSVCHandler);

I initially thought it was already done somewhere, with SysTick_Handler handler…
With that configuration, I am able to execute two simple tasks concurrently.

BUT, atmel bluetooth sdk states that SAMB11 soc includes a proprietary RTOS which supports multiple tasks: Idle task, firmware task responsible for bluetooth functionnality, and application task (user application). So I guess FreeRTOS is not really compatible with this soc…