From d00a7d1c22fd6e9965ef22c77aaf3be1b418e694 Mon Sep 17 00:00:00 2001 From: Christian Mauderer Date: Fri, 17 Nov 2017 09:21:59 +0100 Subject: bsp/atsam: Move clock and SDRAM init to SRAM. If necessary, the BSP can now have it's clock and SDRAM initialization in the SRAM instead of the SDRAM. This allows to change the clock frequency during the startup of an SDRAM application. --- c/src/lib/libbsp/arm/atsam/include/atsam-clock-config.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'c/src/lib/libbsp/arm/atsam/include/atsam-clock-config.h') diff --git a/c/src/lib/libbsp/arm/atsam/include/atsam-clock-config.h b/c/src/lib/libbsp/arm/atsam/include/atsam-clock-config.h index acf0d0be75..396986894b 100644 --- a/c/src/lib/libbsp/arm/atsam/include/atsam-clock-config.h +++ b/c/src/lib/libbsp/arm/atsam/include/atsam-clock-config.h @@ -23,6 +23,14 @@ extern "C" { #endif /* __cplusplus */ +#if ATSAM_CHANGE_CLOCK_FROM_SRAM != 0 +/* Note: fast_text is the simplest section to put this code into. Other + * possibilities would include creating a new section. */ +#define ATSAM_START_SRAM_SECTION BSP_FAST_TEXT_SECTION +#else +#define ATSAM_START_SRAM_SECTION +#endif + struct atsam_clock_config { /* Initialization value for the PMC_PLLAR. */ uint32_t pllar_init; @@ -32,6 +40,7 @@ struct atsam_clock_config { uint32_t mck_freq; }; +ATSAM_START_SRAM_SECTION extern const struct atsam_clock_config atsam_clock_config; #define BOARD_MCK (atsam_clock_config.mck_freq) @@ -43,6 +52,7 @@ struct BOARD_Sdram_Config { uint32_t sdramc_cfr1; }; +ATSAM_START_SRAM_SECTION extern const struct BOARD_Sdram_Config BOARD_Sdram_Config; #ifdef __cplusplus -- cgit v1.2.3