This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LC4357: How to disable MPU function?

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi all:

    How to disable MPU function?  such as write 0 to some registers?

Best Wish

Li

  • One more question, what's the base address of MPU register?

  • what's the base address of MPU register?

    The MPU registers are not memory mapped. They are read and written through MRC and MRC instructions, for example:

    MRC p15, 0, R1, c1, c0, 0 ; read CP15 register 1
    ORR R1, R1, #0x1
    DSB
    MCR p15, 0, R1, c1, c0, 0 ; enable MPU

  • How to disable MPU function? 

    The following code is an example of disabling the MPU:
    MRC p15, 0, R1, c1, c0, 0 ; read CP15 register 1
    BIC R1, R1, #0x1
    DSB
    MCR p15, 0, R1, c1, c0, 0 ; disable MPU
    ISB

    The HALCoGen generates code to configure MPU, enable MPU, or disable MPU:

    _mpuInit_();

    _mpuEnable_();

    _mpuDisable_();

  • So I can not access mpu registers through C code?

  • Maybe I mess up something. Are there any differences between MPU and NMPU? In my project, it seems like using MPU instead of NMPU

  • You can use c code to call the ARM instructions.

    asm(" MRC p15, 0, R1, c1, c0, 0");     //read CP15 register 1
    asm(" BIC R1, R1, #0x1");
    asm(" DSB");
    asm(" MCR p15, 0, R1, c1, c0, 0);  //disable MPU
    asm(" ISB");

    as I said that you can call "_mpuDisable_();" to disable the MPU.