Home
AT91 ISP/SAM-BA User Guide
Contents
1. Note 1 Each string must be allocated from the application and must have a size superior to 80 bytes That string is used to recover in particular CAN dongle USB or JTAG box device name which is then replaced by a reduced symbolic name 3 7 1 1 2 Code Example CHAR strConnectedDevices 5 for UINT i 0 i lt 5 i strConnectedDevices i CHAR malloc 100 AT91Boot Scan char strConnectedDevices AMEL 3 6 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide AT91 ISP Architecture AT91Boot_Scan may return code similar to that below strConnectedDevices 0 usb ARMO strConnectedDevices 1 usb ARM1 strConnectedDevices 2 jlink ARMO strConnectedDevices 3 can AtCanPeak ARM strConnectedDevices 4 COM1 3 7 1 2 AT91Boot Open This function opens the communication link on an AT91SAM device depending on the string given in the argument m USB m JTAG m CAN m Serial COM port Note Atthis step the Atmel device MUST be connected to either SAM ICE JLink CAN network or COM port if using such a communication link 3 7 1 2 1 Description void AT91Boot Open char name int h handle Table 3 2 AT91Boot Open Type Name Details Input Parameters name Pointer to a string returned by AT91Boot_Scan function Communication handle Output Parameters h_handle NULL if opening connection failed Non NULL if opening connection succeeded Return Code void Note 1 As AT91Bo
2. dftAddress base address of the memory module 0x0 for memories not physically mapped like DataFlash or when accesses are not directly done but need a monitor like NAND Flash dftSize size of the memory module dftSend send file procedure name dftReceive receive file procedure name dftScripts name of the array containing the script list see Figure 4 3 below blank if no script is implemented Scripts can be implemented for each memory module Common uses are SDRAM initialization Flash erase operation or any other frequently used operation The scripts are displayed in the script listbox of the corresponding memory tab Their declaration is done by creating an array named in the dftScripts field of the memory array set at91sam7se512 nandflash dftDisplay 1 dftDefault 0 dftAddress 0x0 dftSize SGENERIC memorySize dftSend GENERIC SendFile dftReceive GENERIC ReceiveFile dftScripts at91sam7se512 nandflash scripts array set at91sam7se512 nandflash scripts Enable NandFlash NANDFLASH Init Erase All GENERIC EraseAll Scrub NandFlash GENERIC EraseAll NANDFLASH scrubErase set NANDFLASH appletAddr 0x20000000 set NANDFLASH appletFileName SlibPath extLib S target board isp nandflash at91sam7se512 bin The first field of each entry is the string displayed in the listbox and the second is the procedure name invoked when executing the script AMEL
3. 2 3 4 3 Script File Execution There are two possibilities to execute a script file m See Section 2 4 Running SAM BA Using the Command Line for more information on how to execute TCL script files from a shell m Use the command Execute Script File in the GUI Script File menu and enter the TCL file to execute Messages that inform of the correct execution of the script are displayed in the TCL Shell and or through message boxes Note All TCL commands can be executed through script files AT91 ISP SAM BA User Guide AIMEL 2 7 6421B ATARM 06 Jan 10 Running SAM BA 2 3 5 Disconnect It is possible to close the current connection if necessary by clicking on the corresponding Link Discon nect menu see Figure 2 10 Figure 2 10 Link Menu Fe SAM BA 2 7 AT91SAM9261 EK 2 8 6421B ATARM 06 Jan 10 File Script File ATS1SAM9261 Mer Link Help Disconnect j Start Address 0x300000 Refresh Display format Size in byte s 0x100 0x00300000 0x00300010 0x00300020 0x00300030 0x00300040 0x00300050 0x00300060 0x00300070 0x00300080 OxE5201647 Ox43B225F1 0x7D176F9D OxSBE7BSBF OxOB60EEC3 0x3469D566 Ox6D533C76 0x9984009D Ox2B545D45 OxOSFE7ACA 0x75553E17 O0x89C8A736 Ox0C84E696 OxC479D7FD OxFF43S5EDB OxS9FZBSBE OxO90DED57 Ox6A064EA3 AMEL OxSDOA3DSC 0x712792BF 0x74F40939 OxFFEEFDSC OxSDB6417A OxiEBCBO6B OxFAOE49BE Ox4C80107E OxDSAGEECB C ascii C 8bit C 16 bit 32 bit OxZODBFSOF Ox7BSSB1E
4. Download Upload File Send File Name Send File Receive File Name Receive File Address 0x0 Size For Receive File 0x1000 byte s Compare sent file with memory BIR Scripts Enable Dataflash SPIO CS0 sl Execute AMEL 2 4 6421B ATARM O6 Jan 10 AT91 ISP SAM BA User Guide Running SAM BA 2 3 3 1 Initialize Memory To be able to program data into the internal Flash memory or into the external memory SAM BA uses a small program called applet This applet is specific to each memory and device 2 3 3 2 Upload a File m First select the memory by clicking on its corresponding tab m Enter the file name location in the Send File name field or open the file browser by clicking on the Open Folder button and select it If you enter a wrong file name an error message will be displayed in the TCL Shell see Section 2 3 4 TCL Shell Area m Enter the destination address in the selected memory where the file should be written If you enter a forbidden address or if your file overruns the memory size an error message is dis played in the TCL Shell Note Aforbidden address corresponds to an address outside the selected memory range address m Send the file using the Send File button Make sure that the memory is correctly initialized before sending any data 2 3 8 8 Download Data to a File m First select the memory by clicking on its corresponding tab m Enter the file nam
5. 4 4 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide SAM BA Customization Figure 4 3 Memory Scripts DataFlash AT45DB DCB NorFlash SerialFlash AT25 AT26 Flash NandFlash SDRAM SRAM Download Upload File Send File Name GE Send File Receive File Name Receive File Address 0x0 Size For Receive File 0x1 000 byte s Compare sent file with memory Scripts Enable NandFlash m Execute Enable NandFlas JErase All Scrub NandFlash 4 3 Extending SAM BA Programming Capabilities Several programming algorithms applets are delivered in the standard AT91ISP installation They are pieces of C code that are compiled specifically for each chip However these programming algorithms may require some adaptation to match a new board specification This is the case in particular when a memory is not connected to the same PIO or the same chip select as on the evaluation kit 4 3 1 Applet Workflow The target handles the programming algorithm by running applets The target switches between two modes SAM BA Monitor Mode and Applet Mode The SAM BA monitor mode is the command inter preter that runs in the ROM memory when you connect the chip with USB or COM port to the computer It allows the computer to send or receive data to from the target All transfers between host and device are done when the device is in SAM BA monitor mode Under Applet Mode the device performs pro gramming opera
6. Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 7 1 5 2 Code Example AT91Boot Write Int h handle OxCAFECAFE 0x200000 amp err code AT91 ISP SAM BA User Guide AMEL 3 9 6421B ATARM 06 Jan 10 AT91 ISP Architecture 3 7 1 6 AT91Boot_Write_Short This function writes a 16 bit word into the volatile memory of the connected target 3 7 1 6 1 Description void AT91Boot_Write_Short int h_handle short wValue int uAddress int err_code Table 3 5 AT91Boot_Write_Short Type Name Details h_handle Communication handle returned by AT91Boot_Open function wValue 16 bit value to write Input Parameters uAddress Address where to write 16 bit value Output Parameters none e int 0x0000 AT91C_BOOT_DLL_OK Standard Error Codes e int OxF001 Bad h handle parameter e int OxF002 Address is not correctly aligned E aroge Ld e int OxF005 Communication link broken CAN Error Codes int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 7 1 6 Code Example 3 10 6421B ATARM 06 Jan 10 AT91Boot Write Short h handle OxCAFE 0x200000 amp err code AMEL AT91 ISP SAM BA User Guide 3 7 1 7 AT91Boot_Write_Byte AT91 ISP Architecture This function writes an 8 bit word into the volati
7. Funchons Ek 3 18 3 7 8 Using AT91Boot DLL with ME 3 19 3 7 4 Using AT91Boot DLL without ME 3 20 AT91 ISP SAM BA User Guide i 6421B ATARM 06 Jan 10 Table of Contents Continued 3 8 AT91Boot_TCL Interface Bac eat er b Sec DINI IRI IM I Tees 3 21 3 9 SAM BA TCL Interface u dicet ek aed anne 3 24 Section 4 SAM BA CUS TON Te EE 4 1 LANES uU ET 4 1 4 2 Adding a New Board tea 4 1 4 2 1 X Adding a Board Entry A kk Eka eene nennen nnns 4 1 4 2 2 Board Description File nee 4 3 4 3 Extending SAM BA Programming Capabilities AA 4 5 4 3 1 Memory Access Using Dedicated Applet 4 5 Section 5 Revision PIISIOEV sudan a ilen ni lan koa nne vin kerb W UR Scu Uca h DNI GM M I na wad a k wak Ak kwar Dark 5 1 5 1 Revision History Table lu tetuer lee 5 1 ii AE MEL 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide AIMEL eege Section 1 Overview 1 1 Scope The AT91 In system Programmer ISP provides an open set of tools for programming Atmel AT91SAM ARM Thumb based microcontrollers They are based on a common dynamic linked library DLL the AT91Boot_DLL It is used by SAM BA SAM PROG and all ISP tools The SAM Boot Assistant SAM BA software provides a means of easily programming different Atmel AT91SAM devices SAM BA now uses AT91Boot_DLL dll to communicate with the target This document describes how to extend SAM BA capabilities to program any kind of memory and pro vides
8. JTAG probe 3 4 0 4 SAM BA Boot4CAN Directory This directory contains binary files for AT91SAM7A3 and AT91SAM7X devices These files must be pro grammed into internal Flash memory before communicating over a CAN SAM PROG can be used to program these files AIMEL 3 2 Eeer AT91 ISP SAM BA User Guide 6421B ATARM 06 Jan 10 AT91 ISP Architecture 3 4 1 DLL Registration AT91Boot_DLL needs to be registered in the Windows Base Register in order to be used correctly The Install program will register AT91Boot_DLL automatically AT91Boot DLL dll uses JLinkARM dll In order for the user to compile a project anywhere YOUR INSTALL DIRECTORY ibrary path has been added to the PATH user environment variable If it is not the case JLinkARM dlls has to be set in the current directory of your application in order to be found by the AT91Boot DLL Note Itis also possible to copy dll contained in the Library directory into WINNT System32 as this directory is in the PATH environment variable by default Do not forget to register AT91Boot DLL after moving To register AT91Boot DLL manually execute the following command from a DOS Window or directly through the Windows Start Execute menu regsvr32 s Ze YOUR INSTALL DIRECTORYNMAT91Boot DLL dll Note regsvr32 exe is located in WINNT System32 directory 3 4 2 Updating JLink SAM ICE Software In order to function correctly compatibility between JLink SAM ICE firmware USB drivers and JLinkARM DLL
9. NO BOARD NO BOARD tcl AT91SAM7A3 EK AT91SAM7A3 EK AT91SAM7A3 EK tcl AT91SAM7S32 EK AT91SAM7S32 EK AT91SAM7S32 EK tcl AT91SAM7S64 EK AT91SAM7S64 EK AT91SAM7S64 EK tcl AT91SAM7S128 EK AT91SAM7S128 EK AT91SAM7S128 EK tcl AT91SAM7S256 EK AT91SAM7S256 EK AT91SAM7S256 EK tcl AT91SAM7S512 EK AT91SAM7S512 EK AT91SAM7S512 EK tcl AT91SAM7S321 EK AT91SAM7S321 EK AT91SAM7S321 EK tcl AT91SAM7SE32 EK AT91SAM7SE32 EK AT91SAM7SE32 EK tcl ATO1SAM7SE256 EK AT91SAM7SE256 EK AT91SAM7SE256 EK tcl ATO91SAM7SE512 EK ATO91SAM7SE512 EK AT91SAM7SE512 EK tcl AT91SAM7X128 EK AT91SAM7X128 EK AT91SAM7X128 EK tcl AT91SAM7X256 EK AT91SAM7X256 EK AT91SAM7X256 EK tcl AT91SAM7X512 EK AT91SAM7X512 EK AT91SAM7X512 EK tcl AT91SAM7XC128 EK AT91SAM7XC128 EK AT91SAM7XC128 EK tcl1 AT91 ISP SAM BA User Guide 4 1 6421B ATARM 06 Jan 10 SAM BA Customization AT91SAM7XC256 EK AT91SAM7XC256 EK AT91SAM7XC256 EK tcl AT91SAM7XC512 EK AT91SAM7XC512 EK AT91SAM7XC512 EK tcl AT91SAM9260 EK AT91SAM9260 EK AT91SAM9260 EK tcl AT91SAM9261 EK AT91SAM9261 EK AT91SAM9261 EK tcl AT91SAM9263 EK AT91SAM9263 EK AT91SAM9263 EK tcl AT91SAM9XE512 EK AT91SAM9XE512 EK AT91SAM9XE512 EK tcl NEW BOARD NEW BOARD NEW BOARD tcl The first field is the board name the name that appears in the Select your board listbox when SAM BA is started and the second is the directory where the board and the memory module descrip
10. SAM BA User Guide 2 3 2 AT91 ISP SAM BA User Guide Running SAM BA Once SAM BA s main window is displayed the name of the board is shown on the right side of the status bar see Figure 2 2 Click on the Connect button The main window appears see Figure 2 2 Figure 2 2 SAM BA Main Window Ki SAM BA 2 7 AT91SAM9261 EK File ScriptFile Link Help ATIISAMI261 Memory Display Start Address 0x300000 Refresh p Display format Sire n bytes 0100 j ascii C 8 bit 16 bit 32 bit 0x00300000 OxES201627 0x43B225F1 OxSDOA3DSC Ox20DBF90F 0x00300010 Ox7D176F9D OxSBE7BSBF 0x712792BF 0x7B99B1EO 0x00300020 OxOB60EEC3 Ox3469D566 0x74F40939 Ox1B3F8F69 0x00300030 Ox6D533C76 Ox9984009D OxFFEEFDSC Ox9BSDEBAS 0x00300040 Ox2B545D45 OxO9FE7ACA OxSDB6417A OxBBBAF703 nvnnannnsnn f v7555235F17 nvasacmaai 736 fiviFRCR OGSR nvaanaqana el DataFlash AT45DB DCB SerialFlash AT25 AT26 NandFlash SDRAM SRAM Download Upload File Receive File Name Scripts Enable Dataflash SPIO CS0 ei Execute Send File Name ez Send File amp Receive File Address 0x0 Size For Receive File 0 1000 byte s Compare sent file with memory l loading history file 48 events added SAM BA console display active Tcl8 4 13 Tk8 4 13 AT91 ISP v1 11 49 96 AT91 ISP v1 11 49 96 usb ARMO Board ATS1SAMS2ET EK s Memory Display Area In this area you can display a part of th
11. about the corresponding command on the TCL Shell compare file Compare a file with memory data Memory memory tag in curly brackets fileName absolute path file name in quotes or relative path from the current directory in quotes Address address of the first data to compare with the file in decimal or hexadecimal Output information about the command progress on the TCL Shell TCL Compare Binary comparison of two files fileName1 absolute path file name in quotes or relative path from the current directory in quotes of the first file to compare fileName2 absolute path file name in quotes or relative path from the current directory in quotes of the second file to compare with the first Output return 1 in case of error O if files are identical m TCL Go Jump to a specified address and execute the code Handle handler number of the communication link established with the board Address address to jump to in decimal or hexadecimal The memory tag is the name in curly brackets of the memory module defined in the memoryAlgo array in the board description file e g DataFlash AT45DB DCB Moreover a set of older commands for SAM BA v1 x script compatibility is always available 3 22 6421B ATARM 06 Jan 10 AMEL AT91 ISP SAM BA User Guide AT91 ISP Architecture Table 3 15 Extended Command Set Commands Argument s Example write_byte Address Value write byte 0x200001 O
12. by sending the next payload 4 3 5 Applet Compilation An applet is running on the target device Thus an applet consists in ARM binary code It is loaded by a monitor WriteData command and launched by a monitor go command All applet source code is delivered in the SAM BA installation directory Install Directory SAM BA v2 x applets isp project Applets can be compiled using GNU tools Each applet is delivered with a standard Makefile This Make file takes in arguments of board and chip names A log file called build log located in nstall DirectoryNSAM BA v2 x applets provides all commands executed to compile all applet configurations Thus the same algorithm is used on different devices Resulting binary shall be copied into the corresponding board library Install DirectoryNSAM BA v2 x lib To get an example please refer to the customization example provided with your specific SAM BA version 4 3 6 Applet Internal Structure During startup sequence the BSS segment shall be reset to 0 Once loaded the applet may be invoked several times to execute the same or different functions To keep global variable values the BSS seg ment initialization must be done only once In the isp_cstartup S file its Initialized variable is tested to prevent multiple BSS initialization The stack pointer is initialized in the boot ROM However on some AT91SAM device revisions each time the SAM BA Monitor mode is left by a go command the
13. int Standard Error Codes 0xF001 Bad h_handle parameter 0xF004 USART Communication link not opened e int 0x0000 AT91C_BOOT_DLL_OK E for ede err_code e int OxFO05 Communication link broken CAN Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 7 1 12 2 Code Example 3 16 char bData 10 AT91Boot Read Data h handle 0x200000 bData 10 amp err code AMEL 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide 3 7 1 13 AT91Boot Go AT91 ISP Architecture This function allows starting code execution at specified address 3 7 1 13 1 Description void AT91Boot Go int h handle int uAddress int err code Table 3 12 AT91Boot Read Data Type Name Details h handle Communication handle returned by AT91Boot Open function Input Parameters uAddress Address where to start code execution Output Parameters none e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int OxF001 Bad h handle parameter Error Code err code e int OxF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 7 1 13 2 Code Example AT91Boot Go h handle AT91 ISP SAM BA User Guide AMEL 0x200000 amp err_code 3 17 6421B ATARM 06
14. is necessary Thus it is recommended to update JLink SAM ICE software The JLink SAM ICE software update contained in a zip file is available on the www segger com web site in the Downloads then J Link ARM sub areas To proceed with update carry out the following steps Download the Jlink ARM zip file Unzip this download Run the exe file contained in it Check the update in the Doc ReleaseNotes Run the new J Link exe to update the JLink SAM ICE firmware Check if your PC driver is up to date with the delivery driver in the USBDriver folder contained in the exe m Copy the JLinkARM dll DLL to YOUR INSTALL DIRECTORY LibraryV folder This completes the software update AIMEL AT91 ISP SAM BA User Guide Eeer 3 3 6421B ATARM 06 Jan 10 AT91 ISP Architecture 3 5 Communicating with AT91SAM Devices 3 5 1 Communication Links AT91Boot_DLL connects AT91SAM based targets through a USB link a serial link or a JTAG using a SAM ICE or JLink JTAG box Figure 3 2 Different Ways of Communicating with AT91SAM based Targets SAM PROG SAM BA GUI Customer ISP AT91Boot_DLL dll Command Line Tool TCL SH AT91Boot_TCL dil CAN Dongle dll ATM6124 sys JLinkARM dll SAM ICE or JLINK COM Port driver Peak IXXAT Depending on which communication link is selected the target must be in the following state m When using the USB link or the DBGU serial link SAM BA B
15. send_file Memory fileName Address send file SDRAM C temp file1 bin 0x20000000 receive_file Memory fileName Address Size receive file SDRAM C tempf file1 bin 0x10000256 compare_file Memory fileName Address compare file SDRAM C temp file1 bin 0x20000000 3 24 AIMEL AT91 ISP SAM BA User Guide 6421B ATARM 06 Jan 10 AMEL je Section 4 SAM BA Customization 4 1 Overview SAM BA can be easily customized to add a new AT91SAM based board or to add a new programming algorithm for a new device All AT91SAM evaluation kit descriptions are freely available in the AT91ISP installation directory Likewise all programming algorithms sources are available under the AT91ISP installation directory 4 2 Adding a New Board SAM BA customization allows the user to add new window tabs dedicated to particular memories in the GUI Figure 4 3 shows a board with 5 memory modules described 4 2 1 Adding a Board Entry Customization of SAM BA GUI for a particular board device is done by adding new TCL scripts in the directory Install Directory Nib A good starting point is to have a look at the TCL files provided with SAM BA The file boards tc1 contains the board names and associated description file paths To add support for a new board a new entry must be created in the boards array and the correspond ing directory The directory must have the same name as the board array set boards NO BOARD
16. stack pointer is not reset to its initial value which produces a memory leakage The workaround is to initialize the stack pointer each time the applet is entered At the end of the applet boot ROM is resumed with the stack pointer set to the applet s stack pointer initial value Each time the boot ROM executes a go command it resets PIO initialization Applets must take care of that and perform PIO initialization each time it is resumed A mailbox shared between the applet and host application is located at the beginning of the execution region just after the jump instruction Then it is easy for the host application to determine where the mail box is located applet load address 4 bytes AMEL 4 12 6421B ATARM O6 Jan 10 AT91 ISP SAM BA User Guide SAM BA Customization Figure 4 6 Applet Mapping SDRAM isp_cstartup S 0x2000_0000 Jump Instrauction to 0x2000_0084 0x2000_0004 Argument area 4x32 bytes 0x2000_0084 Stack initialization C variables initialization Branch to the main Return to the ROM monitor unsigned int pArgument unsigned int 0x2000_0004 switch pArgument 0 case INIT case WRITE Update Command state pArgument 0 pArgument 0 Update Command Status pArgument 1 result end Payload Buffer End of SDRAM Stack The 32 4 byte words mailbox definition must be shared between the applet and the host application By default the first word of the mailbox initialized by the
17. 0 Ox1B3FSF69 xSBSDEBAS OxBBBAF703 0x83D49903 OxFCEFC98D OxDACBS4F3 OxEE716F83 AT91 ISP SAM BA User Guide Running SAM BA 2 4 Running SAM BA Using the Command Line Most standard editors offer shortcuts to run DOS command lines It is possible to run SAM BA using the following command line Install Directory SAM BA exe Communication Interface Board Script tcI args gt logfile log where m Communication Interface usb ARMO COMx for RS232 where x is the COM port number or jlink ARMO m Board the name of the board accessible through the Choose Protocol window COM1 COM2 USB etc m Script tcl the name of a TCL script file to be immediately executed m args Arguments to be transferred to the TCL script m gt logfile log optional argument to get the log of the script execution in a file For example gt C Sam ba exe COM2 AT91SAM7S64 EK load_app tcl gt result log If bad arguments are entered in the command line or if there are communication problems SAM BA is not able to start If the Script tcl argument is not specified then the SAM BA GUI will automatically appear Otherwise the TCL script is executed in the same TCL interpreter environment as is run in the TCL shell area of the SAM BA GUI AMEL AT91 ISP SAM BA User Guide 2 9 6421B ATARM O6 Jan 10 Running SAM BA 2 5 Creating a Script 2 5 1 Rapid Script Generation A very simple way to record a script file is to launch SA
18. 2 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide AIMEL Headquarters Atmel Corporation 2325 Orchard Parkway San Jose CA 95131 USA Tel 1 408 441 0311 Fax 1 408 487 2600 International Atmel Asia Unit 1 5 amp 16 19 F BEA Tower Millennium City 5 418 Kwun Tong Road Kwun Tong Kowloon Hong Kong Tel 852 2245 6100 Fax 852 2722 1369 Product Contact Web Site www atmel com www atmel com AT91SAM Atmel Europe Le Krebs 8 Rue Jean Pierre Timbaud BP 309 78054 Saint Quentin en Yvelines Cedex France Tel 33 1 30 60 70 00 Fax 33 1 30 60 71 11 Technical Support AT91SAM Support Atmel techincal support Atmel Japan 9F Tonetsu Shinkawa Bldg 1 24 8 Shinkawa Chuo ku Tokyo 104 0033 Japan Tel 81 3 3523 3551 Fax 81 3 3523 7581 Sales Contacts www atmel com contacts Literature Requests www atmel com literature Disclaimer The information in this document is provided in connection with Atmel products No license express or implied by estoppel or otherwise to any intellectual property right is granted by this document or in connection with the sale of Atmel products EXCEPT AS SET FORTH IN ATMEL S TERMS AND CONDI TIONS OF SALE LOCATED ON ATMEL S WEB SITE ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTY OF MERCHANTABILITY FITNESS FOR A PARTICULAR PU
19. 32 bit word 16 bit half word or 8 bit byte This automatically refreshes the memory contents 4 Press the Refresh button 2 3 2 2 Edit Memory Content Some memories and or embedded peripherals can be edited 1 Double click on the value to update it An editable pop up window appears see Figure 2 4 Note Only memories can be updated this way e g static RAM or SDRAM if previously initial ized If you try to write the other memory types nothing happens Figure 2 4 Update Memory Value Window Lg Update memory value m Address 0x00300024 Value 0 12345678 OK Cancel 2 Press OK to update the value in the Memory display area The corresponding TCL command is dis played in the TCL Shell area Note Only the lowest bits of the value are taken into account if the format of the value entered is higher than the display format 2 3 3 Memory Download Area The Memory download area provides a simple way to upload and download data into internal and external memories For each memory files can be sent and received and the target s memory content can be compared with a file on your computer see Figure 2 5 Note Only binary file format is supported by SAM BA This area also gives access to some specific scripts for the different memories available on the board Nand Flash DataFlash etc Figure 2 5 Memory Download Area DataFlash AT45DB DCB SerialFlash AT25 AT26 NandFlash SDRAM SRAM
20. AT91 ISP SAM BA User Guide AIMEL 6421B ATARM O6 Jan 10 AMEL 2 2 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide AIMEL eege Table of Contents Section 1 M CUI Eee een 1 1 UN WK 1 1 1 2 Key Features of the SAM BA Goftware enne nene 1 1 Section 2 RunnirigS AMS A nee ea Dee 2 1 2 1 O V 371 2 EE 2 1 22 BR nhing EE E EEN 2 1 2 9 SAM BDA GUI ji A ba 2 2 2 3 1 Board Connection disa c t erp eR danan a ka RR RAE a ERE vaka n A nu Al h 2 2 2 3 2 Memory Display Area been 2 3 2 3 3 Memory Download Area 2 4 2 3 4 TCE Shell Area i he t D e Ep sinken 2 6 2 3 0 DiSGOTI o 2 8 2 4 Running SAM BA Using the Command Line L Ek kk kk ek kk kk KS 2 9 25 Crealing a ScfIpt EE 2 10 2 5 1 Rapid Script Generation 2 10 2 5 2 SAM BA Open Scripting Environment 2 10 Section 3 NEMEI 3 1 CN Ke E 3 1 3 2 DLL Ge EE 3 2 3 3 AT91 1SP Installation asil erra aan ae 3 2 KE Den E 3 2 34 1 DLE e EC le a 3 3 3 4 2 Updating JLink SAM ICE Goitware esses 3 3 3 5 Communicating with AT91SAM Devices nennen 3 4 3 5 1 Communication LINKS nennen nennen ean Ya K c nnns 3 4 3 5 2 Starting Communication 3 4 3 6 TCOL Sctipting Language sssrds sarasini nte en 3 5 3 4 AT9IBoot DLL Interface rt eed dene se qe hk ka SE KEKE Han k H kk Ak AKA 3 6 3 7 1 Low level Functions ieri teneantur rea er e cin HEU kn eua eiu 3 6 3 7 2 Internal Flash Programming
21. Jan 10 AT91 ISP Architecture 3 7 2 Internal Flash Programming Functions These functions are available only for AT91SAM microcontrollers with Flash 3 7 2 1 AT91Boot_SAM7xxx_Send_Flash These functions make it possible to write X bytes into the internal Flash memory of the connected target If some sectors are locked they are unlocked in order to effectively program the internal Flash memory Available functions are AT91Boot_SAM7S32_Send_Flash available for SAM7S32 and SAM7S321 parts AT91Boot_SAM7S64_Send_Flash AT91Boot_SAM7S128_Send_Flash AT91Boot_SAM7S256_Send_Flash AT91Boot_SAM7S512_Send_Flash AT91Boot_SAM7A3_Send_Flash AT91Boot_SAM7X128_Send_Flash available for SAM7X128 and SAM7XC128 parts AT91Boot_SAM7X256_Send_Flash available for SAM7X256 and SAM7XC256 parts AT91Boot_SAM7X512_Send_Flash available for SAM7X512 and SAM7XC512 parts AT91Boot_SAM7SE32_Send_Flash AT91Boot_SAM7SE256_Send_Flash AT91Boot_SAM7SE512_Send_Flash 3 7 2 2 Prerequisite Embedded Flash Controller Flash Mode Register EFC_FMR must be programmed correctly prior to using one of these functions Note Two Embedded Flash Controllers are embedded in AT91SAM7S512 AT91SAM7X512 and AT91SAM7SE512 parts Both EFC_FMRx registers must be programmed correctly prior to using one of these functions 3 7 2 2 1 Description void AT91Boot_SAM7xxx_Send_Flash int h_handle int uOffset char bData int uSize int err code Table 3 13 AT91Boot_SAM7xxx_Send
22. L AT91 ISP SAM BA User Guide 3 5 6421B ATARM 06 Jan 10 AT91 ISP Architecture 3 7 AT91Boot_DLL Interface 3 7 1 Low level Functions A description and a code example is given for each function These functions are available for all AT91SAM microcontrollers 3 7 1 4 AT91Boot_Scan This function scans connected devices and returns a list of connected devices Detection is performed in the following order USB connected devices using ATM6124 sys driver Connected SAM ICE or JLink devices CAN dongles Peak IXXAT All available serial COM ports Bw om Note The AT91Boot Scan function does not verify if an Atmel device is really present so even if there are no Atmel devices connected to SAM ICE JLink devices CAN dongles or COM ports these connections are returned in the connected devices list This does not concern USB devices 3 7 1 1 1 Description void AT91Boot Scan char pDevList Table 3 1 AT91Boot Scan Type Name Details Pointer to a char table Input Parameters char pDevList All table entries must have been allocated prior using the AT91Boot Scan function 1 Strings returned in the table usbVARMX for USB connected devices ylink ARMX for SAM ICE JLink connected devices can AtCanPeak ARM for PCAN USB Peak connected Output Parameters char pDevList dongle canVxxatARM for USB to CAN compact IXXAT connected dongle COMX for available COM ports Return Code none
23. LL in such a project the following steps must be performed m Create an AT91Boot DLL class in your project To do this copy both at91boot dll cpp and at91boot dll h files into your project directory Note Do not use the ClassWizard Add Class From a type library as there is a bug in Visual C 6 0 The bug prevents any functions containing a char variable as a parameter from being imported m Initialize OLE libraries by calling A xolernit function m Create an AT91Boot DLL driver object to manage AT91Boot DLL COM object m Create an AT91Boot DLL COM object instance with the AT91Boot DLL program ID ar91Boot_DLL AT91BootDLL 1 by using CreateDispatch function Note 1 Program ID is stored in the base register and is an easier way to retrieve AT91Boot DLL Class ID nec essary for CreateDispatch function Once these four steps have been performed DLL functions should be available See their prototypes in at91boot dll h header file and for details on how to call these functions AIMEL AT91 ISP SAM BA User Guide er O 3 19 6421B ATARM O6 Jan 10 AT91 ISP Architecture Note Atthis step if AT91Boot_DLL functions are not available it is because the AT91Boot_DLL dll has not been registered correctly See Section 3 4 1 DLL Registration on page 3 3 for more information 3 7 3 1 Code Example include at91boot dall bn IAT91BootDLL m_pAT91BootDLL AfxOleInit m_pAT91BootDLL new IAT91BootDLL m pAT91BOOtDLL CreateDispa
24. M BA in GUI mode and use the ScriptFile menu Start the recording on script and then every action done in the GUI changing a value in the Memory Display area executing a script in aMemory Download window or sending receiving file is recorded in the historyCommand tcl file This file can be used as is when launching SAM BA in command line mode It can also be used as a starting point to elaborate longer scripts This mode is very useful for automating memory programming 2 5 2 SAM BA Open Scripting Environment When SAM BA is launched in any mode a board must be specified This information is required to set up the scripting environment can be retrieved by reading target board global variable A set of variable definitions and a set of memory algorithms correspond to each board Variable defini tions correspond to the standard LibV3 symbols Using symbols instead of absolute values increases the readability and re use of the TCL routines Note These variables are declared as global variables Within functions symbols must be declared as global to reference the global variables proc foo global target set err_code 0 global AT91C_DBGU_THR TCL Write Int target handle 64 SAT91C_DBGU_THR err code In the same way TCL programing routines can be invoked for loading code into the device For a better understanding of the TCL libraries all programing functions in TCL are delivered in the SAM BA installation directory Ins
25. MO for USB jlink ARMO for JTAG COMx for RS232 where x is the COM port number m Board the name of the board accessible through the Choose Protocol window see Figure 2 1 m Script File Optional Path to the TCL Script File to execute m Script File Args Optional TCL Script File Arguments Depending on the number of arguments SAM BA opens in different modes If Communication Inter face and Board arguments are provided in the command line SAM BA GUI will start directly without displaying the connection message box If Script File argument is not specified SAM BA starts in GUI mode Some valid command line examples are listed below m launch SAM BA with script file and one argument SAM BA exe usb ARMO AT91SAM9261 EK lib historyCommand tcl AT91C DBGU THR m launch SAM BA with script file SAM BA exe usb ARMO AT91SAM9261 EK myScript tcl m launch SAM BA GUI with preselected communication link and board AT91 ISP SAM BA User Guide 2 1 6421B ATARM 06 Jan 10 Running SAM BA SAM BA exe usb ARMO AT91SAM9261 EK It is possible to catch information sent to standard outputs by SAM BA while executing in command line mode This can be achieved with the following command SAM BA exe usb ARMO AT91SAM9261 EK myScript tcl gt log txt 2 3 SAM BA GUI When SAM BA is launched after selection of the board and the communication link the main window appears see Figure 2 2 It contains three different areas F
26. RPOSE OR NON INFRINGEMENT IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT INDIRECT CONSEQUENTIAL PUNITIVE SPECIAL OR INCIDEN TAL DAMAGES INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF PROFITS BUSINESS INTERRUPTION OR LOSS OF INFORMATION ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice Atmel does not make any commitment to update the information contained herein Unless specifically provided otherwise Atmel products are not suitable for and shall not be used in automotive applications Atmel s products are not intended authorized or warranted for use as components in applications intended to support or sustain life 2010 Atmel Corporation All rights reserved Atmel Atmel logo and combinations thereof DataFlash SAM BA and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries ARM the ARMPowered logo Thumb and others are registered trade marks or trademarks ARM Ltd Windows and others are registered trademarks or trademarks of Microsoft Corporation in the US and or other countries Other terms and product names may be trademarks of others 6421B ATARM O6 Jan 10
27. _Flash Type Name Details h_handle Communication handle returned by AT91Boot_Open function uOffset Internal Flash Offset where to write 8 bit value Input Parameters bData Pointer to 8 bit data buffer to write uSize Buffer size in bytes AIMEL 3 18 ae C AT91 ISP SAM BA User Guide 6421B ATARM 06 Jan 10 AT91 ISP Architecture Table 3 13 AT91Boot_SAM7xxx_Send_Flash Continued Type Name Details Output Parameters none e int 0x0000 AT91C_BOOT_DLL_OK Standard Error Codes e int 0xF001 Bad h handle parameter e int OxF002 Address is not correctly aligned e int OxF003 uSize is not correct E erode ae e int OxF004 USART Communication link not opened e int OxFO05 Communication link broken CAN Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 7 2 2 Code Example char bData 10 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 Write buffer at offset 0x100 into internal SAM7S64 Flash AT91Boot_SAM7S64_Send_Flash h_handle 0x100 bData 10 amp err_code Using AT91Boot_DLL with MFC The project OLE_MFC dsw is located in Examples OLE_MFC folder It scans connected devices opens the first one reads DBUG chip ID If an AT91SAM7S256 is detected it programs a small application BasicMouse in the internal Flash To use AT91Boot_D
28. a helpful guide to installing and using the AT91 ISP 1 2 Key Features of the SAM BA Software Performs in system programming through JTAG RS232 or USB interfaces Provides both AT91SAM embedded flash programing and external flash programing solutions May be used via a Graphical User Interface GUI or started in batch mode from a DOS window Runs under Windows 2000 and XP Memory and peripheral display content User scripts executable from SAM BA Graphical User Interface or a shell AT91 ISP SAM BA User Guide 1 1 6421B ATARM 06 Jan 10 Overview AMEL 1 2 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide AIMEL je Section 2 Running SAM BA 2 1 Overview SAM BA can operate in a graphical mode or it can be launched in command line mode with a TCL script in parameter Both modes can be combined to easily obtain a powerful loading solution on AT91SAM devices customized for the current project 2 2 Running SAM BA Connect your board to your communication interface either the host serial COM port or the USB device port or the SAM ICE JTAG probe Warning The USB cable must NOT be connected to the board for an RS232 use otherwise the USB interface is chosen by default There are two different ways to start SAM BA 1 Click on the SAM BA icon or 2 Typein a shell gt Install Directory SAM BA exe Communication Interface Board Script File Script File Args where Communication Interface usb AR
29. ad buffer address This payload buffer address stored in GENERIC appletBufferAddress is used in the GENERIC Write function to send data to be programmed to the device The INITfunction also returns the memory size and the buffer payload size GENERIC appletBufferSize TCL procedure GENERIC Init loads applet binary in the target calling TCL Write Data to the applet link address appletAddr Once the applet is loaded a TCL Go forces the target to leave the SAM BA mon itor and start applet execution At the end of the applet operations the target resumes the SAM BA monitor execution DATAFLASH Applet initialization example FE HEHEHEHE HE HE HE HE HE HE HE HE HE HE HE HE HEHE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE E E HE E E E HE E HE HE FE HE FE HE FE HE FE FE HE FE HE HE HE HE HEHE HH HHHH HE DATAFLASH FE HEHEHEHE HEHE HE HE HE HE HE HE HE HE HE HE HEHE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE E E E E E E HHHH HH HE HE FE HE HE HE HE HE HE HEHE HH HHHH array set at91sam7se512_dataflash dftDisplay 1 AIMEL AT91 ISP SAM BA User Guide Eeer 4 7 6421B ATARM O6 Jan 10 SAM BA Customization dftDefault 1 dftAddress 0x0 dftSize SGENERIC memorySize dftSend GENERIC SendFile dftReceive GENERIC ReceiveFile dftScripts at91sam7se512 dataflash scripts array set at91sam7se512 dataflash scripts Enable Dataf
30. e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int OxF001 Bad h handle parameter e int OXF004 USART Communication link not opened E for ede err pode e int OXF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 7 1 8 2 Code Example char bData 10 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 AT91Boot_Write_Data h_handle 0x200000 bData 10 amp err_code AIMEL 3 12 Eeer AT91 ISP SAM BA User Guide 6421B ATARM 06 Jan 10 AT91 ISP Architecture 3 7 1 9 AT91Boot Read Int This function reads a 32 bit word from the connected target 3 7 1 9 1 Description void AT91Boot Head Int int h handle int uValue int uAddress int err code Table 3 8 AT91Boot Read Int Type Name Details h handle Communication handle returned by AT91Boot Open function Input Parameters uValue Pointer to a 32 bit value uAddress Address where to read 32 bit value Output Parameters uValue 32 bit read value e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int OxF001 Bad h handle parameter e int OxF002 Address is not correctly aligned Eror Hode oroade e int OxF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dl
31. e location in the Receive File name field or open the file browser by clicking on the Open Folder button and select it If you enter a wrong file name an error message is displayed in the TCL Shell see Section 3 7 m Enter the address of the first data to read in the Address field m Enter the data size to read in the Size field If you enter a forbidden address or if your file size overruns the memory size an error message is displayed in the TCL Shell Note Aforbidden address corresponds to an address outside the selected memory range address Get data using the Heceive File button Make sure that your memory is correctly initialized before getting any data 2 3 3 4 Compare Memory with a File Usually this feature allows to check if a sent file was correctly written into the memory but you can com pare any file with your memory content The comparison is made on the size of the selected file m First select the concerned memory by clicking on its corresponding tab m Enter the file name location in the Send File name field or open the file browser by clicking on the Open Folder button and select it If you enter a wrong file name an error message will be displayed in the TCL Shell see Section 2 3 4 TCL Shell Area m Enter the address of the first data to compare with the selected file in the Address field If you enter a forbidden address or if your file size overruns the memory size an error message is displayed in
32. e microcontroller memory content Three different display formats can be used 32 bit word 16 bit half word or 8 bit byte with a maximum display of 1024 byte long mem ory area Values can also be edited by double clicking on them see Section 2 3 2 2 Edit Memory Content Note Only valid memory areas or system user peripheral areas are displayed An error message is written in the TCL Shell area see Section 2 3 4 TCL Shell Area if a forbidden address is supplied or if a memory overrun occurs Figure 2 3 Memory Display Area ATS1SAMS251 Memory Display Start Address 0x300000 Refresh p Display format Sen b te s 0x100 TT C ascii C 8 bit C 16 bit 32 bit 0x00300000 0x55000012 OxSS9FFO14 OxSS9FFO14 OxSS9FFO14 0x00300010 OxSS9FFO14 OxSS9FFO14 OxSS9FFO14 OxSS9FFO14 0x00300020 Ox23F000A0 Ox23F00100 Ox23F00160 xz3FO001CO 0x00300030 Ox23F00220 Ox23F00280 Ox23FO002E0 OxDEADBEEF 0x00300040 0x31671800 0x73384165 0x37316817 0x23F81183 nznnannn nn nvzr nrnnnn nvrarnnn r nvraannnna AvF1 arnnn lt AMEL a E E 2 3 6421B ATARM 06 Jan 10 Running SAM BA 2 3 2 1 Read Memory Content 1 Enter the address of the area to read in the Starting Address field Note f a wrong address value is entered an error message is displayed in the TCL Shell area 2 Enterthe size of the area to display Note f a wrong size is entered an error message is displayed in the TCL Shell area 3 Choose a display format
33. ed in a specific file called history Command tcl This file is located in the user directory Note Only this file can be written through the Start Stop Reset Recording commands New recorded commands are added at the end of the historyCommand tcl file To stop recording select Stop Recording in the menu To erase the historyCommand tcl content select Reset Recording 2 3 4 2 Editing Script Files SAM BA embeds historyCommand tcl recording file editor Edit Script File command in the Script File menu launches the editor A new window appears to edit and save the history contents Modified script can be saved using another file name through the Save file button Figure 2 9 Script File Edition View 3 P C Program Files ATMEL Corporation AT91 ISP v1 11 SAM BA v2 7 ust h tkcon Edit Loe Save file Ba 2 EEE ASRS RSS FFF PAHS SR SR HSH 2 2 SSS SAM BA history file FESESSSSSSESESESEDSS HOESSHAITESS S H SSUSSSETEHETESESSEHESEHEHASISESEAEEAESHHEEEEETESEETEEATES PSSSSTESTESTESTESSEESESSEHSZSITEESESHSSEHSSESSTATASTESEHSHSESEESSSATESTEESTEESSEETEEHTAEEEE T global target di BB BBBB BB BB B BB Bi Bi B Bi Bi B B Bi B Bi Bi B d Bi B Bi J i B Bi Bi d i J i J Ji Bi d i J i B B Bi d Bi i B Bi Di d i B i Bi EEE EEEE EEEE isend file SRAM C Fabien test binary files test 64k bin 0x00300000 0 pum SRAM C Fabien test binary files test 64k bin 0x00300000 0
34. erpreter This area gives you access to standard TCL commands Type puts Welcome and you will get the result Welcome type expr 3 7 and you will get the result 10 see Figure 2 8 Figure 2 8 TCL Shell Window ATO1 ISP v1 11 49 96 ft AT91 ISP v1 11 49 96 puts Welcome Welcome AT91 ISP v1 11 50 96 expr 3 7 10 ATO1 ISP v1 11 51 usb ARMO Board ATS1SAM9261 EK TCL is a commonly used scripting language for automation This interpreted language offers a standard set of commands which can be extended by application specific commands written in C or other lan guages Tutorials and a manual can be downloaded here http www tcl tk doc Specific commands have been added to the SAM BA TCL interpreter to interface with AT91SAM devices These basic commands can be used to easily build more complex routines 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide Running SAM BA SAM BA allows you to create edit and execute script files A script file configures your device easily or automatically runs significant scripts The Script File menu supplies commands to start and stop recording to execute reset edit and save the recording file The name of the generated file is historyCommand tcl 2 3 4 1 Start Stop Reset Recording In the Script File menu select Start Recording to begin the record Now all the commands that are to be executed in the different blocks of the software are record
35. formation about DCC visit www arm com 2 For further information about SAM BA Boot commands see the Boot Program section of the product datasheet 3 Itis recommended to configure the PLL when returning from AT91Boot Open function in order to speed up monitor execution 3 7 1 4 AT91Boot Close This function closes the communication link previously opened on an AT91SAM device 3 7 1 4 1 Description void AT91Boot Close int h handle Table 3 3 AT91Boot Close Type Name Details Input Parameters h handle Communication handle returned by AT91Boot Open function Output Parameters none Return Code void 3 7 1 4 2 Code Example AT91Boot Close h handle 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide 3 7 1 5 AT91Boot_Write_Int AT91 ISP Architecture This function writes a 32 bit word into the volatile memory of the connected target 3 7 1 5 1 Description void AT91Boot Write Int int h handle int uValue int uAddress int err code Table 3 4 AT91Boot Write Int Type Name Details h handle Communication handle returned by AT91Boot Open function Input Parameters uValue 32 bit value to write uAddress Address where to write 32 bit value Output Parameters none e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int OxF001 Bad h handle parameter e int OxF002 Address is not correctly aligned E aroge em poda e int OxF005 Communication link broken CAN
36. get structure contents m handle identifier of the link used to communicate with the target m board a string containing the board name e AT91SAM7SE512 EK m connection connection type Can be usb ARMx for a USB link COMx for a serial link with x indicating the COM port used or jtag ARMx m comType 1 for serial O for other USB or JTAG These commands are mainly used to send and receive data from the device Table 3 14 Commands Available through the TCL Shell Commands Argument s Example TCL Write Byte Handle Value Address err code TCL Write Byte target handle OxCA 0x200001 err code TCL Write Short Handle Value Address err code TCL Write Short target handle OXCAFE 0x200002 err code TCL Write Int Handle Value Address err code TCL Write Int target handle OXCAFEDECA 0x200000 err code TCL Read Byte Handle Address err code TCL Read Byte target handle 0x200003 err code TCL Read Short Handle Address err code TCL Read Short target handle 0x200002 err code TCL Read Int Handle Address err code TCL Read Int target handle 0x200000 err code TCL Go Handle Address err code TCL Go target handle 0x20008000 err code AT91 ISP SAM BA User Guide These functions are available for all AT91SAM microcontrollers m list TCL Scan m seth handle TCL Open name m TCL Close h handle m Write commands Write a byte TCL Write Byte a half word TCL Write Short or a w
37. host application corresponds to the applet function ID The first word of the mailbox set by the applet corresponds to the logical inversion of the function ID The other words may be used as applet function arguments The first word is used by the application to determine that the applet function is achieved The second word of the mailbox set by the applet corre sponds to the result of the applet function Other words can be used as values returned by the applet function Memory space located after the applet binary code can be used as a dedicated area to store buffer pay loads received in Boot ROM mode and programmed in the media by the applet A good practice is to implement an applet INIT function which returns the address of this memory space AT91 ISP SAM BA User Guide AIMEL 4 13 6421B ATARM 06 Jan 10 SAM BA Customization AMEL 4 14 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide AIMEL ESCH Section 5 Revision History 5 1 Revision History Table Table 5 1 Document Comments Change Reference Request Ref 6421B In Section 4 3 isp applets folder changed into isp project 6421 isp applets build pl removed and build log introduced instead 6421A This document is intended to replace previously published user guides and application note Atmel lit 6132 6224 6272 First Issue AT91 ISP SAM BA User Guide 5 1 6421B ATARM 06 Jan 10 Revision History AMEL 5
38. l CAN Dongle dll ATM6124 sys JLinkARM dll COM Port driver Peak IXXAT SAM ICE Driver AT91 ISP SAM BA User Guide 3 1 6421B ATARM 06 Jan 10 AT91 ISP Architecture 3 2 DLL Prerequisites m Runs under Windows 2000 XP m A SAM ICE or a JLink JTAG box and its associated USB drivers only necessary to use JTAG communication link m CAN Dongles PCAN USB Peak dongle USB to CAN compact IXXAT dongle m TCL Toolchain including tclsh can be downloaded from the following URL http www activestate com Products ActiveTel 3 3 AT91 ISP Installation Installation is automatic using the AT91_ISP vx yy exe install program 3 4 Contents 3 4 0 1 Library Directory All files located in the Library directory are necessary for the AT91Boot_DLL to run correctly AT91Boot_DLL dll AT91Boot_DLL tlb type library file JLinkARM dll AT91Boot_TCL dll CAN Dongle dlls 3 4 0 2 Examples Directory This directory contains some example projects using AT91Boot DLL dll See the section lt Blue gt Using AT91Boot DLL Project Examples for more information on the following projects m OLE MFC project under Visual C 6 0 m OLE without MFC project under Visual C 6 0 m CAN TCLSH gives an example of a TCL script that can be used to program a SAM7X256 based board over the CAN network 3 4 0 0 SAM PROG Application This application downloads a binary file into the Flash memory of one or more AT91SAM devices in par allel from a PC or
39. l function returned fail Return Code void 3 7 1 9 Code Example int ChipId AT91Boot Read Int h handle amp ChipId OxFFFFF240 amp err code AMEL 3 13 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide AT91 ISP Architecture 3 7 1 10 AT91Boot Read Short This function reads a 16 bit word from the connected target 3 7 1 10 1 Description void AT91Boot Read Short int h handle short wValue int uAddress int err code Table 3 9 AT91Boot Read Short Type Name Details h handle Communication handle returned by AT91Boot Open function Input Parameters wValue Pointer to a 16 bit value uAddress Address where to read 16 bit value Output Parameters wValue 16 bit read value e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int OxF001 Bad h handle parameter a e int 0OxF002 Address is not correctly aligned i em egde e int OxFO05 Communication link broken CAN Error Codes e int 0x8002 CAN Read dl function returned fail e int 0x8003 CAN_Write dll function returned fail Return Code void 3 7 1 10 2 Code Example 3 14 6421B ATARM O6 Jan 10 short wRead AT91Boot Read Short h handle amp wRead AMEL 0x200000 amp err_code AT91 ISP SAM BA User Guide 3 7 1 11 AT91Boot Read Byte AT91 ISP Architecture This function reads an 8 bit word from the connected target 3 7 1 11 1 Description void AT91Boot Head Byte i
40. lash SPIO CSO DATAFLASH Init 0 Set DF in Power Of 2 Page Size mode Binary mode DATAFLASH BinaryPage Erase All DATAFLASH EraseAll set DATAFLASH appletAddr 0x20000000 set DATAFLASH appletFileName 1libPath extLib target board isp dataflash at91sam7se512 bin proc DATAFLASH Init dfId global target variable appletAddr variable appletFileName variable DATAFLASH_initialized set DATAFLASH initialized o puts I DATAFLASH Init dfId trace level GENERIC traceLevel Load the applet to the target if catch GENERIC Init DATAFLASH appletAddr DATAFLASH appletFileName list target comType GENERIC traceLevel dfId dummy err error Error Initializing DataFlash Applet dummy_err set DATAFLASH initialized 1 proc GENERIC Init 4 8 Eeer AT91 ISP SAM BA User Guide 6421B ATARM O6 Jan 10 SAM BA Customization proc GENERIC Init memAppletAddr appletFileName appletArgList 0 global target variable appletAddr variable appletCmd Update the current applet address set appletAddr memAppletAddr Load the applet to the target if catch GENERIC LoadApplet appletAddr appletFileName dummy errl error Applet appletFileName can not be loaded 4 Run the INIT command set appletAddrCmd expr appletAddr 0x04 set appletAddrArgvO expr appletAddr 0x0c set appletAddrArgv1 expr appletAddr 0x10 set appletAddrArgv2 expr appletAddr 0x14 set a
41. le memory of the connected target 3 7 1 7 1 Description void AT91Boot_Write_Byte int h_handle char bValue int uAddress int err code Table 3 6 AT91Boot_Write_Byte Type Name Details h_handle Communication handle returned by AT91Boot_Open function Input Parameters bValue 8 bit value to write uAddress Address where to write 8 bit value Output Parameters none e int 0x0000 AT91C_BOOT_DLL_OK Standard Error Codes e int OxF001 Bad h handle parameter e int OxF002 Address is not correctly aligned E aroge SIE e int OxF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 71 72 Code Example AT91Boot_Write_Byte h_handle OxFE 0x200000 amp err_code AT91 ISP SAM BA User Guide AMEL 3 11 6421B ATARM 06 Jan 10 AT91 ISP Architecture 3 7 1 8 AT91Boot Write Data This function writes X bytes into the volatile memory of the connected target 3 7 1 8 1 Description void AT91Boot Write Data int h handle int uAddress char bValue int uSize int err code Table 3 7 AT91Boot Write Data Type Name Details h handle Communication handle returned by AT91Boot Open function uAddress Address where to write 8 bit value Input Parameters pValue Pointer to 8 bit data buffer to write uSize Buffer size in bytes Output Parameters non
42. nch the applet Jumping to the appletAddr if catch TCL_Go target handle SappletAddr dummy_err error Error Running the applet Wait for the end of execution TO DO Handle timeout error set result cmd while result expr cmd if catch set result TCL Read Int target handle appletCmdAddr dummy err tf error Error polling the end of applet execution Return the error code returned by the applet if catch set result TCL_Read_Int target handle appletStatusAddr dummy_err error Error reading the applet result return result TCL Wrappers for Read and Write Applets TCL procedures GENERIC SendFile and GENERIC ReceiveFile invoke the GENERIC Write and GENERIC Read TCL procedures These procedures split data into payloads of GENERIC appletBuf ferSize size TCL procedure GENERIC Write loads data payload in the target calling TCL_Write_Data to the GENERIC appletBufferAddress The WRITE command is set in the first mailbox word by the TCL_Write_Int TCL command TCL_Go forces the target to leave the SAM BA monitor and start applet WRITE execution At the end of the applet operations the target resumes the SAM BA monitor execu AIMEL AT91 ISP SAM BA User Guide ae C 4 11 6421B ATARM 06 Jan 10 SAM BA Customization tion The host polls the end of the programming operation reading the first word of the mailbox Once the device has answered the host can send the rest of the data
43. nt h handle char bValue int uAddress int err code Table 3 10 AT91Boot Read Byte Type Name Details h handle Communication handle returned by AT91Boot Open function Input Parameters pValue Pointer to an 8 bit value uAddress Address where to read 16 bit value Output Parameters pValue 8 bit read value e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int OxF001 Bad h handle parameter e int OxF002 Address is not correctly aligned EES SIE e int OxF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 7 1 11 2 Code Example char bRead AT91Boot Read Byte h handle amp bRead 0x200000 amp err code AT91 ISP SAM BA User Guide AMEL 3 15 6421B ATARM 06 Jan 10 AT91 ISP Architecture 3 7 1 12 AT91Boot_Read_Data This function reads X bytes from the connected target 3 7 1 12 1 Description void AT91Boot_Read_Data int h_handle int uAddress char bValue int uSize int err_code Table 3 11 AT91Boot_Read_Data Type Name Details h_handle Communication handle returned by AT91Boot_Open function uAddress Address where to read 8 bit data Input Parameters pValue Pointer to an 8 bit data buffer where to store read data uSize Number of bytes to read Output Parameters bValue Pointer to read data e int e
44. oot must run onto the target m When using the CAN link SAM BA Boot4CAN must run onto the target m When using JTAG communication through SAM ICE or JLink the target may be in an undefined state In this case it is up to the user to configure the target PLL etc if necessary 3 5 2 Starting Communication The AT91Boot_DLL principle is simple It consists of Scanning all devices connected to the PC Opening communication to the selected device Performing all desired actions such as writing into Flash memory Closing communication e ob gt 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide AT91 ISP Architecture 3 6 TCL Scripting Language TCL is acommonly used scripting language for automation This interpreted language offers a standard set of commands which can be extended with application specific commands written in C or other lan guages Tutorials and manuals can be downloaded here http www tel tk doc Specific commands have been added to the SAM BA TCL interpreter to interface with AT91SAM devices These basic commands can be used to easily build more complex routines In order to communicate with the board API functions are available to deal with AT91Boot_DLL dll library Figure 3 3 AT91ISP Levels AT91ISP SAM BA GUI SAM BA GUI Interface Applets TCL Programing Algo J l l l l l l l l SAM BA l l l l AT91Boot_TCL Interface AT91Boot_DLL Interface AT91BootROM Prot JTAG RDI AME
45. ord TCL Write Int to the target Handle handler number of the communication link established with the board Value byte half word or word to write in decimal or hexadecimal Address address in decimal or hexadecimal Output nothing m Read commands Read a byte TCL_Read_Byte a half word TCL_Read_Short or a word AMEL 3 21 6421B ATARM 06 Jan 10 AT91 ISP Architecture TCL_Read_Int from the target Handle handler number of the communication link established with the board Address address in decimal or hexadecimal Output the byte half word or word read in decimal Note TCL_Read_Int returns a signed integer in decimal For example reading with TCL_Read_Int target handle OXFFFFFFFF command returns 1 whereas reading OxFF with TCL_Read_Byte command returns 255 m send file Send a file to a specified memory Memory memory tag in curly brackets fileName absolute path file name in quotes or relative path from the current directory in quotes Address address in decimal or hexadecimal Output information about the corresponding command on the TCL Shell m receive file Receive data into a file from a specified memory Memory memory tag in curly brackets fileName absolute path file name in quotes or relative path from the current directory file name in quotes Adaress address in decimal or hexadecimal Size size in decimal or hexadecimal Output information
46. ot Scan function detects only CAN dongles and not AT91SAM devices which are connected to it is recommended to add an identifier to the end of string for each device such as for example can AtCanPeak ARMO can AtCanPeak ARM 1 3 7 1 2 2 Code Example AT91Boot Open strConnectedDevices 0 amp h handle AT91Boot_Open can AtCanPeak ARMO amp h handle AIMEL AT91 ISP SAM BA User Guide Eeer 3 7 6421B ATARM O6 Jan 10 AT91 ISP Architecture 3 7 1 3 JTAG Communication Link When opening a JTAG communication link through a SAM ICE or a JLink by using the following command AT91Boot Open MjlinkMARMO amp h handle the following steps are performed Open JLinkARM dll and its associated library functions Set JTAG speed to 5 kHz in order to connect to the target even if it is running at 32 kHz Stop the target Set a hardware breakpoint at address O Send a PROCRST command RSTC CR in the Reset Controller in order to disable the Watchdog Wait for the target to reach the breakpoint N o BI c Download a monitor into the target internal SRAM that allows communication only through the ARM Debug Communication Channels by using the SAM BA Boot commands Jump to the monitor in internal SRAM Then monitor switches on the Main Oscillator 9 For AT91SAMT theJTAG speed is set to 3 MHz as it is the lowest allowed crystal frequency For AT91SAMS the JTAG clock is in adaptive mode Note 1 For further in
47. ppletAddrArgv3 expr appletAddr 0x18 Write the Cmd op code in the argument area if catch TCL_Write_Int target handle appletCmd init appletAddrCmd dummy_err error Error Writing Applet command n dummy_err set argIdx 0 foreach arg appletArgList Write the Cmd op code in the argument area if catch TCL Write Int target handle Sarg expr appletAddrArgvO SargIdx dummy_err error Error Writing Applet argument Sarg dummy_err incr argIdx 4 4 Launch the applet Jumping to the appletAddr if catch set result GENERIC Run appletCmd init dummy errl error Applet Init command has not been launched dummy err if result 1 tf error Can t detect known device elseif Sresult 0 error Applet Init command returns error format 0x 08x Sresult Retrieve values AMEL AT91 ISP SAM BA User Guide 4 9 6421B ATARM 06 Jan 10 SAM BA Customization variable memorySize variable appletBufferAddress variable appletBufferSize set GENERIC memorySize TCL_Read_Int target handle SappletAddrArgv0 set GENERIC appletBufferAddress TCL Read Int target handle SappletAddrArgv1 set GENERIC appletBufferSize TCL_Read_Int target handle SappletAddrArgv2 set FLASH flashLockRegionSize expr TCL Read Int target handle appletAddrArgv3 amp OxFFFF set FLASH flashNumbersLockBits expr TCL_Read_Int target handle SappletAddrArgv3 gt gt 16 se
48. rguments prepared by the host and executes the corresponding function The applet returns state status and result values in the mailbox area Usually applets include INIT buffer read buffer write functions To program large files the whole pro gramming operation is split by the host into payloads Each payload is sent to a device memory buffer using SAM BA monitor command TCL Write The host prepares the mailbox with the Buffer write com mand value the buffer address and the buffer size The host then forces the device in Applet mode using a TCL Go command The host polls the end of payload programming by trying to read the state value in the mailbox The device will answer to the host as soon as it returns to SAM BA monitor mode In case of USB connection when the host polls while the device is in Applet mode the device NACK IN packets sent by the host Applet execution has to be short enough in order to prevent from connection timeout error In case of long programming or erasing operation from time to time the device shall leave Applet mode to return to SAM BA monitor mode in order to be able to achieve the current pending host TCL_ReadInt command within the timeout threshold 4 3 2 SDRAM Initialization 4 6 To extend the buffer size some applets run in SDRAM This requires SDRAM initialization SDRAM ini tialization is done by an applet C code of this applet is located in the Install Directory SAM BA AMEL AT91 ISP SAM BA U
49. rom top to bottom they are f Memory Display area Memory Download area 4f TCL Shell area The Memory Display and the Memory Download areas are used to simplify the memory access 2 3 1 Board Connection SAM BA scans active USB connections with AT91SAM based boards it is mandatory to connect the tar get to the PC before launching SAM BA Non USB connections do not benefit from autodetection Warning The USB cable must NOT be connected to the board for RS232 use otherwise the USB inter face is chosen by default Note To change the connection type RS232 USB JTAG the target must be rebooted and SAM BA must be restarted When SAM BA starts a pop up window see Figure 2 1 appears that enables selection of the board Likewise the connection has to be selected from the dropdown menu usb ARMX for USB connected devices 5jlink ARMX for SAM ICE JLink connected devices COMX for available COM ports Note To select another board SAM BA must be restarted If no USB connected device is available in the list please check that devices have been connected before SAM BA was launched Warning JTAG connection with a new board is possible as soon as the oscillator is the same as the corresponding AT91SAM EK one Figure 2 1 Choose Protocol Window Fw SAM BA 2 7 m Select the connection usb ARMO z Select your board AT 9154M9261 EK Connect Exit 6421B ATARM 06 Jan 10 AT91 ISP
50. ser Guide 6421B ATARM 06 Jan 10 SAM BA Customization v2 x applets isp project extram directory In case the applet fails to initialize it SAM BA launch will stop with the following error message Figure 4 5 Error Message ig ExternalR _ C9 Failed to initialize external RAM OK Usually SDRAM initialization is done by default during SAM BA start up sequence in the lt board gt tcl file This applet may require customization to support a new board SDRAM configuration The initialization is done in the lt board gt tcl file Initialize SDRAMC if catch GENERIC Init SDRAM appletAddr RAM appletFileName dummy_err puts E Error during SDRAM initialization else puts I SDRAM initialized If a custom board has different SDRAM characteristics timing pinout it is mandatory to recompile the extram applet with correct settings 4 3 3 Applets Usage Each memory programming interface is described in an array in lt board gt tcl Please refer to Section 4 2 2 Board Description File on page 4 3 Applets are usually loaded by an INIT script This TCL procedure belongs to the memory namespace DATAFLASH to set an example DATAFLASH Init invokes GENERIC Init procedure with the applet binary location the loading address and eventually arguments required by the INIT function of the data flash applet SPI index and chip select index to set an example The INIT function returns the paylo
51. t FLASH flashSize SGENERIC memorySize puts I Memory Size format 0x X GENERIC memorySize bytes puts I Buffer address format 0x X GENERIC appletBufferAddress puts I Buffer size format 0x X GENERIC appletBufferSize bytes puts I Applet initialization done proc GENERIC LoadApplet appletAddr appletFileName global target global libPath if target connection usb ARMO Se target connection jtag ARMO set GENERIC traceLevel 5 puts I Loading applet file tail appletFileName at address format 0x X SappletAddr Open Data Flash Write file if catch set f open SappletFileName r error Can t open file appletFileName Copy applet into Memory at the appletAddr fconfigure f translation binary set size file size appletFileName set appletBinary read f size if catch TCL Write Data target handle appletAddr appletBinary size dummy err dummy errl error Can t write applet appletFileName close f AMEL 4 10 6421B ATARM O6 Jan 10 AT91 ISP SAM BA User Guide SAM BA Customization proc GENERIC Run Launch the applet wait for the end of execution and return the result proc GENERIC Run cmd 4 3 4 global target variable appletAddr set appletCmdAddr expr appletAddr 4 set appletStatusAddr expr appletAddr 8 puts I Running applet command cmd at address format 0x X appletAddr Lau
52. t address ranges displayed in the Memory Display window array set memoryAlgo SRAM SDRAM Flash DataFlash AT45DB DCB NandFlash NorFlash Map Peripheral ROM REMAP at91sam7se512 sram at91sam7se512 sdram at91sam7se512 flash at91sam7se512 dataflash 1at91sam7se512 nandflash at91sam7se512 norflash map at91sam7se512 peripheral at91sam7se512 rom at91sam7se512 remap The first 5 entries correspond to the five Memory Download tabs see Figure 4 3 Figure 4 2 Memory Download Tabs DataFlash AT45DB DCB Flash NandFlash SDRAM SRAM Download Upload File Send File Name um Send File Receive File Name Address 200000 Size For Receive File 01000 byte s Compare sent file with memory Receive File A memory module array is defined for each module declared in the memoryAlgo array array set at91sam7se512 nandflash dftDisplay 1 dftDefault 1 dftAddress 0x0 dftsize 0x10000000 dftSend NANDFLASH sendFile dftReceive NANDFLASH receiveFile dftScripts at91sam7se512_nandflash_scripts Field definitions AT91 ISP SAM BA User Guide AMEL 4 3 6421B ATARM O6 Jan 10 SAM BA Customization dftDisplay indicates if the memory appears as a Memory Download tab 0 no 1 yes dftDefault Set to one if this memory tab shall be selected when SAM BA starts There shall be one default memory tab among all memory tabs
53. tall Directory SAM BA v2 xMlibNcommon 2 5 2 1 SAM BA Scripts for Demos Most AT91 demos Linux Windows CE are delivered with a TCL script to deploy binaries in AT91SAM devices memories These scripts can be used as a startpoint to deploy custom application on Atmel AT91SAM Evaluation Kits or AT91SAM based boards AIMEL 2 10 Sey C AT91 ISP SAM BA User Guide 6421B ATARM 06 Jan 10 AIMEL Ey Section 3 AT91 ISP Architecture 3 1 Overview The AT91 In system Programmer ISP provides an open set of tools for programming the AT91SAM7 AT91SAMS and ATSAM3 ARM based microcontrollers They are based on a common dynamic linked library DLL the AT91Boot_DLL It is used by SAM BA SAM PROG and all ISP tools AT91Boot_DLL API is in the public domain so that custom GUI ISP solutions can be built It avoids writ ing low level functions such as Flash memory writing algorithms etc AT91Boot_DLL is an OLE COM component distributed under a DLL AT91Boot_DLL dll allowing auto mation tools It is also possible to execute the AT91Boot_DLL functions in command lines in a TCL shell An interme diate DLL AT91Boot_TCL dll is used to transform TCL commands into calls to AT91Boot_DLL Several communication links are available such as USB serial link CAN or JTAG Figure 3 1 AT91 ISP Framework Architecture Command Line Tool SAM PROG SAM BA GUI Customer ISP TCL SH AT91Boot_DLL dll AT91Boot_TCL dl
54. tch T AT91Boot DLL AT91BOOtDLL 1 3 7 4 Using AT91Boot DLL without MFC This paragraph explains the project OpenRDI_OLE dsw located in AT91Boot DLL Example OLE without MFC folder To use AT91Boot DLL in such a project the following steps must be performed m Initialize COM library by calling coInitialize NULL Use coUninitialize to close COM Library at the end of the project m Import AT91Boot DLL COM object from AT91Boot DLL tlb Type Library file Eventually rename namespace if necessary m Add using namespace directive to share the same namespace as AT91Boot DLL library m Create a pointer to AT91Boot DLL COM objec t 3 7 4 1 Code Example In stdafx h header file import YOUR_INSTALL_DIRECTORY AT91Boot_DLL tlb rename_namespace AT91BOOTDLL_Lib In OpenRDI_OLE cpp source file using namespace AT91BOOTDLL_Lib CoInitialize NULL COM Object Creation IAT91BootDLLPtr pAT91BootDLL uuidof AT91BootDLL AIMEL 3 20 een AT91 ISP SAM BA User Guide 6421B ATARM 06 Jan 10 AT91 ISP Architecture 3 8 AT91Boot_TCL Interface AT91Boot_TCL dll must be loaded in order to access its functions The command is load file join AT91Boot TCL dll At91boot tcl Note The command is case sensitive When SAM BA starts a structure containing board and connection information is set This global vari able name is target and the global target statement must be declared in any procedure using an API function Tar
55. the TCL Shell AMEL AT91 ISP SAM BA User Guide 2 5 6421B ATARM 06 Jan 10 Running SAM BA Note A forbidden address corresponds to an address outside the selected memory range address m Compare the selected file with the memory content using the Compare sent file with memory button A message box is displayed if the file matches or not with the memory content of the file size Make sure that your memory is correctly initialized before comparing any data Figure 2 6 Comparison Result Successful ir F Comparison Result d e YD Sent file amp Memory area content address 0x00300000 size 32768 bytes match exactly OK Figure 2 7 Comparison Result Failed Comparison Result m 1 A Sent file amp Memory area content address 0x00300000 size 65536 bytes do not match OK 2 3 3 5 Memory Scripts Some scripts may be supplied for each memory Usually these scripts allow you to configure and initial ize quickly the corresponding memories SDRAM initialization erase all Flash etc m To execute a script select the memory by clicking on its tab m Select the script to launch in the list box m Click on the Execute button Note Messages which inform of the correct execution of the script are displayed in the TCL Shell Section 2 3 4 TCL Shell Area and or through a message box 2 3 4 TCL Shell Area This is a standard TCL shell Everything you type in the shell is interpreted by a TCL int
56. tion files are located Figure 4 1 Adding a New Board SAM BA 2 0 Choose Prot Select the connection COMI MM Select your board AT 915 4M9260 EF ha AT315AMS2EU EE ATS SAMPXC512 EK Connect ATSTSAMTSST2 EK AT31SAM S25b5 EK AT31SAMVSE3Z EK AT31SAM SE2SE EK AT31SAMARLT128 EK AT31SAM7S128 EK AT31SAMSSESTZ EK AT315AM 7x31 ZE Each subdirectory corresponds to one board and has one board description file board_name tc1 and applet binaries i e isp xx device name bin For example the directory of the AT91SAM7SE512 EK board contents are nstall Directory SAM BA v2 x lib AT91SAM7SE512 EK AT91SAM7SE512 EK tcl isp dataflash at91sam7se512 bin isp extram at91sam7se512 bin isp flash at91sam7se512 bin isp serialflash at91sam7se512 bin isp nandflash at91sam7se512 bin isp norflash at91sam7se512 bin Source code of each applet is located in the Install DirectoryNSAM BA v2 7 applets directory AMEL 4 2 6421B ATARM O6 Jan 10 AT91 ISP SAM BA User Guide 4 2 2 Board Description File SAM BA Customization Board description files accomplish the link between applets and generic transfer routines running on the host PC Several hash tables list memory algorithms which apply to the board and parameters The first array found in the board description file lists the memory modules present on the board Note that some devices such as Peripheral or REMAP can also be found here but are jus
57. tions and is not able to communicate with the host An applet is a small piece of software running on the target It is loaded in the device memory while the device is in SAM BA monitor mode using TCL Write command The device switches from SAM BA monitor mode to Applet mode using the TCL Go command The device executes the applet code At the end of the current operation the device switches back to SAM BA monitor mode AMEL 4 5 6421B ATARM O6 Jan 10 AT91 ISP SAM BA User Guide SAM BA Customization Figure 4 4 Applet Workflow HOST TARGET L L 8 AT91BootROM TCL_WriteData applet appletAddr li Load Applet L TCL WriteData payload appletBufferAddr E inp ERE SAM BA Monitor Mode TCL Writelnt appletArg appletArgAddr E gt TCL_Go appletAddr gt Applet L er ER EK em Ze rogram Payloac TCL Readlnt appletArg appletArgAddr E 3 a Applet Mode d lt E TCL WriteData payload appletBufferAddr li gt datis SAM BA Monitor Mode TCL Writelnt appletArg appletArgAddr E TCL_Go appletAddr E gt L TCL Readlnt appletArg appletArgAddr _ I gt Program Payload Applet Mode j L j L L L E SAM BA Monitor Mode L An applet can execute different programming or initialization commands Before switching to Applet mode the host prepares command and arguments data required by the applet in a mailbox mapped in the device memory During its execution the applet decodes the commands and a
58. xCA write short Address Value write short 0x200002 OxCAFE write int Address Value write int 0x200000 OXCAFEDECA read byte Adaress read byte 0x200003 read short Adaress read short 0x200002 read int Adaress read int 0x200000 go Address go 0x20008000 m Write commands Write a byte write_byte a half word write_short or a word write_int to the target Address address in decimal or hexadecimal Value byte half word or word to write in decimal or hexadecimal Output nothing m Read commands Read a byte read_byte a half word read_short or a word read_int from the target Address address in decimal or hexadecimal Output the byte half word or word read in decimal Note read_int returns a signed integer in decimal For example reading with read_int OxFFFFFFFF command returns 1 whereas reading OxFF with read byte command returns 255 m go Jump to a specified address and execute the code Address address to jump to in decimal or hexadecimal Warning The send file receive file and compare file commands are slightly different now The Mem ory tag syntax changed see Table 3 15 If you leave SAM BA be sure to reboot your board before launching it the next time AIMEL 3 23 6421B ATARM 06 Jan 10 AT91 ISP SAM BA User Guide AT91 ISP Architecture 3 9 SAM BA TCL Interface Table 0 1 Commands Available through the TCL Shell Commands Argumeni s Example
Download Pdf Manuals
Related Search
Related Contents
Cognitive Solutions Printer A798 User's Manual 燃焼排ガス分析 / 酸素濃度計 Fiche à télécharger BioWord User Manual NiceLabel Guida veloce Comprendre que le SIDA est une maladie incurable. Copyright © All rights reserved.
Failed to retrieve file