i.MX6UL: Adding bootcount support

Heiko Schocher hs at denx.de
Mon Jul 7 06:31:02 CEST 2025


Hi Fabio,

On 07.07.25 03:18, Fabio Estevam wrote:
> Hi,
> 
> I'm trying to enable bootcount support on the imx6ul-evk board like this:
> 
> --- a/configs/mx6ul_14x14_evk_defconfig
> +++ b/configs/mx6ul_14x14_evk_defconfig
> @@ -110,3 +110,8 @@ CONFIG_SPLASH_SCREEN=y
>   CONFIG_SPLASH_SCREEN_ALIGN=y
>   CONFIG_BMP_16BPP=y
>   CONFIG_IMX_WATCHDOG=y
> +CONFIG_SYS_BOOTCOUNT_ADDR=0x020B0068
> +CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
> +CONFIG_BOOTCOUNT_LIMIT=y
> +CONFIG_SYS_BOOTCOUNT_MAGIC=0xB0C4000
> +CONFIG_SYS_BOOTCOUNT_BE=y
> 
> However, the 'bootcount' variable does not increment after a 'reset' command:
> 
> => print bootcount
> bootcount=1
> 
> Has anyone managed to get bootcount working on it?MX6UL?

Have you checked if CONFIG_SYS_BOOTCOUNT_ADDR address is stable over
reset? May someone overwrites it...

I had it working on imx6ull

CONFIG_BOOTCOUNT_BOOTLIMIT=3
CONFIG_SYS_BOOTCOUNT_ADDR=0x20d8024
CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
CONFIG_BOOTCOUNT_LIMIT=y

I did not needed

 > +CONFIG_SYS_BOOTCOUNT_MAGIC=0xB0C4000
 > +CONFIG_SYS_BOOTCOUNT_BE=y

but may because I have an older base...

Hmm.. your register seems fine ... I read in RM:
"""
For backward compatibility with earlier
versions of SNVS LPGPR0 is aliased at its original offset of 68h.The GPR will be
automatically zeroized when a tamper event occurs, unless GPR zeroization is disabled
via the GPR_Z_DIS bit in the LP Control Register.
"""

May try 0x20b00090 ... just a try...

May tamper event occurs? And the register is in "low power domain" ... may
there is a problem... so no real idea here from my side, just speculation...

bye,
Heiko
-- 
DENX Software Engineering GmbH, Managing Director: Johanna Denk, Tabea Lutz
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list