Skip to content

Commit

Permalink
v.0.8.13 Now supporting the SREC format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Milo-D committed Sep 6, 2021
1 parent cc5a237 commit 7c5ff52
Show file tree
Hide file tree
Showing 42 changed files with 375 additions and 208 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

# Unreleased

- nothing to log

# v.0.8.13 - 2021-09-06

- Now supporting Motorola SRecord

- merged pull-request (#68) from pointbazaar (Alexander Hansen)
- added format reader for motorola hex (SRecord)
- thanks for that :)

- refactored srec format reader (PR #68)
- adjusted style
- fixed some minor bugs

- connected srec format reader to pipeline

- Important: file extension decides which reader will be invoked
- *.hex ==> invokes intel hex reader
- *.srec ==> invokes srec reader

- added format reader interface (reader/reader.c)
- reader for different file formats can be now added to reader/format/
- for example reader/format/ihex.c to read the intel hex format
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int main(const int argc, const char **argv) {

/* ignoring checks for this example */
vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_ihex("file.hex", m328p);
vmcu_report_t *report = vmcu_analyze_file("file.hex", m328p);

for(uint32_t i = 0; i < report->cfg->used; i++) {
Expand Down Expand Up @@ -127,7 +127,7 @@ int main(const int argc, const char **argv) {

/* ignoring checks for this example */
vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_ihex("file.hex", m328p);
vmcu_report_t *report = vmcu_analyze_file("file.srec", m328p);

for(uint32_t i = 0; i < report->progsize; i++) {

Expand Down Expand Up @@ -161,7 +161,7 @@ int main(const int argc, const char **argv) {

/* ignoring checks for this example */
vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_ihex("file.hex", m328p);
vmcu_report_t *report = vmcu_analyze_file("file.hex", m328p);

for(uint32_t i = 0; i < report->progsize; i++) {

Expand Down Expand Up @@ -195,7 +195,7 @@ int main(const int argc, const char **argv) {

/* ignoring checks for this example */
vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_ihex("file.hex", m328p);
vmcu_report_t *report = vmcu_analyze_file("file.hex", m328p);

for(uint32_t i = 0; i < report->n_vector; i++) {

Expand Down Expand Up @@ -237,7 +237,7 @@ int main(const int argc, const char **argv) {

/* ignoring checks for this example */
vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_ihex("file.hex", m328p);
vmcu_report_t *report = vmcu_analyze_file("file.hex", m328p);

for(uint32_t i = 0; i < report->n_label; i++) {

Expand Down Expand Up @@ -287,7 +287,7 @@ int main(const int argc, const char **argv) {

/* ignoring checks for this example */
vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_ihex("file.hex", m328p);
vmcu_report_t *report = vmcu_analyze_file("file.hex", m328p);

for(uint32_t i = 0; i < report->n_sfr; i++) {

Expand Down Expand Up @@ -510,7 +510,7 @@ take a look at engine/*/arch/

- [ ] format reader
- [x] intel hex
- [ ] motorola hex
- [x] motorola hex
- [ ] bin
- [ ] elf

Expand Down
4 changes: 4 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ These are a some of my ideas for the future of libvmcu
[10] a python binding would be really great.
[10.1] requires external contributors :( see CONTRIBUTING.txt

[11] make libvmcu thread safe

/********************************* Internal / Cleanup *****************************/

[12] remove usage of basic integers (int) in libvmcu (nearly done)
Expand All @@ -41,3 +43,5 @@ These are a some of my ideas for the future of libvmcu
[14] speed up controlflow analysis by adding a lookup table for the cfg nodes

[15] fix inconsistency of xref-to

[16] a consistent way to return readable error codes (not just -1 and 0)
4 changes: 2 additions & 2 deletions driver/cfg/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./skeleton <hexfile>\n");
printf("Usage: ./skeleton <binary>\n");
return EXIT_FAILURE;
}

atexit(cleanup);

m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
report = vmcu_analyze_ihex(argv[1], m328p);
report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL)
return EXIT_FAILURE;
Expand Down
4 changes: 2 additions & 2 deletions driver/disasm/disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./skeleton <hexfile>\n");
printf("Usage: ./skeleton <binary>\n");
return EXIT_FAILURE;
}

atexit(cleanup);
m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);

uint32_t progsize = 0;
vmcu_instr_t *prog = vmcu_disassemble_ihex(argv[1], &progsize, m328p);
vmcu_instr_t *prog = vmcu_disassemble_file(argv[1], &progsize, m328p);

if(prog == NULL || progsize == 0)
return EXIT_FAILURE;
Expand Down
4 changes: 2 additions & 2 deletions driver/endloop/endloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./endloop <file.hex>\n");
printf("Usage: ./endloop <binary>\n");
return EXIT_FAILURE;
}

vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_ihex(argv[1], m328p);
vmcu_report_t *report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL) {

Expand Down
4 changes: 2 additions & 2 deletions driver/findgroup/findgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ int main(const int argc, const char **argv) {

if(argc != 3) {

printf("Usage: ./findgroup <file.hex> <group>\n");
printf("Usage: ./findgroup <binary> <group>\n");
return EXIT_FAILURE;
}

atexit(cleanup);

m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
report = vmcu_analyze_ihex(argv[1], m328p);
report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL)
return EXIT_FAILURE;
Expand Down
4 changes: 2 additions & 2 deletions driver/findisr/findisr.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(const int argc, const char **argv) {

if(argc < 2) {

printf("Usage: ./findisr <hexfile>\n");
printf("Usage: ./findisr <binary>\n");
return EXIT_FAILURE;
}

Expand All @@ -76,7 +76,7 @@ int main(const int argc, const char **argv) {
const char* filename = argv[argc-1];
m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);

if((report = vmcu_analyze_ihex(filename, m328p)) == NULL)
if((report = vmcu_analyze_file(filename, m328p)) == NULL)
return EXIT_FAILURE;

uint32_t start_index = 0;
Expand Down
4 changes: 2 additions & 2 deletions driver/graph/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./cfg <hexfile>\n");
printf("Usage: ./cfg <binary>\n");
return EXIT_FAILURE;
}

vmcu_model_t* m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t* report = vmcu_analyze_ihex(argv[1], m328p);
vmcu_report_t* report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL)
return EXIT_FAILURE;
Expand Down
4 changes: 2 additions & 2 deletions driver/labels/labels.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./labels <file.hex>\n");
printf("Usage: ./labels <binary>\n");
return EXIT_FAILURE;
}

vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_ihex(argv[1], m328p);
vmcu_report_t *report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL) {

Expand Down
2 changes: 1 addition & 1 deletion driver/led/ledtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int main(const int argc, const char **argv) {
if((m328p = vmcu_model_ctor(VMCU_DEVICE_M328P)) == NULL)
return EXIT_FAILURE;

if((report = vmcu_analyze_ihex(TESTFILE, m328p)) == NULL)
if((report = vmcu_analyze_file(TESTFILE, m328p)) == NULL)
return EXIT_FAILURE;

if((sys = vmcu_system_ctor(report)) == NULL)
Expand Down
4 changes: 2 additions & 2 deletions driver/occurence/occurence.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void bubblesort(void **array, int length, int (*compar)(const void *, const void
int main(int argc, char* argv[]) {

if(argc != 2) {
printf("Expected hex file argument. exiting.\n");
printf("Expected binary file as argument. exiting.\n");
return 1;
}

Expand All @@ -73,7 +73,7 @@ int main(int argc, char* argv[]) {
const char* fname = argv[argc-1];

vmcu_model_t* m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t* report = vmcu_analyze_ihex(fname, m328p);
vmcu_report_t* report = vmcu_analyze_file(fname, m328p);

if(report == NULL) {

Expand Down
4 changes: 2 additions & 2 deletions driver/rwaccess/rwaccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./rwaccess <hexfile>\n");
printf("Usage: ./rwaccess <binary>\n");
return EXIT_FAILURE;
}

atexit(cleanup);

m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
report = vmcu_analyze_ihex(argv[1], m328p);
report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL)
return EXIT_FAILURE;
Expand Down
4 changes: 2 additions & 2 deletions driver/sca/sca.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./sca <file.hex>\n");
printf("Usage: ./sca <binary>\n");
return EXIT_FAILURE;
}

vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);

vmcu_report_t *report = vmcu_analyze_ihex(FILE, m328p);
vmcu_report_t *report = vmcu_analyze_file(FILE, m328p);
vmcu_system_t *sys = vmcu_system_ctor(report);

char cracked[LENGTH] = "";
Expand Down
4 changes: 2 additions & 2 deletions driver/sfr/sfr.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./sfr <hexfile>\n");
printf("Usage: ./sfr <binary>\n");
return EXIT_FAILURE;
}

vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_ihex(argv[1], m328p);
vmcu_report_t *report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL) {

Expand Down
4 changes: 2 additions & 2 deletions driver/skeleton/skeleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./skeleton <hexfile>\n");
printf("Usage: ./skeleton <binary>\n");
return EXIT_FAILURE;
}

atexit(cleanup);

m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
report = vmcu_analyze_ihex(argv[1], m328p);
report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL)
return EXIT_FAILURE;
Expand Down
4 changes: 2 additions & 2 deletions driver/speed/speed.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./speed <hexfile>\n");
printf("Usage: ./speed <binary>\n");
return EXIT_FAILURE;
}

atexit(cleanup);

m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
report = vmcu_analyze_ihex(argv[1], m328p);
report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL)
return EXIT_FAILURE;
Expand Down
4 changes: 2 additions & 2 deletions driver/stepper/stepper.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./skeleton <hexfile>\n");
printf("Usage: ./skeleton <binary>\n");
return EXIT_FAILURE;
}

atexit(cleanup);

m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
report = vmcu_analyze_ihex(argv[1], m328p);
report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL)
return EXIT_FAILURE;
Expand Down
4 changes: 2 additions & 2 deletions driver/strings/strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./strings <hexfile>\n");
printf("Usage: ./strings <binary>\n");
return EXIT_FAILURE;
}

atexit(cleanup);

m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
report = vmcu_analyze_ihex(argv[1], m328p);
report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL)
return EXIT_FAILURE;
Expand Down
4 changes: 2 additions & 2 deletions driver/vcdump/vcdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int main(const int argc, const char **argv) {

if(argc < 4) {

printf("Usage: ./vcdump <hexfile> <cycles> <values to be monitored>+\n");
printf("Usage: ./vcdump <binary> <cycles> <values to be monitored>+\n");
return EXIT_FAILURE;
}

Expand All @@ -53,7 +53,7 @@ int main(const int argc, const char **argv) {

m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);

if((report = vmcu_analyze_ihex(filename, m328p)) == NULL)
if((report = vmcu_analyze_file(filename, m328p)) == NULL)
return EXIT_FAILURE;

sys = vmcu_system_ctor(report);
Expand Down
4 changes: 2 additions & 2 deletions driver/vector/vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ int main(const int argc, const char **argv) {

if(argc != 2) {

printf("Usage: ./vector <hexfile>\n");
printf("Usage: ./vector <binary>\n");
return EXIT_FAILURE;
}

atexit(cleanup);

m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
report = vmcu_analyze_ihex(argv[1], m328p);
report = vmcu_analyze_file(argv[1], m328p);

if(report == NULL)
return EXIT_FAILURE;
Expand Down
Loading

0 comments on commit 7c5ff52

Please sign in to comment.