From 65b94487c6a0ae38f57e1aa1a35d79129c815faa Mon Sep 17 00:00:00 2001 From: jmichault <48726908+jmichault@users.noreply.github.com> Date: Thu, 25 Apr 2019 23:15:41 +0200 Subject: [PATCH] fixed issue #2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixed issue #2 «error on page 0: byte 0x00 is 0x00 instead of expected 0x02» due to incorrect write length : we must write entire words to flash. --- cc_write | Bin 17984 -> 17984 bytes cc_write.c | 13 ++++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cc_write b/cc_write index 0c32b4c42794ece69c972eea91c36707f62ab1fe..a9a666fbb96bcf6cde5a36bea325989c9ab5160c 100755 GIT binary patch delta 3019 zcmZ8jdu&tJ89&F5#E#?SI<^zX*Nz?RJV?TDnny!OfNUPh7GMlE%G78}SH@_yj$~nK zs{tt_ld3grL?5W3g8oOADmL4IM7A8ay@H!?Qf$l3T%+k?glFcU*3zi`Y%hrb(44plt=o6@Pb zZB>_h|KKW&j`B{=c6Vk|VS{+31J z1txkfXA>Wyxtt1{56W2x=dxKsQ+`HEEt_>&CfaLR#VhH&rN}tN6xBuhY)<;rQf_XC z!%-QLX1B5@UwH4Ut%hte@^oX+E{&@p^a!bW%$2ZeAXD(6ao1%>nB` zeI(W!`s`y50y^k{{OZ!vUnUdGABj&Q!Ji{R2`Ne7|04KYI-TJgT=b3QSFDf>ih2P4 zCfL6x>}Ru5{_hL^26&V=&0(XLBC#pGqW*x|B%f^zyGP-D6_#3SPEwDw(s~84>&Njaq%$Ku&aof`3kBn zsCIPSkybVK+AL{83Knhxlb+5KrHZQe>!yCf=_|6^%Cr%O_D@NOCDB_2vbhOIYVvk6 zA<;hzU~>(cRydosXt5)*aObfaN&^ytR<>F%oz9Y-~Q8_56^rpJ6?LBRoUP90A@=-*(uWo7{>z zE39Wgzk?PT&@v6t51rQWS0S%t7PS&O#x}>zjJX$9&~uK$*4bi3y(ZizK|M%9MiMS0 zd`QO<11P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%}MF6#5R=&m{F ztbqg25=PCe7cq8g7*2a=fh8E)A>){|Hr=SHI@kI~gq7GU<`s$CsnlsYW~uTXO{J2x zwy17ps(u7}r6!gLf%ovJK1!ciF7iWkwqRlDP7%kzV)2}zwh^}d?C97N3ftGLu(59| ztepadYC!>FU9`p$II=wM-~%?w-(n8o2(TpX{1mf6(>wHU1b z-cKbR;#4pRB5N@j5BACdn}5M3(+@>PNZYN_720i6z15J4PFyxj?(`|#k>Arzd(e3q z7#tR}K{Hj1P{1)~<^f2Y+A7^IXDSaf)u=^vhPku(V+oFv(17EW2$i(M;VXFlyNvw+ z>&KY;UV6t7jI3^e4uCKQqC9s5c;W(YkF?@0YEM!EYDrM9Qy%?gGCTRE&v|_Sv~q`cz1tO){47 z*#X-QWAvMPJ8qEZ!D?4je?0lVO~GeJtLHEB6p* zw_3G`s^KZ!65lznFXq z7iOn(%bbD-xm|;eIPV*v#tM3M+QOD??iP)ZGjB?TYf}841P6u zWRuv#7@i_k-z#{0HUwJcBQGAh?f4_}I@V#Vb6DbopGqY-pJG|?$Eymf zmX7;WXJ zds(u=ar%k>4}2*t2=r8s-b*E|S>OrCSeERc6c5;|e+$jkEV!ePUC5FhCU04oze~%? z?DNk;-<7351zCHRY!_sik5#6mpVFZ+JKs9^yD~H9O>{n}@_M?C-H!T z!e6{6v*3a>Go&h>d$c6DuJe5z9)!xT!hOe2SBet9MTh&Go0gGZ^QLgo8tO+`2F zq4z8P$lK|a${=r`)*8g>5cyK4ii<^9mqX#B^BX=AJm17 zG+fs~IZajglRl&Aat;sC{YQPd&6wO~3bY3E7h$(3%vdQs-s;Pp_}5R*w+3@JVFWh~ JzSjB%{~sFNAwK{B diff --git a/cc_write.c b/cc_write.c index f8315ab..70ccc6c 100644 --- a/cc_write.c +++ b/cc_write.c @@ -70,7 +70,7 @@ void readPage(int page,uint8_t *buf) uint32_t offset = ((page&0xf)<<11) + Pages[page].minoffset; // Setup DPTR cc_execi( 0x90, 0x8000+offset ); // MOV DPTR,#data16 - for(int i=0 ; i<2048 ;i++) + for(int i=Pages[page].minoffset ; i<=Pages[page].maxoffset ;i++) { res = cc_exec ( 0xE0 ); // MOVX A,@DPTR buf[i] = res; @@ -88,7 +88,7 @@ int verifPage(int page) readPage(page,verif1); readPage(page,verif2); } while (memcmp(verif1,verif2,2048)); - for(int i=Pages[page].minoffset ; i RAM uint8_t dma_desc0[8]; dma_desc0[0] = 0x62;// src[15:8] @@ -182,7 +186,7 @@ int writePage(int page) res &= ~2; cc_exec3(0x75,0xD6,res); // écrire l'adresse de destination dans FADDRH FADDRL - offset = page<<11 + Pages[page].minoffset; + offset = ((page&0xff)<<11) + Pages[page].minoffset; res=(offset>>2)&0xff; writeXDATA( 0x6271, &res,1); res=(offset>>10)&0xff; @@ -283,7 +287,6 @@ int main(int argc,char **argv) uint16_t start=(sla+addr)&0x7ff; if(start+len> 2048) // some datas are for next page { //copy end of datas to next page -printf("copy to next page %d\n",page+1); if (page+1>maxpage) maxpage=page+1; memcpy(&Pages[page+1].datas[0] ,data+2048-start,(start+len-2048));