Skip to content

fix: Add MPU wrapper for xTimerDelete API#1412

Open
rawalexe wants to merge 1 commit into
mainfrom
timerFree
Open

fix: Add MPU wrapper for xTimerDelete API#1412
rawalexe wants to merge 1 commit into
mainfrom
timerFree

Conversation

@rawalexe

@rawalexe rawalexe commented May 6, 2026

Copy link
Copy Markdown
Member

Description

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

Before the Fix:
before
After the FIx:
after

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sonarqubecloud

sonarqubecloud Bot commented May 6, 2026

Copy link
Copy Markdown

kstribrnAmzn
kstribrnAmzn previously approved these changes May 6, 2026
@kstribrnAmzn

Copy link
Copy Markdown
Member

The change looks sensible to me. Consider testing on a board like we've discussed before merging.

@rawalexe rawalexe force-pushed the timerFree branch 3 times, most recently from 57e6a06 to f2db0b3 Compare June 25, 2026 21:12
@rawalexe rawalexe changed the title Fix: Invalidate MPU object pool entry on timer delete in MPU wrappers v2 fix: Add MPU wrapper for xTimerDelete API Jun 25, 2026
Comment thread include/mpu_prototypes.h
TimerHandle_t xInternalTimerHandle = NULL;
int32_t lIndex;

lIndex = ( int32_t ) xTimer;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this okay? What if the xTimer value is 64 bit? How do we handle that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to have been done in a couple of spots (1, 2) so I'm thinking it must be okay

@kstribrnAmzn

Copy link
Copy Markdown
Member

Please investigate why the unit tests are failing

When using MPU wrappers v2, xTimerDelete needs to be a real function
rather than a macro so that the kernel object pool index can be freed
after the timer is successfully deleted. Without this, deleting a timer
leaks the kernel object pool entry.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
@rawalexe rawalexe force-pushed the timerFree branch 3 times, most recently from 62a857c to 77a465b Compare July 8, 2026 01:11
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants