summary refs log tree commit diff stats
path: root/tests/tcg/tricore/c/testdev_assert.h
diff options
context:
space:
mode:
authorBastian Koppelmann <kbastian@mail.uni-paderborn.de>2023-05-26 08:19:43 +0200
committerBastian Koppelmann <kbastian@mail.uni-paderborn.de>2023-06-07 18:20:42 +0200
commit0e45f7beca959ca085fef3439fa39d2588bc6f52 (patch)
tree300c4c4deb964cb8175590dd7946fdd8733a79a3 /tests/tcg/tricore/c/testdev_assert.h
parent2b8e2992c3c9aa6bee3dd23e2137a0923f7dc0aa (diff)
downloadfocaccia-qemu-0e45f7beca959ca085fef3439fa39d2588bc6f52.tar.gz
focaccia-qemu-0e45f7beca959ca085fef3439fa39d2588bc6f52.zip
tests/tcg/tricore: Add first C program
this allows us to exercise the startup code used by GCC to call main().

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <20230526061946.54514-4-kbastian@mail.uni-paderborn.de>
Diffstat (limited to 'tests/tcg/tricore/c/testdev_assert.h')
-rw-r--r--tests/tcg/tricore/c/testdev_assert.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/tcg/tricore/c/testdev_assert.h b/tests/tcg/tricore/c/testdev_assert.h
new file mode 100644
index 0000000000..ccd14f5025
--- /dev/null
+++ b/tests/tcg/tricore/c/testdev_assert.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2023 Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
+ *
+ * This code is licensed under the GPL version 2 or later. See the
+ * COPYING file in the top-level directory.
+ */
+
+int *testdev = (int *)0xf0000000;
+
+#define FAIL 1
+static inline void testdev_assert(int condition)
+{
+    if (!condition) {
+        *testdev = FAIL;
+        asm("debug");
+    }
+}
+