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

von Jonathan D. (dumarjo)

Attached files:

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

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

I'll attach the ld file and the makefile.



von Martin T. (mthomas) (Moderator)

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.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.