stage2_boot.c

来自「一个非常有用的nand_flash的boot程序代码」· C语言 代码 · 共 36 行

C
36
字号

/*
 Nand Test:  Read/Write and Block Verification for 1550 Nand flash controller 
 Pb1550 supports NAND control on NANDCS1 and NANDCS0 from the control CPLD.
 */

/********************************************************************/

#include "example.h"

typedef uint32 NandDevice;

void __attribute__((section(".stage2"))) init_system(void)
{
	dcacheFlush();
	icacheFlush();
	tlbInit();

	cpuIrqInit();

	/* Allow interrupts to occur (though all masked) */
	cpuEnableIrqs(STATUS_IE);
}

int __attribute__((section(".stage2"))) load_booter()
{
	extern uint32 _text, _end;
	NandDevice* nand_device;
	
	if(nand_device = (NandDevice*) nand_initialize())
	{		
		nand_read(&_text, &_end - &_text, 1, 0);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?