Analog Devices EE249v01 Application Notes

Engineer-to-Engineer Note EE-249
a
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
Implementing Software Overlays on ADSP-218x DSPs with VisualDSP++®
Contributed by Ramesh Babu and Aseem Vasudev Prabhugaonkar Rev 1 – October 4, 2004

Introduction

This EE-Note discusses the implementation of software overlays on ADSP-218x DSPs. A simple code example, demonstrating the software overlay technique for ADSP-218x DSP, is discussed later in this document.
Early versions of the VisualDSP® toolset used a different scheme to support software overlays as discussed in the legacy EE-Note Everything You
Always Wanted to know about Overlays - *But were afraid to ask (EE-67). With VisualDSP++®
3.5 a new approach has been enabled.

What are Software Overlays?

Due to limited address space, many ADSP-218x derivatives provide multiple memory pages, called hardware overlays. The software overlay technique is a completely different scheme to populate the content of physical SRAM with different data or code on demand.
“live address space”, and the memory address where the program is executed in internal memory is called “run address space”. The code responsible for transferring the data / program code from external memory to internal memory at runtime is called an overlay manager. It typically resides in a reserved space of the DSP’s internal memory.

Software Overlays on ADSP-218x DSPs

Software overlays can be implemented using the ADSP-218x DSP's external byte-wide memory space. A byte-wide memory can be interfaced through the processor's BDMA port. The overlay code/data resides in the external byte-wide memory. The overlay manager is responsible for initializing byte DMA (BDMA) to transfer the data/code from external memory into internal memory when required.

VisualDSP++ Support

The software overlay technique is commonly used when a processor is does not have sufficient internal memory to hold all of the application's data / program code. In these situations, part of data / program code is loaded into internal memory during the booting process and the remaining part is placed in external memory. When program code (or data) in external memory has to be executed, it is loaded into
The VisualDSP++ linker automatically generates overlay constants, which configure the BDMA parameters in the overlay manager. Each overlay has a word size, run-time address and live address used by the overlay manager to determine where the overlay resides and where it is executed.
The linker-generated constants (where N is the ID# of the overlay) are:
internal memory and executed. The memory address range where the overlay
_ov_startaddress_N (live address space)
function resides in the external memory is called
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.
_ov_word_size_run_N
p
A
_ov_word_size_live_N _ov_runtimestartaddress_N (run addr. space)
The linker is also responsible for resolving the symbol addresses of overlay data and labels.

Example Program

This section shows a simple example program to illustrate the software overlay implementation on ADSP-218x DSPs. The assembly program provided with this EE-Note toggles a flag pin at two different speeds. This program uses two software overlay functions which exist in the external byte memory.
Internal PM
Memory
0x0000
Main ( )
Overlay_Manager ( )
0x2000
Figure 1. Simple Memory Overlay Example
0x1000
0x2000
ace
Run S
The main program calls the two software overlay functions in an infinite loop. One of the software overlay functions (
Fast-LED-Blink()) toggles
the LED at a faster rate; the other (
Blink()
) toggles the LED at a slower rate.
Figure 1 illustrates where the overlay functions,
overlay manager, and the main function are stored.
The
main() and Overlay_Manager() functions
are loaded into the internal RAM of the ADSP­218x during the booting process. The
Blink()
and Slow-LED-Blink() overlay
External Byte
Memory
Fast-LED-Blink ( )
Slow-LED-Blink ()
Slow-LED-
Fast-LED-
functions are saved in external byte memory. During runtime, when an overlay functions is called, the function is loaded into internal memory and then executed. Accessing code and/or data overlays dynamically provides greater flexibility toward managing your DSP’s internal memory.

Linker Definitions

Let's look into the declarations required in the Linker Description File (.LDF) for the example program explained above.
// "run" space for PMOVLAY pages mem_pmovly { TYPE(PM RAM) START(0x002000) END(0x003fff) WIDTH(24) }
// "live" space for PMOVLAY pages mem_pmpage1 { TYPE (BM RAM) START(0x001000) END(0x001fff)
Live Space
WIDTH(8) } mem_pmpage2 { TYPE(BM RAM) START(0x002000) END(0x002fff) WIDTH(8) }
Listing 1. Run and Live Space Declaration in .LDF
The statements in Listing 1 in the MEMORY {} section of the (i.e., the run space and live space addresses of the overlay program code).
Live space. which is specified in the byte memory (BM), helps the linker generate the overlay constants.
The statements in Listing 2, which are specified in code and data to the physical memory of a processor in a DSP system. In Listing 2, the commands (e.g.,
.LDF file define the target memory
PROCESSOR { } section of the .LDF file, map
tell the linker that a specific section
pm_ovlay_1) from a specified input file
Implementing Software Overlays on ADSP-218x DSPs with VisualDSP++® (EE-249) Page 2 of 6
Loading...
+ 4 hidden pages