SAMA5D4-EK: Fix some AT25BOOT bugs
This commit is contained in:
parent
4b71a0f1e2
commit
2fb61ad15d
@ -122,7 +122,6 @@ int at25_main(int argc, char *argv)
|
|||||||
struct lib_rawinstream_s rawinstream;
|
struct lib_rawinstream_s rawinstream;
|
||||||
struct lib_memsostream_s memoutstream;
|
struct lib_memsostream_s memoutstream;
|
||||||
const uint8_t *src;
|
const uint8_t *src;
|
||||||
uint8_t *dest;
|
|
||||||
ssize_t nwritten;
|
ssize_t nwritten;
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
ssize_t remaining;
|
ssize_t remaining;
|
||||||
@ -172,9 +171,9 @@ int at25_main(int argc, char *argv)
|
|||||||
printf("Send Intel HEX file now\n");
|
printf("Send Intel HEX file now\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
return hex2bin(&rawinstream.public, &memoutstream.public,
|
ret = hex2bin(&rawinstream.public, &memoutstream.public,
|
||||||
(uint32_t)SAM_ISRAM_VSECTION,
|
(uint32_t)SAM_ISRAM_VSECTION,
|
||||||
(uint32_t)(SAM_ISRAM_VSECTION + CONFIG_SAMA5D4EK_AT25_PROGSIZE),
|
(uint32_t)(SAM_ISRAM_VSECTION + CONFIG_SAMA5D4EK_AT25_PROGSIZE),
|
||||||
0);
|
0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
@ -192,11 +191,11 @@ int at25_main(int argc, char *argv)
|
|||||||
memoutstream.public.nput);
|
memoutstream.public.nput);
|
||||||
|
|
||||||
remaining = memoutstream.public.nput;
|
remaining = memoutstream.public.nput;
|
||||||
dest = (uint8_t *)CONFIG_SAMA5D4EK_AT25_PROGSIZE;
|
src = (uint8_t *)SAM_DDRCS_VSECTION;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
nwritten = write(fd, dest, memoutstream.public.nput);
|
nwritten = write(fd, src, memoutstream.public.nput);
|
||||||
if (nwritten <= 0)
|
if (nwritten <= 0)
|
||||||
{
|
{
|
||||||
int errcode = errno;
|
int errcode = errno;
|
||||||
@ -210,7 +209,7 @@ int at25_main(int argc, char *argv)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
remaining -= nwritten;
|
remaining -= nwritten;
|
||||||
dest += nwritten;
|
src += nwritten;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (remaining > 0);
|
while (remaining > 0);
|
||||||
@ -235,7 +234,7 @@ int at25_main(int argc, char *argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
remaining = memoutstream.public.nput;
|
remaining = memoutstream.public.nput;
|
||||||
src = (const uint8_t *)CONFIG_SAMA5D4EK_AT25_PROGSIZE;
|
src = (const uint8_t *)SAM_DDRCS_VSECTION;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -267,7 +266,7 @@ int at25_main(int argc, char *argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
remaining -= nwritten;
|
remaining -= nwritten;
|
||||||
dest += nwritten;
|
src += nwritten;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (remaining > 0);
|
while (remaining > 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user