cancel
Showing results for 
Search instead for 
Did you mean: 

How to Know the reset reason in uboot instead of Primary Bootloader

Smedi
Associate II

Hi,

 I have an STM32MP157C-DK2 reference board and it is booting with yocto linux.From the bootlog I came to know that reset reason is checked in the Primary Bootloader by reading a register from the file tf-a-stm32mp/plat/st/stm32mp1/bl2_plat_setup.c

 uint32_t rstsr = mmio_read_32(stm32mp_rcc_base() + RCC_MP_RSTSCLRR);

  Now I want to know the reason in the uboot level before lauching the kenel image to add an extra environmental variable in uboot.I tried to read the register using readl(),_raw_readl() API's but I was throwing data abort error while booting and the board gets reboot.So I need help w.r.t the way to read register or any other way to get the reset reason information.

Regards

Srikanth.

2 REPLIES 2
Martin Devera
Associate III

The RCC_MP_RSTSCLRR is always readable even in nonsecure mode, you should be able to read it.

I suggest to use asm("bkpt") in uboot at place where you want to read it, use openocd to check

the register (and maybe MMU tables - mdw phys is your friend).

Other way is to copy the value into some of TEMP registers in TF-A and read back in u-boot. TEMPs

are already used for similar things.

regards, Martin

PatrickD
ST Employee

Hi,

in Table 74. Register access type versus protection and security (continued)

RCC_MP_RSTSCLRR, RCC_MP_RSTSSETR

Access types = SR/CR

Access limitations = N

Secure attribute = S

Secure control bits = TZEN

=> only secure can write to this register / controlled by TZEN but read is allowed

After check with memory dump command (md), in U-Boot read is allowed :

STM32MP> md 50000408 1

50000408: 00000014  

regard

Patrick