Page 1 of 1

issue around MS2ST Macros

Posted: Wed Jul 20, 2016 12:38 pm
by Tabulous
using STM32F101
got system tick set to 50,000(need the resolution in the threads). F101 system tick can only run on 16bit timer.


MS2ST(5000) as per below results in overflowing the systime_t delay varible as this is only unsigned 16bits.

Code: Select all

chVTSetI(&tmr1, MS2ST(5000), test1, &msg);


So i assume this is a limitation when the system tick is high these macros dont/can't do what you want........

maybe having some check code around to warn at compile time would be useful.

Re: issue around MS2ST Macros

Posted: Wed Jul 20, 2016 2:38 pm
by Giovanni
Hi,

How would you do that?

Giovanni

Re: issue around MS2ST Macros

Posted: Wed Jul 20, 2016 2:43 pm
by Tabulous
Giovanni wrote:Hi,

How would you do that?

Giovanni


Yeah, not really possibly, but you could have runtime asserts if the value calculated is larger that the variable it is been load into and thus would get trucated ?