Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10565
Posted: 05:18am 05 Mar 2017
Copy link to clipboard
Print this post
Hi Nathan
I can confirm that the MZ CFunction works on an eXtreme.
Here is where I am at with CFunctions on the MZ, not spent much time on it though
Set up the XC-V1.33 compiler as though it is for a MX470, use normal CFunction compiler and linker switches, use the MZ .h file:
Simple CFunctions work - calls to firmware routines are OK Floating point doesn't work Integer divide doesn't work!
Use xc32-1.42, set the compiler for the correct MZ, compiler options as per MX except no -fPIC as this isn't accepted floating point can work as normal code calls to firmware routines; can't remember but may not work anything complex fails
Nathan Regular Member Joined: 10/01/2016 Location: GermanyPosts: 49
Posted: 05:36am 05 Mar 2017
Copy link to clipboard
Print this post
Hi please try the following:
Compiler required: ----------------------------------- XC32 Version 1.34 <---- important it must be 1.34
Compiler upgrade to get unsupported devices ----------------------------------- Download xc32-v1.42-part-support
Install the file into 34v not the 42v directory as the install script suggests. (There is a dialog during install, which asks for the target location)
After that you can select the 1.34 compiler and select the extreme cpu.
Please give me a short feedback if it works.
Nathan
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10565
Posted: 09:09am 05 Mar 2017
Copy link to clipboard
Print this post
No good
long long test(void){ long long a=20000; long long b=126; if(Option->MHz200)b=100; long long c; c=a/b; return c; }
Nathan Regular Member Joined: 10/01/2016 Location: GermanyPosts: 49
Posted: 10:27am 05 Mar 2017
Copy link to clipboard
Print this post
Hi Peter, I expect you will get the same error/limitation on a PIC32MX device, too. The hardware divider is 32 by 16bit as far as I remember. So the division of the long long will be build up in a library call.
__divdi3 is part of the std lib, which is disabled. EXCLUDE Standard libraries. (cross)
A possible workaround is to make the __divdi3 and some more functions available by the MZCFheader.h file. So you have to force __divdi3 to a fixed address.