RealView .sym file in IAR Embedded Workbench for ARM
Technical Note 96176
Architectures:
ARM
Component:
linker
Updated:
5/31/2018 9:14 AM
Introduction
How can I use a RealView symbol definitions file (symdefs/.sym) file in IAR Embedded Workbench for ARM?
Warning!
This is an technically advanced solution. It requires that you for example know what AEABI is and what calling convention is used.
Note, with this solution:
Only a limited numbers of errors and warnings can be produced for the external symbols.
Accessing symbols in another image
You want one image generated with IAR Embedded Workbench for ARM to know the global symbol values of another image generated with RealView Compilation Tools.
Solution
You can use a symbol definitions (symdefs) file.
.sym file
Generate and copy this file to your project directory. Use the armlink option --symdefs.
armlink --symdefs filename
For further information regarding the ARM Linker you are refeered to ARM documentation.
.bat file
Use the sym2h.bat script file in prebuild to generate the .h and .f files -
IAR Embedded Workbench > Project > Options... > Build Actions > Pre-build command line:
$PROJ_DIR$\sym2h.bat $PROJ_DIR$\filename.sym
Use: sym2h.bat filename
The filename should be a fully qualified path name.
Output directory is the same as the input directory.
Filename input is required. The filename should be a fully qualified path name.
Output directory is the same as the input directory.
.f file
To use the generated symbol definitions file add an Extra Option to ilinkerarm.exe -
IAR Embedded Workbench > Project > Options... > Linker > Extra Options > select 'Use command line options' and Command line options:
-f $PROJ_DIR$\filename.f
Use: -f file
Read command line options from file
.h file
To use the generated external definitions file add include to your code -
#include "filename.h"
More information
Tested with a symdefs file generated from RealView Compilation Tools version 2.2 [Build 576] and IAR Embedded Workbench for ARM version 5.11.
Note that this bat file only generates a standard definition based on if the symbol is A(arm) and T(thumb) or D(data).
If A or T script uses -
void <SYMBOL_NAME>();
If D script uses -
extern int <SYMBOL_NAME>;
You may have to cast the use of the symbols to what you need.
Load image
If you not already have your externally built image on your target, one way is to use -
ilinkarm.exe --image_input filename.axf
Use: --image_input file[,symbol[,section[,alignment]]]
Put image file in section from file
Example project
There is an example project on the link: Example project including sym2h.zip.
Disclaimer
IAR Systems neither sells nor supports sym2h.bat - it is not part of our tool chain. Thus these files are provided as is without any promise of further support or information. If you have improvement suggestions regards to sym2h.bat that you want to share with us and other developers we are interested to hear them.
All product names are trademarks or registered trademarks of their respective owners.