added .indent.pro to enable indent source code formatting
modified s19header to printout the current header modified Makefile to build s19header.c in utils directory
This commit is contained in:
22
.indent.pro
vendored
Normal file
22
.indent.pro
vendored
Normal file
@@ -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
|
||||||
|
|
||||||
9
Makefile
9
Makefile
@@ -28,6 +28,7 @@ CPP=$(TCPREFIX)cpp
|
|||||||
OBJCOPY=$(TCPREFIX)objcopy
|
OBJCOPY=$(TCPREFIX)objcopy
|
||||||
AR=$(TCPREFIX)ar
|
AR=$(TCPREFIX)ar
|
||||||
RANLIB=$(TCPREFIX)ranlib
|
RANLIB=$(TCPREFIX)ranlib
|
||||||
|
NATIVECC=gcc
|
||||||
|
|
||||||
INCLUDE=-Iinclude
|
INCLUDE=-Iinclude
|
||||||
CFLAGS=-mcpu=5474\
|
CFLAGS=-mcpu=5474\
|
||||||
@@ -41,6 +42,7 @@ CFLAGS=-mcpu=5474\
|
|||||||
SRCDIR=sources
|
SRCDIR=sources
|
||||||
TRGTDIRS= ./firebee ./m5484lite
|
TRGTDIRS= ./firebee ./m5484lite
|
||||||
OBJDIRS=$(patsubst %, %/objs,$(TRGTDIRS))
|
OBJDIRS=$(patsubst %, %/objs,$(TRGTDIRS))
|
||||||
|
TOOLDIR=util
|
||||||
|
|
||||||
# Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC)
|
# Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC)
|
||||||
LDCFILE=bas.lk
|
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; \
|
do $(CC) $(CFLAGS) $(INCLUDE) -M $(ASRCS) $(CSRCS) | sed -e "s#^\(.*\).o:#$$d/objs/\1.o:#" >> depend; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
indent: $(CSRCS)
|
||||||
|
indent $<
|
||||||
|
|
||||||
.PHONY: tags
|
.PHONY: tags
|
||||||
tags:
|
tags:
|
||||||
ctags sources/* include/*
|
ctags sources/* include/*
|
||||||
@@ -221,3 +226,7 @@ else ifeq (MACHINE_FIREBEE,$(MACHINE))
|
|||||||
MNAME=firebee
|
MNAME=firebee
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
tools:
|
||||||
|
$(NATIVECC) $(INCLUDE) -c $(TOOLDIR)/s19header.c -o $(TOOLDIR)/s19header.o
|
||||||
|
$(NATIVECC) -o $(TOOLDIR)/s19header $(TOOLDIR)/s19header.o
|
||||||
|
|
||||||
|
|||||||
@@ -27,14 +27,15 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "s19reader.h"
|
#include "s19reader.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Yes, I know. The following doesn't really look like code should look like...
|
* 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
|
* I did try to map structures over the S-records with (packed) which didn't work reliably due to
|
||||||
* and finally ended up with this. Not nice, put paid (and working).
|
* 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 */
|
#define SREC_TYPE(a) (a)[0] /* type of record */
|
||||||
@@ -238,6 +239,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
lineno++;
|
lineno++;
|
||||||
uint8_t vector[80];
|
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");
|
printf("S7 or S3 record found before S0: S-records corrupt?\r\n");
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
|
printf("address: 0x%04x\n", SREC_ADDR16(vector));
|
||||||
printf("length of record: %d\n", SREC_COUNT(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;
|
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
|
* this callback verifies the data against the S-record file contents after a write to destination
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user