bootloader: Jump to application code after serial communication is done.
[gps-watch.git] / src / bootloader / main.rs
index 16255f601b4a0c2ab8874fe19d434174a3312a59..d83702e734c5369c31cbabd84d6174e7aff12825 100644 (file)
 extern crate common;
 
 mod flash;
+mod bootloader;
 
 use common::clock;
 use common::usb_serial;
 
+extern {
+    fn jump_to_application(address: u32);
+}
+
+const APPLICATION_ADDR: u32 = 0x0;
+
 #[no_mangle]
 pub unsafe extern fn main() {
     clock::configure();
@@ -39,7 +46,11 @@ pub unsafe extern fn main() {
     if true {
         usb_serial::init();
 
-        loop {
+        let mut b = bootloader::Bootloader::new();
+
+        while b.run() {
         }
     }
+
+    jump_to_application(__application_addr);
 }