[PATCH qemu v3 00/20] Fix malfunctioning of T2-T5 timers on the STM32 platform

~lbryndza posted 20 patches 12 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/170152443229.18048.53824064267512246-0@git.sr.ht
Maintainers: Alistair Francis <alistair@alistair23.me>, Peter Maydell <peter.maydell@linaro.org>
hw/arm/stm32f405_soc.c             |   2 +-
hw/timer/stm32f2xx_timer.c         | 262 +++++++++++++++++++----------
include/hw/timer/stm32f2xx_timer.h |  23 ++-
3 files changed, 189 insertions(+), 98 deletions(-)
[PATCH qemu v3 00/20] Fix malfunctioning of T2-T5 timers on the STM32 platform
Posted by ~lbryndza 12 months ago
Current implementation of T2 - T5 times on the STM32 platform does not
work properly.
After configuring the timer-counter circuit to report interrupts every
10ms, in reality the first interrupt is reported
only once after a few seconds, while subsequent interrupts do not come.
The current code also does not properly emulate the operation of even
the basic functions of the TIME-BASE unit.
This patch contains fixes that reimplements the basic functionality
of the time base unit such as up-counting down-counting , and alternate-
mode up-down counting.
The ptimer() API is used to emulate timers.
After applying the patch, STM32 timer works correctly in its basic
functionality.
The ISIX-RTOS test unit was used to test the patch.
Links and instructions can be found below:

https://github.com/lucckb/isixrtos/blob/master/tests/libisix/01_basic_primitives.cpp
https://github.com/lucckb/isixrtos/blob/master/extras/doc/unit_test_qemu.md


qemu-system-arm -M olimex-stm32-h405  -kernel
build/tests/libisix/isixunittests.binary -nographic
unittests_entry.cpp:146|ISIX VERSION pub/ep0319-157-gb239b35f-dirty
unittests_entry.cpp:83|Exceptions pretest. OK
51 selected tests
[   RUN    ] 01_base_00 TimeBase timer vs systick
[  1001ms  ] ...
[   RUN    ] 01_base_01 Basic heap allocator
[   1ms    ] ...

Lucjan Bryndza (20):
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers
  Fixing the basic functionality of STM32 timers

 hw/arm/stm32f405_soc.c             |   2 +-
 hw/timer/stm32f2xx_timer.c         | 262 +++++++++++++++++++----------
 include/hw/timer/stm32f2xx_timer.h |  23 ++-
 3 files changed, 189 insertions(+), 98 deletions(-)

-- 
2.38.5
Re: [PATCH qemu v3 00/20] Fix malfunctioning of T2-T5 timers on the STM32 platform
Posted by Alistair Francis 11 months, 3 weeks ago
On Sat, Dec 2, 2023 at 11:40 PM ~lbryndza <lbryndza@git.sr.ht> wrote:
>
> Current implementation of T2 - T5 times on the STM32 platform does not
> work properly.
> After configuring the timer-counter circuit to report interrupts every
> 10ms, in reality the first interrupt is reported
> only once after a few seconds, while subsequent interrupts do not come.
> The current code also does not properly emulate the operation of even
> the basic functions of the TIME-BASE unit.
> This patch contains fixes that reimplements the basic functionality
> of the time base unit such as up-counting down-counting , and alternate-
> mode up-down counting.
> The ptimer() API is used to emulate timers.
> After applying the patch, STM32 timer works correctly in its basic
> functionality.
> The ISIX-RTOS test unit was used to test the patch.
> Links and instructions can be found below:
>
> https://github.com/lucckb/isixrtos/blob/master/tests/libisix/01_basic_primitives.cpp
> https://github.com/lucckb/isixrtos/blob/master/extras/doc/unit_test_qemu.md
>
>
> qemu-system-arm -M olimex-stm32-h405  -kernel
> build/tests/libisix/isixunittests.binary -nographic
> unittests_entry.cpp:146|ISIX VERSION pub/ep0319-157-gb239b35f-dirty
> unittests_entry.cpp:83|Exceptions pretest. OK
> 51 selected tests
> [   RUN    ] 01_base_00 TimeBase timer vs systick
> [  1001ms  ] ...
> [   RUN    ] 01_base_01 Basic heap allocator
> [   1ms    ] ...

Great! This is a good step in the right direction.

Each patch needs to have a different title though. The idea is that
each patch describes what that patch is doing. So each commit will
have a title and commit message describing that patch. The cover
letter (this email) will then describe the overarching goal.

Alistair

>
> Lucjan Bryndza (20):
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>   Fixing the basic functionality of STM32 timers
>
>  hw/arm/stm32f405_soc.c             |   2 +-
>  hw/timer/stm32f2xx_timer.c         | 262 +++++++++++++++++++----------
>  include/hw/timer/stm32f2xx_timer.h |  23 ++-
>  3 files changed, 189 insertions(+), 98 deletions(-)
>
> --
> 2.38.5