U-Boot POST Memory Test

Heinrich Schuchardt xypron.debian at gmx.de
Mon Aug 3 22:50:06 CEST 2020


On 8/3/20 8:24 PM, Brownlie, Lewis wrote:
> Hello all,
>
> I am working on enabling a POST-based memory test for an ARM-based processor.  I have defined CONFIG_POST CONFIG_SYS_POST_MEMORY in include/configs/<board>.h; I have also defined CONFIG_POST_EXTERNAL_WORD_FUNCS and wrote some external word functions.  U-Boot builds with no errors and works on the board; however, the memory test is not being run, and I'm trying to figure out why.  Through some printf debugging I have determined that board_init_f() and board_init_r() are calling post_run(), as it should be (discussed in doc/README.POST).  In trying to understand the code and what I can do to make this work, I have encountered some questions:
>
>
>   1.  Since the memory test runs before U-Boot relocates to RAM, the memory test should be run during the post_run() call that happens in board_init_f() and not board_init_r(), correct?  (I just want to clarify that I am understanding that correctly.)

The design is described in doc/README.POST.

>
>
>
>   1.  What is the purpose of post_bootmode_get() (in post/post.c)?

post_bootmode_get() tells you which type of tests should be executed.
For tests after a watchdog reset it also returns the last executed test.

>
>
>   1.  In post_run() (in post/post.c), I noticed that an unsigned int called "last" is declared but never initialized with a value; however, "last" is then used as if it were initialized.  Why is it that we can use this variable without initializing it, and what is the purpose of this variable?

if (post_bootmode_get(&last) & POST_POWERTEST) {

If the return value of post_bootmode_get contains the bit mask
POST_POWERTEST, last has been initialized.

>
>
>   1.  Does memory_post_test() (as declared in post/tests.c and defined in post/drivers/memory.c) ever get called, and if so, where?

post_list[] defines the available tests. The memory test runs in either
of the states  POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL.

>
>
>   1.  Ultimately, like I said, I am just trying to make the POST memory test work; if anyone has any suggestions as to what I can do to do this it would be greatly appreciated.

I suggest that you try to run the memory test on qemu_arm64_defconfig.
There you can easily debug with gdb what is happening.

qemu-system-aarch64 -gdb tcp::1234 creates the debug port.

In a separate terminal:

gdb-multiarch u-boot -ex 'target remote localhost:1234'
add-symbol-file u-boot <relocaddr>

where <relocaddr> is the relocation address printed out in U-Boot by the
'bdinfo' command.

Best regards

Heinrich


More information about the U-Boot mailing list