Commit e4a2d9c8 authored by Oliver Horst's avatar Oliver Horst
Browse files

[add] Initial commit of the meta-toki-apps layer

This layer is intended to hold the recipes for applications that are portable to different platforms supported by toki.

- Added a recipe for the minimal application
- Added a toki-app base class that shall be inherited by all application recipes
parents
BSD with Attribution License
Copyright (c) 2015-2020 fortiss GmbH - Research Institute of the
Free State of Bavaria, Guerickestr. 25, 80805 Munich, Germany
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
4. Redistributions of any form whatsoever must retain the following
acknowledgment: 'This product includes software developed by the
fortiss GmbH -- Research Institute of the Free State of Bavaria,
Munich, Germany (https://www.fortiss.org/).'
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SPDX-License-Identifier: BSD-3-Clause-Attribution
inherit cmake
def generate_cmake_param_list(d, var_name, param):
retVal = []
if type(param) is dict:
for key in param.keys():
_var_name = str(var_name) + "_" + str(key)
retVal.extend( generate_cmake_param_list(d, _var_name, param[key]) )
else:
_var_name = str(var_name).upper()
retVal.append( ( str(_var_name), str(param) ) )
return retVal
def app_build_params (d):
if d.getVar('PN'):
app_name = d.getVar('PN')
app_build_params = get_toki_app_build_params(d, app_name)
return generate_cmake_param_list(d, app_name, app_build_params)
return []
# We do need to populate the site-file.cmake with the build parameters of each application,
# as the it is not possible to evaluate them at an earlier stage on the Yocto build process.
python do_populate_site_file () {
import os
build_params = app_build_params(d)
if len(build_params) > 0:
filename = "{}/site-file.cmake".format(d.getVar('WORKDIR'))
mode = 'w'
f = open(filename, mode)
for var, val in app_build_params(d):
f.write("set({} \"{}\" CACHE STRING \"Build parameter of the application {} automatically set according to the deployment configuration.\")".format(var, val, d.getVar('PN')) + '\n')
f.close()
}
# The site-file.cmake has to be generated before the CMake configuration process is started.
addtask do_populate_site_file after generate_toolchain_file before do_configure
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "toki-apps-layer"
BBFILE_PATTERN_toki-apps-layer = "^${LAYERDIR}/"
BBFILE_PRIORITY_toki-apps-layer = "6"
LAYERVERSION_toki-apps-layer = "1"
LAYERSERIES_COMPAT_toki-apps-layer = "thud"
LAYERDEPENDS_toki-apps-layer = "toki-layer"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
SRC_URI = "git://git.fortiss.org/toki/applications/minimal.git;protocol=https"
SRCREV = "61374c9a9c21d552f96dc8124ad27ab43d3c86f1"
PV = "0.0.1+git${SRCPV}"
S = "${WORKDIR}/git"
inherit toki-externalsrc
EXTERNALSRC = "${@relative_externalsrc(d, "applications/minimal")}"
BINARY_NAME = "minimal.elf"
inherit toki-app
FILES_${PN}-dev += "${libdir}/cmake/*"
TARGET_CFLAGS += "-fpie"
TARGET_LDFLAGS += "-pie"
SYSROOT_DIRS_append = " ${bindir}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment