Skip to content

boot: bootutil: Change assert() calls to ASSERT() - #2789

Open
nordicjm wants to merge 1 commit into
mcu-tools:mainfrom
nordicjm:asserts
Open

boot: bootutil: Change assert() calls to ASSERT()#2789
nordicjm wants to merge 1 commit into
mcu-tools:mainfrom
nordicjm:asserts

Conversation

@nordicjm

Copy link
Copy Markdown
Collaborator

MCUboot has an assert handler macro which is used from the simulator, align usage of assert calls to match it

MCUboot has an assert handler macro which is used from the
simulator, align usage of assert calls to match it

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
@nordicjm
nordicjm requested a review from davidvincze as a code owner July 14, 2026 13:31
@nordicjm
nordicjm requested a review from d3zd3z July 14, 2026 14:18

@d3zd3z d3zd3z left a comment

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.

One problem with assert is that it can be compiled out. For security, that can really never be the case. Does ASSERT have this property? Otherwise, looks good.

@nordicjm

Copy link
Copy Markdown
Collaborator Author

One problem with assert is that it can be compiled out. For security, that can really never be the case. Does ASSERT have this property? Otherwise, looks good.

It's a macro you defined :) so there is this for all targets:

which does also allow using a custom assert, and the simulator uses this:
void sim_assert(int, const char *test, const char *, unsigned int, const char *);
which is important for the simulator as it needs to be able to catch asserts for some tests rather than the rust executable dying at that point due to the assert() call, so for simulator this fixes this, for all other platforms there is no difference at all (unless they want a custom assert handler, in which case this would fix that also)

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.

2 participants