Forums

calling convension of GCC vs Arm compiler (RVCT)

Started by Gus June 8, 2009
Hello experts!

I have a compiled binary image that is compiled with GCC. I need to call that code from ARM compiler (RVCT). In theory I am not seeing a problem but when I try it it doesn't work. Even if I call a "void foo(void)" function with no arguments it will still not work. I end up with abort handler.

I am basically trying to do something like how IAP works. Have a GCC compiled binary image somewhere in RAM and then call it from RVCT compiled code using function pointers.

Any clues? Using RVCT or GCC for both sides is not an option!

Thanks in advance

Gus

An Engineer's Guide to the LPC2100 Series

I think it'll work if you compile your code in rvct with
--library_interfaceabi_clib
and compile and link your gcc code with the codesourcery gcc eabi
toolchain (free
version is fine)

--Ray

Gus wrote:
> Hello experts!
>
> I have a compiled binary image that is compiled with GCC. I need to
> call that code from ARM compiler (RVCT). In theory I am not seeing a
> problem but when I try it it doesn't work. Even if I call a "void
> foo(void)" function with no arguments it will still not work. I end up
> with abort handler.
>
> I am basically trying to do something like how IAP works. Have a GCC
> compiled binary image somewhere in RAM and then call it from RVCT
> compiled code using function pointers.
>
> Any clues? Using RVCT or GCC for both sides is not an option!
>
> Thanks in advance
>
> Gus
Gus schrieb:
> Hello experts!
>
> I have a compiled binary image that is compiled with GCC. I need to
call that code from ARM compiler (RVCT). In theory I am not seeing a

Which RVCT, which gcc. Come on, how difficult is it to post questions
with sufficient information ?

Anyhow: You should use the latest gcc and latest RVCT.

--
42Bastian
------------------
Parts of this email are written with invisible ink.

Note: SPAM-only account, direct mail to bs42@...
> -----Original Message-----
> From: l...
> [mailto:l...] On Behalf Of Gus
> Sent: 08 June 2009 20:19
> To: l...
> Subject: [lpc2000] calling convension of GCC vs Arm compiler (RVCT)
>
>
>
> Hello experts!
>
> I have a compiled binary image that is compiled with GCC. I
> need to call that code from ARM compiler (RVCT). In theory I
> am not seeing a problem but when I try it it doesn't work.
> Even if I call a "void foo(void)" function with no arguments
> it will still not work. I end up with abort handler.
>
> I am basically trying to do something like how IAP works.
> Have a GCC compiled binary image somewhere in RAM and then
> call it from RVCT compiled code using function pointers.
>
> Any clues? Using RVCT or GCC for both sides is not an option!
>
Try using arm-none-eabi-gcc from CodeSourcery - the lite version can be
downloaded for free. We intermix binaries built using it with both Keil and
IAR (IAR V5 or higher required).

If you are using WinARM, GNUARM, Yagarto, etc. I don't think it will work.

Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.
> Which RVCT, which gcc. Come on, how difficult is it to post
> questions
> with sufficient information ?

Didn't think that such info is important!! Why would it be anyways? You can still try to help and be nicer ...if you do not like my question or think it is stupid then simply do not answer it!
For example, look at the few answers I got back. They are more helpful than your annoying comment!

If you still care, I am using RVDS 3.1 and the GCC is what shipped with rowley crossworks which is 4.1.1

Gus

--- In l..., 42Bastian wrote:
>
> Gus schrieb:
> > Hello experts!
> >
> > I have a compiled binary image that is compiled with GCC. I need to
> call that code from ARM compiler (RVCT). In theory I am not seeing a
>
> Which RVCT, which gcc. Come on, how difficult is it to post questions
> with sufficient information ?
>
> Anyhow: You should use the latest gcc and latest RVCT.
>
> --
> 42Bastian
> ------------------
> Parts of this email are written with invisible ink.
>
> Note: SPAM-only account, direct mail to bs42@
>

Thanks for the help. I am using rowley crossworks which uses "CodeSourcery arm-2006q1-3" based on GCC 4.1.0
Do you think this will work?

