SPMA080 April   2021 TM4C1292NCPDT , TM4C1292NCPDT , TM4C1292NCZAD , TM4C1292NCZAD , TM4C1294KCPDT , TM4C1294KCPDT , TM4C1294NCPDT , TM4C1294NCPDT , TM4C1294NCZAD , TM4C1294NCZAD , TM4C1299KCZAD , TM4C1299KCZAD , TM4C1299NCZAD , TM4C1299NCZAD , TM4C129DNCPDT , TM4C129DNCPDT , TM4C129DNCZAD , TM4C129DNCZAD , TM4C129EKCPDT , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129ENCZAD , TM4C129LNCZAD , TM4C129LNCZAD , TM4C129XKCZAD , TM4C129XKCZAD , TM4C129XNCZAD , TM4C129XNCZAD

 

  1.   Trademarks
  2. Introduction
    1. 1.1 TI-RTOS Download
    2. 1.2 License
    3. 1.3 XDCtools
    4. 1.4 Versions
    5. 1.5 Configuring NDK Modules
    6. 1.6 Socket-Based API
      1. 1.6.1 BSD Style Socket APIs
  3. Application Examples
  4. Application Setup
    1. 3.1 Hardware Setup
    2. 3.2 Software Tools
  5. Download and Import the Ethernet Examples
  6. How to Create an Ethernet Application for TI-RTOS NDK
  7. Enet_tcpecho_server_tirtos Example Overview
    1. 6.1 Build and Flash the Program
    2. 6.2 Check and Program the MAC Address
      1. 6.2.1 Using The LM Flash Programmer
      2. 6.2.2 Using CCS
      3. 6.2.3 Using UniFlash
    3. 6.3 Run the enet_tcpecho_server_tirtos Example
  8. Enet_udpecho_server_tirtos Example Overview
    1. 7.1 Run the enet_udpecho_server_tirtos Example
  9. Enet_httpServer_tirtos Example Overview
    1. 8.1 Configure NDK for HTTP Application
    2. 8.2 Embedded File System (EFS) Operation
    3. 8.3 Adding HTTP Server Content
    4. 8.4 Declaring HTML Files to EFS
    5. 8.5 Writing CGI Functions
    6. 8.6 Run the enet_httpServer_tirtos Example
  10. Enet_dns_tirtos Example Overview
    1. 9.1 How to Configure NDK for DNS
    2. 9.2 How to View the DNS Traffic on Wireshark
    3. 9.3 Run the enet_dns_tirtos Example
  11. 10Enet_sntp_tirtos Example Overview
    1. 10.1 Run the enet_dns_tirtos Example
  12. 11Enet_tcpecho_client_tirtos Example Overview
    1. 11.1 Configure the Server IP Address
    2. 11.2 Configure the SocketTest Server
    3. 11.3 Run the enet_tcpecho_client_tirtos Example
  13. 12Enet_udpecho_client_tirtos Example Overview
    1. 12.1 Run the enet_udpecho_client_tirtos Example
  14. 13Enet_httpget_tirtos Example Overview
    1. 13.1 How to Configure NDK for HTTP GET Example
    2. 13.2 Run the enet_httpget_tirtos Example
  15. 14References

Adding HTTP Server Content

All the html pages for this example are stored in the “fs” directory of the project, see Figure 8-4. These html files form the web pages to be served by the web server.

GUID-20210329-CA0I-P9XW-TNTL-BP0SM3ZKC2SK-low.jpg Figure 8-4 File System Directory

The html web pages must be first converted from their binary HTML files into data arrays declared in C. An MS-DOS utility “binsrc” is supplied in the NDK package to allow conversion of files to a C array. The binsrc utility can be found in <TI-RTOS Installation>\products\ndk_2_25_00_09\packages\ti\ndk\tools\binsrc\binsrc.exe.

The calling format for binsrc is:

>binsrc <input file name> <output file name> <identifier>

Parameters:

  • Input file name: File to be converted
  • Output file name: Name for file containing C data representation of the input file name
  • Identifier: C name for data

For example, to convert an HTML file index.html for use by EFS, the following command could be executed from the Windows command window:

>binsrc index.html index.h INDEX

The index.html after conversion to index.h would contain the following as shown in Figure 8-5.

  1. The index.h file defines the size of the file to be 1932 bytes. Later we will look at Wireshark to confirm that the web server indeed transfers the same number of bytes in its HTTP response to the client.
  2. The INDEX character array begins with <!DOCTYPE HTML>. Open a text editor to read the first line of index.html and you can confirm that it is the same as what was stored in the INDEX array.
  3. Look at the content of the next few bytes in the INDEX array and it encodes <!—Copyright © 2013-2021 Texas Instruments Incorporated. All rights…..>. Again, compare it with the index.html and confirm that index.h is a binary representation of the index.html.
GUID-20210329-CA0I-GG9S-JRR8-19VDL8NMZGRV-low.jpg Figure 8-5 Index.html Binary File Content