summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2024-09-11 16:23:30 +0800
committerSadeep Madurange <sadeep@asciimx.com>2024-09-11 16:23:30 +0800
commit45fec7ac2438081bc52889a4af7d95d0aafbd7ee (patch)
tree50961ebd10d007c00c305754f4d8a92883bfe19e /main.c
parente54cdd000a9cb3ec66e5188c43cc94b73a477ba6 (diff)
downloadbare-metal-arduino-due-45fec7ac2438081bc52889a4af7d95d0aafbd7ee.tar.gz
LED works!
Diffstat (limited to 'main.c')
-rw-r--r--main.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/main.c b/main.c
index 8fcc9be..89c1e15 100644
--- a/main.c
+++ b/main.c
@@ -25,9 +25,9 @@
int main(void)
{
// enable peripheral clock
- PMC_WPMR = PMC_WPKEY << 8;
- PMC_PCER0 |= (1u << PMC_PID);
- PMC_WPMR = (PMC_WPKEY << 8) | 1u;
+ //PMC_WPMR = PMC_WPKEY << 8;
+ //PMC_PCER0 |= (1u << PMC_PID);
+ //PMC_WPMR = (PMC_WPKEY << 8) | 1u;
// enable port, set to output, disable pull-up
PIO_WPMR = PIO_WPKEY << 8;
@@ -44,3 +44,14 @@ int main(void)
return 0;
}
+
+extern const unsigned int StackTop;
+
+__attribute__ ((section(".vtor")))
+const void* VectorTable[] = {
+ &StackTop, /* CPU will automatically *
+ * set stack its pointer *
+ * to this value */
+
+ main, /* -15: Reset_IRQn */
+};