From 43d07d71b587135b780e86d82b492a8455c02f8a Mon Sep 17 00:00:00 2001 From: tkl Date: Mon, 8 Aug 2016 11:19:08 +0200 Subject: [PATCH] pwm test app --- .cproject | 23 +++++++++++++++++++++- Makefile | 2 +- config/make/stm32f4xx.mk | 5 ++--- source/firmware/kernel/shell.c | 8 ++++---- source/test/pwm/main.c | 35 ++++++++++++++++++++++++++++++++++ source/test/pwm/pwm.mk | 4 ++++ source/test/test.mk | 5 ++++- 7 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 source/test/pwm/main.c create mode 100644 source/test/pwm/pwm.mk diff --git a/.cproject b/.cproject index 4507fd4..e426cac 100755 --- a/.cproject +++ b/.cproject @@ -136,6 +136,7 @@ make + all true true @@ -143,6 +144,7 @@ make + clean true true @@ -150,7 +152,6 @@ make - distclean true false @@ -206,6 +207,7 @@ make + all true true @@ -237,6 +239,7 @@ make + distclean true false @@ -282,6 +285,22 @@ false true + + make + TEST_APP=pwm BOARD=stm32f4-discovery DEBUG=y + test + true + false + true + + + make + TEST_APP=pwm BOARD=stm32f4-discovery DEBUG=y + install + true + false + true + make APP=example_radio_rx BOARD=msp430-ccrf DEBUG=y @@ -308,6 +327,7 @@ make + all true true @@ -315,6 +335,7 @@ make + clean true true diff --git a/Makefile b/Makefile index 1fccb67..1f44a67 100755 --- a/Makefile +++ b/Makefile @@ -83,7 +83,7 @@ doc: @$(MKDIR) $(DOC_DIR) (cat $(DOXYFILE) ; echo "INPUT=$(DOC_SRC)" ; echo "OUTPUT_DIRECTORY=$(DOC_DIR)") | doxygen - -test: check $(OBJECTS) $(ASM_OBJECTS) +test: $(OBJECTS) $(ASM_OBJECTS) @$(MKDIR) $(EXE_DIR) @$(MKDIR) $(MAP_DIR) @$(MKDIR) $(SIZE_DIR) diff --git a/config/make/stm32f4xx.mk b/config/make/stm32f4xx.mk index 4a9e9f3..252ca65 100644 --- a/config/make/stm32f4xx.mk +++ b/config/make/stm32f4xx.mk @@ -9,8 +9,8 @@ endif CROSS_COMPILE=arm-none-eabi- INCLUDES += \ - /usr/lib/arm-none-eabi/include \ - /usr/lib/gcc/arm-none-eabi/4.8/include + /opt/arm-2011.09/arm-none-eabi/include \ + /opt/arm-2011.09/lib/gcc/arm-none-eabi/4.6.1/include ifeq ($(DEBUG),y) OPTIM = 0 @@ -35,7 +35,6 @@ CFLAGS += \ -mfloat-abi=softfp \ -fdata-sections \ -ffunction-sections -# -D inline= -mthumb\ CPPCHECK_FLAGS += \ -D USE_STDPERIPH_DRIVER\ diff --git a/source/firmware/kernel/shell.c b/source/firmware/kernel/shell.c index 0cfdba2..3a832da 100644 --- a/source/firmware/kernel/shell.c +++ b/source/firmware/kernel/shell.c @@ -23,9 +23,9 @@ struct shell_object { struct shell_object shell_object; -#define RX_STACK_SIZE 256 -stack_t rx_stack[RX_STACK_SIZE]; -struct thread_context rx_thread; +#define TH_STACK_SIZE 256 +stack_t th_stack[TH_STACK_SIZE]; +struct thread_context th_ctx; static void parse(const char *buffer, unsigned int len) { @@ -71,7 +71,7 @@ int shell_init(const struct driver *shell_device) return -1; list_init(&shell_object.command_list); shell_object.shell_device = shell_device; - thread_create(&rx_thread, rx_stack, RX_STACK_SIZE, rx_func, NULL, THREAD_PRIO_LOW); + thread_create(&th_ctx, th_stack, TH_STACK_SIZE, rx_func, NULL, THREAD_PRIO_LOW); return 0; } diff --git a/source/test/pwm/main.c b/source/test/pwm/main.c new file mode 100644 index 0000000..343676f --- /dev/null +++ b/source/test/pwm/main.c @@ -0,0 +1,35 @@ +/* + * main.c + * + * Created on: Aug 2, 2016 + * Author: tkl + */ + +#include + +#include "driver.h" +#include "board.h" +#include "stack.h" +#include "queue.h" +#include "kernel.h" +#include "driver.h" +#include "list.h" +#include "shell.h" + +#define TH_STACK_SIZE 256 +stack_t th_stack[TH_STACK_SIZE]; +struct thread_context th_ctx; +static void th_func(void *arg) +{ + while(1) { + } +} + +int main(void) +{ + thread_create(&th_ctx, th_stack, TH_STACK_SIZE, th_func, NULL, THREAD_PRIO_LOW); + + schedule_start(); + + return 0; +} diff --git a/source/test/pwm/pwm.mk b/source/test/pwm/pwm.mk new file mode 100644 index 0000000..0ce5cc1 --- /dev/null +++ b/source/test/pwm/pwm.mk @@ -0,0 +1,4 @@ +CHECK_FOLDER += source/test/pwm +SUB_FOLDER += source/test/pwm +INCLUDES += source/test/pwm +DOC_SRC += source/test/pwm diff --git a/source/test/test.mk b/source/test/test.mk index 910224c..e16b6ff 100644 --- a/source/test/test.mk +++ b/source/test/test.mk @@ -1,3 +1,6 @@ ifeq ($(TEST_APP), shell) include source/test/shell/shell.mk -endif \ No newline at end of file +endif +ifeq ($(TEST_APP), pwm) +include source/test/pwm/pwm.mk +endif