First Test

Assuming that you didn't change or save anything in the original distribution of this example code, there will be precompiled code available that allows you to immediately download it to RAM of the board and to test the design. As this is a RAM based build, the current application within FLASH of the board (if any) will be left intact and available after next stand-alone Target reset.

Start Embedded Workbench, select Open existing Workspace in the startup dialog, browse to .\ew\demo_at91sam7x (a .EWW file) and open it. Ensure that you are looking at the Debug_RAM_Realink build configuration as indicated in the combobox at the top of the WorkSpace panel. If not, select that item in the ComboBox. You should see something like this (click to see full size image):

Note the vsCoder section in the WorkSpace tree view. It contains the visualSTATE project file JoyStick.vsp which is expanded to show the pre-generated files for this example by virtue of the Build Integration of Embedded Workbench and visualSTATE. Also note that all sources are unmarked for compilation as this is already done. You could download the resulting image directly to the target, but you would have problems using the Debugger as it would not be able to find the source files that are referenced in the ELF/DWARF linker output file by absolute path specifiers. The precompiled image was created for the entire project residing in directory C:\IAR\AT91SAM9xKickStart so unless you have your copy of the project in exactly that place you will need to rebuild the project doing Project->Rebuild All. This should succeed without any errors or warnings shown in Messages pane at the bottom part of Embedded Workbench.

Now select Project->Debug (Ctrl+D) or press the rightmost button on the (standard) toolbar. The application will be downloaded to RAM of the target board, start running and then stop at the main() function (as per setting in the Project Options for this configuration). You will see a screen like this:

EWARM with project downloaded to Target

Now click Debug->Go (F5) or press to Go button on the Toolbar. The Target starts running and you can test the joystick functionality. Press Debug->Break, Debug->Reset and Debug->Go again to repeat startup and note on the Target board that its flashes the LEDs a bit immediately after startup. This behaviour is NOT modelled in the StateChart but rather hard coded in the main() function as a minimalistic 'self-test' routine.

Stop the C-Spy debugger by Debug->Stop Debugging (Ctrl+Shift+D). You can either continue from here to build the example yourself - see Build with RealLink - or test out the RealLink functionality; see Using RealLink. In case you take the first option, it may be helpful to first read the section on the Implementation of the example.