Hm, seems my own reply got just lost while editing. Great. Here I go again.
Ok, so what I found in the CFPRM is the following:
---quote---
NOTE
The DIVS/DIVU and RES/REMU instructions are not implemented on the
earliest V2-based devices MCR5202, MCF5204 and MCF5206.
---quote---
I also tracked down the above problem to be entirely dependant on the compiler setting "4-Byte Integers".
I UNchecked this for my project, since it's a port from an 8 Bit CPU and it's heavily relying on INTs being 16 bit since it's accessing data in an Eeprom which exists in 16 bit portions.
A simple test project revealed that CW will generate a DIVS instruction for any division when i UNcheck "4-Byte Integers".
Then checking it again will produce code that instead of doing a DIVS will call a subroutine "__ldiv__" for any division (be it char, int or long).
Any DIVS will clearly lead to an illeagal opcode exception, I however can not find a hint in the manual (Document Number: CFPRM Rev. 3 03/2005) that this is intentional. So it's either the MCU, the compiler, or me overlooking something blatant that leads to all the confusion.
Could someone please shed some light on this issue since right now I really don't see how to proceed with porting the project without having 16 bit integers?
Edit:
3/2005 seems pretty outdated for a document to cover the lates Flexis core, but it is exactly the document which the ColdFire V1 page links to (see link "ColdFire Programmer's Reference Manual" on top right of this page:
http://www.freescale.com/webapp/sps/site/overview.jsp?code=DR68KV1CF&fsrch=1A closer look now revealed that this document doesn't even have an idea of the existance of a V1 core, hence no comment about DIVS being present or not. According to the D0 register content on startup though, there is clearly no hardware divider present, hence this all comes down to a compiler bug. I just wonder if other than the AC Flexis cores got a divider, cause otherwise this should have stood out long ago already?
Regards,
Sven
Message Edited by Kopone on
2008-11-24 11:59 AM