rknanoutils: fix boot tool

Correctly descramble the first stages (0 to 2) in continuous mode.
Also fix a disassembled (but unused) crc routine used in dfu mode.

Change-Id: I20016d1c696a9bcb6584377ee9b55493783c7159
This commit is contained in:
Amaury Pouly 2013-03-21 19:01:15 +01:00
parent 6ea48cf92b
commit d504a6b220

View file

@ -128,7 +128,7 @@ static uint16_t crc(uint8_t *buf, int size)
{
for(int bit = 128; bit; bit >>= 1)
{
if(result & 0x80)
if(result & 0x8000)
result = (2 * result) ^ 0x1021;
else
result *= 2;
@ -221,7 +221,7 @@ static int do_nanofw_image(uint8_t *buf, unsigned long size)
cprintf(GREEN, " %i: ", i);
print_blob_interval(&hdr->stage[i]);
cprintf(OFF, "\n");
save_blob(&hdr->stage[i], buf, size, "stage", i, NO_ENC);
save_blob(&hdr->stage[i], buf, size, "stage", i, i == 3 ? NO_ENC : CONTINOUS_ENC);
}
cprintf(BLUE, "Fonts\n");
for(unsigned i = 0; i < hdr->nr_fonts; i++)