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:
Markus Fröschle
2013-11-07 14:46:10 +00:00
parent 0a1212d649
commit c5523093e6
3 changed files with 50 additions and 21 deletions

View File

@@ -27,14 +27,15 @@
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#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
*/