aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRJ Ryan <rryan@mit.edu>2011-09-14 00:55:22 -0400
committerRJ Ryan <rryan@mit.edu>2011-09-16 21:31:34 -0400
commit04f4b667595194a4acd29871226dc22463714686 (patch)
treeec81c4468ec0b0bf718eb8c5b3149efe30bdf41c
parenta9f14657020161fe8798e23489ce7b9489bbe815 (diff)
downloadlibrambutan-04f4b667595194a4acd29871226dc22463714686.tar.gz
librambutan-04f4b667595194a4acd29871226dc22463714686.zip
Add an __assert_func assertion handler so that libc does not use its
default implementation. This allows the use of assert() from libc's assert.h. Signed-off-by: RJ Ryan <rryan@mit.edu>
-rw-r--r--libmaple/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libmaple/util.c b/libmaple/util.c
index eead625..1a7c36d 100644
--- a/libmaple/util.c
+++ b/libmaple/util.c
@@ -109,6 +109,15 @@ void _fail(const char* file, int line, const char* exp) {
}
/**
+ * @brief Provide an __assert_func handler to libc so that calls to assert() get
+ * redirected to _fail.
+ */
+void __assert_func(const char* file, int line, const char* method,
+ const char* expression) {
+ _fail(file, line, expression);
+}
+
+/**
* @brief Fades the error LED on and off
* @sideeffect Sets output push-pull on ERROR_LED_PIN.
*/