Facing compilation issue with error warning: implicit declaration of function 'MTHID0'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am wirting a MMU driver for MPC5777C,
For below code I am facing compilation issue.
int main(void)
{
//volatile int counter = 0;
int pid;
asm ("e_li r0, 0x4000");
asm ("mthid0 r0"); /* Enable TB and Decrementer */
pid = MFSPR(286);
xcptn_xmpl (); /* Configure and Enable Interrupts */
if (pid == 0)
{
volatile int i;
SIU.PCR[114].R = ALT0 | OBE; /* PA=0, OBE=1 for GPIO[0] PA[1] */
/* Start Core 1 in VLE mode */
SIU.RSTVEC1.R = ((unsigned long)&__start & RSTVEC_RST_MASK) | RSTVEC_VLE;
/* PIT 0 Timer 0 Config - Used for Periodic Interrupt example */
PIT.MCR.B.MDIS = 0; /* Enable PIT */
PIT.TIMER[0].LDVAL.R = 0x0FBC51FF; /* 2s at 132MHz Per clock */
PIT.TIMER[0].TCTRL.R = 0x00000003; /* Enable timer CH0 and interrupt */
while (1) /* loop forever (core 0) */
{
i++;
}
} else {
volatile int i;
SIU.PCR[115].R = ALT0 | OBE; /* PA=0, OBE=1 for GPIO[0] PA[0] */
/* PIT 0 Timer 1 Config - Used for Periodic Interrupt example */
PIT.MCR.B.MDIS = 0; /* Enable PIT */
PIT.TIMER[1].LDVAL.R = 0x07DE2900; /* 1s at 132MHz Per clock */
PIT.TIMER[1].TCTRL.R = 0x00000003; /* Enable timer CH1 and interrupt */
while (1) /* loop forever (core 1) */
{
i++;
}
}
}
../src/main_Z7_0.c: In function 'main':
../src/main_Z7_0.c:49:5: warning: implicit declaration of function 'MTHID0'
Please suggest if I am missing any file inclusion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tried your project, but I still see compiling error regarding mthid0 instruction opcode, but your warning is about function. The warning you see means, that you use function, which does not have any prototype declared in the project. I hope you understand that mthid0 is not function, but instruction opcode.
Are you really able to compile the code project you sent me with asm ("mthid0 %r0"); line not commented? There is also second compilation error cause by asm ("e_li r0, 0x4000"); line, but this can be easily fixed by adding % symbol in front of r0.
From my point of view, you should use mtspr opcode instead of mthid0. HID0 register is marked as SPR1008. So the instruction should look like asm ("mtspr 1008, %r0");
Regards,
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
which version of S32DS you use?
I tried your code, but there is a compilation error, because mthid0 is not recognized opcode.
Regards,
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Martin. I used to example code only. Any idea how to get it resolved.
I am using version 1.1
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
could you please send me your project? I am not able to compile the code you posted above because of mthid0 opcode which is not supported.
Regards,
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please find attached project