V3 Switch Flasher
----------------------

This is a simple flasher utility, which can be used to load the initial DataFlash 
image (containing AT91Bootstrap and Barebox) or to recover the system from a broken
DF update.

The code is based on the V2 MCH flasher (although not compatibile with the V2 anymore). 

Flashing instructions:
-----------------------

 Connect the PC to the miniUSB connector on the SCB board (next to big JTAG IDC header)
- If there is some broken content in the DF which passess Atmel's builtin ROM checks, but doesn't boot,
  short pins 3 and 4 of the DF chip (the 8-pin IC in the corner of the PCB right next to the CPU).
- Power up or reset the SCB
- Un-short pins 3 and 4 of the DF chip
- Run the flasher: 
  ./mch_flasher name_of_the_image /dev/CDC_Device

	The CDC device is usually /dev/ttyACM0.
	
Troubleshooting:
------------------

- File not found error: make sure the directory containing the mch_flasher binary also 
  contains the subdirectory "samba_applets". 
- "Invalid response from applet": connect a serial port to the DBGU connector and launch the
  flasher again to see what is going on. There's no easy way of passing debug messages via Atmel's
  SAM-BA in USB mode.
  

Re-building the applets:

There are two applets used by the flasher to program the DF. One is called "extram" and it performs
the initialization of the DDR2 memory, and the other is called "dataflash" and does the actual programming.

- Go to samba_applets/isp-project/(extram/dataflash)
- Run build.sh. You may eventually need to change your cross-compiler path.
- Tested with OS-less ARM compilers (Codesourcery). Linux toolchain probably won't work due to libc
  API incompatibilities.