fix invalid parameter type
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
# This Makefile is meant for cross compiling the BaS with Vincent Riviere's cross compilers.
|
# This Makefile is meant for cross compiling the BaS with Vincent Riviere's cross compilers.
|
||||||
# If you want to compile native on an Atari (you will need at least GCC 4.6.3), set
|
# If you want to compile native on an Atari (you will need at least GCC 4.6.3), set
|
||||||
# TCPREFIX to be empty.
|
# TCPREFIX to be empty.
|
||||||
|
#
|
||||||
# If you want to compile with the m68k-elf- toolchain, set TCPREFIX accordingly. Requires an extra
|
# If you want to compile with the m68k-elf- toolchain, set TCPREFIX accordingly. Requires an extra
|
||||||
# installation, but allows source level debugging over BDM with a recent gdb (tested with 7.5),
|
# installation, but allows source level debugging over BDM with a recent gdb (tested with 7.5),
|
||||||
# the m68k BDM tools from sourceforge (http://bdm.sourceforge.net) and a BDM pod (TBLCF and P&E tested).
|
# the m68k BDM tools from sourceforge (http://bdm.sourceforge.net) and a BDM pod (TBLCF and P&E tested).
|
||||||
|
|||||||
@@ -44,9 +44,9 @@
|
|||||||
#define SREC_COUNT(a) (a)[1] /* length of valid bytes to follow */
|
#define SREC_COUNT(a) (a)[1] /* length of valid bytes to follow */
|
||||||
#define SREC_ADDR16(a) (256 * (a)[2] + (a)[3]) /* 2 byte address field */
|
#define SREC_ADDR16(a) (256 * (a)[2] + (a)[3]) /* 2 byte address field */
|
||||||
#define SREC_ADDR24(a) (0x10000 * (a)[2] + 0x100 * \
|
#define SREC_ADDR24(a) (0x10000 * (a)[2] + 0x100 * \
|
||||||
(a)[3] + (a)[4]) /* 3 byte address field */
|
(a)[3] + (a)[4]) /* 3 byte address field */
|
||||||
#define SREC_ADDR32(a) (0x1000000 * a[2] + 0x10000 * \
|
#define SREC_ADDR32(a) (0x1000000 * a[2] + 0x10000 * \
|
||||||
a[3] + 0x100 * (a)[4] + (a)[5]) /* 4 byte address field */
|
a[3] + 0x100 * (a)[4] + (a)[5]) /* 4 byte address field */
|
||||||
#define SREC_DATA16(a) ((uint8_t *)&((a)[4])) /* address of first byte of data in a record */
|
#define SREC_DATA16(a) ((uint8_t *)&((a)[4])) /* address of first byte of data in a record */
|
||||||
#define SREC_DATA24(a) ((uint8_t *)&((a)[5])) /* address of first data byte in 24 bit record */
|
#define SREC_DATA24(a) ((uint8_t *)&((a)[5])) /* address of first data byte in 24 bit record */
|
||||||
#define SREC_DATA32(a) ((uint8_t *)&((a)[6])) /* adress of first byte of a record with 32 bit address field */
|
#define SREC_DATA32(a) ((uint8_t *)&((a)[6])) /* adress of first byte of a record with 32 bit address field */
|
||||||
@@ -60,13 +60,13 @@
|
|||||||
*/
|
*/
|
||||||
static uint8_t nibble_to_byte(uint8_t nibble)
|
static uint8_t nibble_to_byte(uint8_t nibble)
|
||||||
{
|
{
|
||||||
if ((nibble >= '0') && (nibble <= '9'))
|
if ((nibble >= '0') && (nibble <= '9'))
|
||||||
return nibble - '0';
|
return nibble - '0';
|
||||||
else if ((nibble >= 'A' && nibble <= 'F'))
|
else if ((nibble >= 'A' && nibble <= 'F'))
|
||||||
return 10 + nibble - 'A';
|
return 10 + nibble - 'A';
|
||||||
else if ((nibble >= 'a' && nibble <= 'f'))
|
else if ((nibble >= 'a' && nibble <= 'f'))
|
||||||
return 10 + nibble - 'a';
|
return 10 + nibble - 'a';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -74,7 +74,7 @@ static uint8_t nibble_to_byte(uint8_t nibble)
|
|||||||
*/
|
*/
|
||||||
static uint8_t hex_to_byte(uint8_t hex[2])
|
static uint8_t hex_to_byte(uint8_t hex[2])
|
||||||
{
|
{
|
||||||
return 16 * (nibble_to_byte(hex[0])) + (nibble_to_byte(hex[1]));
|
return 16 * (nibble_to_byte(hex[0])) + (nibble_to_byte(hex[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _NOT_USED_
|
#ifdef _NOT_USED_
|
||||||
@@ -83,7 +83,7 @@ static uint8_t hex_to_byte(uint8_t hex[2])
|
|||||||
*/
|
*/
|
||||||
static uint16_t hex_to_word(uint8_t hex[4])
|
static uint16_t hex_to_word(uint8_t hex[4])
|
||||||
{
|
{
|
||||||
return 256 * hex_to_byte(&hex[0]) + hex_to_byte(&hex[2]);
|
return 256 * hex_to_byte(&hex[0]) + hex_to_byte(&hex[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -91,7 +91,7 @@ static uint16_t hex_to_word(uint8_t hex[4])
|
|||||||
*/
|
*/
|
||||||
static uint32_t hex_to_long(uint8_t hex[8])
|
static uint32_t hex_to_long(uint8_t hex[8])
|
||||||
{
|
{
|
||||||
return 65536 * hex_to_word(&hex[0]) + hex_to_word(&hex[4]);
|
return 65536 * hex_to_word(&hex[0]) + hex_to_word(&hex[4]);
|
||||||
}
|
}
|
||||||
#endif /* _NOT_USED_ */
|
#endif /* _NOT_USED_ */
|
||||||
|
|
||||||
@@ -102,47 +102,47 @@ static uint32_t hex_to_long(uint8_t hex[8])
|
|||||||
*/
|
*/
|
||||||
static uint8_t checksum(uint8_t arr[])
|
static uint8_t checksum(uint8_t arr[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint8_t checksum = SREC_COUNT(arr);
|
uint8_t checksum = SREC_COUNT(arr);
|
||||||
|
|
||||||
for (i = 0; i < SREC_COUNT(arr) - 1; i++)
|
for (i = 0; i < SREC_COUNT(arr) - 1; i++)
|
||||||
{
|
{
|
||||||
checksum += arr[i + 2];
|
checksum += arr[i + 2];
|
||||||
}
|
}
|
||||||
return ~checksum;
|
return ~checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _NOT_USED_
|
#ifdef _NOT_USED_
|
||||||
void print_record(uint8_t *arr)
|
void print_record(uint8_t *arr)
|
||||||
{
|
{
|
||||||
switch (SREC_TYPE(arr))
|
switch (SREC_TYPE(arr))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
xprintf("type 0x%x ", SREC_TYPE(arr));
|
xprintf("type 0x%x ", SREC_TYPE(arr));
|
||||||
xprintf("count 0x%x ", SREC_COUNT(arr));
|
xprintf("count 0x%x ", SREC_COUNT(arr));
|
||||||
xprintf("addr 0x%x ", SREC_ADDR16(arr));
|
xprintf("addr 0x%x ", SREC_ADDR16(arr));
|
||||||
xprintf("module %11.11s ", SREC_DATA16(arr));
|
xprintf("module %11.11s ", SREC_DATA16(arr));
|
||||||
xprintf("chk 0x%x 0x%x\r\n", SREC_CHECKSUM(arr), checksum(arr));
|
xprintf("chk 0x%x 0x%x\r\n", SREC_CHECKSUM(arr), checksum(arr));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
xprintf("type 0x%x ", SREC_TYPE(arr));
|
xprintf("type 0x%x ", SREC_TYPE(arr));
|
||||||
xprintf("count 0x%x ", SREC_COUNT(arr));
|
xprintf("count 0x%x ", SREC_COUNT(arr));
|
||||||
xprintf("addr 0x%x ", SREC_ADDR32(arr));
|
xprintf("addr 0x%x ", SREC_ADDR32(arr));
|
||||||
xprintf("data %02x,%02x,%02x,%02x,... ",
|
xprintf("data %02x,%02x,%02x,%02x,... ",
|
||||||
SREC_DATA32(arr)[0], SREC_DATA32(arr)[1], SREC_DATA32(arr)[3], SREC_DATA32(arr)[4]);
|
SREC_DATA32(arr)[0], SREC_DATA32(arr)[1], SREC_DATA32(arr)[3], SREC_DATA32(arr)[4]);
|
||||||
xprintf("chk 0x%x 0x%x\r\n", SREC_CHECKSUM(arr), checksum(arr));
|
xprintf("chk 0x%x 0x%x\r\n", SREC_CHECKSUM(arr), checksum(arr));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
xprintf("unsupported report type %d in print_record\r\n", arr[0]);
|
xprintf("unsupported report type %d in print_record\r\n", arr[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* _NOT_USED_ */
|
#endif /* _NOT_USED_ */
|
||||||
|
|
||||||
@@ -151,21 +151,21 @@ void print_record(uint8_t *arr)
|
|||||||
*/
|
*/
|
||||||
static void line_to_vector(uint8_t *buff, uint8_t *vector)
|
static void line_to_vector(uint8_t *buff, uint8_t *vector)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int length;
|
int length;
|
||||||
uint8_t *vp = vector;
|
uint8_t *vp = vector;
|
||||||
|
|
||||||
length = hex_to_byte(buff + 2);
|
length = hex_to_byte(buff + 2);
|
||||||
|
|
||||||
buff++;
|
buff++;
|
||||||
*vp++ = nibble_to_byte(*buff); /* record type. Only one single nibble */
|
*vp++ = nibble_to_byte(*buff); /* record type. Only one single nibble */
|
||||||
buff++;
|
buff++;
|
||||||
|
|
||||||
for (i = 0; i <= length; i++)
|
for (i = 0; i <= length; i++)
|
||||||
{
|
{
|
||||||
*vp++ = hex_to_byte(buff);
|
*vp++ = hex_to_byte(buff);
|
||||||
buff += 2;
|
buff += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -189,114 +189,114 @@ static void line_to_vector(uint8_t *buff, uint8_t *vector)
|
|||||||
*/
|
*/
|
||||||
err_t read_srecords(char *filename, void **start_address, uint32_t *actual_length, memcpy_callback_t callback)
|
err_t read_srecords(char *filename, void **start_address, uint32_t *actual_length, memcpy_callback_t callback)
|
||||||
{
|
{
|
||||||
FRESULT fres;
|
FRESULT fres;
|
||||||
FIL file;
|
FIL file;
|
||||||
err_t ret = OK;
|
err_t ret = OK;
|
||||||
|
|
||||||
if ((fres = f_open(&file, filename, FA_READ) == FR_OK))
|
if ((fres = f_open(&file, filename, FA_READ) == FR_OK))
|
||||||
{
|
{
|
||||||
uint8_t line[80];
|
uint8_t line[80];
|
||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
int data_records = 0;
|
int data_records = 0;
|
||||||
bool found_block_header = false;
|
bool found_block_header = false;
|
||||||
bool found_block_end = false;
|
bool found_block_end = false;
|
||||||
bool found_block_data = false;
|
bool found_block_data = false;
|
||||||
|
|
||||||
while (ret == OK && (uint8_t *) f_gets((char *) line, sizeof(line), &file) != NULL)
|
while (ret == OK && (uint8_t *) f_gets((char *) line, sizeof(line), &file) != NULL)
|
||||||
{
|
{
|
||||||
lineno++;
|
lineno++;
|
||||||
uint8_t vector[80];
|
uint8_t vector[80];
|
||||||
|
|
||||||
line_to_vector(line, vector); /* vector now contains the decoded contents of line, from line[1] on */
|
line_to_vector(line, vector); /* vector now contains the decoded contents of line, from line[1] on */
|
||||||
|
|
||||||
if (line[0] == 'S')
|
if (line[0] == 'S')
|
||||||
{
|
{
|
||||||
if (SREC_CHECKSUM(vector) != checksum(vector))
|
if (SREC_CHECKSUM(vector) != checksum(vector))
|
||||||
{
|
{
|
||||||
xprintf("invalid checksum 0x%x (should be 0x%x) in line %d\r\n",
|
xprintf("invalid checksum 0x%x (should be 0x%x) in line %d\r\n",
|
||||||
SREC_CHECKSUM(vector), checksum(vector), lineno);
|
SREC_CHECKSUM(vector), checksum(vector), lineno);
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (vector[0])
|
switch (vector[0])
|
||||||
{
|
{
|
||||||
case 0: /* block header */
|
case 0: /* block header */
|
||||||
found_block_header = true;
|
found_block_header = true;
|
||||||
if (found_block_data || found_block_end)
|
if (found_block_data || found_block_end)
|
||||||
{
|
{
|
||||||
xprintf("S7 or S3 record found before S0: S-records corrupt?\r\n");
|
xprintf("S7 or S3 record found before S0: S-records corrupt?\r\n");
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* three byte address field data record */
|
case 2: /* three byte address field data record */
|
||||||
if (!found_block_header || found_block_end)
|
if (!found_block_header || found_block_end)
|
||||||
{
|
{
|
||||||
xprintf("S3 record found before S0 or after S7: S-records corrupt?\r\n");
|
xprintf("S3 record found before S0 or after S7: S-records corrupt?\r\n");
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
ret = callback((uint8_t *) SREC_ADDR24(vector), SREC_DATA24(vector), SREC_DATA24_SIZE(vector));
|
ret = callback((uint8_t *) SREC_ADDR24(vector), SREC_DATA24(vector), SREC_DATA24_SIZE(vector));
|
||||||
data_records++;
|
data_records++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: /* four byte address field data record */
|
case 3: /* four byte address field data record */
|
||||||
if (!found_block_header || found_block_end)
|
if (!found_block_header || found_block_end)
|
||||||
{
|
{
|
||||||
xprintf("S3 record found before S0 or after S7: S-records corrupt?\r\n");
|
xprintf("S3 record found before S0 or after S7: S-records corrupt?\r\n");
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
ret = callback((uint8_t *) SREC_ADDR32(vector), SREC_DATA32(vector), SREC_DATA32_SIZE(vector));
|
ret = callback((uint8_t *) SREC_ADDR32(vector), SREC_DATA32(vector), SREC_DATA32_SIZE(vector));
|
||||||
data_records++;
|
data_records++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: /* four byte address field end record */
|
case 7: /* four byte address field end record */
|
||||||
if (!found_block_header || found_block_end)
|
if (!found_block_header || found_block_end)
|
||||||
{
|
{
|
||||||
xprintf("S7 record found before S0 or after S7: S-records corrupt?\r\n");
|
xprintf("S7 record found before S0 or after S7: S-records corrupt?\r\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// xprintf("S7 record (end) found after %d valid data blocks\r\n", data_records);
|
// xprintf("S7 record (end) found after %d valid data blocks\r\n", data_records);
|
||||||
*start_address = (void *) SREC_ADDR32(vector);
|
*start_address = (void *) SREC_ADDR32(vector);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8: /* three byte address field end record */
|
case 8: /* three byte address field end record */
|
||||||
if (!found_block_header || found_block_end)
|
if (!found_block_header || found_block_end)
|
||||||
{
|
{
|
||||||
xprintf("S8 record found before S0 or after S8: S-records corrupt?\r\n");
|
xprintf("S8 record found before S0 or after S8: S-records corrupt?\r\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// xprintf("S7 record (end) found after %d valid data blocks\r\n", data_records);
|
// xprintf("S7 record (end) found after %d valid data blocks\r\n", data_records);
|
||||||
*start_address = (void *) SREC_ADDR24(vector);
|
*start_address = (void *) SREC_ADDR24(vector);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
xprintf("unsupported record type (%d) found in line %d\r\n", vector[0], lineno);
|
xprintf("unsupported record type (%d) found in line %d\r\n", vector[0], lineno);
|
||||||
xprintf("offending line: \r\n");
|
xprintf("offending line: \r\n");
|
||||||
xprintf("%s\r\n", line);
|
xprintf("%s\r\n", line);
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xprintf("illegal character ('%c') found on line %d: S-records corrupt?\r\n", line[0], lineno);
|
xprintf("illegal character ('%c') found on line %d: S-records corrupt?\r\n", line[0], lineno);
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f_close(&file);
|
f_close(&file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xprintf("could not open file %s\r\n", filename);
|
xprintf("could not open file %s\r\n", filename);
|
||||||
ret = FILE_OPEN;
|
ret = FILE_OPEN;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -304,21 +304,21 @@ err_t read_srecords(char *filename, void **start_address, uint32_t *actual_lengt
|
|||||||
*/
|
*/
|
||||||
static err_t simulate()
|
static err_t simulate()
|
||||||
{
|
{
|
||||||
err_t ret = OK;
|
err_t ret = OK;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _NOT_USED_
|
#ifdef _NOT_USED_
|
||||||
static err_t flash(uint8_t *dst, uint8_t *src, uint32_t length)
|
static err_t flash(uint8_t *dst, uint8_t *src, uint32_t length)
|
||||||
{
|
{
|
||||||
err_t ret = OK;
|
err_t ret = OK;
|
||||||
|
|
||||||
/* TODO: do the actual flash */
|
/* TODO: do the actual flash */
|
||||||
amd_flash_program(dst, src, length, false, NULL, xputchar);
|
amd_flash_program(dst, src, length, false, NULL, xputchar);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* _NOT_USED_ */
|
#endif /* _NOT_USED_ */
|
||||||
|
|
||||||
@@ -326,17 +326,17 @@ static err_t flash(uint8_t *dst, uint8_t *src, uint32_t length)
|
|||||||
/*
|
/*
|
||||||
* this callback verifies the data against the S-record file contents after a write to destination
|
* this callback verifies the data against the S-record file contents after a write to destination
|
||||||
*/
|
*/
|
||||||
static err_t verify(uint8_t *dst, uint8_t *src, uint32_t length)
|
static err_t verify(uint8_t *dst, uint8_t *src, size_t length)
|
||||||
{
|
{
|
||||||
uint8_t *end = src + length;
|
uint8_t *end = src + length;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (*src++ != *dst++)
|
if (*src++ != *dst++)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
} while (src < end);
|
} while (src < end);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -344,86 +344,86 @@ static err_t verify(uint8_t *dst, uint8_t *src, uint32_t length)
|
|||||||
*/
|
*/
|
||||||
static inline err_t srec_memcpy(uint8_t *dst, uint8_t *src, size_t n)
|
static inline err_t srec_memcpy(uint8_t *dst, uint8_t *src, size_t n)
|
||||||
{
|
{
|
||||||
err_t e = OK;
|
err_t e = OK;
|
||||||
|
|
||||||
memcpy((void *) dst, (void *) src, n);
|
memcpy((void *) dst, (void *) src, n);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
void srec_execute(char *flasher_filename)
|
void srec_execute(char *flasher_filename)
|
||||||
{
|
{
|
||||||
DRESULT res;
|
DRESULT res;
|
||||||
FRESULT fres;
|
FRESULT fres;
|
||||||
FATFS fs;
|
FATFS fs;
|
||||||
FIL file;
|
FIL file;
|
||||||
err_t err;
|
err_t err;
|
||||||
void *start_address;
|
void *start_address;
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
|
|
||||||
disk_initialize(0);
|
disk_initialize(0);
|
||||||
res = disk_status(0);
|
res = disk_status(0);
|
||||||
if (res == RES_OK)
|
if (res == RES_OK)
|
||||||
{
|
{
|
||||||
fres = f_mount(0, &fs);
|
fres = f_mount(0, &fs);
|
||||||
if (fres == FR_OK)
|
if (fres == FR_OK)
|
||||||
{
|
{
|
||||||
if ((fres = f_open(&file, flasher_filename, FA_READ) != FR_OK))
|
if ((fres = f_open(&file, flasher_filename, FA_READ) != FR_OK))
|
||||||
{
|
{
|
||||||
xprintf("flasher file %s not present on disk\r\n", flasher_filename);
|
xprintf("flasher file %s not present on disk\r\n", flasher_filename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
f_close(&file);
|
f_close(&file);
|
||||||
|
|
||||||
/* first pass: parse and check for inconsistencies */
|
/* first pass: parse and check for inconsistencies */
|
||||||
xprintf("check file integrity: ");
|
xprintf("check file integrity: ");
|
||||||
err = read_srecords(flasher_filename, &start_address, &length, simulate);
|
err = read_srecords(flasher_filename, &start_address, &length, simulate);
|
||||||
if (err == OK)
|
if (err == OK)
|
||||||
{
|
{
|
||||||
/* next pass: copy data to destination */
|
/* next pass: copy data to destination */
|
||||||
xprintf("OK.\r\ncopy/flash data: ");
|
xprintf("OK.\r\ncopy/flash data: ");
|
||||||
err = read_srecords(flasher_filename, &start_address, &length, srec_memcpy);
|
err = read_srecords(flasher_filename, &start_address, &length, srec_memcpy);
|
||||||
if (err == OK)
|
if (err == OK)
|
||||||
{
|
{
|
||||||
/* next pass: verify data */
|
/* next pass: verify data */
|
||||||
xprintf("OK.\r\nverify data: ");
|
xprintf("OK.\r\nverify data: ");
|
||||||
err = read_srecords(flasher_filename, &start_address, &length, verify);
|
err = read_srecords(flasher_filename, &start_address, &length, verify);
|
||||||
if (err == OK)
|
if (err == OK)
|
||||||
{
|
{
|
||||||
xprintf("OK.\r\n");
|
xprintf("OK.\r\n");
|
||||||
typedef void void_func(void);
|
typedef void void_func(void);
|
||||||
void_func *func;
|
void_func *func;
|
||||||
xprintf("target successfully written and verified. Start address: %p\r\n", start_address);
|
xprintf("target successfully written and verified. Start address: %p\r\n", start_address);
|
||||||
|
|
||||||
func = start_address;
|
func = start_address;
|
||||||
flush_and_invalidate_caches();
|
flush_and_invalidate_caches();
|
||||||
(*func)();
|
(*func)();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xprintf("failed\r\n");
|
xprintf("failed\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xprintf("failed\r\n");
|
xprintf("failed\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xprintf("failed\r\n");
|
xprintf("failed\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// xprintf("could not mount FAT FS\r\n");
|
// xprintf("could not mount FAT FS\r\n");
|
||||||
}
|
}
|
||||||
f_mount(0, NULL);
|
f_mount(0, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// xprintf("could not initialize SD card\r\n");
|
// xprintf("could not initialize SD card\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user