From a97e460bea62375c9c870fb3e3650fbff20c5ad1 Mon Sep 17 00:00:00 2001
From: laforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>
Date: Wed, 13 Sep 2006 16:02:52 +0000
Subject: Completely separate DFU from application program, we now have a real
 bootloader. DFU occupies 0x00100000 - 0x00100fff in flash, application starts
 at 0x00101000. DFU also occupies the first couple of bytes in SRAM,
 application starts at 0x00200024.

In order to produce a samba-flashable image, first build dfu.bin by typing
'make -f Makefule.dfu', succeeded by 'make TARGET=... DEBUG=... BOARD=...' and then
concatenating the two files together, e.g. cat dfu.bin main_reqa.bin > flash.bin.

Actual flashing via DFU is still not operational, but will be implemented next


git-svn-id: https://svn.openpcd.org:2342/trunk@194 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
---
 firmware/doc/dfu.txt | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

(limited to 'firmware/doc')

diff --git a/firmware/doc/dfu.txt b/firmware/doc/dfu.txt
index 9b40c3c..78fe5a6 100644
--- a/firmware/doc/dfu.txt
+++ b/firmware/doc/dfu.txt
@@ -86,4 +86,46 @@ dfu_api				x	x	flash (const anyway)
 dfu_state			x	x	RAM
 
 
+preconditions:
+	- dfu code assumes to be loaded to address zero to make it work from both ram and rom
+
+startup:
+	- exception vectors (in flash)
+	- call lowlevel_init
+	- setup user/supervisor/FIQ/IRQ stack
+	- relocate dfu_state
+	- if DFU switch is pressed
+		- jump to dfu_main in flash
+			- relocate all of DFU .text/.data into ram (including exception vectors)
+			- initialize DFU .bss
+			- remap RAM to address zero
+
+	- if DFU switch is not pressed jump to entry address of app
+		- Cstartup_app.S
+			- relocate application .data
+			- initialize application .bss
+			- jump to appliction main 
+			- application uses dfu_api in flash, pointing to in-flash data
+			- application calls dfu_switch()
+				- disable all interupts but USB
+				- relocate all of DFU .text/.data into ram (including exception vectors)
+				- remap RAM to address zero
+				- check whether app has already remapped RAM before !?!
+
+memory map:
+
+load_addr	run_Addr
+0x00100000	0x00000000	exception vectors (DFU Cstartup)
+				Cstartup_SAM7
+
+		0x00200000	
+
+
+DFU constants:
+_etext:
+_data:	0x200000
+_edata:
+
+APP contants:
+_data: _edata_dfu
 
-- 
cgit v1.2.3