Rahix / tbot

Automation/Testing tool for Embedded Linux Development
https://tbot.tools
GNU General Public License v3.0
84 stars 21 forks source link

Send arbitrary commands via uboot console #110

Closed Adnan-Elhammoudi closed 6 months ago

Adnan-Elhammoudi commented 7 months ago

Is there any way to send the Enter key as an arbitrary command via u-boot console? My purpose here is to make the md increment the next result address and read it back.

Rahix commented 7 months ago

I would avoid doing that. This "enter without a command does something special" behavior of U-Boot is an optimization for allowing CLI users to type less. But tbot doesn't care about how much "typing" it has to do. So it is a better idea to send explicit commands every time rather than relying on such convenience features on the other side. This also gives you a lot more flexibility should you ever want to adjust your code.

So I'd rather do something like this:

START_ADDR = 0x10000000
READ_SIZE = 0x100

addr = START_ADDR
for i in range(10):
    output = ub.exec0("md.b", hex(addr), hex(READ_SIZE))
    addr += READ_SIZE
Rahix commented 6 months ago

@Adnan-Elhammoudi is this topic resolved for you? If yes, please close the issue :)