This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDSEVM437X: U-boot problem

Part Number: TMDSEVM437X
Other Parts Discussed in Thread: TPS65218

I am a embedded engineer. I use Ti SDK to develop product.

hardware: TMDSEVM437X

hardware link: https://www.ti.com/tool/TMDSEVM437X

soc: Ti am437x

sdk: ti-processor-sdk-linux-am437x-evm-06.03.00.106

sdk link: https://www.ti.com/tool/PROCESSOR-SDK-AM437X

sdk u-boot version: u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3

host PC: Debian 10

 

I enable CONFIG_AUTOBOOT_KEYED and set CONFIG_AUTOBOOT_DELAY_STR as NULL and set CONFIG_AUTOBOOT_STOP_STR as NULL.

CONFIG_AUTOBOOT_KEYED: 1

CONFIG_AUTOBOOT_DELAY_STR: “”

CONFIG_AUTOBOOT_STOP_STR: “”

 

I add some print logs to file “u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3/common/autoboot.c”. When i start up the board, the terminal conncted to board show some logs and it’s normal.

But I find a problem. When u-boot autoboot is ongoing (the boot timeout time has not expired), if i press any key, the process will hang and the printout will stop. I think the process don’t exit “do while“ loop.

Because there is no “passwd end” log that i add. I think it has been in the “tstc” function and did not exit. So i think it’s error. I think it should be when u-boot autoboot is ongoing (the boot timeout time has not expired), if i press any key, the process will continues and the print log will continues to output until the boot timeout time is reached.

 

The terminal log is as follows:

U-Boot SPL 2019.01-g5dac0286d2-dirty (Jun 18 2020 - 15:36:12 +0800)

Trying to boot from MMC1

SPL: Please implement spl_start_uboot() for your board

SPL: Direct Linux boot not active!

U-Boot 2019.01-g5dac0286d2-dirty (Jun 18 2020 - 15:36:12 +0800)

 

CPU : AM437X-GP rev 1.2

Model: TI AM437x GP EVM

DRAM: 2 GiB

PMIC: TPS65218

NAND: 512 MiB

MMC:   OMAP SD/MMC: 0

Loading Environment from FAT... *** Warning - bad CRC, using default environment

 

Net:

Warning: ethernet@4a100000 using MAC address from ROM

eth0: ethernet@4a100000

Autoboot in 30 seconds

delay key:<>

stop key:<>

presskey_len: 0, presskey_max: 0

time: 544812, end time: 90523059

time: 553707, end time: 90523059

time: 562603, end time: 90523059

time: 571498, end time: 90523059

 

The print logs that i add is as follows:

static int passwd_abort(uint64_t etime)

