Atmel AT91SAM9 CPU Support Package

This package contains project templates and system files for the Atmel AT91SAM9.

CrossWorks Version 2 Installation Instructions

To install this support package
  1. Click the Tools > Package Manager menu option to open the package manager window.
  2. Right click on the Atmel AT91SAM9 CPU Support Package entry and select Install Selected Packages.
  3. Click Next to take you to the summary page.
  4. Click Next to install the package.
  5. Click Finish to close the package manager window.
  6. Click the Tools > Show Installed Packages.
  7. Click on the Atmel AT91SAM9 CPU Support Package link to view the package and its contents.
To manually install this support package
  1. Download the file AT91SAM9.hzq using your web browser.
  2. Click the Tools > Manually Install Packages menu option.
  3. Select the file you have just downloaded to install the package.
  4. Click the Tools > Show Installed Packages.
  5. Click on the Atmel AT91SAM9 CPU Support Package link to view the package and its contents.
To install this support package using other versions

Release Notes

2.5

2.4

2.3

2.2

2.1

2.0

Documentation

Creating AT91SAM9 Projects

To create a new AT91SAM9 project
To build and debug an application

For a SAM9XE device the project will be built to run in internal flash. For a SAM9 device the project will be build to run in internal SRAM. If you wish to run from internal SRAM on a SAM9XE device then you should right click on the project node in the project explorer and select the ISRAM placement.

AT91SAM9 Project Specifics

Target Processor

There are two sets of target processors supported, Atmel AT91SAM9 and Atmel AT91SAM9XE. Once a project has been created you can select different target processors from the selected set by right clicking on the project node in the project explorer and selecting the Target Processor entry.

Selecting the target processor will specify the memory map that is used for the build and debug. You can view the selected memory map by right clicking on the project node in the project explorer and selecting View Memory Map or View Memory Map (as text). In the memory map files the memory segments defining the names, sizes and access types of the external memories are specified using macros which can be set using the Memory Map Macros project property. Similarly for memory map files that have TCM's the desired sizes of the TCM's can be specified.

Section Placement

CrossStudio for ARM supports AT91SAM9 projects running applications in a number of different memory configurations. You can select the memory configuration you require by right clicking on the project node in the project explorer and selecting the Placement entry.

For AT91SAM9 projects the set of placements are:

For AT91SAM9XE project the set of placements are:

Placement files that use SDRAM will allocate the first 16K of SDRAM for the MMU translation table. The internal NOR Flash placement file puts the MMU translation table into the internal NOR Flash. The internal SRAM placement file doesn't allocate an MMU translation table. All placement files use internal SRAM for the exception vectors.

Debug Handler

When you create a AT91SAM9 project a file is included in the build that implements additional (to JTAG) debug functionality. This file is used to implement monitor mode debug. This enables interrupts to occur when stopped on a breakpoint and memory to be examined without stopping the processor. The project setup code creates a debug project property Debug Handler that enables you to choose additional (to JTAG) debug capabilities you require:

Target Startup Code

The startup code AT91SAM9_Startup.s is common to all AT91SAM9 processors there are a set of preprocessor defines that configure the startup code and are documented in the startup file itself.

Target Reset Script

There are two reset scripts one for AT91SAM9_Target.js devices and one for AT91SAM9XE_Target.js devices. The reset script for the AT91SAM9XE enables the GPNVM bits to be displayed and programmed using the right click menu on the connected target in the Targets

AT91SAM9XE Internal Flash Loader

The flash loader for the internal NOR Flash of A91SAM9XE is provided. Source files to build flash loaders for external NOR Flash and DataFlash are provided which are used by the various AT91SAM9 board support packages.

AT91SAM9 DataFlash/SPIFlash Loader Files

The DataFlash/SPIFlash loaders are board specific, however the files that are common to all DataFlash/SPIFlash loaders are supplied in the AT91SAM9 CPU support package. The DataFlash/SPIFlash loader works by shadowing memory writes to the SDRAM section into the DataFlash/SPIFlash. You can specify the start address of memory to shadow in the Target Loader Options | Loader Parameter property. The DataFlash/SPIFlash loader adds the secondary boot loader to the start of the DataFlash/SPIFlash. Before it is written the secondary boot loader is updated with the start address the DataFlash/SPIFlash is copied to (and ultimately starts executing at) and the number of bytes to copy based on the highest shadowed address.

Memory Simulator

An AT91SAM9 memory simulator is provided that simulates the memories of the various AT91SAM9 devices. The memory simulation parameter (which is set by the Target Processor selection) contains macros that determine the sizes of the simulated memories and can be specified using the Memory Simulation Parameter Macros property.

Interrupt Handling

The file AIC.c implements the ctl_set_isr, ctl_unmask_isr and ctl_mask_isr functions by programming the AIC register group. The vector parameter to these functions corresponds to the peripheral identifier as defined in the appropriate device user manual. The priority parameter to the ctl_set_isr is between 0 and 7 then an ARM IRQ exception is generated. If nested interrupts are enabled on the irq_handler then the priority is a pre-emption priority i.e. interrupt handlers can be interrupted by higher priority interrupt handlers. If the priority parameter to the function ctl_set_isr is 8 then an ARM FIQ exception is generated. The file AIC_irq_handler.s implement the irq_handler and fiq_handler exception handlers.

Header Files

Header files are generated from the memory map files and can be included using the file AT91SAM9.h. The AT91SAM9 project setup adds the directory $(TargetsDir)/AT91SAM9 to the User Include Directories project property so that you can just include targets/AT91SAM9.h into your source code.

CrossWorks Sample Projects

The following project files are supplied that can be used to run the standard CrossWorks samples.