This example implements an HTTP Server on a device that can be accessed from a computer via network interface.
The example uses a fixed set of web pages stored in ROM, but is capable of exchanging information with the underlying hardware by using the CGI interface.
The following picture shows an exemplary connection of the development board and a Computer.
The HTTP Server project is available as part of the Network Reference examples.
Following files implement application-specific logic in the example:
HTTP_Server.c
contains the application main thread which initializes the Network Component.HTTP_Server_CGI.c
defines the functions for the scripting language for communication with the hardware../Web/
directory contains all the HTML and CGI files that will be compiled into the Web.c
file. The files in this group determine the actual layout of the web page and the behaviour of the different refs using CGI.Web.c
is a compiled file that will be generated by the FCARM File Converter tool from all the web input files.You can add the following optional files, which are not included in the project by default:
HTTP_Server_Multiuser.c
is used for specifying multiple users and access rights for these users.HTTP_Server_Access.c
enables the server to accept or block connection requests from certain remote clients.HTTP_Server_Error.c
contains the information that the web server is showing in case of errors (such as Error 404).Configuration files for the software components used in the project are located in the ./RTE/
directory and can be modified by users to adjust the operation of related components.
Following configuration files are provided with this example:
./RTE/Network/
folder:Net_Config_HTTP_Server.h
: HTTP Server configurationNet_Config_TCP.h
: TCP Socket configurationNet_Config_UDP.h
: UDP Socket configurationNet_Config_ETH_0.h
: Ethernet Interface configurationNet_Config.h
: Network Core configurationNet_Debug.h
: Network Debug configuration./RTE/CMSIS/
folder:RTX_Config.h
and RTX_Config.c
: CMSIS-RTX Configuration files for the RTOS KernelWhen a board layer is added to the project, corresponding configuration files for the board and device components will become available in the local ./Board/
directory.
In order to build the project it shall be extended with a compatible board layer that provides following interfaces as connections:
CMSIS_ETH
: CMSIS-Driver for Ethernet interfaceCMSIS_VIO
: CMSIS-Driver for Virtual I/O interfaceSTDOUT
: standard output stream redirectionWorking with MDK-Middleware Examples explains the workflow for accessing, configuring and building an MDK-Middleware example project for your target hardware.
Setup
Board-specific hardware setup such as jumpers, Ethernet ports, power supply, etc is documented in the board layer description (README.md
) of your selected target.
Example execution
The web server can be tested on any PC using any browser available.
In the browser URL area type the address to the local host name for the server that is defined in the Net_Config.h
file. The default name is my_host, and for this case type http://my_host
as the URL. If you have a DCHP server in your network, you will be automatically connected.
To log in to the server use admin for the user name and no password (you can change the defaults in the Net_Config_HTTP_Server.h
file). The following (or a similar) page will come up in your browser:
If you get an error message, please verify that all network, IP and other settings are correct.