Pointer values options in command line compiler. CW for ColdFire 6.4. Target MCF5307.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Pointer values options in command line compiler. CW for ColdFire 6.4. Target MCF5307.

2,228 Views
Veter
Contributor I

Is there a way to set option for pointer values return from functions, such as in DIAB compiler: X36=1, which allows pointer values to be returned in both register d0 and register a0? The value in a0 is used by the caller. I am using CodeWarrior for ColdFire version 6.4. and my target is MCF5307. My current command line for CodeWarrior compiler is:

set Output_Dir=%SOME_DIR%\Output\

set PEGDEFS=-DPEG_UNICODE=1 -DPEGDOS=1

set TARGET=-proc MCF5307

set CFLAGS=-c -g -inline smart opt l=0 -model far %SOME_INCLUDE_SOURCES% %PEGDEFS%

mwccmcf -o %Output_Dir% %CFLAGS% %TARGET% %1.cpp >> build.err

Labels (1)
0 Kudos
4 Replies

589 Views
CrasyCat
Specialist III
Hello
 
There are  pragmas allowing you to inform the compiler you want to return pointer values in D0 or A0:
    #pragma pointers_in_D0 tells tells the compiler to return pointer values in D0.
    #pragma pointers_in_A0 tells tells the compiler to return pointer values in A0.
 
  But return values are returned either in A0 or D0, not both of them.
  by the way I do not see the benefit of using 2 registers to return the same return value.
 Why do you need that?
 
CrasyCat
0 Kudos

589 Views
Veter
Contributor I

The reason behind returning pointer values from functions in both register d0 and register a0 is compatibility with third-party tools and libraries. It is available in DIAB compiler and works well with the 3rd party tool that we are using (PEG library and TCP/IP library). Could you please suggest how can I accomplish that?

0 Kudos

589 Views
CrasyCat
Specialist III
Hello
 
Well there is no way to tell the compiler to do that. So only solution I see for now is to call the functions through a wrapper (a function with inline assembly code copying the function return value in the alternate register as well.
 
Note also that returning pointer values in A0 and data values in D0 is a pretty common calling convention. I am not sure why someone would use another way around that.
 
You can submit a feature request through our Web interface and ask for an extension in the compiler, but keep in mind that that will take some time.
Click here to submit a feature request.

Make sure to clearly explain why you need that extension.
 
CrasyCat
0 Kudos

589 Views
Veter
Contributor I
I will do that.
Thank you!
0 Kudos