From 378957f3d75a6bfe1f449e43659c9e2871757491 Mon Sep 17 00:00:00 2001 From: arighi Date: Wed, 31 Mar 2010 14:41:58 +0000 Subject: [PATCH] lm3s1968: enable the kernel in the example. This enables kernel, signals, dynamic memory allocator and process priorities in the lm3s1968 example and execute the proc_test testcase. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3360 38d2e660-2303-0410-9eaa-f027e97ec537 --- examples/lm3s1968/cfg/cfg_monitor.h | 2 +- examples/lm3s1968/cfg/cfg_proc.h | 8 ++++---- examples/lm3s1968/cfg/cfg_signal.h | 2 +- examples/lm3s1968/lm3s1968.c | 26 ++++++++++++++++++++------ examples/lm3s1968/lm3s1968.mk | 16 ++++++++++++++-- 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/examples/lm3s1968/cfg/cfg_monitor.h b/examples/lm3s1968/cfg/cfg_monitor.h index 78f222bf..d0e24da4 100644 --- a/examples/lm3s1968/cfg/cfg_monitor.h +++ b/examples/lm3s1968/cfg/cfg_monitor.h @@ -42,6 +42,6 @@ * Process monitor. * $WIZ$ type = "autoenabled" */ -#define CONFIG_KERN_MONITOR 0 +#define CONFIG_KERN_MONITOR 1 #endif /* CFG_MONITOR_H */ diff --git a/examples/lm3s1968/cfg/cfg_proc.h b/examples/lm3s1968/cfg/cfg_proc.h index 3c9439fb..0f47739d 100644 --- a/examples/lm3s1968/cfg/cfg_proc.h +++ b/examples/lm3s1968/cfg/cfg_proc.h @@ -43,7 +43,7 @@ * * $WIZ$ type = "autoenabled" */ -#define CONFIG_KERN 0 +#define CONFIG_KERN 1 /** * Kernel interrupt supervisor. WARNING: Experimental, still incomplete! @@ -72,21 +72,21 @@ * Priority-based scheduling policy. * $WIZ$ type = "boolean" */ -#define CONFIG_KERN_PRI 0 +#define CONFIG_KERN_PRI 1 /** * Dynamic memory allocation for processes. * $WIZ$ type = "boolean" * $WIZ$ conditional_deps = "heap" */ -#define CONFIG_KERN_HEAP 0 +#define CONFIG_KERN_HEAP 1 /** * Size of the dynamic memory pool used by processes. * $WIZ$ type = "int" * $WIZ$ min = 0 */ -#define CONFIG_KERN_HEAP_SIZE 2048L +#define CONFIG_KERN_HEAP_SIZE 8192L /** * Module logging level. diff --git a/examples/lm3s1968/cfg/cfg_signal.h b/examples/lm3s1968/cfg/cfg_signal.h index e48d86a6..ce5324ec 100644 --- a/examples/lm3s1968/cfg/cfg_signal.h +++ b/examples/lm3s1968/cfg/cfg_signal.h @@ -42,6 +42,6 @@ * Inter-process signals. * $WIZ$ type = "autoenabled" */ -#define CONFIG_KERN_SIGNALS 0 +#define CONFIG_KERN_SIGNALS 1 #endif /* CFG_SIGNAL_H */ diff --git a/examples/lm3s1968/lm3s1968.c b/examples/lm3s1968/lm3s1968.c index 9dfaf006..edf72110 100644 --- a/examples/lm3s1968/lm3s1968.c +++ b/examples/lm3s1968/lm3s1968.c @@ -63,20 +63,34 @@ static void led_off(void) GPIO_PORTG_DATA_R &= ~0x04; } +static NORETURN void spinner_thread(void) +{ + char spinner[] = {'/', '-', '\\', '|'}; + int i; + + kputs("\n"); + for(i = 0; ; i++) + { + kprintf("BeRTOS is up & running: %c\r", + spinner[i % countof(spinner)]); + timer_delay(100); + } +} + int main(void) { IRQ_ENABLE; - kdbg_init(); - timer_init(); led_init(); + proc_testSetup(); + proc_testRun(); + + proc_new(spinner_thread, NULL, KERN_MINSTACKSIZE, NULL); while(1) { - kputs("STATUS LED: on \r"); led_on(); - timer_delay(1000); - kputs("STATUS LED: off\r"); + timer_delay(250); led_off(); - timer_delay(1000); + timer_delay(250); } } diff --git a/examples/lm3s1968/lm3s1968.mk b/examples/lm3s1968/lm3s1968.mk index b96e7bc9..453fddaf 100644 --- a/examples/lm3s1968/lm3s1968.mk +++ b/examples/lm3s1968/lm3s1968.mk @@ -20,18 +20,30 @@ lm3s1968_CSRC = \ bertos/mware/formatwr.c \ bertos/mware/hex.c \ bertos/mware/sprintf.c \ + bertos/mware/event.c \ + bertos/struct/heap.c \ bertos/drv/timer.c \ + bertos/kern/monitor.c \ + bertos/kern/proc_test.c \ + bertos/kern/proc.c \ + bertos/kern/coop.c \ + bertos/kern/preempt.c \ + bertos/kern/signal.c \ bertos/cpu/cortex-m3/drv/irq_lm3s.c \ bertos/cpu/cortex-m3/drv/timer_lm3s.c \ bertos/cpu/cortex-m3/drv/clock_lm3s.c \ bertos/cpu/cortex-m3/drv/kdebug_lm3s.c \ bertos/cpu/cortex-m3/hw/startup_lm3s.c +lm3s1968_CPPASRC = \ + bertos/cpu/cortex-m3/hw/switch_ctx_cm3.S \ + # + # This is an hosted application lm3s1968_PREFIX = arm-none-eabi- -lm3s1968_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug -mthumb -fno-strict-aliasing -fwrapv -lm3s1968_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_LM3S1968__ -D'CPU_FREQ=(50000000L)' -D'WIZ_AUTOGEN' -g3 -gdwarf-2 -fverbose-asm -mthumb -Iexamples/lm3s1968 -Ibertos/cpu/cortex-m3 -fno-strict-aliasing -fwrapv +lm3s1968_CPPAFLAGS = -g -gdwarf-2 -mthumb -fno-strict-aliasing -fwrapv +lm3s1968_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_LM3S1968__ -D'CPU_FREQ=(50000000L)' -D'WIZ_AUTOGEN' -g3 -gdwarf-2 -fverbose-asm -mthumb -Iexamples/lm3s1968 -Ibertos/cpu/cortex-m3 -fno-strict-aliasing -fwrapv lm3s1968_LDFLAGS = -nostartfiles -T bertos/cpu/cortex-m3/scripts/lm3s1968_rom.ld -Wl,--no-warn-mismatch -fno-strict-aliasing -fwrapv lm3s1968_CPU = cortex-m3 -- 2.25.1