Example of placing ARM C++ library
code
The following is a C++ program that is to be scatter-loaded:
#include <iostream>
using namespace std;
extern "C" int foo ()
{
cout << "Hello" << endl;
return 1;
}
To place the C++ library code, define the scatter file as
follows:
LR 0x0
{
ER1 0x0
{
*armlib*(+RO)
}
ER2 +0
{
*cpplib*(+RO)
*(.init_array) ; Section .init_array must be placed explicitly,
; otherwise it is shared between two regions, and
; the linker is unable to decide where to place it.
}
ER3 +0
{
*(+RO)
}
ER4 +0
{
*(+RW,+ZI)
}
}
The name install_directory\lib\armlib is
used to indicate the ARM C library files that are located in the armlib directory.
The name install_directory\lib\cpplib is
used to indicate the ARM C++ library files that are located in the cpplib directory.
See also
- Concepts
- Reference
Using ARM® C and C++ Libraries and
Floating Point Support: