]> git.sur5r.net Git - openocd/commitdiff
rlink: fix speed table generation
authorPaul Fertser <fercerpav@gmail.com>
Sun, 2 Jun 2013 09:28:37 +0000 (13:28 +0400)
committerSpencer Oliver <spen@spen-soft.co.uk>
Mon, 3 Jun 2013 10:59:59 +0000 (10:59 +0000)
The speed table generation (by using explicit
make -f Makefile.rlink) was broken since
865efd828a267992db0f2a92a731c5ce23a34236 Dec 2 2009 which did a bunch of
renaming and included hand-editing of a generated rlink_speed_table.c file.

This patch is compile-tested, i.e. the new generated rlink_speed_table.c
links fine with the rlink driver.

Change-Id: I1789a2f2f5bf20183b772d55c55fe68a0bd05cf5
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1431
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/jtag/drivers/Makefile.rlink
tools/rlink_make_speed_table/rlink_make_speed_table.pl

index 94c53f50ea8b4db63a16df481b3de4749c7a4f48..37630e18665a757d0b5d5c2b258501dc97f60bac 100644 (file)
@@ -51,10 +51,10 @@ DTCFILES += $(addsuffix _call.dtc, ${PRESCALERS})
 
 default: rlink_speed_table.c clean
 
-%_init.fsm: init.m4
+%_init.fsm: rlink_init.m4
        ${M4} -P -DSHIFTER_PRESCALER=`echo "$@" | sed -e's/_.*//'` $< > $@
 
-%_call.fsm: call.m4
+%_call.fsm: rlink_call.m4
        ${M4} -P -DSHIFTER_PRESCALER=`echo "$@" | sed -e's/_.*//'` $< > $@
 
 %.dtc: %.fsm
index 910fbf822cea578ff6af87b8ffe97ce25e9650cc..305d1703c554271d7d2e2c4a6059e73a50ee06a5 100755 (executable)
@@ -32,7 +32,7 @@ print <<HEADER;
 #endif
 
 #include "rlink.h"
-#include "st7.h"
+#include "rlink_st7.h"
 
 HEADER
 
@@ -49,12 +49,12 @@ for $prescaler (sort {$b <=> $a} @ARGV) {
        $bytes =~ s/(^|\s)(.{70}?\S*)/\2\n/go;  # break up long lines
        $bytes =~ s/\n +/\n/go;
        $bytes =~ s/(^|\n)/\1\t/go;             # format nicely
-       printf("static const u8 dtc_%d[] = {\n%s\n};\n\n", $prescaler, $bytes);
+       printf("static const uint8_t dtc_%d[] = {\n%s\n};\n\n", $prescaler, $bytes);
        push(@speed_table, sprintf("\tdtc_%d, sizeof(dtc_%d), (ST7_FOSC * 2) / (1000 * %d), %d\n", $prescaler, $prescaler, $prescaler, $prescaler));
 }
 
-printf("const rlink_speed_table_t rlink_speed_table[] = {{\n%s}};\n\n", join("}, {\n", @speed_table));
-printf("const size_t rlink_speed_table_size = sizeof(rlink_speed_table) / sizeof(*rlink_speed_table);\n\n");
+printf("const struct rlink_speed_table rlink_speed_table[] = { {\n%s} };\n\n", join("}, {\n", @speed_table));
+printf("const size_t rlink_speed_table_size = ARRAY_SIZE(rlink_speed_table);\n\n");
 
 
 sub byte_array_from_file {