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.

CCS/TMS570LS1224: MPU

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

I am experimenting with using the MPU. When I allocate an array, the mpu protection is triggered and step into        b   _dabort, 

 step into

  stmfd r13!, {r0 - r12, lr}; 

and then step into 

       b   _dabort,

just like loop,

the program is shown in the following two figures:

,I have two questions:

1.Why  the program steps into         b   _dabort  instead of ldr r12, esmsr3 after stmfd r13!, {r0 - r12, lr}?

2.What is the normal software flow for triggering MPU protection?

 

 

More pictures:

1.Assign values to arrays to trigger mpu protection

2.value of R0-R13

3.config of HALCoGen

4.CMD

  • Hello Wenbao,

    Your MPU settings is fine to test MPU access violation. The RAM section is defined as read only, then  writing data to RAM will violate the MPU and cause CPU abort. It is expected.

  • I want to control a pin pull when the MPU is triggered:
    1.Can I modify the content of dabort?
    2.How can I achieve the function that if the MPU is triggered, a pin will send out a high level signal?
    3.Whether the CPU can recover from MPU access violation?By watch dog?
  • Hello Wenhao,

    You can add your code (toggle GPIO pin) into the custom_abort function which is located in sys_selftest.c

    void custom_dabort(void)
    {
    /* Need custom data abort handler here.
    * This data abort is not caused due to diagnostic checks of flash and TCRAM ECC logic.
    */
    /* USER CODE BEGIN (42) */
    /* USER CODE END */
    }

    If you write data to the protected SRAM (read only), you will continue to get abort.
  • After some testing ,I found if the region size set to 128bytes ,it will get aborting and do custom_abort .And if the size is set to 128KB, it would execute like the following figure:

    it  only execute “b   _dabort” and ‘“stmfd r13!, {r0 - r12, lr}”.It did not execute custom_dabort .Why do different sizes lead to two different results?

  • Hello Wenhao,

    You must align the region start address to a region-sized boundary. For example, if a region size is 128KB, the base address must be a multiple of 128KB (at least 0x20000).

    If the region is not aligned correctly, this results in Unpredictable behavior.