Incorrect asserts in hal_timer.c

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

Hello,

 

In hal_timer.c, in timer_remove_task(), there is an ASSERT(false) in the case where the task was not found to be removed.

 

Also in timer_add_task(), there is an ASSERT(false) in the case where the task already exists.

 

I think these asserts are mistakes (I'm wondering if someone left them in for debugging?): Timer_remove_task() should return with an error if the task was not found.  Likewise, timer_add_task() should return with an error if the task already exists. Code exists for the proper error returns, but the assert prevents it from happening.  If the user wants an assert for these conditions he can do it after the return.  There are definitely cases where you do not want the asserts- maybe the timer already fired, or hasn't fired yet.  These are valid conditions, not fatal errors.

 

Anyway, can we get these asserts removed in the next version?

 

I see this in AtmelStart generated code for atsamd21, atsame54 and atsame70.

 

Thanks!

Joe

 

Last Edited: Sat. Dec 11, 2021 - 08:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to contact microchip support with these requests.

 

Remember that asserts are only active during debug builds, so a release build will disable asserts.

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

Last Edited: Sat. Dec 11, 2021 - 08:19 PM