aboutsummaryrefslogtreecommitdiffstats
path: root/src/generic/armcm_boot.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-08-21 12:05:56 -0400
committerKevin O'Connor <kevin@koconnor.net>2019-08-22 09:58:58 -0400
commit2a2cf1f536f985330054cf47f47ec7d2455e35fa (patch)
treecf0e468e4de0751b4dd3bc391aa5f742ba6ae430 /src/generic/armcm_boot.h
parent351910c5ac8935341ffa31d644f5a6bbc54b02ed (diff)
downloadkutter-2a2cf1f536f985330054cf47f47ec7d2455e35fa.tar.gz
kutter-2a2cf1f536f985330054cf47f47ec7d2455e35fa.tar.xz
kutter-2a2cf1f536f985330054cf47f47ec7d2455e35fa.zip
armcm_boot: Add generic code for early board init on armcm machines
Add basic ARM Cortex-M C init code and build linker scripts to src/generic/ code. This can be used to simplify the various ARM board code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/generic/armcm_boot.h')
-rw-r--r--src/generic/armcm_boot.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/generic/armcm_boot.h b/src/generic/armcm_boot.h
new file mode 100644
index 00000000..10b17e18
--- /dev/null
+++ b/src/generic/armcm_boot.h
@@ -0,0 +1,20 @@
+#ifndef __GENERIC_ARMCM_BOOT_H
+#define __GENERIC_ARMCM_BOOT_H
+
+#include "ctr.h" // DECL_CTR_INT
+
+// Declare an IRQ handler
+#define DECL_ARMCM_IRQ(FUNC, NUM) \
+ DECL_CTR_INT("DECL_ARMCM_IRQ " __stringify(FUNC), (NUM))
+
+// Statically declare an IRQ handler and run-time enable it
+#define armcm_enable_irq(FUNC, NUM, PRIORITY) do { \
+ DECL_ARMCM_IRQ(FUNC, (NUM)); \
+ NVIC_SetPriority((NUM), (PRIORITY)); \
+ NVIC_EnableIRQ((NUM)); \
+ } while (0)
+
+// Vectors created by scripts/buildcommands.py from DECL_ARMCM_IRQ commands
+extern const void * const VectorTable[];
+
+#endif // armcm_boot.h