003 - Project and HTTP generator
Changelog
Version | Date | Remark |
---|---|---|
1.0 | Â | Initial Release |
1.1 | 15.02.2021 | Fixed msys installation procedure |
Table: Changelog
Introduction
Scope
This document describes the project generator for application projects. Beside that the generator for the GOAL web server is described.
Document structure
Chapter | Content |
---|---|
Introduction | Introduction of this document |
Project creation | Introduction to GOAL projects |
Installation | Installation requirements for the generators |
Project generator | Description of the GOAL project generator |
HTTP generator | Description of the GOAL http generator |
Table: Content of this document
GOAL projects
GOAL projects consist of a Makefile and are build using the make utility. Changes regarding features or files need to be done within the project Makefile.
Following an example project file:
## @file
#
# @brief
# Generic Makefile
#
# The output will be stored in the directory build/.
#
# @copyright
# Copyright 2021 port GmbH Halle/Saale.
# This software is protected Intellectual Property and may only be used
# according to the license agreement.
#
# paths
PWD = $(shell pwd)
GOAL = $(PWD)/../../../../..
APPL = appl/2015013_irj45/ac/09_ecat_slave
TGTS = $(PWD)/targets
# features
CONFIG_MAKE_FEAT_MCTC_AC = 1
CONFIG_MAKE_FEAT_GOAL_ECAT = 1
CONFIG_MAKE_FEAT_DD_CTC_AC = 1
CONFIG_MAKE_FEAT_LM_EMIT_MA_UART = 1
CONFIG_MAKE_FEAT_HTTP = 1
# files
SRC_C += \
$(APPL)/goal_appl.c \
$(APPL)/../../rpc/ccm_rpc_ac.c \
$(APPL)/goal_appl_ecat.c \
$(APPL)/goal_appl_ecat_objects.c \
$(APPL)/goal_appl_foe.c \
$(APPL)/goal_appl_http.c
INC_C_FILES += \
$(APPL)/../../rpc/ccm_rpc_ac.h \
$(APPL)/../../rpc/ccm_rpc.h \
$(APPL)/goal_appl_ecat.h \
$(APPL)/goal_appl_ecat_objects.h \
$(APPL)/goal_appl.h \
$(APPL)/goal_appl_http.h \
$(APPL)/goal_http_fs.h \
$(APPL)/goal_config.h
export
all:
@$(MAKE) --no-print-directory -f $(GOAL)/tools/make/Makefile $@
.DEFAULT:
@$(MAKE) --no-print-directory -f $(GOAL)/tools/make/Makefile $@
gen_http_fs:
$(GOAL)/tools/generator/goal_gen_http_fs.sh $(GOAL)/$(APPL) $(GOAL)/$(APPL)/html goal_http_fs.h
Line 18:
This path points to the application folder, where source files are located.
Line 22 .. 26:
This section configures features which are part of the project. Available features are described within the file $(GOAL)/tools/make/gcc/Makefile.features. In this example the required features for an application controller (AC) are configured which enable:
CONFIG_MAKE_FEAT_MCTC_AC: general RPC functionality
CONFIG_MAKE_FEAT_LM_EMIT_MA_UART: logging output to a serial console
CONFIG_MAKE_FEAT_HTTP: RPC interface for web server
CONFIG_MAKE_FEAT_GOAL_ECAT: RPC interface for the EtherCAT stack
CONFIG_MAKE_FEAT_DD_CTC_AC: RPC interface for the device detection (DD)
Line 28 .. 45:
This section describes the required source files and used header files. The list of header files is required for project generation. Only the listed files will be visible within the target IDE.
Line 50 .. 55:
Required targets, please leave unchanged.
Line 57 .. 58:
This target can be used to generate header files required for the web server.
Installation
In order to use the generators a shell environment is required. Following for different operating systems an installation procedure is provided.
Linux
Reference system is an Ubuntu Server 20.04.1 64 bit system.
Install build essentials
sudo apt-get install build-essential
Install perl dependency
sudo cpan File::Copy::Recursive
sudo cpan List::MoreUtils
Microsoft Windows
Reference system is Windows 10, version 2004 (10.0.19041.0).
Optionally the Windows subsystem for Linux can be used, then the Linux installation procedure applies.
Install msys2 (http://msys2.org)
Update msys2
Install required tools
Install perl dependency
MacOS X
Reference system is an OSX Catalina (10.15.6).
Install homebrew (https://brew.sh)
Install tools
Install perl module
Project generator
The project generator needs to be run within the project folder (where the Makefile is located).
Enter the project folder
Select a target:
Please select the prefered target from the list of available targets.
Run project generator (eclipse)
Please select the project template from the list of available targets.
Following table gives a short description of the available targets:
Template | Description |
---|---|
atollic_nucleo_f429zi | Atollic studio project |
e2studio_s7g2sk | E2Studio project for s7g2sk |
e2studio_synergy | E2Studio project for Aris |
e2studio_synergy_lib | E2Studio project for Aris |
eclipse_mcu | Generic embedded eclipse project |
generic | Generic eclipse project |
stmcubeide_nucleo_f429zi | STM32CubeIde project for stm32f4 |
Table: Available project templates
The project generator will output some details regarding the process:
The output folder contains the generated project, which can be imported as an preexisting project into the IDE, e.g. STM32CubeIDE.
Â
HTTP Content generator
The provided tool takes a folder containing files, prepared for delivery by the web server and converts those to a format, which can be compiled into the application binary.
Within the project makefile a target can be created which performs this action:
This target calls the bash script goal_gen_http_fs.sh which takes the following arguments:
target path: where the generated header file goal_http_fs.h is created
source path: folder which contains html files, images, js files ... for web server delivery
target filename
Upon invoking of the generator the target file is created. This file can be included from the application. For each file within the source file the following artefacts are created (e.g. from index.html):
binary representation of the file content:
length of the file content:
These variables can be used to provide the data to the web server: