
****************************************************************************************************
This folder is associated with the Application Note


   	ADSP-CM40x Serial Flash Execute-in-Place Technology(EE-363)

that can be found at http://www.analog.com/ee-notes.

Date Created:	21/10/2015

****************************************************************************************************
CONTENTS

	1. DESCRIPTION
	2. VERSION INFORMATION
	3. DIRECTORY STRUCTURE
	4. EXTERNAL CONNECTIONS

****************************************************************************************************
1. DESCRIPTION

The folder contains the LED_Blink_Flash project that illustrates the speed of code execution between Internal SRAM and Internal SPI Flash. The example also provides a sample Linker Configuration File that shows how to call a function inside Internal Flash from Internal SRAM, with the entire application executing directly from Flash after power-on. 

It nails down several facts related to ADSP-CM40x processor performance, visually :-

a.	Internal SRAM can run at very high rates.
b.	Internal SPI Flash access can be cached.
c.	Internal SPI Flash can run with cache-bypassed mode also, though with significantly lower speed.
d.	Improving CGU and SPI rates will improve access performance.
e.	Quick configuration of the application for optimal operation in a direct flash execution boot scenario.


Example code Description :-

User has to follow the sequence as it is, for using the code as a demonstration example.
An LED blinks with rate that is relative to the placement of its code as well as the optimized condition.

#define PREFETCH_ENABLE
#define XIP_ENABLE

1.  Comment    #define PLACE_FLASH 
    Comment    #define BYPASS_CACHE
    Comment    #define SET_CLOCKS
    Comment    #define PREFETCH_ENABLE
    Comment    #define XIP_ENABLE

    Observation: LED blinks very fast because it runs from SRAM.

2.  Uncomment  #define PLACE_FLASH 
    Comment    #define BYPASS_CACHE
    Comment    #define SET_CLOCKS
    Uncomment  #define PREFETCH_ENABLE
    Uncomment  #define XIP_ENABLE

    Observation: LED blinks very fast because after first iteration, the code is brought in to Cache.

3.  Uncomment #define PLACE_FLASH 
    Uncomment #define BYPASS_CACHE
    Comment   #define SET_CLOCKS
    Comment    #define PREFETCH_ENABLE
    Comment    #define XIP_ENABLE

    Observation: LED blinks very slow because cache is now bypassed

4.  Uncomment #define PLACE_FLASH 
    Uncomment #define BYPASS_CACHE
    Uncomment #define SET_CLOCKS
    Comment   #define PREFETCH_ENABLE
    Comment   #define XIP_ENABLE

    Observation: LED blinks faster than #3(though slower than SRAM case, #1) because CGU and SPI is now optimized, even if Cache is still bypassed.


****************************************************************************************************
2. VERSION INFORMATION

Tested on:

IDE: 	  IAR Embedded Workbench for ARM 7.40.1
Hardware: ADSP-CM408F EZ-KIT board revision 0.2, BOM Revision 0.7
    	  ADSP-CM403F EZ-Kit board revision 1.0, BOM Revision 0.7
	  Silicon Revision H

****************************************************************************************************
3. DIRECTORY STRUCTURE
		
- LED_Blink_Flash
     -src
     
	Init_CGU.c - Initializes CGU.
	LED_Blink_Flash.c - Contains main() function and places led blink code in flash/SRAM memory.
	Memory_placement.h - Contains User configurable MACROs. 
	SystemUtil.c - Configures XIP mode, cache, clocks and different memory regions.

****************************************************************************************************
4. EXTERNAL CONNECTIONS

None
