Switched from explicit port definitions in asm
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sun, 22 Nov 2009 03:20:03 +0000 (03:20 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sun, 22 Nov 2009 03:20:03 +0000 (03:20 +0000)
to preprocessor definitions.  gfports.h, being included
in assembly, MUST NOT contain any C function definitions.

This fixes MSP430 flash programming from the GoodFET30.

git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@230 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/apps/jtag/jtag430asm.S
firmware/include/gfports.h [new file with mode: 0644]
firmware/include/platform.h

index 5bbf352..7e4aabf 100644 (file)
@@ -1,6 +1,9 @@
 .globl jtag430_tclk_flashpulses
 .type jtag430_tclk_flashpulses,@function //for linking
 
+#define _GNU_ASSEMBLER_
+#include "gfports.h"
+
 //This detects model, chooses appropriate timing.
 jtag430_tclk_flashpulses:
        mov &0x0ff0, r14
@@ -11,7 +14,7 @@ jtag430_tclk_flashpulses:
 // At 3.68MHz, 7 to 14 cycles/loop are allowed for 257 to 475kHz.
 // At 16MHz, 33 to 62 cycles/loop are allowed.
 jtag430_tclk_flashpulses_3mhz:
-       mov #0x0031, r14
+       mov #P5OUT, r14
 pulseloop3:
        bis.b #2, @r14          ;SETTCLK, 3 cycles
        sub #1, r15             ; 1 cycle
@@ -26,7 +29,7 @@ pulseloop3:
        ret
 
 jtag430_tclk_flashpulses_16mhz:
-       mov #0x0031, r14
+       mov #P5OUT, r14
 pulseloop16:   
        bis.b #2, @r14          ;SETTCLK, 3 cycles
        sub #1, r15             ; 1 cycle
diff --git a/firmware/include/gfports.h b/firmware/include/gfports.h
new file mode 100644 (file)
index 0000000..59fe4ce
--- /dev/null
@@ -0,0 +1,34 @@
+/*! \file gfports.h
+  \author Travis Goodspeed
+  \brief GoodFET Port Definitions
+*/
+
+#ifndef GFPORTS
+#define GFPORTS
+
+#include <io.h>
+
+// N.B., only asm-clean CPP definitions allowed.
+
+//Use P3 instead of P5 for target I/O on chips without P5.
+#ifndef __MSP430_HAS_PORT5__
+#ifndef __MSP430_HAS_PORT5_R__
+#warning "No P5, using P3 instead.  Will break 2618 and 1612 support."
+#define P5OUT P3OUT
+#define P5DIR P3DIR
+#define P5REN P3REN
+#define P5IN P3IN
+
+#endif
+#endif
+
+//Use false P5REN for 1612.
+#ifdef __MSP430_HAS_PORT5__
+#ifndef __MSP430_HAS_PORT5_R__
+#warning "1xx, using fake P5REN for external pulling resistors."
+#define P5REN P5OUT
+#endif
+#endif
+
+
+#endif //GFPORTS
index 5de88ca..113549c 100644 (file)
 #include <io.h>
 #include <iomacros.h>
 
-
-//Use P3 instead of P5 for target I/O on chips without P5.
-#ifndef __MSP430_HAS_PORT5__
-#ifndef __MSP430_HAS_PORT5_R__
-#warning "No P5, using P3 instead.  Will break 2618 and 1612 support."
-#define P5OUT P3OUT
-#define P5DIR P3DIR
-#define P5REN P3REN
-#define P5IN P3IN
-
-#endif
-#endif
-
-//Use false P5REN for 1612.
-#ifdef __MSP430_HAS_PORT5__
-#ifndef __MSP430_HAS_PORT5_R__
-#warning "1xx, using fake P5REN for external pulling resistors."
-#define P5REN P5OUT
-#endif
-#endif
+#include "gfports.h"
 
 unsigned char serial_rx();
 void serial_tx(unsigned char);