[U-Boot] selecting CONFIG_BOOTCOUNT_RAM requires defining BOOTCOUNT_ADDR, yes?

Robert P. J. Day rpjday at crashcourse.ca
Sat Jul 23 13:27:24 CEST 2016


  clawing my way through bootcount code, and there are a few
variations for the macro name BOOTCOUNT_ADDR, that's for sure (but
that's for another post).

  anyway, just noticed this relatively sparse use of the macro
BOOTCOUNT_ADDR:

$ grep -rw BOOTCOUNT_ADDR *
board/keymile/km_arm/km_arm.c:	bootcountaddr = gd->ram_size - BOOTCOUNT_ADDR;
board/keymile/km_arm/km_arm.c:	void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
board/keymile/km_arm/km_arm.c:	void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
drivers/bootcount/bootcount_ram.c:	save_addr = (ulong *)(size - BOOTCOUNT_ADDR);
drivers/bootcount/bootcount_ram.c:	save_addr = (ulong *)(size - BOOTCOUNT_ADDR);
include/configs/km/km_arm.h:#define BOOTCOUNT_ADDR          (CONFIG_KM_RESERVED_PRAM)
include/configs/theadorable.h:/* Max size of RAM minus BOOTCOUNT_ADDR is the bootcounter address */
include/configs/theadorable.h:#define BOOTCOUNT_ADDR			0x1000
$

and since bootcount_ram.c simply assumes that macro has a value:

  void bootcount_store(ulong a)
  {
        ulong *save_addr;
        ulong size = 0;
        int i;

        for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
                size += gd->bd->bi_dram[i].size;
        save_addr = (ulong *)(size - BOOTCOUNT_ADDR);
        ... snip ...

i conclude that if you're using CONFIG_BOOTCOUNT_RAM, you *better*
assign a value to BOOTCOUNT_ADDR in your board definition. i see in
the above that that feature isn't used all that often; still, the fact
that you need to set that macro doesn't seem to be mentioned anywhere,
so i'm adding that to my list of doc fixes for later (unless someone
has newer info about that setting they care to share).

  onward ...

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



More information about the U-Boot mailing list