==========================================================================
                          USB Stick Bootloader
==========================================================================
                 (C) Fujitsu Semiconductor Europe GmbH (FSEU)           
                                                                      
   The following software deliverable is intended for and must only be  
   used for reference and in an evaluation laboratory environment.      
   It is provided on an as-is basis without charge and is subject to    
   alterations.                                                         
   It is the user's obligation to fully test the software in its        
   environment and to ensure proper functionality, qualification and    
   compliance with component specifications.                            
                                                                      
   In the event the software deliverable includes the use of open       
   source components, the provisions of the governing open source       
   license agreement shall apply with respect to such software          
   deliverable.                                                         
   FSEU does not warrant that the deliverables do not infringe any      
   third party intellectual property right (IPR). In the event that     
   the deliverables infringe a third party IPR it is the sole           
   responsibility of the customer to obtain necessary licenses to       
   continue the usage of the deliverable.                               
                                                                      
   To the maximum extent permitted by applicable law FSEU disclaims all 
   warranties, whether express or implied, in particular, but not       
   limited to, warranties of merchantability and fitness for a          
   particular purpose for which the deliverable is not designated.      
                                                                      
   To the maximum extent permitted by applicable law, FSEU's liability  
   is restricted to intentional misconduct and gross negligence.        
   FSEU is not liable for consequential damages.                        
                                                                      
   (V1.5)                                                        
==========================================================================
Histrory

Date       Ver AE  IAR    ARM  Description
2012-02-11 1.0 MSc 6.40.5 4.10 First Version
2013-02-11 1.1 MSc 6.40.5 4.10 Bootloader updated to new USB Stack 
==========================================================================

User Code Application:
#########################

ROM start and interrupt vector has to be linked to 0x00004000.
0x00000000 - 0x00004000 is locked for bootloader.

On USB stick the motorola s-record file must be placed.
Name must be:
For MB9BF506N: 9bf506n.mhx
For MB9BFD18T: 9bfd18t.mhx
...

If 9bfxxxx.mhx was not found, "app.mhx" is used.

Example firmwares (Simple counter) are in the folder "usbmassstorage_content" 
and must be placed on root directory of an USB mass storage (e.g. USB Stick).

PROJECT ADJUSTMENTS (IAR):
==========================
The following lines were changed in the standard FM3 template linker files (*.icf):

/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00004000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00004000;

PROJECT ADJUSTMENTS (KEIL):
===========================
Project -> Options for Target 'Release' -> Target:
IROM1 - Start must be changed from 0x0 to 0x00004000

Bootoader:
#########################

The bootloader starts only at power on or if no user code application exists.
The seven segment display shows following status:
01: Bootoader started
02: USB Stick detected
03: User Code found
04: Start erasing flash
05: Start flashing
00: Operation completed successfully, remove USB Stick
11: Error while erasing, System halt
12: Error CRC, System halt

PROJECT ADJUSTMENTS (IAR):
==========================

For using RAM code for Flash erase/programming routines copied to RAM
automatically by start-up and executed later in RAM, the following
lines were added to the standard FM3 template linker files (*.icf):

define symbol __RAM_func_start__   = 0x20000000;
define symbol __RAM_func_end__     = 0x20007FFF;
define region RAM_func_region =   mem:[from __RAM_func_start__ to __RAM_func_end__];

define block RamCode {section .flash_ram_code};
place in RAM_func_region  { block RamCode };


PROJECT ADJUSTMENTS (KEIL):
===========================

For using RAM code for Flash erase/programming routines copied to RAM
automatically by start-up and executed later in RAM, the following
adjustment was done:

Options for flash.c	-> Properties -> Memory Assignment -> Code / Const:
IRAM (0x2000000-0x20007FFF)

Read application note mcu-an-300401-e-fm3_flash_programming for
further details.




