FW: GCC ARM Cross Linker Problem
Kanwal Preet Singh CHANANA
kanwalpreet.singh@st.com
Wed Aug 30 06:45:00 GMT 2006
Hi Richard,
I have tried the wayout suggested by you but problem still remains.
I used the following file:
Sym.s:
.global MaskInterrupt
.type MaskInterrupt %function
.equ MaskInterrupt, 0x00c008f8
Note: MaskInterrupt is Thumb function located at ROM address(0x00c008f8).
When my application calls this function then there is no Interworking stub
called. Also there is no __MaskInterrupt_from_arm function present in my
application Map file.
Kindly check the above file & suggest a wayout.
Regards,
Kanwal
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Kanwal Preet Singh CHANANA
Sent: Wednesday, August 30, 2006 9:36 AM
To: 'Richard Earnshaw'
Cc: vinayakbhalkar@Math.net; gcc-help@gcc.gnu.org;
crossgcc@sources.redhat.com
Subject: RE: FW: GCC ARM Cross Linker Problem
Hi Richard,
Thanks for valuable suggestion. I will try the following to certify if Image
is running correctly on target.
Another thing, the symbols I am linking are in ROM. ROM code is compiled
with ADSv1.2 & "symbols.o" was generated using "-symdefs symbols.o" option
for armlink. Now when I link my Flash (project) code with "symbols.o" using
ADSv1.2 or RVDSv2.2,linker generates image with no error but if I use
GCC-ARM ,linker gives a error " symbols.o: File format not recognised". This
occurs due to EABI differences between ADS & GCC-ARM.
As per your suggestion, one "sym.s" will be included in project code. We
want to use the same source code for ADS,RVDS & GCC-ARM(few changes in *.s
files are done using perl script). This will make sources to be generic &
compiled with above mentioned too chains.
Can I change "symbols.o" in a way so that GCC-ARM linker recognises it ? In
this way I dont have to add "sym.s" file.
Regards,
Kanwal
-----Original Message-----
From: Richard Earnshaw [mailto:Richard.Earnshaw@arm.com]
Sent: Tuesday, August 29, 2006 7:54 PM
To: Kanwal Preet Singh CHANANA
Cc: vinayakbhalkar@Math.net; gcc-help@gcc.gnu.org;
crossgcc@sources.redhat.com
Subject: RE: FW: GCC ARM Cross Linker Problem
The following works fine for me:
sym.s:
.global tfunc
.type tfunc %function
.equ tfunc, 0x1235
main.c:
extern void tfunc(void);
int main()
{
tfunc();
return 0;
}
arm-elf-as sym.s -o sym.o
arm-elf-gcc main.c sym.o -o main.exe
arm-elf-objdump -xd main.exe
...
00008224 <main>:
8224: e1a0c00d mov ip, sp
8228: e92dd800 stmdb sp!, {fp, ip, lr, pc}
822c: e24cb004 sub fp, ip, #4 ; 0x4
8230: eb0007f8 bl a218 <__tfunc_from_arm>
8234: e3a03000 mov r3, #0 ; 0x0
8238: e1a00003 mov r0, r3
823c: e89da800 ldmia sp, {fp, sp, pc}
...
0000a218 <__tfunc_from_arm>:
a218: e59fc000 ldr ip, [pc, #0] ; a220
<__tfunc_from_arm
+0x8>
a21c: e12fff1c bx ip
a220: 00001235 andeq r1, r0, r5, lsr r2
...
Notice that __tfunc_from_arm loads the value 0x1235 into a register and
issues a bx instruction, which will then correctly switch to Thumb state.
R.
On Tue, 2006-08-29 at 14:47, Kanwal Preet Singh CHANANA wrote:
> Hi Vinayak,
> Kindly refer to below mail. I am already using this following method
> but it is not working.
>
> Regards,
> Kanwal
>
> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]
> On Behalf Of Vinayak Bhalkar
> Sent: Tuesday, August 29, 2006 5:42 PM
> To: kanwalpreet.singh@st.com
> Cc: gcc-help@gcc.gnu.org; crossgcc@sources.redhat.com
> Subject: Re: FW: GCC ARM Cross Linker Problem
>
>
>
> Try following-
>
> MaskInterrupt = 0x00c008f9;
>
> Regards,
> vinayak
>
> --- kanwalpreet.singh@st.com wrote:
>
> From: Kanwal Preet Singh CHANANA <kanwalpreet.singh@st.com>
> To: <gcc-help@gcc.gnu.org>, <crossgcc@sources.redhat.com>
> Subject: FW: GCC ARM Cross Linker Problem
> Date: Tue, 29 Aug 2006 14:59:35 +0530
>
> Hi all,
>
> I am able to compile & Link my source files with a workaround
> mentioned below:
>
> The absolute symbols defined in symbols.o are
>
> 0x000002a8 D CurTask
> 0x00c008f8 T MaskInterrupt
> Where Curtask is data located in RoM & MaskInterrupt is function in
> Thumb Mode.
>
> I used following definations in Linker Script
>
> pCurTask = 0x000002a8;
> MaskInterrupt = 0x00c008f8;
>
> With this I am able to link & built Image.axf file. But when running
> on target,the image crashes at a point when it jumps to
> MaskInterrupt(shown above) . The reason is that the Linker assumes
> MaskInterrupt function to be in ARM mode.When it jumps there, it
> expects 4 byte ARM instruction but the code at this location has 2
> Byte Thumb Instruction.
>
> The Thumb Interwork option is enabled in Build options.
>
> Can anyone suggest me a method to Link above symbols in a way so that
> GCC-ARMv4.0.3 knows whether the symbols is Data or Thumb Function or
> ARM function? If there is a way, then Image will run correctly on
> Target. Also if anyone needs any help on Project porting from ADS to
> GCC-ARM,then I can help him out.
>
> Please suggest a wayout to fix the above problem.
> Regards,
> Kanwal
>
>
>
>
> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]
> On Behalf Of Kanwal Preet Singh CHANANA
> Sent: Monday, August 21, 2006 3:48 PM
> To: gcc-help@gcc.gnu.org
> Subject: GCC ARM Cross Linker Problem
>
>
> Hi all,
>
> I am porting my project from ADS from ARM to GCC ARM Tool chain. I am
> able to compile my source files but fail to link. I have a symbols file
(symbols.o) with absolute symbols addresses in format
> Symboladdress SymbolType Symbolname e.g
>
> 0x000002a8 D CurTask
> 0x00c008f8 T MaskInterrupt
>
> These symbols are located in ROM( code built with ADS) & project image
> will be in flash. When I use this same file during build with ARM ADS,
> it works fine but with GCC ARM tool chain,I get following error
> message
>
> "./symbols.o: file not recognized: File format not recognized"
>
> Can anybody please tell me the solution to this error? Can I link
> objects built with ADS with GCC ARM ?
>
> Regards,
> Kanwal
>
>
>
> _____________________________________________________________
> Get your free web-based e-mail account from http://www.Math.net Your
> online tourguide of Mathematics, with books, links, news, message
> boards, and much more!
>
>
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
--
Richard Earnshaw Email: Richard.Earnshaw@arm.com
ARM Ltd Phone: +44 1223 400569 (Direct + VoiceMail)
110 Fulbourn Road Switchboard: +44 1223 400400
Cherry Hinton Fax: +44 1223 400410
Cambridge CB1 9NJ Web: http://www.arm.com/
UK
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list