Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Next »

This section describes all the steps required to build a HTTPs-based application. The instructions provided in this section are not intended for any particular toolchain, but instead are described in a generic way that can be adapted to any toolchain.

The best way to start building a  HTTPs-based project is to start from an existing project. If you are using µC/OS-II or µC/OS-III, Micrium provides example projects for multiple development boards and compilers. If your target board is not listed on Micrium’s web site, you can download an example project for a similar board or microcontroller.

If you are starting from a Micriµm example, section µC/HTTPs Project Example gives more details on the Micriµm example repository and included files.

Working project with RTOS

The first step before including the µC/HTTPs is to have a working project with the RTOS of your choice. As previously mentioned, Micriµm offers starting example with the µC/OS-II and µC/OS-III kernels for many evalboards. 

Complete documentation for µC/OS-II here, including a Getting Started Guide.

Complete documentation for µC/OS-III here, including a Getting Started Guide.

Including Additional Modules to the Project

Once you have a working project with your RTOS, additional modules are needed by the Micriµm HTTP server that are not necessarily already included in your project. Therefore, be sure to add µC/CPU, µC/LIB, µC/Common and µC/TCPIP to your project.  

Complete documentation for µC/CPU here.

Complete documentation for µC/LIB here.

Complete documentation for µC/Common here.

Complete documentation for µC/TCPIP here.

Bear in mind to include the required paths associated with those modules to your project’s C compiler settings.

Including HTTP Server Source Code

Include the following files in your project tree from the µC/HTTPs source code distribution, as indicated in Figure - µC/HTTPs Source Code.

As indicated in the Figure - µC/HTTPs Source Code, all the files in the Source folder must be added to your project tree. Furthermore, http-s_os.c file of the selected RTOS must be added as well as the generic http-s_os.h file that can be found in the OS folder. 

For the file system, µC/HTTPs uses the network file system layer included with µC/TCP-IP located inside the uC-TCPIP/FS folder. Therefore, the file net_fs.h inside this folder must be include to your project, no matter what file system your HTTP server is using.

If a conventional file system is used, the port should be located also inside the uC-TCPIP/FS folder. A port for the µC/FS-V4 file system is already included in this folder. If a file system other than µC/FS is used, a port template is available inside the uC-TCPIP/FS/Template folder to be customize according to your file system.
 

If the Static file system is used, the port for this file system is located inside uC/HTTPs. Therefore, the source files http-s_fs_static.c/.h must be include to your project. They are located inside theMicrium/Software/uC-HTTPs/FS/Static folder. Furthermore, The configuration file template http-s_fs_static_cfg.h must be copied in your application directory. This configuration file can be retrieve inside the Micrium/Software/uC-HTTPs/FS/Static/Cfg/Template folder.

Finally, add the following include paths to your project’s C compiler settings:

\Micrium\Software\uC-HTTPs
\Micrium\Software\uC-HTTPs\OS\<OS type>

Copying and Modifying Template Files

Copy the files from the uC-HTTPs configuration folder into your application as illustrated in Figure - Copying Template Files.

 

http-s_cfg.h is a configuration file used to setup µC/HTTPs module static parameters  and features such as CGI form configuration, dynamic token replacement  configuration, header field feature, proxy configuration and so on. Refer to section Module Configuration for more details on all the configurations inside http-s_cfg.h 

The http-s_instance_cfg.c/.h pair of files, defines the configuration structure for an HTTP server’s instance (see µC/HTTPs Instance Configuration for more details). If your application requires a secured HTTP server instance, the http-s_instance_secure_cfg.c/.h pair of files should be used as template instead. 

Modifying the Application Configuration Files

The µC/HTTPs Module uses additional heap memory space. Therefore, it is possible that your sample application will require more allocation of heap memory. If ti is the case, you can increase the value of the #define LIB_MEM_CFG_HEAP_SIZE inside the lib_cfg.h file of your sample project. You can refer to section µC/LIB Memory Management Configuration for more details on the heap usage of the µC/HTTPs Module. 

Adding µC/HTTPs application function

Before running the sample application, you will need to add the new funtion, AppInit_HTTPs(), in your app.c file to initialize and setup the µC/HTTPs module. Section µC/HTTPs Mocule Initiaziation Example gives an example of the main application task inside which the AppInit_HTTPs() function will be called. 

This code example will need to be modified in accordance with your project setup. For example, 

Adding Additional includes

Since the µC/TCP-IP module was added to the sample project, the following include must be added to the app.c file :

#include <Source/http-s.h>
#include <http-s_cfg.h>
#include  <http-s_fs_static_cfg.h>  (optional if another file system is used)
#include <http-s_(instance_name)_cfg.h> (...and other instance configuration files)

 

 

DEVELOP

  • No labels