...
The first step before including µC/HTTP-client TFTPc is to have a working project with µC/TCP-IP. As previously mentioned, Micriµm may offer an example with the µC/OS-III kernel, µC/TCP-IP and even µC/HTTP-client TFTPc for many evalboards.
If no project with µC/TCP-IP is available for your platform, you should follow the µC/TCP-IP Getting Started Guide to ensure you have a working project before installing µC/HTTP-clientTFTPc. Then you can follow the steps to build and run your first µC/HTTP-client TFTPc sample application shown below.
Including µC/
...
TFTPc Stack Source Code
As indicated in the Figure - HTTP-client TFTPc Folder Tree, all the files in the "Source" folder of the "Client" directory must be added to your project tree.Furthermore, all files in the "Common" folder under the "HTTP" µC/TFTPc parent directory must be added to your project tree.
...
Add the following include paths to your project’s C compiler settings:
\Micrium\Software\uC-HTTPTFTPc
Copying and Modifying Template Files
Copy the files file from the uC-HTTP-client µC/TFTPc configuration folder into your application as illustrated below.
Panel | ||
---|---|---|
| ||
Adding µC/TFTPc Example Application Code
...
Note that some sections of the source code have been removed or modified to help focus on the µC/TFTPc module use.
Code Block | ||||
---|---|---|---|---|
| ||||
#define TFTPc_TEST_SERVER_IP "192.168.1.102"
#define TFTPc_TEST_SERVER_PORT 69
#define TFTPc_TEST_FILE_NAME_LOCAL "\\file_local"
#define TFTPc_TEST_FILE_NAME_REMOTE_GET "file_remote_get"
#define TFTPc_TEST_FILE_NAME_REMOTE_PUT "test_remote_put"
static void App_TestTFTPc (void)
{
NET_IP_ADDR ip_server;
NET_ERR err_net;
TFTPc_ERR err;
ip_server = NetASCII_Str_to_IP(TFTPc_TEST_SERVER_IP, /* See Note #1. */
&err_net);
if (err_net != NET_ASCII_ERR_NONE) {
printf("Error - NetASCII_Str_to_IP: %d\n\r", err_net);
return;
}
TFTPc_Init(&TFTPc_Cfg, &err); /* See Note #2. */
if (err != TFTPc_ERR_NONE) {
printf("Error - TFTPc Initialization: %d\n\r", err);
return;
}
(void)TFTPc_Get(DEF_NULL, /*See Note #3. */
TFTPc_TEST_FILE_NAME_LOCAL,
TFTPc_TEST_FILE_NAME_REMOTE_GET,
TFTPc_MODE_NETASCII,
&err);
if (err != TFTPc_ERR_NONE) {
printf("Error - TFTPc_Get: %d\n\r", err);
}
(void)TFTPc_Put(DEF_NULL, /*See Note #4. */
TFTPc_TEST_FILE_NAME_LOCAL,
TFTPc_TEST_FILE_NAME_REMOTE_PUT,
TFTPc_MODE_NETASCII,
&err);
if (err != TFTPc_ERR_NONE) {
printf("Error - TFTPc_Put: %d\n\r", err);
}
} |
Panel | ||
---|---|---|
| ||
|