CW 10 std  libs error

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

CW 10 std  libs error

Jump to solution
1,316 Views
DariusB
Contributor I

I using CW 10

(Eclipse C/C++ Development Tools
Version: 5.0.2.FSL_b02025-A21
Build id: b02025-A21)  and mcf52233 cpu.

 

If I using std lib functions, which returns char*   this function work not correctly, because they return in char* in  A4 register, but  compiler using D0 register as return data. If  std lib function return int, then working OK. (return in D0 and using D0).

 

How resolve this problem?

I tryed recompile libs ( info in pdf ),  but got more errors.

Labels (1)
0 Kudos
Reply
1 Solution
543 Views
CrasyCat
Specialist III

Hello

 

I did create a project for MCF52233 with the wizard. I activated optimization level 4 and checked the generated disassembly file.

 

I got following code generated:

 

;   23:     pch = strpbrk (str, key);;   24:         while (pch != NULL);0x00000022  0x43F900000000           lea      _key,a10x00000028  0x41F900000000           lea      _str,a00x0000002E  0x4EBA0000               jsr      _strpbrk0x00000032  0x2D48FFF0               move.l   a0,-16(a6)

 

  

So return value is read from A0 (as expected by the calling convention) and strpbrk is putting return value in A0 as well.

 

Which library file are you linking with your application?

How did you create your project?

 

Did you define a pragma  pointers_in_xx somewhere in your application (where xx stands either for A0 or for D0)?

This pragmas changes the way the compiler returns pointer values. See FAQ-27837 on www.freescale.com for more information on this pragma.

 

CrasyCat

View solution in original post

0 Kudos
Reply
4 Replies
543 Views
CrasyCat
Specialist III

Hello

 

It looks like you are calling a library function but did not have a prototype for this function.

Did you include the appropriate .h file on top of your source file?

Can you please open project properties then activate the C/C++ Build > Settings page. Then activate the panel Coldfire Compiler > Language Settings. Make sure Require Prototypes is checked.

Then try to build application again.

 

In case you try to call a function for which you do not have a prototype you will get an error message,

 

If you are still unable to build can you specify which function you are trying to invoke?

Is this function implemented in assembly?

 

CrasyCat

0 Kudos
Reply
543 Views
DariusB
Contributor I

Thanks,

 

I known about prototype problems. I was tryed include  and extern function.

 

function which I using strpbrk: (but I think that this problem for all function which return pointer type)

 

I was protyping it..

 

extern char * strpbrk(const char *, const char *) ;

 

I think, that stdlib compiled with  options, which returns pointer type data via A4.

But  project compiler use returns data via D0 register.

So posible resolve problems change compiler options for stdlib buil or for main project. I dont found this options.

 

 

stdlib have other problem, that it using near model for static memory- so need special init A5 register, at startup or in treads.

 

 

 

 

0 Kudos
Reply
544 Views
CrasyCat
Specialist III

Hello

 

I did create a project for MCF52233 with the wizard. I activated optimization level 4 and checked the generated disassembly file.

 

I got following code generated:

 

;   23:     pch = strpbrk (str, key);;   24:         while (pch != NULL);0x00000022  0x43F900000000           lea      _key,a10x00000028  0x41F900000000           lea      _str,a00x0000002E  0x4EBA0000               jsr      _strpbrk0x00000032  0x2D48FFF0               move.l   a0,-16(a6)

 

  

So return value is read from A0 (as expected by the calling convention) and strpbrk is putting return value in A0 as well.

 

Which library file are you linking with your application?

How did you create your project?

 

Did you define a pragma  pointers_in_xx somewhere in your application (where xx stands either for A0 or for D0)?

This pragmas changes the way the compiler returns pointer values. See FAQ-27837 on www.freescale.com for more information on this pragma.

 

CrasyCat

0 Kudos
Reply
543 Views
DariusB
Contributor I

My project was imported from CW7.

 

>>Did you define a pragma  pointers_in_xx somewhere in your application (where xx stands either for A0 or for D0)?

 

Yes, you right!    :smileyhappy:   pragma was defined . I commented it and now working ok .

//#pragma pointers_in_D0 .

 

Thenks you very much CrasyCat !

0 Kudos
Reply