Gus
--- In l..., "FreeRTOS info" wrote:
>
> > -----Original Message-----
> > From: l...
> > [mailto:l...] On Behalf Of Gus
> > Sent: 08 June 2009 20:19
> > To: l...
> > Subject: [lpc2000] calling convension of GCC vs Arm compiler (RVCT)
> >
> >
> >
> > Hello experts!
> >
> > I have a compiled binary image that is compiled with GCC. I
> > need to call that code from ARM compiler (RVCT). In theory I
> > am not seeing a problem but when I try it it doesn't work.
> > Even if I call a "void foo(void)" function with no arguments
> > it will still not work. I end up with abort handler.
> >
> > I am basically trying to do something like how IAP works.
> > Have a GCC compiled binary image somewhere in RAM and then
> > call it from RVCT compiled code using function pointers.
> >
> > Any clues? Using RVCT or GCC for both sides is not an option!
> >
>
>
> Try using arm-none-eabi-gcc from CodeSourcery - the lite version can be
> downloaded for free. We intermix binaries built using it with both Keil and
> IAR (IAR V5 or higher required).
>
> If you are using WinARM, GNUARM, Yagarto, etc. I don't think it will work.
>
> Regards,
> Richard.
>
> + http://www.FreeRTOS.org
> Designed for Microcontrollers. More than 7000 downloads per month.
>
> + http://www.SafeRTOS.com
> Certified by T as meeting the requirements for safety related systems.
>

So they are in fact different in the way they call functions?
How come using IAP works fine when using GCC or RVCT if they call functions differently?
Maybe I can work around the problem is I knew how they are different

Thanks again

Gus

--- In l..., Ray Molenkamp wrote:
>
> I think it'll work if you compile your code in rvct with
> --library_interfaceabi_clib
> and compile and link your gcc code with the codesourcery gcc eabi
> toolchain (free
> version is fine)
>
> --Ray
>
> Gus wrote:
> >
> >
> > Hello experts!
> >
> > I have a compiled binary image that is compiled with GCC. I need to
> > call that code from ARM compiler (RVCT). In theory I am not seeing a
> > problem but when I try it it doesn't work. Even if I call a "void
> > foo(void)" function with no arguments it will still not work. I end up
> > with abort handler.
> >
> > I am basically trying to do something like how IAP works. Have a GCC
> > compiled binary image somewhere in RAM and then call it from RVCT
> > compiled code using function pointers.
> >
> > Any clues? Using RVCT or GCC for both sides is not an option!
> >
> > Thanks in advance
> >
> > Gus
> >
>

Gus wrote:
> So they are in fact different in the way they call functions?
> How come using IAP works fine when using GCC or RVCT if they call functions differently?
> Maybe I can work around the problem is I knew how they are different
>
> Thanks again
>

RVDS and CrossWorks use the same calling convention, in the main. That
is, R0-R3 are used as argument registers and do not need to be saved.

Make sure you can return from a function correctly, i.e. you may require
thumb interwork if caller or calle could be thumb.

I suggest you single step at low level in the debugger to ensure things
work. Single step the BL instruction an insn level at the call site in
RVDS and make sure it's calling the right address.

-- Paul.

Gus schrieb:

>> Which RVCT, which gcc. Come on, how difficult is it to post
>> questions
>> with sufficient information ?
>
> Didn't think that such info is important!! Why would it be anyways?

Because the internal structure of the ELF files did change. E.g. you
can't link RVCT 2.x with RVCT 3.x files !

> You can still try to help and be nicer ..
Oh, I was as nice as I could be ...

> If you still care, I am using RVDS 3.1 and the GCC is what shipped with rowley crossworks which is 4.1.1

I doubt the ELF of 4.1.1 complies AEABI. As other suggest try CS.

--
42Bastian
------------------
Parts of this email are written with invisible ink.

Note: SPAM-only account, direct mail to bs42@...
who said anything about linking those libraries? I think you completely misunderstood my question

The GCC code is compiled and loaded in flash at address X. Then the RVCT code calls functions at address x using function pointers

Gus

--- In l..., 42Bastian wrote:
>
> Gus schrieb:
>
> >> Which RVCT, which gcc. Come on, how difficult is it to post
> >> questions
> >> with sufficient information ?
> >
> > Didn't think that such info is important!! Why would it be anyways?
>
> Because the internal structure of the ELF files did change. E.g. you
> can't link RVCT 2.x with RVCT 3.x files !
>
> > You can still try to help and be nicer ..
> Oh, I was as nice as I could be ...
>
> > If you still care, I am using RVDS 3.1 and the GCC is what shipped with rowley crossworks which is 4.1.1
>
> I doubt the ELF of 4.1.1 complies AEABI. As other suggest try CS.
>
> --
> 42Bastian
> ------------------
> Parts of this email are written with invisible ink.
>
> Note: SPAM-only account, direct mail to bs42@
>