Are there any scratch registers where I can keep some counter value stored and this value is kept after a reboot/reset. I would like to implement a boot_counter in u-boot, therefore I need some register where the boot counter is stored. So if I installed a second Linux on the target and this panics on bootup, the watchdog would reboot the board and u-boot would increase this value. After a bootcount limit is exceeded a backup linux is booted.
So are there such registers present on the vybrid vf6 cpu?
Thanks a lot, Andi
Hi Andi
During the boot of the module, the reset cause can be seen, which will be for your application watchdog reset. You could use a uboot variable to implement a counter and save the value on the flash. Then at the start of uboot, the decision of booting normal or backup kernel can be made.
Best regards, Jaski
Hello Jaski,
thanks for your recommendation; writing to flash is an option, but I would like to limit flash write cycles, due to wear out, writing to flash on every boot up cycle and then reset this variable from Linux via fw_envwrite, another write access… Another option would be to write this value to an address in RAM but if this is not secured by a signature then this could be misinterpreted by u-boot if this mem location is not “secured” from running Linux. Thanks, Andi
Hello Stefan,
thank you for your support. I can confirm that your suggestion works like charm!
There are some persistent registers in the SRC (System Reset Controller) IP. Those are used by the boot ROM for suspend/resume entry addresses, but if you don’t use the secondary M4 core/suspend resume they would be ok to use. E.g. the SRC_GRP3 (address 0x4006e02c
) should be fine to use. Of course this register is only available at this address on Colibri VF50/VF61, so this won’t be applicable for other Toradex modules.