I'm trying to write a firmware mod (to existing firmware, for which i don't have source code) All Thumb code.
does anybody have any idea how to do this, in gcc as
(GAS) assembler:
Use BL
without having to manually calculate offsets, when BL
'ing to some existing function (not in my code.. but i know its address)
Currently, if i want to use BL
...i have to :
-go back in my code
-figure out and add all the bytes that would result from assembling all the previous instructions in the function i'm writing
-add the begining address of my function to that (i specify the starting address of what i'm writing, in the linker script)
-and then substract the address of the firmfunc function i want to call
All this... just to calculate the offset... to be able to write abl
offset... to call an existing firmware function?
And if i change any code before that BL, i have to do it all over again manually !
See.. this is why i want to learn to use BX
right... instead of BL
Also, i don't quite understand the BX. If i use BX to jump to an absolute address, do i have to increase the actual address by 1, when caling Thumb code from Thumb code (to keep the lsb byte 1)... and the CPU will know it's thumb code ?