Chipcon entry in ASM.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Mon, 1 Mar 2010 02:22:55 +0000 (02:22 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Mon, 1 Mar 2010 02:22:55 +0000 (02:22 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@378 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/Makefile
firmware/apps/chipcon/chipcon.c
firmware/apps/chipcon/chipconasm.S [new file with mode: 0644]

index 531f3d1..443d016 100644 (file)
@@ -26,7 +26,7 @@ CC=msp430-gcc -Wall -Os -g -mmcu=$(mcu) -D$(mcu) -DGCC $(GCCINC) -I include $(CC
 moreapps?=apps/i2c/i2c.o apps/chipcon/chipcon.o apps/glitch/glitch.o apps/jtag/sbw.o apps/smartcard/smartcard.o
 
 apps= $(moreapps) apps/monitor/monitor.o apps/spi/spi.o   apps/jtag/jtag.o apps/jtag/jtag430.o apps/jtag/jtag430x2.o apps/avr/avr.o apps/jtag/ejtag.o
 moreapps?=apps/i2c/i2c.o apps/chipcon/chipcon.o apps/glitch/glitch.o apps/jtag/sbw.o apps/smartcard/smartcard.o
 
 apps= $(moreapps) apps/monitor/monitor.o apps/spi/spi.o   apps/jtag/jtag.o apps/jtag/jtag430.o apps/jtag/jtag430x2.o apps/avr/avr.o apps/jtag/ejtag.o
-libs= lib/$(mcu).o lib/command.o apps/jtag/jtag430asm.o
+libs= lib/$(mcu).o lib/command.o apps/jtag/jtag430asm.o apps/chipcon/chipconasm.o
 app= goodfet
 
 all: $(app).hex
 app= goodfet
 
 all: $(app).hex
index 1f4b3d4..ce0a9ff 100644 (file)
@@ -56,6 +56,22 @@ void ccsetup(){
   //P5REN=0xFF;
 }
 
   //P5REN=0xFF;
 }
 
+
+/* 33 cycle critical region
+0000000e <ccdebuginit>:
+   e:  f2 d0 0d 00     bis.b   #13,    &0x0031 ;5 cycles
+  12:  31 00 
+  14:  f2 c2 31 00     bic.b   #8,     &0x0031 ;4 cycles
+  18:  d2 c3 31 00     bic.b   #1,     &0x0031 ;4
+  1c:  f2 e2 31 00     xor.b   #8,     &0x0031 ;4
+  20:  f2 e2 31 00     xor.b   #8,     &0x0031 ;4
+  24:  f2 e2 31 00     xor.b   #8,     &0x0031 ;4
+  28:  f2 e2 31 00     xor.b   #8,     &0x0031 ;4
+  2c:  d2 d3 31 00     bis.b   #1,     &0x0031 ;4
+  30:  30 41           ret                     
+*/
+
+/*
 //! Initialize the debugger
 void ccdebuginit(){
   //Port output BUT NOT DIRECTION is set at start.
 //! Initialize the debugger
 void ccdebuginit(){
   //Port output BUT NOT DIRECTION is set at start.
@@ -78,6 +94,10 @@ void ccdebuginit(){
   //Raise !RST.
   P5OUT|=RST;
 }
   //Raise !RST.
   P5OUT|=RST;
 }
+*/
+
+//! Initialize the debugger.
+void ccdebuginit(); 
 
 //! Read and write a CC bit.
 unsigned char cctrans8(unsigned char byte){
 
 //! Read and write a CC bit.
 unsigned char cctrans8(unsigned char byte){
diff --git a/firmware/apps/chipcon/chipconasm.S b/firmware/apps/chipcon/chipconasm.S
new file mode 100644 (file)
index 0000000..09e8683
--- /dev/null
@@ -0,0 +1,32 @@
+.globl ccdebuginit
+.type ccdebuginit,@function //for linking
+
+#define _GNU_ASSEMBLER_
+#include "gfports.h"
+
+       
+//In assembly for cycle-counting, not for efficiency.
+//
+ccdebuginit:
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       nop                     ;1 cycle
+       
+       bis.b   #13,    &0x0031 ;5 cycles
+       bic.b   #8,     &0x0031 ;4 cycles
+       bic.b   #1,     &0x0031 ;4
+       xor.b   #8,     &0x0031 ;4
+       xor.b   #8,     &0x0031 ;4
+       xor.b   #8,     &0x0031 ;4
+;;     xor.b   #8,     &0x0031 ;4
+       bis.b   #1,     &0x0031 ;4
+       ret