Showing results for 
Show  only  | Search instead for 
Did you mean: 
Registered: ‎05-26-2020

Zynq and ZynqMP bootcount register


i want to implement a bootcounter in u-boot for the Zynq and ZynqMP devices. At the moment i only find the solution to write the bootcount information to the u-boot environment. My concern is to put the bootcount information in a cpu register. In the same way like the ti am335x rtc register. Is this also possible with a Zynq/ZynqMP device? Especially a register is needed which keep the data in case of a soft reset and loss the data after power loss.

A different aproach, would be to save the bootcounter in a reserved-memory part of the ram. But there is a risk to loos the data while the reset.



0 Kudos
1 Reply
Registered: ‎02-24-2020

Why not simply use the U-Boot env to store your boot count variable? Assuming your env is writable and stored in non-volatile memory, this would take away and concerns about it being volatile.


Actually U-Boot does have a feature like this already which is intended to be used to prevent endless reboots in the case of something like a continual crash after booting to Linux:


It says in the docs it's only for specific platforms but I think that doc is actually outdated as there are actually a couple implementations of this now:

One which saves in a configurable memory address:


and another which saves in the env (which requires another variable/flag "upgrade_available" to be set to prevent un-intended multiple writes to the env and based on the name most probably use this during updates when a endless reboot might occur):


Additionally, if you store it in the U-Boot env, then you can also use the U-Boot fwutils app in Linux to read the value if that is desired.


You could also write a simple U-Boot script to achieve this as well. 

Ken Sloat - Embedded Software Engineer
0 Kudos