Linker to link Functions found in different Code space but same Flash

I am using HCS08 micro-controller and Code Warrior as Development Environment. I have 2 separate programs residing on the ROM (Bootloader and Application code). I have some files/functions present in Bootlaoder Code and also required for my Application code but I do not want to duplicate these functions(are 3-4k bytes). So, is there any way possible to use functions which are not part of Application code but are present in ROM. Is this think possible? Can linker be told something?

Answers


In general, yes, but the way you'd do this through the linker is likely to be toolset specific. I've never used CodeWarrior for embedded development, but as an example using ARM's RVCT toolset, you could create a 'symdefs' file when you link the bootloader, and have the application code link against that file.

If you don't want to worry about toolset lock-in, then an option would be to use GNU's binutils to export a symbol table from your bootloader's executable (e.g. nm foo.exe > symtab.txt), run a script over the symbol table to convert it into a .h file of the form:

#define symbol_name_ADDR 0x00001efc

and call externally-defined functions through a mechanism like:

((void (*)(int arg)) symbol_name_ADDR)(12);

which is pretty ugly, but should get the job done.


Need Your Help

Mongo DB, mongod.lock

mongodb nosql initialization runtime

Folks, I have a question about MongoDB, is the following, MongoDB installed in Windows Service, for whenever I start the computer, start the service together, just that .. is not working .. checkin...

Does Monodevelop support configuration files?

c# mono monodevelop

I added a file app.config to a C# mono project.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.