if device==None:
device=("0x%04x" % deviceid);
- return device;
+ return "%s %s" % (vendor,device);
#Connect to target
client.start();
+if(sys.argv[1]=="glitch"):
+ print "Identifies as %s" % client.identstr();
+ for i in range(1,20):
+ client.start();
+ print "Identifies as %s, fused 0x%02x" % (
+ client.identstr(),
+ client.lockbits());
+
if(sys.argv[1]=="info"):
print "Identifies as %s" % client.identstr();
if(sys.argv[1]=="erase"):
client.erase();
if(sys.argv[1]=="lockbits"):
print "Lockbits are 0x%02x" % client.lockbits();
+#if(sys.argv[1]=="lock"):
+#if(sys.argv[1]=="unlock"):
+
+
if(sys.argv[1]=="dump"):
f = sys.argv[2];
CC=msp430-gcc -Wall -Os -g -mmcu=$(mcu) -D$(mcu) -DGCC $(GCCINC) -I include $(CCEXTRA)
#Define extra modules here.
-moreapps?=apps/i2c/i2c.o apps/chipcon/chipcon.o
+moreapps?=apps/i2c/i2c.o apps/chipcon/chipcon.o apps/glitch/glitch.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
libs= lib/$(mcu).o lib/command.o apps/jtag/jtag430asm.o
#include <iomacros.h>
#include "avr.h"
+#include "glitch.h"
//! Setup the AVR pins.
void avrsetup(){
spisetup();
+
+ glitchsetup();
}
//! Initialized an attached AVR.
//! Locks the chip.
void cc_lockchip(){
- register i;
+ register int i;
debugstr("Locking chip.");
cc_wr_config(1);//Select Info Flash
unsigned char cc_peekdatabyte(unsigned int adr){
unsigned char
hb=(adr&0xFF00)>>8,
- lb=adr&0xFF,
- toret;
+ lb=adr&0xFF;
//MOV DPTR, adr
cc_debug(3, 0x90, hb, lb);
--- /dev/null
+/*! \file glitch.c
+ \author Travis Goodspeed
+ \brief Glitching Support for GoodFET20
+
+ See the TI example MSP430x261x_dac12_01.c for usage of the DAC.
+ This module sends odd and insufficient voltages on P6.6/DAC0
+ in order to bypass security restrictions of target devices.
+*/
+
+#include "platform.h"
+#include "command.h"
+#include "glitch.h"
+
+//! Disable glitch state at init.
+void glitchsetup(){
+#ifdef DAC12IR
+ //Set GSEL high to disable glitching.
+
+ P5DIR|=0x80;
+ P6DIR|=0x40;
+
+ P5OUT|=0x80;
+ P6OUT|=0x40;
+
+ glitchsetupdac();
+#endif
+}
+
+//! Setup analog chain for glitching.
+void glitchsetupdac(){
+#ifdef DAC12IR
+ int i;
+ ADC12CTL0 = REF2_5V + REFON; // Internal 2.5V ref on
+ // Delay here for reference to settle.
+ for(i=0;i!=0xFFFF;i++) asm("nop");
+ DAC12_0CTL = DAC12IR + DAC12AMP_5 + DAC12ENC; // Int ref gain 1
+ // 1.0V 0x0666, 2.5V 0x0FFF
+ DAC12_0DAT = 0x0FFF;
+ //DAC12_0DAT = 0x0880;
+ //__bis_SR_register(LPM0_bits + GIE); // Enter LPM0
+#endif
+}
#include "platform.h"\r
#include "command.h"\r
#include "apps.h"\r
-\r
+#include "glitch.h"\r
\r
\r
//LED on P1.0\r
unsigned long len;\r
\r
init();\r
+ glitchsetup();\r
\r
txstring(MONITOR,OK,"http://goodfet.sf.net/");\r
\r
+ \r
//Command loop. There's no end!\r
while(1){\r
//Magic 3\r
//256 bytes, plus overhead
//For chips with very little RAM.
#define CMDDATALEN 0x104
-#warning Very little RAM.
+//#warning Very little RAM.
#endif
#ifndef CMDDATALEN
--- /dev/null
+/*! \file glitch.h
+ \author Travis Goodspeed
+ \brief Glitch handler functions.
+*/
+
+#include <signal.h>
+#include <io.h>
+#include <iomacros.h>
+
+//! Disable glitch state at init.
+void glitchsetup();
+//! Setup analog chain for glitching.
+void glitchsetupdac();
unsigned int jtag430x2_syncpor();
//! Executes an MSP430X2 POR
unsigned int jtag430x2_por();
-
+//! Power-On Reset
+void jtag430_por();
//JTAG commands
#define JTAG_IR_SHIFT 0x80