; The bootloader is fixed up to run from RAM, but is stored in flash. ROMOFFSET
; adjusts the .bin file record headers to that they lie in flash (this tells the
; bootloader already on the device to store the image in flash).
ROMOFFSET=3C9E0000
MODULES
; Name Path Memory Type
; ------ ---------------------------------------------- -----------
nk.exe $(_TARGETPLATROOT)\target\$(_TGTCPU)\$(WINCEDEBUG)\eboot.exe EBOOT
MSC0之类的寄存器配置如下:
xlli_CCCR_value EQU (0x00000290) ; Bulverde (HW reset value to start)
运行擦写测试结果如下:
UART Init OK!
INFO: DetectFlashDevice: flash type is J3.
INFO: LoadEBootCFG: load default eboot config.
Microsoft Windows CE Ethernet Bootloader Common Library Version 1.1 Built Jul 7
2008 12:31:49
Microsoft Windows CE Ethernet Bootloader 1.7 for the DADI PXA270 Development Pla
tform Built Jul 15 2008
Press [ENTER] to download now or [SPACE] to cancel.
Initiating image download in -1 seconds.
Ethernet Boot Loader Configuration:
0) IP address: 192.168.0.44
1) Subnet mask: 255.255.255.0
2) Boot delay: 5 seconds
3) DHCP: (Disabled)
4) Reset to factory default configuration
5) Download new image at startup
6) Boot device order: SMSC -> CF
7) Program SMSC MAC address
D) Download image now
L) Launch existing flash resident image now
E) FlashErase Test
Enter your selection: e
Enter Erase start address: 0x40000
Enter Erase flash lenght: 0x100
// Make sure we know what kind of flash part we have.
//
EdbgOutputDebugString("INFO: FlashErase flash_start_address=0x%x FlashStart=0x%x , Length=0x%x .\r\n", flash_start_address, FlashStart, FlashLength);
// If Tyax flash, need to change block count based on if we're in the first 4 blocks
// as the first 4 blocks are 16KWords (vs. 64KWords/block)
if ((g_FlashDeviceType == L18) || (g_FlashDeviceType == L30))
{
// Is start address within the first 4 blocks. As there are 2 devices in parallel,
// are we within the first 128KWords (2 x 64KWords)? If so, we need to account for
// increased number of blocks - which is the first 256K of addy range
if ((FlashStart >= flash_start_address) && (FlashStart < (flash_start_address + 0x40000)))
{
// If we're within the first 128K words (256K), we need to treat the block as a special case
num_l3_blocks_to_erase = 4;
num_blocks--; // Decrease the num_blocks count, as it assumes the first block is 64K
// Now add the # of L3 blocks to the # blocks calc.'ed at the beginning to get total
// # of blocks to erase on a given L3 device INCLUDING the first 4 16kWord blocks
num_blocks = num_blocks + num_l3_blocks_to_erase;
}
}
pFlash = (volatile UINT32 *)(FlashStart);
// Issue the clear lock bits and confirm command.
if (g_FlashDeviceType == J3)
{
// For J3 FLASH, unlock all blocks at once with one command
num_blocks_to_erase = 1;
}
else if ((g_FlashDeviceType == K3) || (g_FlashDeviceType == K18)|| (g_FlashDeviceType == L18) || (g_FlashDeviceType == L30)||(g_FlashDeviceType == P30))
{
// For K3/K18 FLASH, unlock individual blocks one at a time
num_blocks_to_erase = num_blocks;
}
// For L3, need to set for use within the FOR loop
num_l3_blocks_erased = num_l3_blocks_to_erase;
EdbgOutputDebugString("INFO: FlashErase: num_blocks_to_erase=%d.\r\n", num_blocks_to_erase );
for (j = 0; j < num_blocks_to_erase; j++)
{
EdbgOutputDebugString("INFO: pFlash = %x.\r\n", pFlash);
*pFlash = 0x00600060;
*pFlash = 0x00d000d0;
i = 0;
while ((i & 0x00800080) != 0x00800080)
{
i = *pFlash;
}
if ((i & 0x00000008) )
EdbgOutputDebugString("ERROR: FlashErase: voltage range error ... lower flash.\r\n");
if ((i & 0x00080000) )
EdbgOutputDebugString("ERROR: FlashErase: voltage range error ... upper flash.\r\n");
if (i != 0x00800080)
{
EdbgOutputDebugString("ERROR: FlashErase: status register returned 0x%X\r\n", i);
EdbgOutputDebugString("ERROR: FlashErase: unrecoverable failure encountered while erasing flash. System halted!\r\n");
return(FALSE);
}
}