Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Common/Inc/assert.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef ASSERT_H
Copy link
Member

Choose a reason for hiding this comment

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

Use a different file name, assert is part of the standard library and we don't want to cause confusion between C standard assert.h and our own assert.

#define ASSERT_H

void zp_assert(bool expr);

#endif // ASSERT_H
10 changes: 10 additions & 0 deletions Common/Src/assert.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "assert.h"
#include <stdbool.h>

void zp_assert(bool expr) {
if (expr) {
#warning This should call the los hardfault handler, or something more appropriate
while (1) {
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Add a stack trace printout so that we know where the assert was called, as well as printing out the location of where the assert failed to aid debugging

}