[PATCH] Updated tick implementation for HAL_GetTick

Robin Müller robin.mueller.m at gmail.com
Tue Apr 20 17:45:50 UTC 2021


Hmm, do you have an idea how to fix this cleanly? Was this the reason the
implementation returned 0?
This was not an issue with the other implementation:

(rtems_clock_get_ticks_since_boot() * 1000) /
rtems_clock_get_ticks_per_second();

Kind Regards
Robin

On Tue, 20 Apr 2021 at 19:31, Robin Müller <robin.mueller.m at gmail.com>
wrote:

> Yes, I tried to switch oscillator and clock init in the start hook, but
> that did not appear to solve the issue.
>
> Kind Regards
> Robin
>
> On Tue, 20 Apr 2021 at 19:24, Robin Müller <robin.mueller.m at gmail.com>
> wrote:
>
>> This is really odd.. THe function is already called in the start up hook
>> function init_oscillator() before init.c . Maybe this is problematic.
>> The code crashes in line 508 of kern_tc.c (see rtems-crash.png).
>>
>> Kind Regards
>> Robin
>>
>> On Tue, 20 Apr 2021 at 19:09, Robin Müller <robin.mueller.m at gmail.com>
>> wrote:
>>
>>> Okay, there is some issue with the rtems function to get the uptime
>>> nanoseconds.. The call appears to crash for some reason.
>>>
>>> Kind Regards
>>> Robin
>>>
>>> On Tue, 20 Apr 2021 at 18:31, Robin Mueller <robin.mueller.m at gmail.com>
>>> wrote:
>>>
>>>> This now uses rtems_clock_get_uptime_nanoseconds
>>>> to calculate the uptime ticks in milliseconds.
>>>> ---
>>>>  bsps/arm/stm32h7/start/bspstart.c | 4 +++-
>>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/bsps/arm/stm32h7/start/bspstart.c
>>>> b/bsps/arm/stm32h7/start/bspstart.c
>>>> index 2fc8133cca..7ae39f1410 100644
>>>> --- a/bsps/arm/stm32h7/start/bspstart.c
>>>> +++ b/bsps/arm/stm32h7/start/bspstart.c
>>>> @@ -32,9 +32,11 @@
>>>>
>>>>  #include <stm32h7xx_hal.h>
>>>>
>>>> +/* Get number of milliseconds elapsed since startup */
>>>>  uint32_t HAL_GetTick(void)
>>>>  {
>>>> -  return 0;
>>>> +  uint64_t temp = rtems_clock_get_uptime_nanoseconds() / (1000 * 1000);
>>>> +  return temp;
>>>>  }
>>>>
>>>>  uint32_t stm32h7_systick_frequency(void)
>>>> --
>>>> 2.25.1
>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210420/0be51747/attachment.html>


More information about the devel mailing list