got it to actually build + a few more cleanups
diff --git a/gyro_board/src/usb/.gitignore b/gyro_board/src/usb/.gitignore
new file mode 100644
index 0000000..fb4dc0a
--- /dev/null
+++ b/gyro_board/src/usb/.gitignore
@@ -0,0 +1,3 @@
+*.o
+main.elf
+main.hex
diff --git a/gyro_board/src/usb/Makefile b/gyro_board/src/usb/Makefile
index b91b6a5..8bf7da3 100644
--- a/gyro_board/src/usb/Makefile
+++ b/gyro_board/src/usb/Makefile
@@ -4,7 +4,14 @@
 
 CSRC=main.c
 
-GCC_PATH=/usr/local/cortex-m3/bin
+# See if /opt/cortex-m3 exists first, because that's the preferred location. If
+# not, fall back to /usr/local/cortex-m3.
+ifneq ($(wildcard /opt/cortex-m3),)
+	TOOLS_PREFIX=/opt/cortex-m3
+else
+	TOOLS_PREFIX=/usr/local/cortex-m3
+endif
+GCC_PATH=$(TOOLS_PREFIX)/bin
 
 PORT=/dev/ttyS1
 
@@ -43,7 +50,7 @@
 all: $(NAME).hex
 
 $(NAME).elf: Makefile $(SOURCES:.c=.o) $(LDSCRIPT)
-	$(CC) $(CFLAGS) -nostartfiles -nostdlib -T $(LDSCRIPT) -o $@ -L/usr/local/cortex-m3/lib/gcc/arm-eabi/4.5.1/ $(SOURCES:.c=.o) -Wa,-Map -Wa,main.map -lgcc
+	$(CC) $(CFLAGS) -nostartfiles -nostdlib -T $(LDSCRIPT) -o $@ -L$(TOOLS_PREFIX)/lib/gcc/arm-eabi/4.5.1/ $(SOURCES:.c=.o) -Wa,-Map -Wa,main.map -lgcc
 
 %.o: %.c Makefile
 	$(CC) $(CFLAGS) -nostartfiles -nostdlib -c -o $@ $< -Wall -std=gnu99
@@ -59,6 +66,9 @@
 
 assm.S: $(NAME).elf
 	$(OBJDUMP) -D -S $(NAME).elf > $@
+# So that you can see the assembly for an individual file with any comments etc.
+%.s: %.c Makefile
+	$(CC) $(CFLAGS) -nostartfiles -nostdlib -S -o $@ $< -Wall -std=gnu99
 
 %.hex: %.elf Makefile
 	$(OBJCOPY) -O ihex $< $@
diff --git a/gyro_board/src/usb/analog.c b/gyro_board/src/usb/analog.c
index cbbee63..a956a5d 100644
--- a/gyro_board/src/usb/analog.c
+++ b/gyro_board/src/usb/analog.c
@@ -159,31 +159,27 @@
 volatile int32_t encoder5_val;
 
 // ENC1A 2.11
-static void EINT1_IRQHandler(void) {
+void EINT1_IRQHandler(void) {
+  // TODO(brians): need to test this on hardware, but I think this should be
+  // below the EXTPOLAR set
   SC->EXTINT = 0x2;
-  // TODO(brians): figure out whether this style or the style in all the rest
-  // generates nicer code and then make them all the same
-  int stored_val = encoder1_val;
   int fiopin = GPIO2->FIOPIN;
   if (((fiopin >> 1) ^ fiopin) & 0x800) {
-    ++stored_val;
+    ++encoder1_val;
   } else {
-    --stored_val;
+    --encoder1_val;
   }
-  encoder1_val = stored_val;
   SC->EXTPOLAR ^= 0x2;
 }
 // ENC1B 2.12
-static void EINT2_IRQHandler(void) {
+void EINT2_IRQHandler(void) {
   SC->EXTINT = 0x4;
-  int stored_val = encoder1_val;
   int fiopin = GPIO2->FIOPIN;
   if (((fiopin >> 1) ^ fiopin) & 0x800) {
-    --stored_val;
+    --encoder1_val;
   } else {
-    ++stored_val;
+    ++encoder1_val;
   }
-  encoder1_val = stored_val;
   SC->EXTPOLAR ^= 0x4;
 }
 
@@ -398,18 +394,18 @@
 
 // Count leading zeros.
 // Returns 0 if bit 31 is set etc.
-__attribute__((always_inline)) static __INLINE uint8_t __clz(uint32_t value) {
-  uint8_t result;
-  __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value));
+__attribute__((always_inline)) static __INLINE uint32_t __clz(uint32_t value) {
+  uint32_t result;
+  __asm__("clz %0, %1" : "=r" (result) : "r" (value));
   return result;
 }
 inline static void IRQ_Dispatch(void) {
   // TODO(brians): think about adding a loop here so that we can handle multiple
   // interrupts right on top of each other faster
-  uint8_t index = __clz(GPIOINT->IO2IntStatR | GPIOINT->IO0IntStatR |
+  uint32_t index = __clz(GPIOINT->IO2IntStatR | GPIOINT->IO0IntStatR |
       (GPIOINT->IO2IntStatF << 28) | (GPIOINT->IO0IntStatF << 4));
 
-	typedef void (*Handler)(void);
+  typedef void (*Handler)(void);
   const static Handler table[] = {
     Encoder5BFall,     // index 0: P2.3 Fall     #bit 31  //Encoder 5 B  //Dio 10
     Encoder5AFall,     // index 1: P2.2 Fall     #bit 30  //Encoder 5 A  //Dio 9
@@ -594,10 +590,10 @@
 
   xTaskCreate(vDelayCapture,
               (signed char *) "SENSORs",
-      				configMINIMAL_STACK_SIZE + 100,
-      				NULL /*parameters*/,
-      				tskIDLE_PRIORITY + 5,
-      				NULL /*return task handle*/);
+              configMINIMAL_STACK_SIZE + 100,
+              NULL /*parameters*/,
+              tskIDLE_PRIORITY + 5,
+              NULL /*return task handle*/);
 
   GPIOINT->IO0IntEnF |= (1 << 4);  // Set GPIO falling interrupt
   GPIOINT->IO0IntEnR |= (1 << 4);  // Set GPIO rising interrupt