CrossStudio's New Project Wizard simplifies the creation of projects for the ATMEL EB40A by creating a project with the appropriate project settings, memory map files and startup files. See Creating a New Project for more information on creating projects.

##### To create a new ATMEL EB40A project

- Select the File | New | New Project menu item.
- Select ATMEL EB40A Projects from the Project Type list.
- Select the required project template type from the Templates list.
- Set the required project name and location directory.
- Click OK.

CrossStudio for ARM supports the ATMEL EB40A running applications from both RAM and FLASH.

##### To build and debug an application running from RAM

- Select the project to work on by using the Project | Set Active Project menu option.
- Select the RAM configuration you require by using the Build | Set Active Build Configuration menu option.
- Build the project by using the Build | Build Project menu option.
- Connect to the appropriate target in the target window.
- Download and start debugging the current project by using Debug | Start Debugging.

##### To build and debug an application running from FLASH

Warning: Downloading to FLASH on the EB40A can erase part of the EB40A firmware. See Restoring EB40A Firmware for details of how CrossStudio can be used to restore the EB40A's firmware.

- Select the project to work on by using the Project | Set Active Project menu option.
- Select the FLASH configuration you require by using the Build | Set Active Build Configuration menu option.
- Build the project by using the Build | Build Project menu option.
- Set JP1 to USER.
- Connect to the appropriate target in the target window.
- Download and start debugging the current project by using Debug | Start Debugging.

The following sections describe the ATMEL EB40A support in more detail. See ARM Target Support for more information.

### Memory Map Files

The default memory map file $(StudioDir)/targets/ATMEL_EB40A/ATMEL_EB40A_MemoryMap.xml has been provided. This file is used to describe the memory layout of the target and is used for linking and debugging. The placement of program sections within the memory map for both RAM and FLASH configurations is described by the non-target-specific default memory maps $(StudioDir)/targets/flash_placement.xml and $(StudioDir)/targets/sram_placement.xml.

The memory segment layout for both configurations is the same and is described in the following table:

Type | Description | Start Address | End Address
FLASH | FLASH using NSC0 chip select line | 0x01000000 | 0x011FFFFF
RAM | On-chip Primary RAM Bank | 0x00000000 | 0x0003FFFF

### Target Startup Code

The default startup code is in $(StudioDir)/targets/ATMEL_EB40A/ATMEL_EB40A_Startup.s. It contains the exception vectors and the default exception handlers. The FLASH version of the code (specified by defining BUILD_FLASH) is also responsible for configuring memory to match the above memory map and copying the exception vectors into RAM.

### Restoring the EB40A Firmware

The FLASH memory on the EB40A is split into standard boot and user sections. The jumper JP1 controls which half of the FLASH memory is visible first in the address map. If the JP1 jumper has been set to SDT rather than USER or the application being downloaded is larger than 0x100000 bytes the EB40A's firmware will be overwritten. This is reversible as CrossStudio can be used to re-program the firmware image into FLASH.

##### To restore the EB40A Firmware

- Download and unzip http://www.atmel.com/dyn/resources/prod_documents/software_an_2668A.zip. Amongst other things, this file contains the binary images for the EB40A firmware.
- Set the EB40A's JP1 jumper to SDT.
- Connect to the ATMEL EB40A - FLASH target.
- Select the Target | Load menu option. When prompted for the file to download, select Binary_files/Boot/boot_eb40a.bin.
- When prompted for the start address, specify 0x01000000.
- Select the Target | Load menu option. When prompted for the file to download, select Binary_files/Angel/angel_eb40a.rom.
- When prompted for the start address, specify 0x01006000.
- Reset the target.