aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorajmeyer@mit.edu <ajmeyer@mit.edu@749a229e-a60e-11de-b98f-4500b42dc123>2010-02-12 20:57:45 +0000
committerajmeyer@mit.edu <ajmeyer@mit.edu@749a229e-a60e-11de-b98f-4500b42dc123>2010-02-12 20:57:45 +0000
commit966e4ac594494f02a62d34bb9446ce1ff07dc54b (patch)
tree6f99c8c8c2bca9f0ab5b21319abec3da26f1552e
parent2826bbb424f15d61c5ef917dcfd5444e7e607b56 (diff)
downloadlibrambutan-966e4ac594494f02a62d34bb9446ce1ff07dc54b.tar.gz
librambutan-966e4ac594494f02a62d34bb9446ce1ff07dc54b.zip
modded the library makefile to work with patched dfu-util, also added the USER_FLASH section to the rom linker
git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@131 749a229e-a60e-11de-b98f-4500b42dc123
-rw-r--r--Makefile7
-rw-r--r--src/main.cpp5
-rw-r--r--src/main.cxx7
-rw-r--r--src/wiring/WProgram.h16
-rw-r--r--stm32conf/lanchon-stm32-user-rom.ld8
5 files changed, 27 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 350d73e..4d3f54c 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,9 @@ AS := arm-none-eabi-as
CP := arm-none-eabi-objcopy
OD := arm-none-eabi-objdump
+#todo: use an OS switch here to grab a different bin
+DFU = ../dfu-util/bin/linux/dfu-util
+
BUILD_PATH = build
LIB_PATH = lib
COMM_PATH = comm
@@ -180,10 +183,10 @@ jtag: $(BUILD_PATH)/main.bin
@echo "JTAG build"
program_ram: ram
- dfu-util -a0 -d 0110:1001 -D build/main.bin -R
+ $(DFU) -a0 -d 0110:1001 -D build/main.bin -R
program_flash: flash
- dfu-util -a1 -d 0110:1001 -D build/main.bin -R
+ $(DFU) -a1 -d 0110:1001 -D build/main.bin -R
program_jtag: jtag
openocd -f stm32conf/flash.cfg
diff --git a/src/main.cpp b/src/main.cpp
index 78b0f89..6f210e5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,6 +5,8 @@
#include "usb.h"
int ledPin = 13;
+HardwareUsb Usb;
+
void setup() {
pinMode(ledPin, OUTPUT);
}
@@ -13,7 +15,8 @@ int toggle = 1;
void loop() {
digitalWrite(ledPin, toggle);
toggle ^= 1;
- delay(100);
+ delay(1000);
+ Usb.println("hello world!");
}
int main(void) {
diff --git a/src/main.cxx b/src/main.cxx
index 7734d6e..24b6483 100644
--- a/src/main.cxx
+++ b/src/main.cxx
@@ -9,6 +9,13 @@ int main(void)
return 0;
}
+/* Required for C++ hackery */
+/* TODO: This really shouldn't go here... move it later
+ * */
+extern "C" void __cxa_pure_virtual(void) {
+ while(1)
+ ;
+}
/* Implemented:
* void pinMode(pin, mode)
diff --git a/src/wiring/WProgram.h b/src/wiring/WProgram.h
index 111c7dc..1d38776 100644
--- a/src/wiring/WProgram.h
+++ b/src/wiring/WProgram.h
@@ -1,17 +1,7 @@
-#include "stm32f10x_map.h"
-#include "stm32f10x_lib.h"
-#include "stm32f10x_flash.h"
-#include "stm32f10x_usart.h"
-#include "Serial.h"
-#include "timers.h"
#include "wiring.h"
-#include "util.h"
-#include "systick.h"
-#include "adc.h"
-#include "gpio.h"
-#include "pwm.h"
-#include "ext_interrupts.h"
-#include "usart.h"
+#include "HardwareSerial.h"
+#include "HardwareUsb.h"
+#include "math.h"
#include "usb.h"
void setup();
diff --git a/stm32conf/lanchon-stm32-user-rom.ld b/stm32conf/lanchon-stm32-user-rom.ld
index e6825e5..8fbf4b7 100644
--- a/stm32conf/lanchon-stm32-user-rom.ld
+++ b/stm32conf/lanchon-stm32-user-rom.ld
@@ -134,6 +134,14 @@ SECTIONS
. = ALIGN(8);
_etext = .;
} >rom
+
+/* expose a custom rom only section */
+ .USER_FLASH :
+ {
+ *(.USER_FLASH)
+ } >rom
+
+
/* __cs3_region_end_rom is deprecated */
__cs3_region_end_rom = __cs3_region_start_rom + LENGTH(rom);
__cs3_region_size_rom = LENGTH(rom);