Browse Source

corrected bug in reading hex file.

master
jmichault 5 years ago
committed by GitHub
parent
commit
ef10c354af
2 changed files with 5 additions and 4 deletions
  1. BIN
      cc_write
  2. +5
    -4
      cc_write.c

BIN
cc_write View File


+ 5
- 4
cc_write.c View File

@@ -111,6 +111,7 @@ int writePage(int page)
uint32_t offset = ((page&0xf)<<11) + Pages[page].minoffset;

uint32_t len = Pages[page].maxoffset-Pages[page].minoffset+1;
if(len&0xf) len= (len&0x7f0)+16;
// configure DMA-0 pour DEBUG --> RAM
uint8_t dma_desc0[8];
dma_desc0[0] = 0x62;// src[15:8]
@@ -279,12 +280,12 @@ int main(int argc,char **argv)
int page= (sla+addr)>>11;
if (page>maxpage) maxpage=page;
uint16_t start=(sla+addr)&0x7ff;
if(start+len> 2048)
{
if(start+len> 2048) // some datas are for next page
{ //copy end of datas to next page
if (page+1>maxpage) maxpage=page+1;
memcpy(&Pages[page+1].datas[0]
,data,(start+len-2048));
if(0 < Pages[page].minoffset) Pages[page].minoffset=0;
,data+2048-start,(start+len-2048));
if(0 < Pages[page+1].minoffset) Pages[page+1].minoffset=0;
if( (start+len-2048-1) > Pages[page].maxoffset) Pages[page].maxoffset=start+len-2048-1;
len=2048-start;
}


Loading…
Cancel
Save