SAMv71 Evaluation Kit freeRTOS initialization + getRunTimeStats

mokrooussov wrote on Wednesday, March 30, 2016:

Hello, we have a pretty detailed question regarding to the RTOS implementation and usage generation values. At this point, I have been pursuing a FreeRTOS example project provided by Atmel in Atmel Studio 7. We have found multiple examples where initializing a GET_RUNTIME_STATS configuration and using a vTaskGetRunTimeStats() provides a table in the form of:
In order for us to achieve this tabular interface, we took the following steps as detailed by RTOS website in this website:
We added the following code to FreeRTOSconfig.h


We then added vTaskGetRunTimeStats() function in the task monitor function in the c main file and passed through an array construction, based on the following documentation:
The value passed through is a pcWriteBuffer, a buffer into which execution times will be written in ASCII form, approximately 40 bits per task used.

However, we found that when defining the ports in FreeRTOSconfig.h was complicated, we needed an incremented timer tick clock. The 2 examples in the first website referenced above, provides an example of a demo application that already includes a 20KHz timer test and one that does not. For the one that does not, we belive this resembles our situation. However, the definition they provide of a configuration of a timer for runtime stats in the main.c file does not fit our processor. We are currently attempting to discover a method for defining a peripheral clock. If you have any more questions or if you could assist us, we would be grateful.

rtel wrote on Wednesday, March 30, 2016:

How you configure a chip specific timer is, I’m afraid, outside the scope of FreeRTOS support because its an Atmel hardware question not a FreeRTOS question. You have some options:

  • Look at the examples provided by Atmel, they will probably have one.
  • Read the data sheet and write the code yourself - generally timers are simple to program.
  • Ask on an Atmel specific forum.

Alternatively, you could use the cycle counter that is present on all Cortex-M devices. It is not very efficient to do that, but it will provide you with some numbers. The following file should work for you, and even comes from a SAM4E demo application, which I think is [at least pin] compatible with your part.

[also look at the following function]