论坛» 嵌入式开发» MCU

求救:关于flash烧写

菜鸟
2005-05-23 05:26 1楼

U32 WriteSector(U32 index,U8 *buff) { volatile U16 *Dest; volatile U16 *Org; U16 i,k; Org = (volatile U16 *)buff; Dest = (volatile U16 *)(GetSecAddr(index));

/*section1*/*(volatile U16 *)(0x0000AAAA)=0xAAAA; *(volatile U16 *)(0x00005554)=0x5555; *(volatile U16 *)(0x0000AAAA)=0x8080; *(volatile U16 *)(0x0000AAAA)=0xAAAA; *(volatile U16 *)(0x00005554)=0x5555; *Dest =0x3030;for(k=0;k<65000;k++); for(k=0;k<65000;k++); printf("."); if (!buff) return 0; for (i=0;i

/*section2*/*(volatile U16 *)(0x0000AAAA)=0xAAAA; *(volatile U16 *)(0x00005554)=0x5555; *(volatile U16 *)(0x0000AAAA)=0xA0A0;*(Dest+i)=*(Org+i); for(k=0;k<200;k++); if(*(Dest)!=*(Org)) return 0; } return SECLEN; }

大虾,帮我看看为什么我执行到section1就死了,是不是还要做什么设置啊

菜鸟
2005-06-14 14:41 2楼
你的flash是不是写保护?地址映射对不对?
菜鸟
2005-06-15 00:12 3楼

如果代码本身就在flash里执行,那是肯定死机的

共3条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册]