Hello,
I am looking into getting help to understand how to debug/probe the MMU initialization?
NXP IC: MPC5566
CodeWarrior IDE version 5.9.0
To be honest I don't even know if I can even ask a good question. I am attempting to follow the complete boot up of the MPC5566 and I don't know how to step through any startup sequence for the MMU.
First step I do is create a new project using the code warriors wizard to setup the project.
Code warrior creates a project explorer as follows. I believe the MMU and the TLBs need to be configured prior to most of the operation of the chip. The only location that I find this is in MPC_HWInit.c
/*----------------------------------------------------------------------------*/
/* Writing to MMU Table Entries */
/*----------------------------------------------------------------------------*/
/* Write one MMU Table Entry: */
/* r3, r4, r5 and r6 must hold */
/* the values of MAS0, MAS1, MAS2 and MAS3 */
__asm void WriteMMUTableEntry( void )
{
nofralloc
/* Write MMU Assist Register 0 (MAS0); SPR 624 */
mtspr 624, r3
/* Write MMU Assist Register 1 (MAS1); SPR 625 */
mtspr 625, r4
/* Write MMU Assist Register 2 (MAS2); SPR 626 */
mtspr 626, r5
/* Write MMU Assist Register 3 (MAS3); SPR 627 */
mtspr 627, r6
/* Write the table entry */
tlbwe
blr
}
But I can't figure out how this __asm function is called? My guess is that they are called during boot up by placing them in memory prior to main file. Looking into the linker configuration file, MPC5566.lcf I see.
SECTIONS
{
.__bam_bootarea LOAD (0x00000000): {} > resetvector
GROUP : {
.init LOAD (0x00000020) : {}
.init_vle (VLECODE) LOAD (_e_init) : {
*(.init)
*(.init_vle)
}
} > init
.__exception_handlers (VLECODE) LOAD (0x00001000): {} > exception_handlers
GROUP : {
.text : {}
.text_vle (VLECODE) ALIGN(0x1000): {
*(.text)
*(.text_vle)
}
.rodata (CONST) : {
*(.rdata)
*(.rodata)
}
.ctors : {}
.dtors : {}
extab : {}
extabindex : {}
} > internal_flash
GROUP : {
.__uninitialized_intc_handlertable ALIGN(0x10) : {}
.data : {}
.sdata : {}
.sbss : {}
.sdata2 : {}
.sbss2 : {}
.bss : {}
} > internal_ram
}
Where an init (I am assuming this is Startup Code files) group is before the internal flash .text (which I am assuming is the main function). If this is the case how do I know what order any of the Startup files are going in?
Thanks for any help anyone can provide.
Hi Beau,
if default settings performed by BAM are sufficient for you, you do not need to change it:
Function WriteMMUTableEntry is used in startup files only when using external memory. Note from the reference manual:
You can find this code in MPC5566_HWInit.c file:
This is also example which shows how to call the function.
This excel tool can help to modify the MMU if you really need it:
https://community.nxp.com/docs/DOC-331924
The best way to see what kind of operation is done in startup files is to step them step by step.
Regards,
Lukas