Getting to the details is my natural engineering passion, see memory is everything. The same applies for building my embedded application: you should know what you pack into your binary file.
One aspect of this are the libraries. The linker does the heavy lifting, but still I want to know the details, right? In CodeWarrior for MCU, things are a little bit different for the 8/16bit tools (HCS08 and RS08) compared to Kinetis, ColdFire, DSC and Qorivva: the format for the libraries is not the archive (*.a) format. Therefore, I cannot use the usual command line tools like readelf, objdump or elfdump available in the GNU Binutils to inspect the libraries. The good news is: there are other good ways to get the information I need :-).
The first thing I look at is at the .map file produced by the linker. Of interest is the FILE SECTION of the map file:
Here I can see that several files are used from the ANSI library: ansiis.lib. If you want to know the mapping of the library file names to the memory models, then I can consult the following readme files:
- <installation>\MCU\lib\hc08c\readme.txt
- <installation>\MCU\lib\rs08c\readme.txt
The map file is already very useful. But eclipse gives me a nice tool too: the Executables View:
This shows me all the files used in my linked binary executable file, together with the path information. Notice that it lists as well header files: this is the same information used by the debugger.
Looking closely at the Executables View, I notice that there is a toolbar icon to configure the view for additional columns:
Enabling all options, it shows me now more information, including the file size and the modification date:
But: it shows me only the files referenced and used in my application. Unused variables and functions of the library are not listed as they were removed by the linker. So I need to dig a little bit deeper to find out what is in the library.
The Executable View shows me that the library is located in \MCU\lib\hc08c\lib inside my CodeWarrior installation. In that folder I can find the corresponding listing file which reveals further details about the library:
Now I see the complete list of files together and the functions and variables inside the library.
But what if the library you are using does not come with such a listing file? The answer is: I can decode that library!
There is a decoder utility delivered with CodeWarrior inside the installation MCU\prog directory. On Windows it comes with a graphical user interface.Launch it and then simply drag & drop the library to decode it:
That way I get a full listing of the library with files, functions and variable information, including the disassembly of the code.
If this is a too much information, I know another way. The trick is to use the Libmaker in the <installation>\MCU\prog folder: this is the librarian used to build the libraries.
It has a command line interface, and if I want to get a listing of the library MyLib, I can use following command:
-cmd(MyLib.lib = MyLib2.lib)
This produces a complete list with files, functions and variables of that library.
Happy listing 🙂