summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/atsam/startup/bspstarthooks.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-01-14 16:03:51 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-01-19 08:36:21 +0100
commitf2e0f8e1a769231257f38a6bb6ab9ea9bbad452f (patch)
tree498136ee92c83d03789b5c378de0d0b7ed1e2cdc /c/src/lib/libbsp/arm/atsam/startup/bspstarthooks.c
parentbsp/atsam: Port SAM Software Package to RTEMS (diff)
downloadrtems-f2e0f8e1a769231257f38a6bb6ab9ea9bbad452f.tar.bz2
bsp/atsam: New
Close #2529.
Diffstat (limited to 'c/src/lib/libbsp/arm/atsam/startup/bspstarthooks.c')
-rw-r--r--c/src/lib/libbsp/arm/atsam/startup/bspstarthooks.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/arm/atsam/startup/bspstarthooks.c b/c/src/lib/libbsp/arm/atsam/startup/bspstarthooks.c
new file mode 100644
index 0000000000..718a2625e8
--- /dev/null
+++ b/c/src/lib/libbsp/arm/atsam/startup/bspstarthooks.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016 embedded brains GmbH Huber. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <bsp.h>
+#include <bsp/start.h>
+#include <bsp/pin-config.h>
+
+#include <chip.h>
+#include <include/board_lowlevel.h>
+#include <include/board_memories.h>
+
+void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
+{
+ system_init_flash(BOARD_MCK);
+ SystemInit();
+
+ PIO_Configure(&atsam_pin_config[0], atsam_pin_config_count);
+ MATRIX->CCFG_SYSIO = atsam_matrix_ccfg_sysio;
+
+ if (!PMC_IsPeriphEnabled(ID_SDRAMC)) {
+ BOARD_ConfigureSdram();
+ }
+
+ if ((SCB->CCR & SCB_CCR_IC_Msk) == 0) {
+ SCB_EnableICache();
+ }
+
+ if ((SCB->CCR & SCB_CCR_DC_Msk) == 0) {
+ SCB_EnableDCache();
+ }
+
+ _SetupMemoryRegion();
+}
+
+void BSP_START_TEXT_SECTION bsp_start_hook_1(void)
+{
+ bsp_start_copy_sections_compact();
+ SCB_CleanDCache();
+ SCB_InvalidateICache();
+ bsp_start_clear_bss();
+ WDT_Disable(WDT);
+}