diff options
Diffstat (limited to 'meta-rtmod1/recipes-training/rt-demoapps')
5 files changed, 133 insertions, 0 deletions
diff --git a/meta-rtmod1/recipes-training/rt-demoapps/files/rt-demotest-mlockall.c b/meta-rtmod1/recipes-training/rt-demoapps/files/rt-demotest-mlockall.c new file mode 100644 index 0000000000..c4840f6bd9 --- /dev/null +++ b/meta-rtmod1/recipes-training/rt-demoapps/files/rt-demotest-mlockall.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2021 by Linaro */ +/* Permission to use, copy, modify, and/or distribute this software for any */ +/* purpose with or without fee is hereby granted. */ +/* THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES */ +/* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF */ +/* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR */ +/* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ +/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN */ +/* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF */ +/* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <pthread.h> +#include <sched.h> +#include <signal.h> +#include <errno.h> +#include <unistd.h> +#include <sys/time.h> +#include <sys/mman.h> + +int main (void) +{ + printf("TODO: Write an apllication to RT wakeup test with mlockall!\n"); + return 0; +} diff --git a/meta-rtmod1/recipes-training/rt-demoapps/files/rt-demotest.c b/meta-rtmod1/recipes-training/rt-demoapps/files/rt-demotest.c new file mode 100644 index 0000000000..57bfe4de05 --- /dev/null +++ b/meta-rtmod1/recipes-training/rt-demoapps/files/rt-demotest.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2021 by Linaro */ +/* Permission to use, copy, modify, and/or distribute this software for any */ +/* purpose with or without fee is hereby granted. */ +/* THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES */ +/* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF */ +/* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR */ +/* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ +/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN */ +/* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF */ +/* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <pthread.h> +#include <sched.h> +#include <signal.h> +#include <errno.h> +#include <unistd.h> +#include <sys/time.h> + +int main (void) +{ + printf("TODO: Write an apllication to RT wakeup test!\n"); + return 0; +} diff --git a/meta-rtmod1/recipes-training/rt-demoapps/files/rt-thread.c b/meta-rtmod1/recipes-training/rt-demoapps/files/rt-thread.c new file mode 100644 index 0000000000..5f26d05ffc --- /dev/null +++ b/meta-rtmod1/recipes-training/rt-demoapps/files/rt-thread.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2021 by Linaro */ +/* Permission to use, copy, modify, and/or distribute this software for any */ +/* purpose with or without fee is hereby granted. */ +/* THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES */ +/* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF */ +/* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR */ +/* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ +/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN */ +/* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF */ +/* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <pthread.h> +#include <errno.h> +#include <unistd.h> + +int main(void) +{ + printf("TODO: Write an apllication to launch RT threads!\n"); + return 0; +} diff --git a/meta-rtmod1/recipes-training/rt-demoapps/files/rtapps-systemd.service b/meta-rtmod1/recipes-training/rt-demoapps/files/rtapps-systemd.service new file mode 100644 index 0000000000..45e2e1d439 --- /dev/null +++ b/meta-rtmod1/recipes-training/rt-demoapps/files/rtapps-systemd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Start RT demo apps via non-root user +DefaultDependencies=no + +[Service] +ExecStart=/usr/bin/rt-thread +RemainAfterExit=yes +User=nobody + +[Install] +WantedBy=sysinit.target diff --git a/meta-rtmod1/recipes-training/rt-demoapps/rt-demoapps_1.0.bb b/meta-rtmod1/recipes-training/rt-demoapps/rt-demoapps_1.0.bb new file mode 100644 index 0000000000..3f06c7a299 --- /dev/null +++ b/meta-rtmod1/recipes-training/rt-demoapps/rt-demoapps_1.0.bb @@ -0,0 +1,44 @@ +DESCRIPTION = "RT demo applications" +SECTION = "examples" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://rt-thread.c;startline=1;endline=10;md5=5841cfc60f86a77434a8e5bf643b6b54" + +SRC_URI = "file://rt-thread.c \ + file://rt-demotest.c \ + file://rt-demotest-mlockall.c \ + file://rtapps-systemd.service \ + " + +S = "${WORKDIR}" + +inherit pkgconfig systemd + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" + +PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" + +do_compile() { + ${CC} rt-thread.c ${CFLAGS} -o rt-thread ${LDFLAGS} -lpthread + ${CC} rt-demotest.c ${CFLAGS} -o rt-demotest ${LDFLAGS} -lpthread + ${CC} rt-demotest-mlockall.c ${CFLAGS} -o rt-demotest-mlockall ${LDFLAGS} -lpthread +} + +do_install() { + install -d ${D}${bindir} + install -m 0755 rt-thread ${D}${bindir} + install -m 0755 rt-demotest ${D}${bindir} + install -m 0755 rt-demotest-mlockall ${D}${bindir} + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 644 ${WORKDIR}/rtapps-systemd.service ${D}/${systemd_unitdir}/system + fi +} + +SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" +SYSTEMD_SERVICE_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'rtapps-systemd.service', '', d)}" + +FILES_{PN} += "${bindir}/rt-thread \ + ${bindir}/rt-demotest \ + ${bindir}/rt-demotest-mlockall \ + " |