关于2440在norflash上跑裸机的问题
我在mdk环境下用jlink调试2440裸机程序,在SDRAM中运行顺利。现准备把程序烧写到norflash中,Scatter File如下:
;Run in Flash
LR_ROM1 0x00000000 { ; load region
ER_ROM1 0x00000000 0x0200000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_RAM1 0x30000000 0x4000000 { ; RW data
.ANY (+RW +ZI)
}
RW_IRAM1 0x40000000 0x00001000 {
.ANY (+RW +ZI)
}
}
Initialization File如下:
FUNC void Init (void) {
_WDWORD(0x4A000008, 0xFFFFFFFF); // Disable All Interrupts
_WDWORD(0x53000000, 0x00000000); // Disable Watchdog Timer
// Clock Setup
// FCLK = 300 MHz, HCLK = 100 MHz, PCLK = 50 MHz
_WDWORD(0x4C000000, 0x0FFF0FFF); // LOCKTIME
_WDWORD(0x4C000014, 0x0000000F); // CLKDIVN
_WDWORD(0x4C000004, 0x00043011); // MPLLCON
_WDWORD(0x4C000008, 0x00038021); // UPLLCON
_WDWORD(0x4C00000C, 0x001FFFF0); // CLKCON
// Memory Controller Setup for SDRAM
_WDWORD(0x48000000, 0x22000000); // BWSCON bank6,7=32bit
_WDWORD(0x4800001C, 0x00018005); // BANKCON6
_WDWORD(0x48000020, 0x00018005); // BANKCON7
_WDWORD(0x48000024, 0x008404F3); // REFRESH
_WDWORD(0x48000028, 0x00000032); // BANKSIZE
_WDWORD(0x4800002C, 0x00000020); // MRSRB6
_WDWORD(0x48000030, 0x00000020); // MRSRB7
_WDWORD(0x56000000, 0x000003FF); // GPACON: Enable Address lines for SDRAM
}
// Reset chip with watchdog, because nRST line is routed on hardware in a way
// that it can not be pulled low with ULINK
_WDWORD(0x40000000, 0xEAFFFFFE); // Load RAM addr 0 with branch to itself
CPSR = 0x000000D3; // Disable interrupts
PC = 0x40000000; // Position PC to start of RAM
_WDWORD(0x53000000, 0x00000021); // Enable Watchdog
g, 0 // Wait for Watchdog to reset chip
Init(); // Initialize memory
LOAD my_led.axf INCREMENTAL // Download program
PC = 0x00000000; // Setup for Running
g, main // Goto Main
启动代码用的是mdk自带的S3C2440A.S
运行后不成功,个人感觉是自写的Initialization File有问题(只初始化了SDRAM),除去Initialization File也不成功。请问各位大侠,正确的Initialization File该如何编写?或者启动代码需要哪里改动?那位手头上恰好有2440mdk跑flash的例子,能否发我一份,先谢过:)
邮箱:ysy27@sina.com