我最近在调试一块S3C4510的开发板。配置如下:Flash:SST39VF160 一片。Flash中原有一个Bootloader。上电后,串口显示如下:
Compex BIOS for SAMSUNG S3C4510B (build 20040121)
Main Menu
1 - Run uClinux
2 - Load image to sdram and Run uClinux
3 - Burn image to flash
4 - Update BIOS(Pay attention!!)
5 - Read ram data
Please Select:
现在我想使用HJTAG烧写Flash确怎么也不能读出Flash的ID。
使用AXD调试器(配合HJTAG)调试发现,上电后,memory 0x1000000位置开始为Flash的内容(flash的地址)。但是比较奇怪,我使用setmem 0x1000000 0x0000 32这之类的命令时,发现flash对应的内存空间数据也会被修改。
使用如下代码在AXD中调试时发现,代码装载到0x00开始的空间且可以执行,但是无法读出flash的ID。代码如下
#define UINT16 unsigned short
#define AM_START_ADDR 0x1000000 //此处为Flash的起始地址,设为1000000
#define AM_ADDR_UNLOCK1 0x5555
#define AM_ADDR_UNLOCK2 0x2aaa
#define AM_DATA_UNLOCK1 0xaaaa
#define AM_DATA_UNLOCK2 0x5555
#define AM_SETUP_WRITE 0xaaaa
#define AM_SETUP_ERASE 0x8080
#define AM_CHIP_ERASE 0x1010
#define AM_SECTOR_ERASE 0x3030
#define AM_RESET 0xf0f0
int Main()
{
int i;
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK1) = AM_DATA_UNLOCK1; //aaaa
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK2) = AM_DATA_UNLOCK2; //5555
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK1) = AM_SETUP_ERASE; //9090
/*
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK1) = AM_DATA_UNLOCK1;
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK2) = AM_DATA_UNLOCK2;
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK1) = AM_CHIP_ERASE; //1010
*/
for (i=0; i<5000; i++)
{
;
}
return(0);
}
请各位高手给我解惑啊。这个问题我看了好几天了,不知道问题出在哪了。
非常感谢!
使用JTAG和AXD只能把BOOT放到内存。至于要实现烧写flash,必须自己在boot加入烧写程序。
1 - Run uClinux
2 - Load image to sdram and Run uClinux
3 - Burn image to flash
4 - Update BIOS(Pay attention!!)
5 - Read ram data
从上面几个菜单看出你的boot并不支持烧写flash,要想实现,自己写些程序吧。
使用JTAG和AXD只能把BOOT放到内存。至于要实现烧写flash,必须自己在boot加入烧写程序。
1 - Run uClinux
2 - Load image to sdram and Run uClinux
3 - Burn image to flash
4 - Update BIOS(Pay attention!!)
5 - Read ram data
从上面几个菜单看出你的boot并不支持烧写flash,要想实现,自己写些程序吧。
我是用如下程序来操作的。也是从网上找到的修改的。
#define UINT16 unsigned short
#define AM_START_ADDR 0x1000000 //此处为Flash的起始地址,设为1000000
#define AM_ADDR_UNLOCK1 0x5555
#define AM_ADDR_UNLOCK2 0x2aaa
#define AM_DATA_UNLOCK1 0xaaaa
#define AM_DATA_UNLOCK2 0x5555
#define AM_SETUP_WRITE 0xaaaa
#define AM_SETUP_ERASE 0x8080
#define AM_CHIP_ERASE 0x1010
#define AM_SECTOR_ERASE 0x3030
#define AM_RESET 0xf0f0
int Main()
{
int i;
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK1) = AM_DATA_UNLOCK1; //aaaa
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK2) = AM_DATA_UNLOCK2; //5555
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK1) = AM_SETUP_ERASE; //9090
/*
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK1) = AM_DATA_UNLOCK1;
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK2) = AM_DATA_UNLOCK2;
*((volatile UINT16 *)AM_START_ADDR+ AM_ADDR_UNLOCK1) = AM_CHIP_ERASE; //1010
*/
for (i=0; i <5000; i++)
{
;
}
return(0);
}
不知道是怎么回事。请各位牛人赐教啊
你是只是无法得出flashID吧 怎么没看到你得ID得代码
我以前有一次没有得到ID是因为变量没有设置成voilate
不知道你得是不是同样的问题