X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Flpcload.c;fp=betty%2Flpcload.c;h=d1bfd5473c6ee477bd83821d1d7f42bd80713f42;hp=9f60d88c8ab921602c72a0ed6d0d3a606d3f8fc9;hb=afe6191925fbdac90169ed8a463bd9928276a863;hpb=e013de8b92ff7ba9cf70c7c8669c023a315f1348 diff --git a/betty/lpcload.c b/betty/lpcload.c index 9f60d88..d1bfd54 100644 --- a/betty/lpcload.c +++ b/betty/lpcload.c @@ -564,8 +564,11 @@ int write_to_flash(t_lpc *lpc,u8 *buf,u32 addr,int len) { u8 check; int i; + /* prepare addr */ + addr+=lpc->roff; + /* send cmd */ - send_cmd(lpc->sfd,addr+lpc->roff,len,CMD_WRITE); + send_cmd(lpc->sfd,addr,len,CMD_WRITE); /* transfer data */ cnt=0; @@ -591,7 +594,7 @@ int write_to_flash(t_lpc *lpc,u8 *buf,u32 addr,int len) { break; } if(buf[cnt+i]!=check) - printf("FATAL: write to flash: wrong transfer\n"); + printf("FATAL: write to flash (transfer)\n"); } cksml+=buf[cnt]; cksml+=buf[cnt+1]; @@ -611,9 +614,10 @@ int write_to_flash(t_lpc *lpc,u8 *buf,u32 addr,int len) { if(cksml!=cksmr) { printf("FATAL: wrong checksum or failure in flash write!\n"); if(cksml+1==cksmr) - printf(" -> most probably due to flash write!"); + printf(" -> most probably due to flash write!\n"); else - printf(" -> most probably due to failure in transfer!"); + printf(" -> most probably failure in transfer!\n"); + printf(" addr:0x%08x l:%02x r:%02x\n",addr,cksml,cksmr); } return 0;