mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
2d415d16c9
- split up interrupt vector code from bootloader.c to vectors.c - moved bootloader.c to arm7_init.c - Use consistent naming: - use lower case for everything but preprocessor stuff - ISRs now named isr_foo()
80 lines
1.6 KiB
C
80 lines
1.6 KiB
C
/*
|
|
* Copyright 2008-2009, Freie Universitaet Berlin (FUB). All rights reserved.
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
/**
|
|
* @ingroup cpu_arm7_common
|
|
* @{
|
|
*
|
|
* @file
|
|
* @brief Common ARM7 boot up code
|
|
*
|
|
* @author Heiko Will <hwill@inf.fu-berlin.de>
|
|
* @author Michael Baar <michael.baar@fu-berlin.de>
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "thread.h"
|
|
|
|
#include "log.h"
|
|
|
|
static inline void
|
|
_init_data(void)
|
|
{
|
|
extern unsigned int _etext;
|
|
extern unsigned int _data;
|
|
extern unsigned int _edata;
|
|
extern unsigned int __bss_start;
|
|
extern unsigned int __bss_end;
|
|
|
|
register unsigned int *p1;
|
|
register unsigned int *p2;
|
|
register unsigned int *p3;
|
|
|
|
// initialize data from flash
|
|
// (linker script ensures that data is 32-bit aligned)
|
|
p1 = &_etext;
|
|
p2 = &_data;
|
|
p3 = &_edata;
|
|
|
|
while (p2 < p3) {
|
|
*p2++ = *p1++;
|
|
}
|
|
|
|
// clear bss
|
|
// (linker script ensures that bss is 32-bit aligned)
|
|
p1 = &__bss_start;
|
|
p2 = &__bss_end;
|
|
|
|
while (p1 < p2) {
|
|
*p1++ = 0;
|
|
}
|
|
}
|
|
|
|
void bootloader(void)
|
|
{
|
|
extern void bl_init_ports(void);
|
|
extern void bl_init_clks(void);
|
|
|
|
/* board specific setup of clocks */
|
|
bl_init_clks();
|
|
|
|
/* initialize bss and data */
|
|
_init_data();
|
|
|
|
/* board specific setup of i/o pins */
|
|
bl_init_ports();
|
|
|
|
#ifdef MODULE_NEWLIB
|
|
extern void __libc_init_array(void);
|
|
__libc_init_array();
|
|
#endif
|
|
}
|
|
|
|
/** @} */
|