MMU running problem in codewarrior 10.6 environment

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MMU running problem in codewarrior 10.6 environment

977 Views
pengjianxin
Contributor II

hello:

      A project (MCU type: MPC5644A) can run normally in codewarrior 2.10 .  But in the codewarrior 10.6 environment  the program crashes. the program only have one function (MmuSetRam256K) which is about MMU initial. when the program run the instruction " tlbwe " (Write entry defined in MAS0 (Entry0 here) to MMU TLB),the program dies both in FLASH and RAM mode.

    the program is  in  the attachment,look forward to your reply, thanks.

4 Replies

784 Views
takaoyamada
Contributor IV

Greetings,

Try writing to MMU entry that is not zero. You are most likely replacing a previous entry that covered SRAM and/or FLASH and hence debugging fails. E.g. try this

e_lis r3, 0x1003 // Select TLB1 Entry 1, define R/W replacement control
ori r3, r3, 0x0000
mtMAS0 r3 // Load MAS0 with 0x1003 0000 for TLB Entry1

Within Codewarrior 2.10, the MMU table is initialized differently using a reset macro script from PEmicro. Within this script, there are multiple entries in the MMU that closely resembles how the BAF initializes the chip. The zeroth entry is Peripheral B and this is why FLASH and SRAM were kept intact and debugging behaved normally. Most likely Lauterbach is similarly setting up the MMU Table in this fashion and hence why there was no issue there as well. However in Codewarrior 10.x and 11.x the reset scripts are handled using NXP's TCL scripts that writes only one entry in the MMU Table at entry 0:

# Setup MMU entry 0 for entire 32-bit address space: base address = 0x0000_0000
# 4GB Memory Space, Not Guarded, Cache inhibited, All Access
if {$booke_vle == "vle"} {
# VLE page
reg ${TLB1_GROUP}MMU_CAM0 = 0xB0000008FE0800000000000000000001
} else {
# BOOKE page
reg ${TLB1_GROUP}MMU_CAM0 = 0xB0000008FC0800000000000000000001
}

This one entry is set to cover the entire memory map. Your entry is replacing this single MMU table entry and therefore you lose access to the flash and SRAM located elsewhere. This is why reading the current MMU table entries before writing to it is probably good practice. 

Note, S32 Power IDE does use PEmicro's reset scripts so users will not face this problem.

Best,

Takao 

PEmicro Design Engineer

784 Views
martin_kovar
NXP Employee
NXP Employee

Hello Takao,

thank you very much for explanation. Now, it makes sense to me.

So, it is necessary to edit TCL script.

Regards,

Martin

0 Kudos

784 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

I am able to reproduce this problem on my side, unfortunately, I have no idea, why the program does not work correct. I checked with Lauterbach debugger and there is no problem with functionality.

Only possibility for me is create bug ticket and wait, if this issue will be fixed in future.

I am sorry for any inconvenience.

Regards,

Martin

0 Kudos

784 Views
pengjianxin
Contributor II

looking forward to your  response,My E@mal is" flesher@126.com ", thank you.

0 Kudos