Hi Luc,
To add to Daniel's good comments I did an experiment using TWR-K60F120M tower kit.
I started with the C:\Freescale\Freescale_MQX_4_0_2_GA\rtcs\examples\shell\cw10gcc\rtcs_shell_twrk60f120m example using CW10.5.
In the demo_cmd.c file I added the following (the line with "//DES test" comment):
{ "ipconfig", Shell_ipconfig },
{ "oneshot", Shell_SNTP_oneshot }, //DES test
In the shell RTOS component I added the following to the sh_rtcs.h header:
extern int_32 Shell_iwconfig(int_32 argc, char_ptr argv[] );
extern int_32 Shell_SNTP_oneshot(int_32 argc, char_ptr argv[] ); //DES test
In the shell RTOS component I copied and pasted the sh_tftp.c and renamed it "sh_oneshot.c". I then added the file into the shell component (drag-n-drop using Windows Explorer) "Shell Source-->rtcs" folder (i.e. it gets added to the project for compiling). I've attached this file to the post as it is the only file I had to generate.
Compile the shell RTOS component and then the rtcs_shell application.
I used the NIST Internet Time Server ( http://tf.nist.gov/tf-cgi/servers.cgi ) to find a NTP Server IP Address to use below.
My Terminal prompt output is:
shell>
shell> help oneshot
Usage: oneshot <host> <timeout_ms>
<host> = host ip address or name
<timeout_ms> = timeout delay in milliseconds
shell>
shell> oneshot 64.90.182.55 6000
Connecting to 64.90.182.55 [64.90.182.55]: <-- NTP SERVER DOWN :-(
Connection failed, error 0x1103
Connection closed
shell>
shell> oneshot 129.6.15.30 8000
Connecting to 129.6.15.30 [129.6.15.30]: <-- NTP SERVER UP :-)
Connection closed
shell>
shell> help
Available commands:
gethbn <host>
help [<command>]
ipconfig [<device>] [<command>]
oneshot <host> <timeout_ms> <--NEW COMMAND in the help list
shell>
shell> dir
Error, directory does not exist.
shell>
shell> format a: david
Formating...
Done. Volume name is DAVID
Free disk space: 11776 bytes
shell>
shell> write bob 1
shell>
shell> dir
DAVID 0 00-00-1980 00:00:00 V DAVID <-- NOT SURE WHY NOT PROPER DATE and TIME
BOB 1 03-04-2014 19:19:20 A BOB <-- PROPER DATE and TIME !
shell>
shell>
shell>
shell>
shell> gethbn time-c.nist.gov <--IF YOU KNOW SERVERNAME AND WANT IP ADDRESS
time-c.nist.gov...129.6.15.30
shell>
Regards,
David