{

            debug_bootkeys("presskey_len: %d, presskey_max: %d\n", presskey_len, presskey_max);         // wl.yan, display: “presskey_len: 0, presskey_max: 0 ”; it’s right

 

            /* In order to keep up with incoming data, check timeout only

            * when catch up.

            */

            do {

                        if (tstc()) {

                                    if (presskey_len < presskey_max) {

                                                presskey[presskey_len++] = getc();

                                    } else {

                                                for (i = 0; i < presskey_max - 1; i++)

                                                            presskey[i] = presskey[i + 1];

 

                                                presskey[i] = getc();

                                                debug_bootkeys("presskey: %c\n", presskey[0]);          // wl.yan

                                    }

                                    debug_bootkeys("1presskey: %c\n", presskey[0]);        // wl.yan

                        }

                        //debug_bootkeys("presskey_len: %d, time: %llu, end time: %llu\n", presskey_len, get_ticks(), etime);            // wl.yan

                        debug_bootkeys("time: %llu, end time: %llu\n", get_ticks(), etime);       // wl.yan, it will continue to print log before the boot timeout time is reached

 

                        for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i++) {

                                    if (delaykey[i].len > 0 &&

                                       presskey_len >= delaykey[i].len &&

                                                memcmp(presskey + presskey_len -

                                                            delaykey[i].len, delaykey[i].str,

                                                            delaykey[i].len) == 0) {

                                                            debug_bootkeys("got %skey\n",

                                                                        delaykey[i].retry ? "delay" :

                                                                        "stop");

 

                                                /* don't retry auto boot */

                                                if (!delaykey[i].retry)

                                                            bootretry_dont_retry();

                                                abort = 1;

                                    }

                        }

            } while (!abort && get_ticks() <= etime);

            debug_bootkeys("passwd end\n");      // wl.yan

}

  • Wenlong,

    I've not seen any such issues with CONFIG_AUTOBOOT* in the past but give me a day or so to double-check and see if I can re-create what you see.

    Regards, Andreas

  • Wenlong,

    wenlong yan said:

    I enable CONFIG_AUTOBOOT_KEYED and set CONFIG_AUTOBOOT_DELAY_STR as NULL and set CONFIG_AUTOBOOT_STOP_STR as NULL.

    CONFIG_AUTOBOOT_KEYED: 1

    CONFIG_AUTOBOOT_DELAY_STR: “”

    CONFIG_AUTOBOOT_STOP_STR: “”

    This is actually an invalid setup as per U-Boot documentation here: https://git.ti.com/cgit/processor-sdk/processor-sdk-u-boot/tree/doc/README.autoboot?h=processor-sdk-u-boot-2019.01#n89

    	Define CONFIG_AUTOBOOT_KEYED (no value required) to enable
    	this group of options.	CONFIG_AUTOBOOT_DELAY_STR,
    	CONFIG_AUTOBOOT_STOP_STR or both should be specified (or
    	specified by the corresponding environment variable),
    	otherwise there is no way to stop autoboot.

    And if you look at the autoboot.c:passwd_abort() function around line 103 you see that in fact the only way to exit this function is if either a DELAY_STR or a STOP_STR has gotten set.

    If this doesn't answer your question please describe in a bit more detail how you would like your autoboot/abort to work and I should be able to provide some more specific guidance. For example, why can't you just use the default behavior of CONFIG_AUTOBOOT_KEYED not set?

    Regards, Andreas

  • Hi Andreas,

    I have seen README.autoboot. I know if CONFIG_AUTOBOOT_DELAY_STR and CONFIG_AUTOBOOT_STOP_STR is NULL, there is no way to stop autoboot until the boot timeout time is reached. I have added some logs to show how the program runs.

    When the boot timeout time has not expired, if i press any key, the process will hang and the printout will stop. But why? I think It is wrong to press the button to cause the program to hang. I think it should be  if i press any key, the process will continues (no hang) and the print log will continues to output until the boot timeout time is reached. At the autoboot.c:passwd_abort() function around line 175, it keeps checking the boot timeout.

    When i press any key, the tstc() function will not exit. So the process will hang. I think it's wrong. 

    do {
    	if (tstc()) {
    		if (presskey_len < presskey_max) {
    			presskey[presskey_len++] = getc();
    		} else {
    			for (i = 0; i < presskey_max - 1; i++)
    				presskey[i] = presskey[i + 1];
    
    			presskey[i] = getc();	// wl.yan, if CONFIG_AUTOBOOT_DELAY_STR and CONFIG_AUTOBOOT_STOP_STR is NULL, it will "presskey[0] = getc()"
    		}
    	}
    
    	for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i++) {
    		if (delaykey[i].len > 0 &&
    			presskey_len >= delaykey[i].len &&
    			memcmp(presskey + presskey_len -
    				delaykey[i].len, delaykey[i].str,
    				delaykey[i].len) == 0) {
    				debug_bootkeys("got %skey\n",
    					delaykey[i].retry ? "delay" :
    					"stop");
    
    			/* don't retry auto boot */
    			if (!delaykey[i].retry)
    				bootretry_dont_retry();
    			abort = 1;
    		}
    	}
    } while (!abort && get_ticks() <= etime);

    Best regards, wenlong.

  • wenlong yan said:
    When i press any key, the tstc() function will not exit. So the process will hang. I think it's wrong. 

    Ok so the issue is with tstc() not returning from the call?

    If so, can you use the JTAG debugger to step into this to see why it doesn't return?

    Regards, Andreas

  • Hi, i have solved this problem. The  tstc() is normal and it will return from the call. If CONFIG_AUTOBOOT_DELAY_STR and CONFIG_AUTOBOOT_STOP_STR is NULL, presskey_max and presskey_len will be 0. So “presskey_max – 1” is -1. But it is “unsigned int” type. The process will loop here.

    SDK: u-boot 2019.01

    File: /common/autoboot.c

    Function: static int passwd_abort(uint64_t etime)

    Location: line 152~153

    if (tstc()) {
    	if (presskey_len < presskey_max) {
    		presskey[presskey_len++] = getc();
    	} else {
    		for (i = 0; i < presskey_max - 1; i++)	// wl.yan, presskey_max and presskey_len is 0; "presskey_max - 1" is -1; the type of "presskey_max" is unsigned int; so "presskey_max - 1" is 4294967295
    			presskey[i] = presskey[i + 1];
    
    		presskey[i] = getc();
    	}
    }


    Best regards, wenlong.