Error: unrecognized opcode: `mtmas0'

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Error: unrecognized opcode: `mtmas0'

跳至解决方案
2,547 次查看
ronlewis
Contributor III

I am trying to implement the MMU_init_TLB6(void) in S32KDS for the MPC5644a,  but I keep getting the the following assembly errors:

 

GNU assembler version 2.24.51 (powerpc-eabivle) using BFD version (GNU Binutils) 2.24.90.20141014
C:\Users\rlewis\AppData\Local\Temp\cc52snFd.s: Assembler messages:
C:\Users\rlewis\AppData\Local\Temp\cc52snFd.s:505: Error: unrecognized opcode: `mtmas0'
C:\Users\rlewis\AppData\Local\Temp\cc52snFd.s:530: Error: unrecognized opcode: `mtmas2'
C:\Users\rlewis\AppData\Local\Temp\cc52snFd.s:545: Error: unrecognized opcode: `mtmas3'

 

Anyone have any guidance here?

 

Code:

void MMU_init_TLB6(void) {

unsigned int reg0;
PPCASM("e_lis %0, 0x1006" : "=r" (reg0)); /* Select TLB entry #, define R/W replacment control */
PPCASM("mtMAS0 %0":"=r" (reg0)); /* Load MAS0 with 0x1006 0000 for TLB entry #6 */
/* Define description context and configuration control:*/
/* VALID=1, IPROT=0, TID=0, TS=0, TSIZE=1 (4KB size) */
PPCASM("e_lis %0, 0x8000": "=r" (reg0)); /* Load MAS 1 with 0x8000 0100 */
PPCASM("e_or2i %0, 0x0100" : "=r" (reg0));
PPCASM("mtMAS1 %0" : "=r" (reg0)); /* Define EPN and page attributes: */
/* EPN = 0x4004 0000, WIMAGE = all 0's */
PPCASM("e_lis %0, 0x4004" : "=r" (reg0)); /* Load MAS2 with 0x4004 0000 */
PPCASM("mtMAS2 %0" : "=r" (reg0));
/* Define RPN and access control for data R/W */
/* RPN = 0x4004 0000, U0:3=0, UX/SX=0, UR/SR/UW/SW=1 */
PPCASM("e_lis %0, 0x4004" :"=r" (reg0)); /* Load MAS3 with 0x4004 000F */
PPCASM("e_or2i %0, 0x000F" : "=r" (reg0));
PPCASM("mtMAS3 %0" : "=r" (reg0));
PPCASM("tlbwe"); /* Write entry defined in MAS0 (entry 6 here) to MMU TLB */
}

标签 (2)
标记 (4)
0 项奖励
1 解答
1,763 次查看
ronlewis
Contributor III

After some digging I found that you need to use the MTSPR function.  The compiler_api.h has a macro defined for this function.

Working Code is Now:

static void MMU_init_TLB6(void) {

     unsigned int reg0;
     PPCASM("e_lis %0, 0x1006" : "=r" (reg0)); /* Select TLB entry #, define R/W replacment control */
     MTSPR(624, "reg0"); /* Load MAS0 with 0x1006 0000 for TLB entry #6 */
     /* Define description context and configuration control:*/
     /* VALID=1, IPROT=0, TID=0, TS=0, TSIZE=1 (4KB size) */
     PPCASM("e_lis %0, 0x8000": "=r" (reg0)); /* Load MAS 1 with 0x8000 0100 */
     PPCASM("e_ori %0, %0, 0x0100" : "=r" (reg0));
     MTSPR(625, "reg0"); /* Load MAS 1 with 0x8000 0100 */
     //PPCASM("mtMAS1 %0" : "=r" (reg0)); /* Define EPN and page attributes: */
     /* EPN = 0x4004 0000, WIMAGE = all 0's */
     PPCASM("e_lis %0, 0x4004" : "=r" (reg0));  /* Load MAS2 with 0x4004 0000 */
     MTSPR(626, "reg0");
     //PPCASM("mtMAS2 %0" : "=r" (reg0));
     /* Define RPN and access control for data R/W */
     /* RPN = 0x4004 0000, U0:3=0, UX/SX=0, UR/SR/UW/SW=1 */
     PPCASM("e_lis %0, 0x4004" :"=r" (reg0)); /* Load MAS3 with 0x4004 000F */
     PPCASM("e_ori %0, %0, 0x000F" : "=r" (reg0));
     MTSPR(627, "reg0");
     //PPCASM("mtMAS3 %0" : "=r" (reg0));
     PPCASM("tlbwe"); /* Write entry defined in MAS0 (entry 6 here) to MMU TLB */
}

在原帖中查看解决方案

1 回复
1,764 次查看
ronlewis
Contributor III

After some digging I found that you need to use the MTSPR function.  The compiler_api.h has a macro defined for this function.

Working Code is Now:

static void MMU_init_TLB6(void) {

     unsigned int reg0;
     PPCASM("e_lis %0, 0x1006" : "=r" (reg0)); /* Select TLB entry #, define R/W replacment control */
     MTSPR(624, "reg0"); /* Load MAS0 with 0x1006 0000 for TLB entry #6 */
     /* Define description context and configuration control:*/
     /* VALID=1, IPROT=0, TID=0, TS=0, TSIZE=1 (4KB size) */
     PPCASM("e_lis %0, 0x8000": "=r" (reg0)); /* Load MAS 1 with 0x8000 0100 */
     PPCASM("e_ori %0, %0, 0x0100" : "=r" (reg0));
     MTSPR(625, "reg0"); /* Load MAS 1 with 0x8000 0100 */
     //PPCASM("mtMAS1 %0" : "=r" (reg0)); /* Define EPN and page attributes: */
     /* EPN = 0x4004 0000, WIMAGE = all 0's */
     PPCASM("e_lis %0, 0x4004" : "=r" (reg0));  /* Load MAS2 with 0x4004 0000 */
     MTSPR(626, "reg0");
     //PPCASM("mtMAS2 %0" : "=r" (reg0));
     /* Define RPN and access control for data R/W */
     /* RPN = 0x4004 0000, U0:3=0, UX/SX=0, UR/SR/UW/SW=1 */
     PPCASM("e_lis %0, 0x4004" :"=r" (reg0)); /* Load MAS3 with 0x4004 000F */
     PPCASM("e_ori %0, %0, 0x000F" : "=r" (reg0));
     MTSPR(627, "reg0");
     //PPCASM("mtMAS3 %0" : "=r" (reg0));
     PPCASM("tlbwe"); /* Write entry defined in MAS0 (entry 6 here) to MMU TLB */
}