Reported by Anonymous in Bitbucket Issue #129:

When MIPS port is built for microMIPS and then loaded as an application, the __start entry point is entered in microMIPS mode, but the CPU core initialization code there misses to set the config3ISAOnExc bit to 1. Subsequently, exceptions are entered in MIPS32 mode, but the code base was built for microMIPS.
This commit is contained in:
Gregory Nutt
2018-11-07 10:48:33 -06:00
parent 02f83334d5
commit 68e45d0453
+10
View File
@@ -539,6 +539,16 @@ __start:
and t0, t0, ~CP0_STATUS_BEV /* Clear BEV */
mtc0 t0, PIC32MZ_CP0_STATUS
#ifdef CONFIG_MIPS_MICROMIPS
/* Exception handlers are also being compiled for microMIPS, so enable
* config3ISAOnExc now that exception vectors have been [re]located.
*/
mfc0 t0, MICROAPTIV_CP0_CONFIG3 /* Load CONFIG3 register */
or t0, t0, CP0_CONFIG3_ISAONEXC /* Specify microMIPS mode on exceptions */
mtc0 t0, MICROAPTIV_CP0_CONFIG3 /* Update CONFIG3 register */
#endif
/* Start NuttX. We do this via a thunk in the text section so that
* a normal jump and link can be used, enabling the startup code
* to work properly whether main is written in MIPS16 or MIPS32