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.

EK-TM4C1294XL: Software privilege mode

Guru 56178 points

Part Number: EK-TM4C1294XL

Hi All,

It would seem LM flash programmer is considered USR privilege during flash writes upon certain registers when the MPU has been enabled for debug register NMI review. Configuring NVIC_MPU_ATTR register (prv: RW, USR=None somehow causes sudden MCU death after flash writes with reset MCU (after programming box checked) but only upon certain application execution. Clicking LMFlash hardware reset button after MCU crash (2nd SOFTRST) clears the crashing event condition until the next firmware update. After MCU can POR all day without application crashing if you don't update firmware again. The reason behind granting software privilege RW access seemingly is security based, in my mind we should not grant USR (hacker) any such privilege.   

Giving full Cortex-M USR software RW privileges stops application runtime sudden death syndrome! Perhaps why some peripheral errata issues are perceived as POR related events when the registers are not being configured, if or when ever USR (none) issues a SFTRST?

/* Enable the Cortex-M memory protection unit. PRIV_DEFAULT:
 * Enables the default memory map when in privileged mode and
 * when no other regions are defined. HARDFLT_NMI: Enables
 * the MPU while in a hard fault or NMI exception handler.
 * If this option is not enabled, then the MPU is disabled while
 * in one of these exception handlers and the default
 * memory map is applied. */

MAP_MPUEnable(MPU_CONFIG_PRIV_DEFAULT | MPU_CONFIG_HARDFLT_NMI);

/* MPU attributes Software privileged mode, RW full access */
HWREG(NVIC_MPU_ATTR) = NVIC_MPU_ATTR_AP_RW_RW; 

//NVIC_MPU_ATTR_AP_RW_NO  0x01000000  (prv: rw, usr: none)
//NVIC_MPU_ATTR_AP_RW_RW  0x03000000  (prv: rw, usr: rw)

  • When you program the flash, it should have nothing to do with the MPU setting. Let's say you are programming an address location in the flash, it is not the CPU who is writing to that location. It is the FSM (flash state machine) within the flash control who is carrying this programming task.
  • Hi Charles,

    The last HWREG sets the RW software privilege allowing USR access to protected registers as datasheet explains. For some reason granting RW privilege stopped sudden death after firmware update, so it seemed. Pattern was 2 LMFlash resets typically arrest initial runtime crash after a firmware update. The NMI pin PD7 is being used for an AINx after all peripheral clocks have been enabled, set for sleep clock gating. The ADC's are being reset just prior to configuration well after clock gating set true.

    That initial runtime crash does not often occur just after power up but did today, perhaps it might be MCU reset the crux of the issue?  The EKEVM ICDI JTAG off boards via ribbon cable and reset series 470 ohm into 20K pull up MCU reset pin, 100n to ground.