Strawing Blog » Archivers » 利用树莓派SPI刷BIOS Flash(W25Q64)
FILE *fp;
int nVal;
fp = fopen("/home/pi/K56CM.BIN", "r");
int shanqui = 1;
int alli = 1;
for(alli = 1;alli<=2048;alli++){
n = W25Q64_eraseSector(alli-1,true);
printf("Erase Sector(%d): n=%d\n",alli-1,n);
for(shanqui = 1;shanqui<=32;shanqui++){
int fuckingi = 1;
for(fuckingi = 1;fuckingi <= 128;fuckingi++){
nVal = 0;
fread(&nVal, 1, 1, fp);
fseek(fp,(((alli*4096)+(shanqui*128)-128)-4096)+fuckingi,SEEK_SET);
wdata[fuckingi-1]=nVal;
printf("%02X", wdata[fuckingi-1]);
}
n = W25Q64_pageWrite(alli-1, (shanqui*128)-128, wdata, 128);
printf("page_write(%d,%d,d,128): n=%d\n",alli-1,(shanqui*128)-128,n);
查看完整版本:利用树莓派SPI刷BIOS Flash(W25Q64)
© Strawing Blog