Technical notes on using Analog Devices DSPs, processors and development tools
Contact our technical support at dsp.support@analog.com and at dsptools.support@analog.com
Or vi sit our o n-li ne r esou rces htt p:/ /www.analog.com/ee-notes and http://www.analog.com/processors
Programming In-Circuit Flash on the ADSP-21262 SHARC® DSP
Contributed by R Murphy Rev 1 – January 23, 2004
Introduction
The ADSP-21262 SHARC® DSP, like most reprogrammable processors, requires internal program
code and data to be boot-loaded upon power-up. The
code and data can be supplied by a host system (e.g.,
via SPI, JTAG connection, etc.) or can be stored in an
on-board non-volatile memory device such as a ROM
or in a serial or parallel flash device. The ADSP21262 EZ-KIT Lite™ evaluation board enables the
DSP to boot in any of these ways. The focus of this
Engineer-to-Engineer note is PROM booting. This is
supported by an 8-Mbit flash memory device
(AM29LV081B-120EC) from AMD.
The system designer and the EZ-KIT Lite user alike
have several options available to program the boot
code into the flash device.
Flash Programmer Utility
VisualDSP++® 3.0 for SHARC DSPs includes a
Flash Programmer utility that allows you to point the
flash utility to a previously programmed loader
(.LDR) file and programs the flash based on a
supplied driver file. The driver file is simply a DSP
executable (.DXE) developed for a specific processor
and flash device combination. The VisualDSP++
development tools include a driver file for the ADDS21262 EZ-KIT Lite board, allowing you to program
your own driver file with your own specific flash
device.
Attached Example Code
Alternatively, the Flash Programmer utility itself can
be circumvented, and the attached example code can
be used to manually program the image into flash.
This is useful for verifying the development of a
custom driver for the Flash Programmer utility as
well as for simply creating a custom executable for
use in programming the end system.
This example shows how the VisualDSP++ can be
used to program an application into the flash. “Incircuit programming” (as opposed to burning the
flash before it is placed on the board) is frequently
used to perform software or firmware updates to
systems already deployed in the field.
The task requires two separate sets of code: a
software routine to program data into the flash, and
an end application that will ultimately be boot-loaded
and run by the DSP. In this example, a generic flash
programming algorithm is contained in
flash_programmer.asm, and the application is a
simple LED toggling routine in
blink.asm. (This
routine will serve as the data payload that
flash_programmer.asm will program into the
flash.) The attached code example demonstrates the
four steps involved with in-circuit flash
programming.
Overview
1. Building the Application
Using the USB Debug Agent, a JTAG emulator,
and/or the VisualDSP++ simulator, you can write and
test the application. As previously mentioned, the
application in
sequentially. Verify that this routine and your board
is functional by activating an EZ-KIT Lite debugtarget in the IDDE and then opening
Next, load the
executable has been loaded, run the project (press the
<F5> key) and watch the LEDs.
blink.asm toggles LED0-LED8
blink.dpj.
blink.dxe executable. After the
Copyright 2004, Analog Devices, Inc. All rights reserved. Analog Devices assumes no responsibility for customer product design or the use or application of
customers’ products or for any infringements of patents or rights of others which may result from Analog Devices assistance. All trademarks and logos are property
of their respective holders. Information furnished by Analog Devices Applications and Development Tools Engineers is believed to be accurate and reliable, however
no responsibility is assumed by Analog Devices regarding technical accuracy and topicality of the content provided in Analog Devices’ Engineer-to-Engineer Notes.
2. Creating the PROM Boot-Image
After verifying the application, use the VisualDSP++
loader to generate a boot-image from the source code.
To do this, open the Project Options dialog box for
blink.dpj and specify “DSP loader file” as the
output file type (Figure 1.)
Figure 2. Specifying Parallel Port (prom) as boot type
a
Figure 1. Specifying DSP loader file as output file
type
The .LDR file to be generated will ultimately be
included in the flash-programming routine as an
array. To this end, the .LDR file should be in
“Include” format (essentially comma-delimited
ASCII) with each word being 32-bits, as shown in
Figure 2.
Click "OK" and then click "Rebuild All". This
rebuilds the project according to the specified project
options and generates
3. Programming the Flash Device
At this point, use the Flash Programmer utility (A) or
included flash-programmer project (B) to program the
.LDR image into the flash device.
blink.ldr.
3A. Using the Flash Programmer Utility
i. From the VisualDSP++ Tools menu, choose
‘Flash Programmer’.
ii. Click on ‘Load Driver’. The utility will load a
supplied driver for the AMD Flash on the EZKIT Lite board (or you can browse to a custom
flash driver file).
iii. Browse to the folder containing blink.ldr and
click ‘Load File’
iv. In the ‘Confirm Load File’ dialog box, click
‘Yes’.
v. When the status icon turns green, reset the board
to boot the new application code.
3B. Using the Included flash_programmer Project
i. Open
ii. Rebuild the project with your application code.
flash_programmer.dpj.
The last step is to modify the flash-programming
application to include the recently generated
blink.ldr. To do this, in the file
flash_programmer.asm, simply declare an
array in a section mapped to external memory and
initialize it with the payload .LDR file. To use the
example application (blink), this is done as
follows:
Programming In-Circuit Flash on the ADSP-21262 SHARC® DSP Page 2 of 13
The linker description file (.LDF) is then used to
pack all
memory seg ment (also named
With the correct payload file specified, simply
rebuild the project to generate the flashprogramming executable.
(flash_programmer.dxe) .
iii. Programming the FLASH
Four LEDs provide feedback on the progress of
the FLASH programming.As each of the
following five steps to program the FLASH
complete, an LED illuminates to indicate that it
was successful or blinks rapidly if it failed.
The five steps are as follows:
seg_ext8 input sections to an external
seg_ext8).
1. Verify that the payload fits into the 1 M x 8-
bit Flash.
2. Reset the flash.
3. Erase the flash (completely or by-sector).
4. Write the payload .LDR file into the FLASH.
5. Verify the data.
If all five steps are successful, all of the LEDs briefly
flash, indicatinge that the in-circuit FLASH
programming was successful. You may now reset the
board and the new application code will be booted.
Additional Notes
In this example, the payload buffer,
my_file[], is initiated at build time. In a real
system, this buffer would be initialized during
execution. The FLASH data may be imported
from a serial port, link port, or SPI port. The data
could be placed into memory by an on-board
host processor.
Viewing the flash and external memory space via
memory windows in the IDDE is supported in
VisualDSP++ 3.0 using the HP PCI ICE.
However, during debug of the application, this
may cause the debugger window to hang
momentarily, especially while single stepping.
To avoid this bottleneck, close the external
memory windows while the code is running, and
open them as needed to verify the memory
contents.
a
References
[1] ADSP-2126x SHARC DSP Core Manual, Revision 1.0, November 2003. Analog Devices, Inc.
[2]
ADSP-2126x SHARC DSP Peripherals Manual, Revision 1.0, December 2003. Analog Devices, Inc.
[3] ADSP-21262 EZ-KIT Lite® Evaluation System Manual, Revision 1.0, October 2003. Analog Devices, Inc.
[4] ADSP-21262 SHARC Processor Preliminary Data Sheet, Revision PrB, August 2003. Analog Devices, Inc.
[5] AM29LV081B 1M x 8-Bit Uniform Sector Flash Memory Data Sheet, Revision D, September 2003. AMD
Programming In-Circuit Flash on the ADSP-21262 SHARC® DSP Page 3 of 13
a
Appendix
flash_programmer.asm
/* ********************************************************************************
*
* Copyright (c) 2003 Analog Devices Inc. All rights reserved.
*
* *******************************************************************************/
//"flash_programmer.asm" RJM 9/2003 DSP Applications Engineering
//This program is intended for the AMD 8-bit 1M parallel flash
//found on the ADSP-21262 Ez-Kit.
//The subroutines will:
// -FLASH_FILE_SIZE: -check to see that the buffer 'my_file' is not too large to
// fit in the 1Mx8 flash
// -FLASH_RESET: -issue the flash reset command
// -ERASE_FLASH_CHIP; -erase the entire flash and wait until the erase command is
// completed
// -SECTOR_ERASE: -calculate the number of sector needed to hold the data and
// -erase accordingly (and verify erasure)
// -PROGRAM_FLASH: -program the flash with the data/code in my_file and check
// for write cmd completion after each byte
// -VERIFY_FLASH: -verify the contents of the flash with the values in
// ‘my_file'
//This example is intended to provide a starting point to be tailored to fit
//specific needs.
//The VERIFY_FLASH routine can be omitted and you can use either SECTOR_ERASE or
//ERASE_FLASH_CHIP
//External memory (SRAM) is not required to store the data before programming, but
//is desirable if the data is > internal memory.
//***Be advised, initializing a large un-initialized variable in external memory
//can take a long time to load with the emulator.
//***For debug purposes, after loading the external segment once, use the
//SHT_NOBITS command in the LDF to avoid this lengthy process
//***as you debug. Be sure to rebuild without SHT_NOBITS after debug.
//To program boot loader code into the flash, use the Loader in VisualDSP++ 3.0 SP1
//to generate a .ldr file with the following options:
// -Width: 32
// -Boot Type: Parallel Port (prom)
// -Format: Include
//
//*************************************************
#include <def21262.h>
#define FLASH_START_ADDRESS 0x01000000
#define FLASH_SIZE 0x100000
#define LED_ADDRESS 0x01400000
#define SRAM_START_ADDRESS 0x01200000
#define SECTOR_SIZE 65536
#define NUMBER_SECTORS (LENGTH(my_file)*BYTES >>16) +1
//i.e. if length of file in bytes is 0x1ffff, 1 sector= 0xffff, shift by 16 gives
//us 1+1 etc.
#define BYTES 4 //i.e. 4 * 8bits = 32 bit logical data width
// 2 * 8bits = 16 bit logical data width
// 1 * 8bits = 8 bit logical data width
.global main;
Programming In-Circuit Flash on the ADSP-21262 SHARC® DSP Page 4 of 13
Loading...
+ 9 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.