2014-07-30 14:59:14 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Freie Universität Berlin
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License v2.1. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2018-06-01 12:25:00 +02:00
|
|
|
* @ingroup cpu_nrf51
|
2014-07-30 14:59:14 +02:00
|
|
|
* @{
|
|
|
|
*
|
2015-05-22 07:34:41 +02:00
|
|
|
* @file
|
2014-07-30 14:59:14 +02:00
|
|
|
* @brief Implementation of the CPU initialization
|
|
|
|
*
|
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cpu.h"
|
2023-01-02 18:08:35 +01:00
|
|
|
#include "kernel_init.h"
|
2017-04-03 15:26:10 +02:00
|
|
|
#include "nrf_clock.h"
|
2022-04-28 12:17:02 +02:00
|
|
|
#include "nrfx_riot.h"
|
2014-11-12 13:17:13 +01:00
|
|
|
#include "periph_conf.h"
|
2017-01-20 11:18:38 +01:00
|
|
|
#include "periph/init.h"
|
2019-04-10 11:07:05 +02:00
|
|
|
#include "stdio_base.h"
|
2014-07-30 14:59:14 +02:00
|
|
|
|
2023-07-06 15:47:22 +02:00
|
|
|
/**
|
|
|
|
* @brief LFCLK Clock selection configuration guard
|
|
|
|
*/
|
|
|
|
#if ((CLOCK_LFCLK != CLOCK_LFCLKSRC_SRC_RC) && \
|
|
|
|
(CLOCK_LFCLK != CLOCK_LFCLKSRC_SRC_Xtal) && \
|
|
|
|
(CLOCK_LFCLK != CLOCK_LFCLKSRC_SRC_Synth))
|
|
|
|
#error "LFCLK init: CLOCK_LFCLK has invalid value"
|
|
|
|
#endif
|
|
|
|
|
2014-07-30 14:59:14 +02:00
|
|
|
/**
|
|
|
|
* @brief Initialize the CPU, set IRQ priorities
|
|
|
|
*/
|
|
|
|
void cpu_init(void)
|
|
|
|
{
|
2015-05-27 23:06:34 +02:00
|
|
|
/* initialize the Cortex-M core */
|
|
|
|
cortexm_init();
|
2020-03-07 17:04:06 +01:00
|
|
|
/* Enable the DC/DC power converter */
|
|
|
|
nrfx_dcdc_init();
|
2017-04-03 15:26:10 +02:00
|
|
|
/* setup the HF clock */
|
|
|
|
clock_init_hf();
|
2019-04-10 11:07:05 +02:00
|
|
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
2023-01-02 18:08:35 +01:00
|
|
|
early_init();
|
2017-01-20 11:18:38 +01:00
|
|
|
/* trigger static peripheral initialization */
|
|
|
|
periph_init();
|
2014-07-30 14:59:14 +02:00
|
|
|
}
|