2
\$\begingroup\$

I have very little test project for PIC32MX440F512H, which builds (with XC32 v1.21) and works correctly.

Then I tried to generate 16-bit code, set checkbox "Generate 16-bit code", additional option appeared: -mips16

But now I get a lot of errors, here's a part of output:

 make -f nbproject/Makefile-Orion.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `D:/projects/trcomp_bundle/project_common/fw_test_pic32/appl/fw_test_pic32.X'
make  -f nbproject/Makefile-Orion.mk dist/Orion/debug/fw_test_pic32.X.debug.elf
make[2]: Entering directory `D:/projects/trcomp_bundle/project_common/fw_test_pic32/appl/fw_test_pic32.X'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s: Assembler messages:
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:223: Error: unrecognized opcode `rdpgpr'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:226: Error: unknown opcode `mfc0 $k0,$13'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:229: Error: unknown opcode `mfc0 $k1,$14'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:232: Error: illegal operands `srl'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:238: Error: illegal operands `sw'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:241: Error: unknown opcode `mfc0 $k1,$12'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:244: Error: illegal operands `sw'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:247: Error: unrecognized opcode `ins'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:250: Error: unrecognized opcode `ins'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:253: Error: unknown opcode `mtc0 $k1,$12'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:256: Error: illegal operands `sw'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:277: Error: illegal operands `sw'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:280: Error: illegal operands `sw'
d:\home\progr\LOCALS~1\Temp\ccnv5akn.s:283: Error: illegal operands `sw'
 .................

I tried to clean project and rebuild, result is the same. If I remove that option, project is built successfully again.

What could be wrong?

\$\endgroup\$
1
  • \$\begingroup\$ MIPS16 only supports a subset of MIPS and so cannot be used for all code (comparable to original ARM Thumb). Presumably the illegal instructions were in assembly in the source (almost certainly for mtc0/mfc0). Functions that do not use large immediates, mtc0/mfc0, and other non-MIPS16 features can be compiled as MIPS16, other code must be compiled to regular MIPS. See the Architecture for Programmers Vol. IV-a: The MIPS16e Application Specific Extension manual for details. \$\endgroup\$ Jul 1 '13 at 12:21
1
\$\begingroup\$

Finally, I found the reason and fixed it, with help of user andersm from microchip forums, here's my thread.

Shortly: I use RTOS TNKernel PIC32 port, and there is macro for declaring system ISRs. Too bad that compiler didn't point at the place where this macro is included.

Fixed by adding attribute nomips16. Bugreport is sent to TNKernel PIC32 port author.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.