- bootloader is left in kernel-mode
- improved flash error handling Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@463 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -170,9 +170,7 @@ void Exec_at(void *pEntry)
|
|||||||
|
|
||||||
__asm
|
__asm
|
||||||
(
|
(
|
||||||
"mfc0 $26, $12\n" // change exception vector
|
"li $26, 0x10000000\n"
|
||||||
"li $27, 0xFFBFFFFF\n"
|
|
||||||
"and $26, $27\n"
|
|
||||||
"mtc0 $26, $12\n"
|
"mtc0 $26, $12\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -269,8 +267,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
UINT8 buf[256];
|
UINT8 buf[256];
|
||||||
srec_t srec;
|
srec_t srec;
|
||||||
int result, srec_state, i;
|
int srec_state, i;
|
||||||
UINT32 haddr;
|
UINT32 haddr, result;
|
||||||
flash_t flash;
|
flash_t flash;
|
||||||
flash_img_hdr_t img_hdr = {0};
|
flash_img_hdr_t img_hdr = {0};
|
||||||
flash_img_hdr_t *pImg_hdr;
|
flash_img_hdr_t *pImg_hdr;
|
||||||
@@ -295,7 +293,7 @@ int main(int argc, char *argv[])
|
|||||||
block_sel = 0x7F & (UINT32)*pDip;
|
block_sel = 0x7F & (UINT32)*pDip;
|
||||||
|
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
if (flash_find(&flash, sys_flash_io))
|
if (IS_ERROR(flash_find(&flash, sys_flash_io)))
|
||||||
{
|
{
|
||||||
sputs("Cannot find flash device. Exit now!\n\n");
|
sputs("Cannot find flash device. Exit now!\n\n");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -319,7 +317,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
sputs("Booting application from flash (");print_word(flashio_offset);sputs(")...");
|
sputs("Booting application from flash (");print_word(flashio_offset);sputs(")...");
|
||||||
|
|
||||||
|
|
||||||
ram32 = (UINT32*)pImg_hdr->target_base;
|
ram32 = (UINT32*)pImg_hdr->target_base;
|
||||||
pFlashIO = (UINT32*)(sys_flash_io + pImg_hdr->img_base);
|
pFlashIO = (UINT32*)(sys_flash_io + pImg_hdr->img_base);
|
||||||
img_size = pImg_hdr->img_size;
|
img_size = pImg_hdr->img_size;
|
||||||
@@ -327,8 +324,9 @@ int main(int argc, char *argv[])
|
|||||||
for (i=0; i < img_size/4; i++)
|
for (i=0; i < img_size/4; i++)
|
||||||
ram32[i] = pFlashIO[i];
|
ram32[i] = pFlashIO[i];
|
||||||
|
|
||||||
sputs("done\n\n");
|
sputs("done\n");
|
||||||
|
|
||||||
|
sputs("Execute at ");print_word(pImg_hdr->target_base); sputs("\n\n");
|
||||||
Exec_at((void*)ram32);
|
Exec_at((void*)ram32);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -376,33 +374,33 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
sputs("Flash erase...");
|
sputs("Flash erase...");
|
||||||
result = flash_erase(&flash, flashio_offset, img_hdr.img_size + sizeof(flash_img_hdr_t));
|
result = flash_erase(&flash, flashio_offset, img_hdr.img_size + sizeof(flash_img_hdr_t));
|
||||||
if (result < 0)
|
if (IS_ERROR(result))
|
||||||
{
|
{
|
||||||
sputs("failed!\n");
|
sputs("failed (");print_word(result);sputs(")\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sputs("done\n");
|
sputs("done\n");
|
||||||
|
|
||||||
sputs("Flash write...");
|
sputs("Flash write...");
|
||||||
result = flash_program(&flash, flashio_offset, (UINT8*)&img_hdr, sizeof(flash_img_hdr_t));
|
result = flash_program(&flash, flashio_offset, (UINT8*)&img_hdr, sizeof(flash_img_hdr_t));
|
||||||
if (result < 0)
|
if (IS_ERROR(result))
|
||||||
{
|
{
|
||||||
sputs("failed!\n");
|
sputs("failed (");print_word(result);sputs(")\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result = flash_program(&flash, img_hdr.img_base, (UINT8*)ram32, img_hdr.img_size);
|
result = flash_program(&flash, img_hdr.img_base, (UINT8*)img_hdr.target_base, img_hdr.img_size);
|
||||||
if (result < 0)
|
if (IS_ERROR(result))
|
||||||
{
|
{
|
||||||
sputs("failed!\n");
|
sputs("failed (");print_word(result);sputs(")\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sputs("done\n");
|
sputs("done\n");
|
||||||
|
|
||||||
sputs("Flash verify...");
|
sputs("Flash verify...");
|
||||||
result = flash_verify(&flash, img_hdr.img_base, (UINT8*)ram32, img_hdr.img_size);
|
result = flash_verify(&flash, img_hdr.img_base, (UINT8*)img_hdr.target_base, img_hdr.img_size);
|
||||||
if (result < 0)
|
if (IS_ERROR(result))
|
||||||
{
|
{
|
||||||
sputs("failed!\n");
|
sputs("failed (");print_word(result);sputs(")\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sputs("passed\n");
|
sputs("passed\n");
|
||||||
@@ -416,7 +414,7 @@ int main(int argc, char *argv[])
|
|||||||
result = -1;
|
result = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (result < 0)
|
if (IS_ERROR(result))
|
||||||
{
|
{
|
||||||
*pReg = 0x40000000;
|
*pReg = 0x40000000;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user