From 3f14b667d3afc8b82ce3ae035240c9d90d12c0b8 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Sat, 24 Jan 2009 21:21:54 -0800 Subject: [PATCH] [app] convert the existing apps to the app modules, add new shell app to contain the console --- app/shell/rules.mk | 7 +++++++ app/shell/shell.c | 37 ++++++++++++++++++++++++++++++++++ app/stringtests/string_tests.c | 6 ++++++ app/tests/include/app/tests.h | 2 -- app/tests/tests.c | 9 ++++++++- 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 app/shell/rules.mk create mode 100644 app/shell/shell.c diff --git a/app/shell/rules.mk b/app/shell/rules.mk new file mode 100644 index 00000000..5b7c919e --- /dev/null +++ b/app/shell/rules.mk @@ -0,0 +1,7 @@ +LOCAL_DIR := $(GET_LOCAL_DIR) + +MODULES += \ + lib/console + +OBJS += \ + $(LOCAL_DIR)/shell.o diff --git a/app/shell/shell.c b/app/shell/shell.c new file mode 100644 index 00000000..e646683a --- /dev/null +++ b/app/shell/shell.c @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Travis Geiselbrecht + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include +#include +#include + +static void shell_init(const struct _app_descriptor *app, void *args) +{ + console_init(); + console_start(); +} + +APP_START(shell) + .entry = shell_init, + .flags = APP_FLAG_BOOT_START | APP_FLAG_THREAD, +APP_END + diff --git a/app/stringtests/string_tests.c b/app/stringtests/string_tests.c index fcb1e1b9..69bdbbee 100644 --- a/app/stringtests/string_tests.c +++ b/app/stringtests/string_tests.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -243,3 +244,8 @@ STATIC_COMMAND_END(stringtests); #endif +APP_START(stringtests) + .entry = 0, + .flags = 0, +APP_END + diff --git a/app/tests/include/app/tests.h b/app/tests/include/app/tests.h index 7e9a7da7..9144809c 100644 --- a/app/tests/include/app/tests.h +++ b/app/tests/include/app/tests.h @@ -23,8 +23,6 @@ #ifndef __APP_TESTS_H #define __APP_TESTS_H -void tests_init(void); - int thread_tests(void); void printf_tests(void); diff --git a/app/tests/tests.c b/app/tests/tests.c index 0fc2bcbb..9e049183 100644 --- a/app/tests/tests.c +++ b/app/tests/tests.c @@ -20,6 +20,8 @@ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include +#include #include #include @@ -33,7 +35,12 @@ STATIC_COMMAND_END(tests); #endif -void tests_init(void) +static void tests_init(const struct _app_descriptor *app, void *args) { } +APP_START(tests) + .entry = tests_init, + .flags = APP_FLAG_BOOT_START, +APP_END +