cpu: Moved stdio_init() into cpu_init()
- Removed stdio_init() from newlib's _init(), as this is too late in the boot process to allow DEBUG()ing during periph_init() - Added stdio_init() to the various cpu_init() routines of the ARM CPUs just before periph_init()
This commit is contained in:
parent
999fffdc59
commit
df27dbef7a
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
#define BIT(n) ( 1UL << (n) )
|
#define BIT(n) ( 1UL << (n) )
|
||||||
|
|
||||||
@ -48,6 +49,8 @@ void cpu_init(void)
|
|||||||
SYS_CTRL->I_MAP = 1;
|
SYS_CTRL->I_MAP = 1;
|
||||||
/* initialize the clock system */
|
/* initialize the clock system */
|
||||||
cpu_clock_init();
|
cpu_clock_init();
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
#ifndef HF_CLOCK_SOURCE
|
#ifndef HF_CLOCK_SOURCE
|
||||||
#define HF_CLOCK_SOURCE DDI_0_OSC_CTL0_SCLK_HF_SRC_SEL_RCOSC /* set 48MHz RCOSC */
|
#define HF_CLOCK_SOURCE DDI_0_OSC_CTL0_SCLK_HF_SRC_SEL_RCOSC /* set 48MHz RCOSC */
|
||||||
@ -44,6 +45,9 @@ void cpu_init(void)
|
|||||||
/* initialize the system clock */
|
/* initialize the system clock */
|
||||||
cpu_clock_init();
|
cpu_clock_init();
|
||||||
|
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
|
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
#include "em_chip.h"
|
#include "em_chip.h"
|
||||||
#include "em_cmu.h"
|
#include "em_cmu.h"
|
||||||
@ -172,6 +173,9 @@ void cpu_init(void)
|
|||||||
/* initialize power management interface */
|
/* initialize power management interface */
|
||||||
pm_init();
|
pm_init();
|
||||||
|
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
|
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configure clock sources and the CPU frequency
|
* @brief Configure clock sources and the CPU frequency
|
||||||
@ -60,6 +61,8 @@ void cpu_init(void)
|
|||||||
cortexm_init();
|
cortexm_init();
|
||||||
/* Initialise clock sources and generic clocks */
|
/* Initialise clock sources and generic clocks */
|
||||||
clk_init();
|
clk_init();
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
#ifdef MODULE_PERIPH_MCG
|
#ifdef MODULE_PERIPH_MCG
|
||||||
#include "mcg.h"
|
#include "mcg.h"
|
||||||
#endif
|
#endif
|
||||||
@ -41,6 +42,10 @@ void cpu_init(void)
|
|||||||
/* initialize the CPU clocking provided by the MCG module */
|
/* initialize the CPU clocking provided by the MCG module */
|
||||||
kinetis_mcg_init();
|
kinetis_mcg_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
|
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the CPU, set IRQ priorities
|
* @brief Initialize the CPU, set IRQ priorities
|
||||||
@ -36,6 +37,9 @@ void cpu_init(void)
|
|||||||
/* initialize the clock system */
|
/* initialize the clock system */
|
||||||
cpu_clock_init(CLOCK_SOURCE);
|
cpu_clock_init(CLOCK_SOURCE);
|
||||||
|
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
|
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the CPU, set IRQ priorities
|
* @brief Initialize the CPU, set IRQ priorities
|
||||||
@ -27,6 +28,8 @@ void cpu_init(void)
|
|||||||
{
|
{
|
||||||
/* initialize the Cortex-M core */
|
/* initialize the Cortex-M core */
|
||||||
cortexm_init();
|
cortexm_init();
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#include "nrf_clock.h"
|
#include "nrf_clock.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the CPU, set IRQ priorities
|
* @brief Initialize the CPU, set IRQ priorities
|
||||||
@ -31,6 +32,8 @@ void cpu_init(void)
|
|||||||
cortexm_init();
|
cortexm_init();
|
||||||
/* setup the HF clock */
|
/* setup the HF clock */
|
||||||
clock_init_hf();
|
clock_init_hf();
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include "nrf_clock.h"
|
#include "nrf_clock.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
/* FTPAN helper functions */
|
/* FTPAN helper functions */
|
||||||
static bool ftpan_32(void);
|
static bool ftpan_32(void);
|
||||||
@ -83,6 +84,9 @@ void cpu_init(void)
|
|||||||
/* enable wake up on events for __WFE CPU sleep */
|
/* enable wake up on events for __WFE CPU sleep */
|
||||||
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
|
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
|
||||||
|
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
|
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Keys needed for editing certain PMC registers
|
* @brief Keys needed for editing certain PMC registers
|
||||||
@ -90,6 +91,9 @@ void cpu_init(void)
|
|||||||
/* wait for master clock to be ready */
|
/* wait for master clock to be ready */
|
||||||
while (!(PMC->PMC_SR & PMC_SR_MCKRDY));
|
while (!(PMC->PMC_SR & PMC_SR_MCKRDY));
|
||||||
|
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
|
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
#ifndef CLOCK_8MHZ
|
#ifndef CLOCK_8MHZ
|
||||||
#define CLOCK_8MHZ 1
|
#define CLOCK_8MHZ 1
|
||||||
@ -218,6 +219,8 @@ void cpu_init(void)
|
|||||||
cortexm_init();
|
cortexm_init();
|
||||||
/* Initialise clock sources and generic clocks */
|
/* Initialise clock sources and generic clocks */
|
||||||
clk_init();
|
clk_init();
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
static void xosc32k_init(void)
|
static void xosc32k_init(void)
|
||||||
{
|
{
|
||||||
@ -137,6 +138,9 @@ void cpu_init(void)
|
|||||||
gclk_connect(6, GCLK_SOURCE_DFLL, 0);
|
gclk_connect(6, GCLK_SOURCE_DFLL, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
|
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
#ifdef CPU_FAM_SAML11
|
#ifdef CPU_FAM_SAML11
|
||||||
#define _NVMCTRL NVMCTRL_SEC
|
#define _NVMCTRL NVMCTRL_SEC
|
||||||
@ -115,6 +116,9 @@ void cpu_init(void)
|
|||||||
/* Setup GCLK generators */
|
/* Setup GCLK generators */
|
||||||
_gclk_setup(0, GCLK_GENCTRL_GENEN | GCLK_GENCTRL_SRC_OSC16M);
|
_gclk_setup(0, GCLK_GENCTRL_GENEN | GCLK_GENCTRL_SRC_OSC16M);
|
||||||
|
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
|
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
|
|
||||||
static void _gclk_setup(int gclk, uint32_t reg)
|
static void _gclk_setup(int gclk, uint32_t reg)
|
||||||
{
|
{
|
||||||
@ -118,6 +119,9 @@ void cpu_init(void)
|
|||||||
SUPC->BOD33.bit.ENABLE=0;
|
SUPC->BOD33.bit.ENABLE=0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
|
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "stdio_base.h"
|
||||||
#include "stmclk.h"
|
#include "stmclk.h"
|
||||||
#include "periph_cpu.h"
|
#include "periph_cpu.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
@ -160,6 +161,8 @@ void cpu_init(void)
|
|||||||
/* initialize DMA streams */
|
/* initialize DMA streams */
|
||||||
dma_init();
|
dma_init();
|
||||||
#endif
|
#endif
|
||||||
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
stdio_init();
|
||||||
/* trigger static peripheral initialization */
|
/* trigger static peripheral initialization */
|
||||||
periph_init();
|
periph_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,7 +69,7 @@ char *heap_top = &_sheap + 4;
|
|||||||
*/
|
*/
|
||||||
void _init(void)
|
void _init(void)
|
||||||
{
|
{
|
||||||
stdio_init();
|
/* nothing to do here */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user