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>
This commit is contained in:
Kevin O'Connor
2019-08-21 12:05:56 -04:00
parent 351910c5ac
commit 2a2cf1f536
5 changed files with 202 additions and 0 deletions

20
src/generic/armcm_boot.h Normal file
View File

@@ -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