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
There are (at least) two options to build the example:
- Using the
- Using CCS IDE
Option 1: make
- Follow the Build Tools tutorial to setup your development environment.
- Start a terminal, navigate to the project folder, and from there run
- When build finishes, run
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
File -> Import..., then open
Code Composer Studioand select
- Pick a project directory as
search-directory, make sure that
http-serveris checked and click
- Click on the project in the
Project Explorertab, now click on the hammer icon to build the project, then on the bug icon to flash the project and start the debugging session:
- The microcontroller will be flashed: <img src="images/pic4.webp" class="w-75" alt="flashed microcontroller>
- 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.
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_TIRTOSto the preprocessor symbols (
Properties->Arm Compiler->Predefined Symbols)
- You can use the
printf()function or the
MG_LOG()macro to output information;
stdoutis routed through the debugger so the output of
printf()and similar functions go directly to the CCS console.