# Forum: ARM programming with GCC/GNU tools linker stub problem

 Author: Jonathan Dumaresq (dumarjo) Posted on: 2010-06-15 16:32

Rate this post
 0 ▲ useful ▼ not useful
Hi all,

I have a small problem. We have a big project that use an AT91SAM7S
and/or only a section of code that need to be change to optimize the
time that is needed to download the application (via an RS485 network).
So What I did is modified the Linker script to add some new section of
code (userControl) and RAM (DataUser and BssUser).

This is work great. I can have 2 bin file. 1 with all the code main.bin
and 1 with the UserControl section only.

Now the problem.

The way I build the code, I have only 1 entry point in the Usercontrol
section from the main.bin file. The entryFonction is the only link
between the main application and the usercontrol application.

The problem that I have, is the linker add some code (stub) before the
Entryfonction and of course change the entry adress of the function. So
When I only download the Usercontrol bin file, the main application try

I compile mthumb files with interworking option. I would like to know if
it is possible to have the linker do not generate the stub if the caller
function is in thumb mode and the callee fonction is in the thumb mode
too.

I need to have the UserControl EntryPoint always at the same adress.

I'll attach the ld file and the makefile.

regards

Jonathan

 Author: Martin Thomas (mthomas) (Moderator) Posted on: 2010-06-17 17:15

Rate this post
 0 ▲ useful ▼ not useful
>...
> I need to have the UserControl EntryPoint always at the same adress.
>...

Maybe you could add an extra input-section for the EntryPoint-function
(function attribute section), make sure the function is compiled in
thumb-mode and place this function into an output-section for which you
define another extra memory-entry with a fixed start-address in the
linker-script. This way the address of the function should be fixed and
you know it's thumb-code. In the main-application you could use a small
self-made glue-function with a little bit of inline-assembler which does
a "bx entrypoint".

For similar tasks I have used SWIs but I developed the "BIOS-code"
called by SWIs independently from the main-application so my approach is
rather different from your one.

• $formula (LaTeX syntax)$