Overview

This example shows how to build an HTTP server using Mongoose Library and run it on a TI EK-TM4C1294XL development board with TI-RTOS.

The source code for this tutorial is located at https://github.com/mongoose-examples/ti-ek-tm4c1294xl-http-server

A big part of this example is a regular Code Composer Studio (CCS) project.

Below is a general process outline:

  • IP address, network mask and gateway, are obtained via DHCP, there's no need to change anything
  • Build the example (see below) and run it on a development board
  • The firmware initializes the network, and turns on a green LED if the network cable is connected
  • If you don't see this green LED turned on, make sure that your Ethernet cable is properly connected to the board
  • After initialization, the application starts Mongoose's event loop
  • The web server is ready
  • Open your web browser and navigate to the board IP address

Build options

There are (at least) two options to build the example:

  1. Using the make command
  2. Using CCS IDE

Option 1: make

  • Install Docker
  • Optionally, install the Uniflash utility or even TIFlash
  • Start a terminal, navigate to the project folder, and from there run
    $ make build
    
  • When build finishes, run
    $ make flash
    
    Optionally, use Uniflash or TIFlash

Done! Now the firmware is flashed and the code is running. If you used the make flash command, that window turned into a console and you should start seeing TI-NDK and Mongoose messages. The web server should be reachable at the IP address printed at the console.

Option 2: CCS

CCS is an IDE software provided by TI. We'll be importing the project so it has to be present in your filesystem, so first run make to clone the git repository; unless you've already tried Option 1 above.

  • Start CCS
  • Choose File -> Import..., then open Code Composer Studio and select CCS Projects:pic
  • Pick a project directory as search-directory, make sure that http-server is checked and click Finish:pic
  • Click on the project in the Project Explorer tab, now click on the hammer icon to build the project, then on the bug icon to flash the project and start the debugging session:pic
  • The microcontroller will be flashed:
  • The code will stop right at the start of the main() function. Click the continue icon and the example will start:
  • At the bottom of the CCS window you'll see the console, there, TI-NDK and Mongoose messages will be printed. The web server should be reachable at the IP address printed at this console.

Custom application

In order to create your own Mongoose-enabled application, add the required functionality to this example or write your own using this one as a guidance. The main points to keep in mind are:

  • Configure Mongoose Library to use TI-RTOS resources: add MG_ARCH=MG_ARCH_TIRTOS to the preprocessor symbols (Properties->Arm Compiler->Predefined Symbols)
  • You can use the printf() function or the MG_LOG() macro to output information; stdout is routed through the debugger so the output of printf() and similar functions go directly to the CCS console.