From 624e690f62f9ad3df259a8b1ad7919fd8fdc3ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Sun, 17 Feb 2013 07:30:14 +0000 Subject: [PATCH] modified to enable remote debugging of basflash.s19. basflash.s19 does not work in this version (hang)! --- BaS_gcc/Makefile | 2 +- BaS_gcc/basflash.lk.in | 13 ++++--------- BaS_gcc/sources/basflash_start.c | 2 -- BaS_gcc/sources/s19reader.c | 23 ++++++++++++----------- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/BaS_gcc/Makefile b/BaS_gcc/Makefile index a1093e3..36fc825 100644 --- a/BaS_gcc/Makefile +++ b/BaS_gcc/Makefile @@ -107,7 +107,7 @@ $(RAM_EXEC): TARGET_ADDRESS=0x10000000 $(RAM_EXEC): LDCFILE=ram.lk $(RAM_EXEC): MAPFILE=ram.map -$(BASFLASH_EXEC): TARGET_ADDRESS=0x00100000 +$(BASFLASH_EXEC): TARGET_ADDRESS=0x00040000 $(BASFLASH_EXEC): LDCFILE=basflash.lk $(BASFLASH_EXEC): MAPFILE=basflash.map diff --git a/BaS_gcc/basflash.lk.in b/BaS_gcc/basflash.lk.in index d7f80be..9d51b88 100644 --- a/BaS_gcc/basflash.lk.in +++ b/BaS_gcc/basflash.lk.in @@ -15,20 +15,15 @@ SECTIONS *(.rodata) *(.rodata.*) } > flasher - - .bas : - /* The BaS is stored in the flash, just after the init part. - * Then it will be copied to its final location in the RAM. - * This data must be aligned for optimal copy loop speed. - */ - AT (ALIGN(ADDR(.text) + SIZEOF(.text), 4)) + + .bas : { } - + #define BAS_LABEL_LMA(x) ((x)) _xprintf_before_copy = BAS_LABEL_LMA(_xprintf); _display_progress_before_copy = BAS_LABEL_LMA(_display_progress); - _flush_and_invalidate_caches_before_copy = BAS_LABEL_LMA(_flush_and_invalidate_caches); + /* _flush_and_invalidate_caches_before_copy = BAS_LABEL_LMA(_flush_and_invalidate_caches); */ /* * Global memory map diff --git a/BaS_gcc/sources/basflash_start.c b/BaS_gcc/sources/basflash_start.c index c0869fb..1398e98 100644 --- a/BaS_gcc/sources/basflash_start.c +++ b/BaS_gcc/sources/basflash_start.c @@ -9,8 +9,6 @@ void startup(void) { void basflash(void); - void init_serial(void); - init_serial(); basflash(); } diff --git a/BaS_gcc/sources/s19reader.c b/BaS_gcc/sources/s19reader.c index 8ca6b3c..2710979 100644 --- a/BaS_gcc/sources/s19reader.c +++ b/BaS_gcc/sources/s19reader.c @@ -43,12 +43,12 @@ #define SREC_TYPE(a) (a)[0] /* type of record */ #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_ADDR32(a) (0x1000000 * a[2] + 0x10000 * \ - a[3] + 0x100 * (a)[4] + (a)[5]) /* 4 byte address field */ #define SREC_ADDR24(a) (0x10000 * (a)[2] + 0x100 * \ (a)[3] + (a)[4]) /* 3 byte address field */ +#define SREC_ADDR32(a) (0x1000000 * a[2] + 0x10000 * \ + 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_DATA24(a) ((uint8_t *)&((a)[3])) /* address of first data bite 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_DATA16_SIZE(a) (SREC_COUNT((a)) - 3) /* length of the data[] array without the checksum field */ #define SREC_DATA24_SIZE(a) (SREC_COUNT((a)) - 4) /* length of the data[] array without the checksum field */ @@ -147,22 +147,22 @@ void print_record(uint8_t *arr) /* * convert an S-record line into its corresponding byte vector (ASCII->binary) */ -static void line_to_vector(uint8_t *line, uint8_t *vector) +static void line_to_vector(uint8_t *buff, uint8_t *vector) { int i; int length; uint8_t *vp = vector; - length = hex_to_byte(line + 2); + length = hex_to_byte(buff + 2); - line++; - *vp++ = nibble_to_byte(*line); /* record type. Only one single nibble */ - line++; + buff++; + *vp++ = nibble_to_byte(*buff); /* record type. Only one single nibble */ + buff++; for (i = 0; i <= length; i++) { - *vp++ = hex_to_byte(line); - line += 2; + *vp++ = hex_to_byte(buff); + buff += 2; } } @@ -203,7 +203,7 @@ err_t read_srecords(char *filename, void **start_address, uint32_t *actual_lengt while (ret == OK && (uint8_t *) f_gets((char *) line, sizeof(line), &file) != NULL) { lineno++; - uint8_t vector[64]; + uint8_t vector[80]; line_to_vector(line, vector); /* vector now contains the decoded contents of line, from line[1] on */ @@ -292,6 +292,7 @@ err_t read_srecords(char *filename, void **start_address, uint32_t *actual_lengt else { xprintf("could not open file %s\r\n", filename); + ret = FILE_OPEN; } return ret; }