Computer Hardware Algorithm Standard User's Guide
Table Of Contents
- Table of Contents
- Preface
- 1 Overview
- 2 General Programming Guidelines
- 3 Algorithm Component Model
- 3.1 Interfaces and Modules
- 3.1.1 External Identifiers
- 3.1.2 Naming Conventions
- 3.1.3 Module Initialization and Finalization
- 3.1.4 Module Instance Objects
- 3.1.5 Design-Time Object Creation
- 3.1.6 Run-Time Object Creation and Deletion
- 3.1.7 Module Configuration
- 3.1.8 Example Module
- 3.1.9 Multiple Interface Support
- 3.1.10 Interface Inheritance
- 3.1.11 Summary
- 3.2 Algorithms
- 3.3 Packaging
- 3.1 Interfaces and Modules
- 4 Algorithm Performance Characterization
- 5 DSP-Specific Guidelines
- 6 Use of the DMA Resource
- 6.1 Overview
- 6.2 Algorithm and Framework
- 6.3 Requirements for the Use of the DMA Resource
- 6.4 Logical Channel
- 6.5 Data Transfer Properties
- 6.6 Data Transfer Synchronization
- 6.7 Abstract Interface
- 6.8 Resource Characterization
- 6.9 Runtime APIs
- 6.10 Strong Ordering of DMA Transfer Requests
- 6.11 Submitting DMA Transfer Requests
- 6.12 Device Independent DMA Optimization Guideline
- 6.13 C6xxx Specific DMA Rules and Guidelines
- 6.14 C55x Specific DMA Rules and Guidelines
- 6.15 Inter-Algorithm Synchronization
- A Rules and Guidelines
- B Core Run-Time APIs
- C Bibliography
- D Glossary
www.ti.com
2.4 Program Memory
2.5 ROM-ability
Program Memory
Like the data memory requirements described in the previous section, it is important that all
eXpressDSP-compliant algorithms are fully relocatable; i.e., there should never be any assumption about
the specific placement of an algorithm at a particular address. Alignment on a specified page size is
permitted, however.
Rule 4
All algorithm code must be fully relocatable. That is, there can be no hard coded program memory
locations.
As with the data memory requirements, this rule only requires that Code be relocated via a linker. For
example, it is not necessary to always use PC-relative branches. This requirement allows the system
developer to optimally allocate program space to the various algorithms in the system.
Algorithm modules sometimes require initialization Code that must be executed prior to any other
algorithm method being used by a client. Often this Code is only run once during the lifetime of an
application. This Code is effectively "dead" once it has been run at startup. The space allocated for this
Code can be reused in many systems by placing the "run-once" Code in data memory and using the data
memory during algorithm operation.
A similar situation occurs in "finalization" Code. Debug versions of algorithms, for example, sometimes
implement functions that, when called when a system exits, can provide valuable debug information; e.g.,
the existence of objects or objects that have not been properly deleted. Since many systems are designed
to never exit (i.e., exit by power-off), finalization Code should be placed in a separate object module. This
allows the system integrator to avoid including Code that can never be executed.
Guideline 2
Each initialization and finalization function should be defined in a separate object module; these
modules must not contain any other code.
In some cases, it is awkward to place each function in a separate file. Doing so may require making some
identifiers globally visible or require significant changes to an existing Code base. The TI C compiler
supports a pragma directive that allows you to place specified functions in distinct COFF output sections.
This pragma directive may be used in lieu of placing functions in separate files. The table below
summarizes recommended section names and their purpose.
Section Name Purpose
.text:init Run-once initialization code
.text:exit Run-once finalization code
.text:create Run-time object creation
.text:delete Run-time object deletion
There are several addressing modes used by algorithms to access data memory. Sometimes the data is
referenced by a pointer to a buffer passed to the algorithm, and sometimes an algorithm simply references
global variables directly. When an algorithm references global data directly, the instruction that operates
on the data often contains the address of the data (rather than an offset from a data page register, for
example). Thus, this Code cannot be placed in ROM without also requiring that the referenced data be
placed in a fixed location in a system. If a module has configuration parameters that result in variable
length data structures and these structures are directly referenced, such Code is not considered
ROM-able; the offsets in the Code are fixed and the relative positions of the data references may change.
Alternatively, algorithm Code can be structured to always use offsets from a data page for all fixed length
references and place a pointer in this page to any variable length structures. In this case, it is possible to
configure and locate the data anywhere in the system, provided the data page is appropriately set.
SPRU352G – June 2005 – Revised February 2007 General Programming Guidelines 23
Submit Documentation Feedback