Merged
Conversation
g0nz4I0
reviewed
Dec 2, 2025
g0nz4I0
reviewed
Dec 2, 2025
g0nz4I0
reviewed
Dec 2, 2025
g0nz4I0
reviewed
Dec 2, 2025
g0nz4I0
reviewed
Dec 2, 2025
g0nz4I0
reviewed
Dec 2, 2025
g0nz4I0
reviewed
Dec 2, 2025
g0nz4I0
reviewed
Dec 2, 2025
StefanCostea
requested changes
Dec 2, 2025
StefanCostea
requested changes
Dec 2, 2025
Compiler would've probably optimized it but it's better to make it explicit
g0nz4I0
reviewed
Dec 19, 2025
g0nz4I0
reviewed
Dec 19, 2025
g0nz4I0
reviewed
Dec 19, 2025
Comment on lines
+65
to
+66
| this->CNT += val; | ||
| simulate_ticks(this); |
Member
There was a problem hiding this comment.
You have removed the side effects fomr CNT and added them into this function, why have you chosen this approach?
Contributor
Author
There was a problem hiding this comment.
Because I wanted something separate that would only increment CNT when specified, when I used the previous approach, clearing CNT from the scheduler in schedule_next_interval() would cause simulate_ticks() to be called sometimes
g0nz4I0
reviewed
Dec 19, 2025
Comment on lines
+243
to
+248
|
|
||
| $<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/Time/Scheduler.cpp> | ||
| $<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/mocked_ll_tim.cpp> | ||
| $<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/mocked_system_stm32h7xx.c> | ||
| $<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/stm32h723xx_wrapper.c> | ||
| $<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/NVIC.cpp> |
Member
There was a problem hiding this comment.
this should be moved into a variable, MockedSources or something like that
We're already including them in stm32h723xx_wrapper
victor-Lopez25
added a commit
that referenced
this pull request
Dec 27, 2025
victor-Lopez25
added a commit
that referenced
this pull request
Dec 27, 2025
#534 (comment) Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com>
victor-Lopez25
added a commit
that referenced
this pull request
Dec 27, 2025
jorgesg82
added a commit
that referenced
this pull request
Jan 22, 2026
* feat: add DSB and ISB intructions in x86_64 * feat: add NVIC * add NVIC logic * feat: use NVIC and remove print * fix: move extern"C" block to allow using <iostream> * add Register class to allow for side effects * feat: use newly created Register class for side effects, neat trick in CNT write * feat: be as realistic as possible in test, by using CNT++ * feat: remove unnecessary include * feat: add an __RBIT impl for x86_64 * fix: compilation * fix: used_bitmap_ -> free_bitmap_ * Added tests check in CI/CD * fix(ci/cd): output folder * Added ARM specific instructions to be able to compile in ARM hosts (Mac) * Fix: compiler barrier for msvc, hopefully works * Fix: Try to fix -Wchanges-meaning warning * Fix typo * Update Inc/MockedDrivers/common.hpp #534 (comment) Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com> * Actually do the change github didn't do :/ * Fix typo p2 * Fix another typo * Fix unsigned long - 64bit when testing using LL functions * Minor fixes to scheduler Rebased from remotes/origin/MockTim * Fix: uint32_t* cast of a word instead of the ptr * Fix: remove active_task_count_ decrement in pop_front() #534 (comment) * Try fix Wstrict-aliasing in front_id * Try fix Wstrict-aliasing again * Fix typo in allocate_slot * fix: test UsedBitmap -> FreeBitmap * used_bitmap_ -> free_bitmap_ in test part 2 * fixed tests discovery * fix: set_timeout() test * Add a test, fix the error (kind of) * Fix: underflow in schedule_next_interval * Fix: call schedule_next_interval() in start() * Fix: invert condition, that was stupid * feat: add test showcasing possible usage within StateMachine logic * fix: Calculate correct prescaler & add to HALAL.hpp * Try to fix tests * try to fix tests part 2 * Try to fix tests part 3 * part 4 - add the wrapper.c to cmake, will this work? * part 5 - fix cmake stm32h723xx_wrapper.c path * fix: try to fix tests part 6 * fix: volatile warnings * fix: active_PSC is now set when PSC is set * fix: remove outdated comment * fix: tests part 7, should work now * fix: remove unecessary if, return if cancelled in cancel_timeout * Pop all due tasks, several might be due in the same tick * Revert force-push * fix: off by one error + configure_timer_for_interval should use uint32_t * fix: off by one error in schedule_next_interval() * All 15 tasks in MultipleTasks test, and it works * Add SameTaskMultipleTimes test, does all 16 tasks too * larger NUM_TICKS just in case * fix bug mentioned in previous cancel_timeout() * fix: id uint32_t -> uint16_t + bug fix * fix: remove TimerPeripheral::start and Time::start from HALAL::start * try to fix ci/cd * try to fix ci/cd part 2 * try to fix ci/cd part 3 * clean up ci/cd fix * Remove unnecessary warning ignore * fix: use wrapper instead of interface for stm32h7xx_ll_tim.h * fix ci/cd and add the other submodule to be automatically added * fix: actually add stm32h7xx_ll_tim_wrapper.h * try to fix ci/cd warning * try fix warnings again * fix: add ignore Woverflow to stm32h7xx_ll_tim * fix: remove need to ignore Woverflow warnings * fix: Remove tim_register_definitions.hpp We're already including them in stm32h723xx_wrapper * Initial TimerDomain commit, lots of work to do... * Change name to TimerDomain.hpp in comment * feat: Implement getting AnyGeneralPurpose timer with priorities * Make prettier * Remove leftovers * Remove outdated comment * fix: Finish the comment :) * Clean up error messages, add comment * temp: setup to try to compile template_project * Try to get TimerDomain to compile * Add initial implementation of scheduler * Try to fix -Wuninitialized warning * Try to remove Wuninitialized warning temporarily * Remove unnecessary clear of task element * fix: Readability and todo for validation * fix: allocate_slot * Add explenation of sorted_task_ids_, static_assert for the bitmaps * Remove long_wait_remaining_us_ * fix: better get_at * fix: better front_id Compiler would've probably optimized it but it's better to make it explicit * fix: endianness in pop_front * Added unlikely to release_slot conditional * fix: Correct comment explenation * No bit field insert, it annoyed me * No more diagnostic ignore * fix: loss in accuracy by not adding 1: #534 (comment) * fix: Moved active_task_count_ modification * Actually set used_bitmap_ in allocate_slot * fix: used_bitmap_ -> free_bitmap_ * only include sources when cross-compiling * modify CMakeLists inside Tests * feat: use ugly ifdef guards for host testing purposes * add sample tests for Scheduler * add emulated ticking * test for execution count * fix: CI * fix: expected result in test case + explanation * add compiler specific and CoreMacros * copy files from LL and CMSIS for TIM Registers * bridge between LL MMIO Timer and user defined TIMER * reduce the number of ugly macros * compile the new mock file * update test * enable debugging of tests with TestMate C++ extension * feat: add DSB and ISB intructions in x86_64 * feat: add NVIC * add NVIC logic * feat: use NVIC and remove print * fix: move extern"C" block to allow using <iostream> * add Register class to allow for side effects * feat: use newly created Register class for side effects, neat trick in CNT write * feat: be as realistic as possible in test, by using CNT++ * feat: remove unnecessary include * feat: add an __RBIT impl for x86_64 * fix: compilation * Added tests check in CI/CD * fix(ci/cd): output folder * Added ARM specific instructions to be able to compile in ARM hosts (Mac) * Fix: compiler barrier for msvc, hopefully works * Fix: Try to fix -Wchanges-meaning warning * Fix typo * Update Inc/MockedDrivers/common.hpp #534 (comment) Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com> * Actually do the change github didn't do :/ * Fix typo p2 * Fix another typo * Fix unsigned long - 64bit when testing using LL functions * Fix: uint32_t* cast of a word instead of the ptr * Minor fixes to scheduler Rebased from remotes/origin/MockTim * Fix: remove active_task_count_ decrement in pop_front() #534 (comment) * Try fix Wstrict-aliasing in front_id * Try fix Wstrict-aliasing again * Fix typo in allocate_slot * fix: test UsedBitmap -> FreeBitmap * used_bitmap_ -> free_bitmap_ in test part 2 * fixed tests discovery * fix: set_timeout() test * Add a test, fix the error (kind of) * Fix: underflow in schedule_next_interval * Fix: call schedule_next_interval() in start() * Fix: invert condition, that was stupid * feat: add test showcasing possible usage within StateMachine logic * fix: Calculate correct prescaler & add to HALAL.hpp * Try to fix tests * try to fix tests part 2 * Try to fix tests part 3 * part 4 - add the wrapper.c to cmake, will this work? * part 5 - fix cmake stm32h723xx_wrapper.c path * fix: try to fix tests part 6 * fix: volatile warnings * fix: active_PSC is now set when PSC is set * fix: remove outdated comment * fix: tests part 7, should work now * fix: remove unecessary if, return if cancelled in cancel_timeout * Pop all due tasks, several might be due in the same tick * Revert force-push * fix: off by one error + configure_timer_for_interval should use uint32_t * fix: off by one error in schedule_next_interval() * All 15 tasks in MultipleTasks test, and it works * Add SameTaskMultipleTimes test, does all 16 tasks too * larger NUM_TICKS just in case * fix bug mentioned in previous cancel_timeout() * fix: id uint32_t -> uint16_t + bug fix * fix: remove TimerPeripheral::start and Time::start from HALAL::start * try to fix ci/cd * try to fix ci/cd part 2 * try to fix ci/cd part 3 * clean up ci/cd fix * Remove unnecessary warning ignore * fix: use wrapper instead of interface for stm32h7xx_ll_tim.h * fix ci/cd and add the other submodule to be automatically added * fix: actually add stm32h7xx_ll_tim_wrapper.h * try to fix ci/cd warning * try fix warnings again * fix: add ignore Woverflow to stm32h7xx_ll_tim * fix: remove need to ignore Woverflow warnings * fix: Remove tim_register_definitions.hpp We're already including them in stm32h723xx_wrapper * Initial TimerDomain commit, lots of work to do... * Change name to TimerDomain.hpp in comment * feat: Implement getting AnyGeneralPurpose timer with priorities * Make prettier * Remove leftovers * Remove outdated comment * fix: Finish the comment :) * Clean up error messages, add comment * temp: setup to try to compile template_project * Try to get TimerDomain to compile * Fix all compilation errors (yipee) * Try to fix compile errors when in template_project * Try to fix compile errors... Goodbye ErrorInRequestN I thought it could be used T-T * try fix again * slowly but surely * Fix TimerWrapper constructor * Add timer interrupt callbacks, use XList for TIM_HandleTypeDef definitions * try to choose 16 bit or 32 bit at compile time * Fix compilation issues * Fix overflow calculation and a test * Fix all remaining issues * Change TimerRequest values * Remove temporary function * fix: Remove static assert * fix: Change order of parameters * fix: timer 15 (hopefully?) * fix: Rollback removal of tim15 when getting AnyGeneralPurpose timer * fix: pins are now part of TimerWrapper, not TimerDomain * fix: Split TimerWrapper into a different file: TimerWrapper.hpp * fix: Use new way to add Domain to board * feat: Initial implementation of new PWM class * fix: Make PWM class more private * feat: Use an initializer_list to get the pins without needing a size * fix: Remove prescaler and period from TimerDomain * feat: Add Any32bitTimer to TimerDomain * fix: Rename Any32bitTimer to Any32bit * Fix docker build hopefully * feat: add a macro: get_timer_instance * fix: compile error * fix: revert change to .vscode settings * fix: tim3 is 16 bit, tim5 is 32 bit + start of pin af checking * More timer pin afs * More pins, todo: tim23 and tim24 * tim23, tim24 pins done, now programming time * next step: compile time check_pins * feat: Finish implementing check_pins * Add tests for TimerWrapper, not running them yet * Almost implement all wrappers for TimerDomain tests * Add TimerDomain.cpp to simulator * Further fix compile errors * Fix tests compilation! * NVIC ICER now clears the bit in NVIC ISER --------- Co-authored-by: Gonzalo Sánchez <gonzalosmoya24@gmail.com> Co-authored-by: Jorge Sáez <jorgeesg82@gmail.com> Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com> Co-authored-by: StefanCostea <stefanxenadu@gmail.com>
oganigl
pushed a commit
that referenced
this pull request
Jan 30, 2026
* Update Inc/MockedDrivers/common.hpp #534 (comment) Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com> * Actually do the change github didn't do :/ * Fix typo p2 * Fix another typo * Fix unsigned long - 64bit when testing using LL functions * Minor fixes to scheduler Rebased from remotes/origin/MockTim * Fix: uint32_t* cast of a word instead of the ptr * Fix: remove active_task_count_ decrement in pop_front() #534 (comment) * Try fix Wstrict-aliasing in front_id * Try fix Wstrict-aliasing again * Fix typo in allocate_slot * fix: test UsedBitmap -> FreeBitmap * used_bitmap_ -> free_bitmap_ in test part 2 * fixed tests discovery * fix: set_timeout() test * Add a test, fix the error (kind of) * Fix: underflow in schedule_next_interval * Fix: call schedule_next_interval() in start() * Fix: invert condition, that was stupid * feat: add test showcasing possible usage within StateMachine logic * fix: Calculate correct prescaler & add to HALAL.hpp * Try to fix tests * try to fix tests part 2 * Try to fix tests part 3 * part 4 - add the wrapper.c to cmake, will this work? * part 5 - fix cmake stm32h723xx_wrapper.c path * fix: try to fix tests part 6 * fix: volatile warnings * fix: active_PSC is now set when PSC is set * fix: remove outdated comment * fix: tests part 7, should work now * fix: remove unecessary if, return if cancelled in cancel_timeout * Pop all due tasks, several might be due in the same tick * Revert force-push * fix: off by one error + configure_timer_for_interval should use uint32_t * fix: off by one error in schedule_next_interval() * All 15 tasks in MultipleTasks test, and it works * Add SameTaskMultipleTimes test, does all 16 tasks too * larger NUM_TICKS just in case * fix bug mentioned in previous cancel_timeout() * fix: id uint32_t -> uint16_t + bug fix * fix: remove TimerPeripheral::start and Time::start from HALAL::start * try to fix ci/cd * try to fix ci/cd part 2 * try to fix ci/cd part 3 * clean up ci/cd fix * Remove unnecessary warning ignore * fix: use wrapper instead of interface for stm32h7xx_ll_tim.h * fix ci/cd and add the other submodule to be automatically added * fix: actually add stm32h7xx_ll_tim_wrapper.h * try to fix ci/cd warning * try fix warnings again * fix: add ignore Woverflow to stm32h7xx_ll_tim * fix: remove need to ignore Woverflow warnings * fix: Remove tim_register_definitions.hpp We're already including them in stm32h723xx_wrapper * Initial TimerDomain commit, lots of work to do... * Change name to TimerDomain.hpp in comment * feat: Implement getting AnyGeneralPurpose timer with priorities * Make prettier * Remove leftovers * Remove outdated comment * fix: Finish the comment :) * Clean up error messages, add comment * temp: setup to try to compile template_project * Try to get TimerDomain to compile * Add initial implementation of scheduler * Try to fix -Wuninitialized warning * Try to remove Wuninitialized warning temporarily * Remove unnecessary clear of task element * fix: Readability and todo for validation * fix: allocate_slot * Add explenation of sorted_task_ids_, static_assert for the bitmaps * Remove long_wait_remaining_us_ * fix: better get_at * fix: better front_id Compiler would've probably optimized it but it's better to make it explicit * fix: endianness in pop_front * Added unlikely to release_slot conditional * fix: Correct comment explenation * No bit field insert, it annoyed me * No more diagnostic ignore * fix: loss in accuracy by not adding 1: #534 (comment) * fix: Moved active_task_count_ modification * Actually set used_bitmap_ in allocate_slot * fix: used_bitmap_ -> free_bitmap_ * only include sources when cross-compiling * modify CMakeLists inside Tests * feat: use ugly ifdef guards for host testing purposes * add sample tests for Scheduler * add emulated ticking * test for execution count * fix: CI * fix: expected result in test case + explanation * add compiler specific and CoreMacros * copy files from LL and CMSIS for TIM Registers * bridge between LL MMIO Timer and user defined TIMER * reduce the number of ugly macros * compile the new mock file * update test * enable debugging of tests with TestMate C++ extension * feat: add DSB and ISB intructions in x86_64 * feat: add NVIC * add NVIC logic * feat: use NVIC and remove print * fix: move extern"C" block to allow using <iostream> * add Register class to allow for side effects * feat: use newly created Register class for side effects, neat trick in CNT write * feat: be as realistic as possible in test, by using CNT++ * feat: remove unnecessary include * feat: add an __RBIT impl for x86_64 * fix: compilation * Added tests check in CI/CD * fix(ci/cd): output folder * Added ARM specific instructions to be able to compile in ARM hosts (Mac) * Fix: compiler barrier for msvc, hopefully works * Fix: Try to fix -Wchanges-meaning warning * Fix typo * Update Inc/MockedDrivers/common.hpp #534 (comment) Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com> * Actually do the change github didn't do :/ * Fix typo p2 * Fix another typo * Fix unsigned long - 64bit when testing using LL functions * Fix: uint32_t* cast of a word instead of the ptr * Minor fixes to scheduler Rebased from remotes/origin/MockTim * Fix: remove active_task_count_ decrement in pop_front() #534 (comment) * Try fix Wstrict-aliasing in front_id * Try fix Wstrict-aliasing again * Fix typo in allocate_slot * fix: test UsedBitmap -> FreeBitmap * used_bitmap_ -> free_bitmap_ in test part 2 * fixed tests discovery * fix: set_timeout() test * Add a test, fix the error (kind of) * Fix: underflow in schedule_next_interval * Fix: call schedule_next_interval() in start() * Fix: invert condition, that was stupid * feat: add test showcasing possible usage within StateMachine logic * fix: Calculate correct prescaler & add to HALAL.hpp * Try to fix tests * try to fix tests part 2 * Try to fix tests part 3 * part 4 - add the wrapper.c to cmake, will this work? * part 5 - fix cmake stm32h723xx_wrapper.c path * fix: try to fix tests part 6 * fix: volatile warnings * fix: active_PSC is now set when PSC is set * fix: remove outdated comment * fix: tests part 7, should work now * fix: remove unecessary if, return if cancelled in cancel_timeout * Pop all due tasks, several might be due in the same tick * Revert force-push * fix: off by one error + configure_timer_for_interval should use uint32_t * fix: off by one error in schedule_next_interval() * All 15 tasks in MultipleTasks test, and it works * Add SameTaskMultipleTimes test, does all 16 tasks too * larger NUM_TICKS just in case * fix bug mentioned in previous cancel_timeout() * fix: id uint32_t -> uint16_t + bug fix * fix: remove TimerPeripheral::start and Time::start from HALAL::start * try to fix ci/cd * try to fix ci/cd part 2 * try to fix ci/cd part 3 * clean up ci/cd fix * Remove unnecessary warning ignore * fix: use wrapper instead of interface for stm32h7xx_ll_tim.h * fix ci/cd and add the other submodule to be automatically added * fix: actually add stm32h7xx_ll_tim_wrapper.h * try to fix ci/cd warning * try fix warnings again * fix: add ignore Woverflow to stm32h7xx_ll_tim * fix: remove need to ignore Woverflow warnings * fix: Remove tim_register_definitions.hpp We're already including them in stm32h723xx_wrapper * Initial TimerDomain commit, lots of work to do... * Change name to TimerDomain.hpp in comment * feat: Implement getting AnyGeneralPurpose timer with priorities * Make prettier * Remove leftovers * Remove outdated comment * fix: Finish the comment :) * Clean up error messages, add comment * temp: setup to try to compile template_project * Try to get TimerDomain to compile * Fix all compilation errors (yipee) * Try to fix compile errors when in template_project * Try to fix compile errors... Goodbye ErrorInRequestN I thought it could be used T-T * try fix again * slowly but surely * Fix TimerWrapper constructor * Add timer interrupt callbacks, use XList for TIM_HandleTypeDef definitions * try to choose 16 bit or 32 bit at compile time * Fix compilation issues * Fix overflow calculation and a test * Fix all remaining issues * Change TimerRequest values * Remove temporary function * fix: Remove static assert * fix: Change order of parameters * fix: timer 15 (hopefully?) * fix: Rollback removal of tim15 when getting AnyGeneralPurpose timer * fix: pins are now part of TimerWrapper, not TimerDomain * fix: Split TimerWrapper into a different file: TimerWrapper.hpp * fix: Use new way to add Domain to board * feat: Initial implementation of new PWM class * fix: Make PWM class more private * feat: Use an initializer_list to get the pins without needing a size * fix: Remove prescaler and period from TimerDomain * feat: Add Any32bitTimer to TimerDomain * fix: Rename Any32bitTimer to Any32bit * Fix docker build hopefully * feat: add a macro: get_timer_instance * fix: compile error * fix: revert change to .vscode settings * fix: tim3 is 16 bit, tim5 is 32 bit + start of pin af checking * More timer pin afs * More pins, todo: tim23 and tim24 * tim23, tim24 pins done, now programming time * next step: compile time check_pins * feat: Finish implementing check_pins * Add tests for TimerWrapper, not running them yet * Almost implement all wrappers for TimerDomain tests * Add TimerDomain.cpp to simulator * Further fix compile errors * Fix tests compilation! * NVIC ICER now clears the bit in NVIC ISER * fix: TimerDomain pins * hotfix! pwm compilation * Huge cleanup of TimerDomain, TimerWrapper + NewPWM now starts up the timer channel should work now? Also removed Wpedantic because I hate it * Keep TimerPeripheral behaviour - default psc = 5 * fix test * get_CCR_offset -> set_capture_compare * fix gpio operation mode * Fix frequency, it was a typo T-T * fix frequency completely, off by one errors and all * cleanup get_pwm() * fix get_pwm * remove these todos * add set_frequency, remove CLOCK_FREQ_MHZ_WITHOUT_PRESCALER * set_frequency [uint64_t -> float], remove psc default 5 * Added newlines to GetPinFromIdx to make it more readable * PWM gpio speed is now low * Add compile time check for one pin per channel per timer * remove outdated comment --------- Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com> Co-authored-by: StefanCostea <stefanxenadu@gmail.com> Co-authored-by: Jorge Sáez <jorgeesg82@gmail.com> Co-authored-by: Gonzalo Sánchez <gonzalosmoya24@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
example main.cpp: