[U-Boot] [RFC] Act as a TFTP server

Luca Ceresoli
2011-04-13T12:47:26Z

Wolfgang,
thanks for the feedback.

Wolfgang Denk wrote:

> ...
>> From the user point of view, I would implement a new command, activated only
>> when CONFIG_CMD_TFTPSRV is defined:
>>
>> Usage: tftpsrv [<loadaddr>]
>>
>> This would be used almost like tftpboot, except no file name is specified on
>> the commandline.
>> <loadaddr> would default to the environment variable.
> I see some user interface issues here:
> - When and how do you terminate this command? After a successful
> download, ok. But how long do we wait for that? Forever? Or do we
> time out?
The TFTP client tries sending a RRQ packet TIMEOUT_COUNT times (default 10),
spaced TIMEOUT msecs (default 5000) from each other. 50 seconds total by default.

I would keep the same scheme for the server, except it would obviously not send
anything after each timeout. This would allow to print something every 5 seconds,
for user feedback.

> - It would be nice if the user could terminate the command using ^C.
Sure. The main loop in NetLoop() would be unchanged, so I expect ctrlc() to work
for free in the same way it does for the TFTP client.

Luca