Using C++ with DSP/BIOS
2-28
2.9 Using C++ with DSP/BIOS
DSP/BIOS applications can be written in C++. An understanding of issues
regarding C++ and DSP/BIOS can help to make C++ application
development proceed smoothly. These issues concern memory
management, name mangling, calling class methods from configured
properties, and special considerations for class constructors and destructors.
2.9.1
Memory Management
The functions new and delete are the C++ operators for dynamic memory
allocation and deallocation. Within DSP/BIOS applications, these operators
are reentrant because they are implemented with the DSP/BIOS memory
management functions MEM_alloc and MEM_free. However, memory
management functions require that the calling thread obtain a lock to memory
before proceeding if the requested lock is already held by another thread,
blocking results. Therefore, new and delete should be used by TSK objects
only.
The functions new and delete are defined by the run-time support library, not
the DSP/BIOS library. Since the DSP/BIOS library is searched first, some
applications can result in a linker error stating that there are undefined
symbols that were first referenced within the rtsbios (the run-time support)
library. This linker error is avoided by using the -x linker option which forces
libraries to be searched again in order to resolve undefined references. See
Section 2.7,
Using DSP/BIOS with the Run-Time Support Library
for more
information.
2.9.2
Name Mangling
The C++ compiler implements function overloading, operator overloading,
and type-safe linking by encoding a function's signature in its link-level name.
The process of encoding the signature into the linkname is referred to as
name mangling. Name mangling could potentially interfere with a DSP/BIOS
application since you use function names within the configuration to refer to
functions declared in your C++ source files. To prevent name mangling and
thus to make your functions recognizable within the configuration, it is
necessary to declare your functions in an extern C block as shown in the code
fragment of Example 2-4.
Summary of Contents for TMS320 Series
Page 1: ...TMS320 DSP BIOS v5 40 User s Guide Literature Number SPRU423G April 2009 ...
Page 16: ...xvi ...
Page 152: ...Tasks 4 48 Figure 4 12 Trace from Example 4 7 ...
Page 168: ...Semaphores 4 64 Figure 4 14 Trace Results from Example 4 11 ...
Page 202: ...5 20 ...
Page 287: ...Index 9 Index Void 1 11 W words data memory 3 15 of code 1 5 wrapper function 2 29 ...
Page 288: ...Index 10 Index ...