diff --git a/BaS_gcc/.indent.pro b/BaS_gcc/.indent.pro new file mode 100644 index 0000000..a37afc0 --- /dev/null +++ b/BaS_gcc/.indent.pro @@ -0,0 +1,22 @@ +-bad +-bap +-bbb +-bbo +-bl +-blf +-bli0 +-bls +-bs +-cbi0 +-cdb +-cli4 +-cs +-i4 +-lp +-saf +-sai +-saw +-ts4 +-npcs +-npsl + diff --git a/BaS_gcc/Makefile b/BaS_gcc/Makefile index cb588ab..01c3e6f 100644 --- a/BaS_gcc/Makefile +++ b/BaS_gcc/Makefile @@ -28,19 +28,21 @@ CPP=$(TCPREFIX)cpp OBJCOPY=$(TCPREFIX)objcopy AR=$(TCPREFIX)ar RANLIB=$(TCPREFIX)ranlib +NATIVECC=gcc INCLUDE=-Iinclude CFLAGS=-mcpu=5474\ - -Wall\ + -Wall\ -g \ - -fomit-frame-pointer\ - -ffreestanding\ - -fleading-underscore\ - -Wa,--register-prefix-optional + -fomit-frame-pointer\ + -ffreestanding\ + -fleading-underscore\ + -Wa,--register-prefix-optional SRCDIR=sources TRGTDIRS= ./firebee ./m5484lite OBJDIRS=$(patsubst %, %/objs,$(TRGTDIRS)) +TOOLDIR=util # Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC) LDCFILE=bas.lk @@ -204,6 +206,9 @@ depend: $(ASRCS) $(CSRCS) do $(CC) $(CFLAGS) $(INCLUDE) -M $(ASRCS) $(CSRCS) | sed -e "s#^\(.*\).o:#$$d/objs/\1.o:#" >> depend; \ done +indent: $(CSRCS) + indent $< + .PHONY: tags tags: ctags sources/* include/* @@ -221,3 +226,7 @@ else ifeq (MACHINE_FIREBEE,$(MACHINE)) MNAME=firebee endif +tools: + $(NATIVECC) $(INCLUDE) -c $(TOOLDIR)/s19header.c -o $(TOOLDIR)/s19header.o + $(NATIVECC) -o $(TOOLDIR)/s19header $(TOOLDIR)/s19header.o + diff --git a/BaS_gcc/util/s19header.c b/BaS_gcc/util/s19header.c index 550ffe4..22f0340 100644 --- a/BaS_gcc/util/s19header.c +++ b/BaS_gcc/util/s19header.c @@ -27,14 +27,15 @@ #include #include #include +#include #include "s19reader.h" /* * Yes, I know. The following doesn't really look like code should look like... * - * I did try to map structures over the S-records with (packed) which didn't work reliably due to gcc _not_ packing them appropiate - * and finally ended up with this. Not nice, put paid (and working). + * I did try to map structures over the S-records with (packed) which didn't work reliably due to + * gcc _not_ packing them appropiate and finally ended up with this. Not nice, put paid (and working). * */ #define SREC_TYPE(a) (a)[0] /* type of record */ @@ -238,6 +239,8 @@ int main(int argc, char *argv[]) { lineno++; uint8_t vector[80]; + char str[255]; + int length; @@ -263,8 +266,16 @@ int main(int argc, char *argv[]) printf("S7 or S3 record found before S0: S-records corrupt?\r\n"); ret = FAIL; } + printf("address: 0x%04x\n", SREC_ADDR16(vector)); printf("length of record: %d\n", SREC_COUNT(vector)); - printf("comment: %s\n", &vector[4]); + length = SREC_DATA16_SIZE(vector) - (SREC_DATA16(vector) - vector); + printf("length: %d\n", length); + strncpy(str, SREC_DATA16(vector), length); + str[length] = '\0'; + printf("Name: %s\n", str); + printf("version: %d, revision %d\n", + * (unsigned short *)((char *) SREC_DATA16(vector) + length), + * (unsigned short *)((char *) SREC_DATA16(vector) + length + 1)); break; @@ -348,19 +359,6 @@ static err_t simulate() } -#ifdef _NOT_USED_ -static err_t flash(uint8_t *dst, uint8_t *src, uint32_t length) -{ - err_t ret = OK; - - /* TODO: do the actual flash */ - amd_flash_program(dst, src, length, false, NULL, xputchar); - - return ret; -} -#endif /* _NOT_USED_ */ - - /* * this callback verifies the data against the S-record file contents after a write to destination */