SysTick_Handler

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I am just adding the FreeRTOS to our existing project.

I have noticed that there are two places the SysTick_Handler is used, one in libchip provided by Atmel and another in FreeRTOS port.c file.

 

Please guide me , what is the best approach to handle this?

 

Function SysTick_Handler() defined in the following two files:
"C:\MyProject\Atmel Provided\libchip\source\timetick.c"

"C:\MyProject\Third Party\RTOS\freertos\portable\iar\arm_cm7\r0p1\port.c"

 

I have attached both the files with this post for reference.

 

Thank you.

 

Attachment(s): 

Last Edited: Wed. Sep 5, 2018 - 07:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ptpatel wrote:
I am just adding the FreeRTOS to our existing project.

You can't "just add" an RTOS to a project!

 

An RTOS project has a fundamentally different structure to a "bare metal" project - one of those will be how timing is managed.

 

How FreeRTOS uses the SysTick will be described in the FreeRTOS documentation - you will need to study that!

 

Note that FreeRTOS is an independent, 3rd-party product; it is not owned or managed by Atmel/Microchip, and is not specific to Atmel/Microchip products.

 

Formerly https://www.freertos.org/ - now https://aws.amazon.com/freertos/

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Sep 5, 2018 - 10:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ptpatel wrote:

 

 

 

Function SysTick_Handler() defined in the following two files:

 

There is no SysTick_Handler() in port.c. Do you mean xPortSysTickHandler() ? It should not conflict during compilation. Post the compiler error log otherwise.

 

The quickest way to understand the usage is to check where SysTick_Handler() is being called. Can be it is assigned somewhere as an interrupt handler.

 

Regards

Last Edited: Wed. Sep 5, 2018 - 11:19 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

Thank you for reply. I understand the process of adding RTOS and that is what I am trying to achieve.

 

Hi Opal, you are right there is no SysTick_Handler() in port.c. Because in the FreeRTOSConfig.h file, it is define as the following.

I have also attached the following file for reference.

 

FreeRTOSConfig.h

/* Redefine functions names to match the standard peripheral library */
#define xPortSysTickHandler     SysTick_Handler

 

Here is the error it gives when I build my project:

Error[Li006]: duplicate definitions for "SysTick_Handler"; in "E:\Dewar\DM1300\Debug\Obj\port.o", and "E:\Dewar\DM1300\Debug\Obj\timetick.o" 

 

I am sure this kind of situation will be faced by all the developers who use Atmel Library and if they decide to add FreeRTOS to their project.

 

 

Thank you.

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, not being an expert in FreeRTOS I can't help you further here.

 

My feeling is that it is eaither the library or the FreeRTOS. They are not meant to be built together. You do understand that issues like this don't really make it into production.

 

SysTick is a valuable resource in the system and should be used by the abstraction layer of the software, to hide its details from the application layer. So, again - I think that you should find the way to get rid of libchip.

 

Let us know if you managed to get the FreeRTOS built.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would suggest that it's probably better to start with a "blank" FreeRTOS project, and add your stuff to that ...

 

EDIT

 

It seems that is the approach recommended by FreeRTOS themselves:

 

FreeRTOS wrote:

It is always recommended that a new FreeRTOS project is created by starting with, and then adapting, one of the provided pre-configured demos.

 

Doing this ensures the new project includes all the necessary source and header files, and installs the necessary interrupt service routines, with no effort on the part of the project's creator.

 

https://www.freertos.org/Creating-a-new-FreeRTOS-project.html

 

although the page does go on to say

Some FreeRTOS users also want to know how to create FreeRTOS projects by means other than adapting an existing project.

The procedure for doing this is documented below.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Sep 5, 2018 - 04:35 PM