EmbDev.net

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


von Jonathan D. (dumarjo)


Attached files:

Rate this post
useful
not useful
Hi all,

I have a small problem. We have a big project that use an AT91SAM7S 
part. We have build a bootloader that can download all the application 
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.

SO I can download both bin and everything work.

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 
to jump to a wrong adress.

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

von Martin T. (mthomas) (Moderator)


Rate this post
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.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.