This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Division by non-power-of-2 hits into exception

Hi there,

I was using Codewarrior targeting Cortex-R4 CPU to build Firmware. When doing a division coprocessor was used and caused exception.

Here is the division in C:

u8 i, j = 8;

i = j / 3;

Disassembly:

(u8 i, j = 8;)

mov r5, #0x8

(i = j / 3;)

mov r1, #0x3

mov r0, r5

mrc p6, 1, r0, c0, c1, 4

and r4, r0, #0xff

When running mrc, exception occurred.

Does anybody have any idea why it happens? Anyway to disable coprocessor in this operation?

Thanks.

Parents
  • Thanks to the helps from daith and Martin. It turns out the micro-kernel I'm using is built with hardware division enabled. That HW division instruction was carried to Cortex-R5 which supports SW division only. Everything turns ok after rebuilding the micro-kernel for Cortex-R5.

Reply
  • Thanks to the helps from daith and Martin. It turns out the micro-kernel I'm using is built with hardware division enabled. That HW division instruction was carried to Cortex-R5 which supports SW division only. Everything turns ok after rebuilding the micro-kernel for Cortex-R5.

Children
No data