📄 board_init.c.svn-base
字号:
#include "board.h"
#include "OS_CPU.h"
#include "board_mpc555.h"
/************************************************************************
*
* This is the first part of the initialization sequence that is
* implemented in C, but still running from ROM.
*
* The main purpose is to initialize the RAM so that we can
* relocate the code to RAM.
*
* Be aware of the restrictions: global data is read-only, BSS is not
* initialized, and stack space is limited to a few kB.
*
************************************************************************
*/extern void relocate_code(int, int);
void board_init_f()
{
ULONG sp_addr; /*stack pointer*/
ULONG des_addr; /*destination address of relocatable code*/
ULONG s;
des_addr = CFG_SDRAM_BASE;
sp_addr = CFG_SDRAM_BASE + CFG_SDRAM_SIZE; /*stack is in the high address of RAM*/
sp_addr -= sizeof(bd_t); /*some space reserved for board information*/
sp_addr &= ~(4096 - 1); /*4kB reserved for other use*/
/*
* Finally, we set up a new (bigger) stack.
*
* Leave some safety gap for SP, force alignment on 16 byte boundary
* Clear initial stack frame
*/
sp_addr -= 16;
sp_addr &= ~0xF;
/* s = (ULONG *)sp_addr;
*(s--) = 0;
*(s--) = 0;
sp_addr = (ULONG)s;*/
relocate_code(sp_addr, des_addr); /*it will not return from relocate_code*/
}
void board_init_r()
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -