From 374897e697352618bf58012dd7c925fa4cf716c0 Mon Sep 17 00:00:00 2001 From: mahi Date: Wed, 10 Feb 2010 18:18:34 +0100 Subject: [PATCH] Kernel now built with it's config. examples/simple verified in PPC simulator. --- arch/ppc/mpc55xx/scripts/linkscript_gcc.ldf | 2 +- boards/board_common.mk | 4 ++-- examples/simple/config/Os_Cfg.c | 6 +++--- examples/tiny/build_config.mk | 4 +++- include/Os.h | 2 -- include/os_config_macros.h | 5 +++-- makefile | 6 +++--- scripts/rules.mk | 2 +- system/kernel/include/pcb.h | 8 ++++---- system/kernel/makefile | 4 ++-- system/kernel/testsystem/config/Os_Cfg.c | 2 +- 11 files changed, 23 insertions(+), 22 deletions(-) diff --git a/arch/ppc/mpc55xx/scripts/linkscript_gcc.ldf b/arch/ppc/mpc55xx/scripts/linkscript_gcc.ldf index e6f8431f..0e37084c 100644 --- a/arch/ppc/mpc55xx/scripts/linkscript_gcc.ldf +++ b/arch/ppc/mpc55xx/scripts/linkscript_gcc.ldf @@ -86,7 +86,7 @@ SECTIONS .t32_outport ALIGN(0x10): { *(.t32_outport); } > ram .got : AT(ALIGN(LOADADDR(.sdata)+SIZEOF(.sdata),4)) { *(.got.plt) *(.got) } > ram .bss : { *(.bss .bss.* COMMON .gnu.linkonce.b.*);__BSS_END = .; } > ram - .init_stack ALIGN(16) (NOLOAD) : { __SP_END = .;. = . + 3000; __SP_INIT = .; } > ram + .init_stack ALIGN(16) (NOLOAD) : { __SP_END = .;. = . + 200; __SP_INIT = .; } > ram /* Fls RAM section */ .fls_ram ALIGN(16) (NOLOAD) : { __FLS_ERASE_RAM__ = .; diff --git a/boards/board_common.mk b/boards/board_common.mk index 8905c59e..d37f717a 100644 --- a/boards/board_common.mk +++ b/boards/board_common.mk @@ -57,6 +57,8 @@ obj-$(USE_PORT) += Port_Cfg.o obj-$(USE_ADC) += Adc.o obj-$(USE_ADC) += Adc_Cfg.o +# Include the kernel +include $(ROOTDIR)/system/kernel/makefile # Spi obj-$(USE_SPI) += Spi.o @@ -171,8 +173,6 @@ VPATH += $(ROOTDIR)/common obj-y += newlib_port.o obj-y += $(obj-y-y) -#def-y += CC_KERNEL - vpath-y += $(ROOTDIR)/$(ARCH_PATH-y)/kernel vpath-y += $(ROOTDIR)/$(ARCH_PATH-y)/drivers vpath-y += $(ROOTDIR)/boards/$(BOARDDIR) diff --git a/examples/simple/config/Os_Cfg.c b/examples/simple/config/Os_Cfg.c index e693d0f7..04ed730a 100644 --- a/examples/simple/config/Os_Cfg.c +++ b/examples/simple/config/Os_Cfg.c @@ -14,10 +14,10 @@ * -------------------------------- Arctic Core ------------------------------*/ #include -#include +#include +#include "Platform_Types.h" +#include "Os.h" // includes Os_Cfg.h #include "os_config_macros.h" -#include "Platform_Types.h" -#include "Os.h" // includes Os_Cfg.h #include "kernel.h" #include "kernel_offset.h" #include "alist_i.h" diff --git a/examples/tiny/build_config.mk b/examples/tiny/build_config.mk index 7a369106..6b2e24ce 100644 --- a/examples/tiny/build_config.mk +++ b/examples/tiny/build_config.mk @@ -1,5 +1,7 @@ -MOD_USE+=KERNEL MCU SIMPLE_PRINTF +#MOD_USE+=KERNEL MCU SIMPLE_PRINTF +MOD_USE+=KERNEL MCU +def-y += HEAPSIZE=400 #RAMLOG diff --git a/include/Os.h b/include/Os.h index e0d42690..667dbe63 100644 --- a/include/Os.h +++ b/include/Os.h @@ -24,9 +24,7 @@ #include #include "Std_Types.h" -#if !defined(CC_KERNEL) #include "Os_Cfg.h" -#endif #include "MemMap.h" #include "Cpu.h" diff --git a/include/os_config_macros.h b/include/os_config_macros.h index 097cd37a..a821232f 100644 --- a/include/os_config_macros.h +++ b/include/os_config_macros.h @@ -27,7 +27,7 @@ // +1 here.. easy to have a reference.. #define GEN_TRUSTEDFUNCTIONS_LIST trusted_func_t os_cfg_trusted_list[SERVICE_CNT]; -#define GEN_APPLICATION_HEAD OsRomApplicationType rom_app_list[] = +#define GEN_APPLICATION_HEAD const OsRomApplicationType rom_app_list[] = #define GEN_APPLICATON( _id,_name,_trusted,_startuphook,_shutdownhook, \ _errorhook,_isr_mask,_scheduletable_mask, _alarm_mask, \ @@ -320,7 +320,8 @@ } \ } -#if ( OS_SC3 == STD_ON) || ( OS_SC4 == STD_ON) +#if ( OS_SC3 == STD_ON) || ( OS_SC4 == STD_ON) +#error BEPA #define GEN_HOOKS( _startup, _protection, _shutdown, _error, _pretask, _posttask ) \ struct OsHooks os_conf_global_hooks = { \ .StartupHook = _startup, \ diff --git a/makefile b/makefile index 76a53783..25094619 100644 --- a/makefile +++ b/makefile @@ -48,7 +48,7 @@ endif USE_T32_SIM?=n export USE_T32_SIM -override BDIR := system/kernel ${BDIR} +# override BDIR := system/kernel ${BDIR} # Tools # Ugly thing to make things work under cmd.exe @@ -63,10 +63,10 @@ export objdir = obj_$(BOARDDIR) .PHONY: help help: @echo "Make kernel and a simple example" - @echo " > make BOARDDIR=mpc551xsim CROSS_COMPILE=/opt/powerpc-eabi/bin/powerpc-eabi- BDIR=system/kernel,examples/simple all" + @echo " > make BOARDDIR=mpc551xsim CROSS_COMPILE=/opt/powerpc-eabi/bin/powerpc-eabi- BDIR=examples/simple all" @echo "" @echo "Save the config (CROSS_COMPILE and BDIR)" - @echo " > make BOARDDIR=mpc551xsim CROSS_COMPILE=/opt/powerpc-eabi/bin/powerpc-eabi- BDIR=system/kernel,examples/simple save" + @echo " > make BOARDDIR=mpc551xsim CROSS_COMPILE=/opt/powerpc-eabi/bin/powerpc-eabi- BDIR=examples/simple save" @echo "" @echo "Clean" @echo " > make clean" diff --git a/scripts/rules.mk b/scripts/rules.mk index 51624920..01643be3 100644 --- a/scripts/rules.mk +++ b/scripts/rules.mk @@ -127,7 +127,7 @@ $(build-hex-y): $(build-exe-y) $(Q)$(CROSS_COMPILE)objcopy -O ihex $< $@ # Could use readelf -S instead of parsing the *.map file. -$(build-exe-y): $(obj-y) $(sim-y) $(libitem-y) $(ldcmdfile-y) +$(build-exe-y): $(dep-y) $(obj-y) $(sim-y) $(libitem-y) $(ldcmdfile-y) @echo " >> LD $@" $(Q)$(LD) $(LDFLAGS) -T $(ldcmdfile-y) -o $@ $(libpath-y) --start-group $(obj-y) $(lib-y) $(libitem-y) --end-group $(LDMAPFILE) @echo "Image size: (decimal)" diff --git a/system/kernel/include/pcb.h b/system/kernel/include/pcb.h index 2b1eba75..493a26ef 100644 --- a/system/kernel/include/pcb.h +++ b/system/kernel/include/pcb.h @@ -78,7 +78,7 @@ typedef sint8 OsPriorityType; * */ typedef struct OsHooks { -#if ( OS_SC2 == STD_ON ) || ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON ) +#if ( OS_SC2 == STD_ON ) || ( OS_SC3 == STD_ON ) || ( OS_SC4 == STD_ON ) ProtectionHookType ProtectionHook; #endif StartupHookType StartupHook; @@ -178,13 +178,13 @@ typedef struct OsPcb { /*-----------------------------------------------------------------*/ typedef struct OsRomPcb { - TaskType pid; - uint8 prio; + OsTaskidType pid; + OsPriorityType prio; uint32 app_mask; void (*entry)(); proc_type_t proc_type; uint8 autostart; - OsStackType stack; + OsStackType stack; int vector; // ISR ApplicationType application_id; char name[16]; diff --git a/system/kernel/makefile b/system/kernel/makefile index 3427d37d..5a4f73e0 100644 --- a/system/kernel/makefile +++ b/system/kernel/makefile @@ -32,7 +32,6 @@ obj-y += os_arctest.o obj-y += irq.o # We are compiling the kernel -def-y+=CC_KERNEL dep-y += asm_offset.h dep-y += kernel_offset.h dep-$(CFG_ARM_CM3) += arch_offset.h @@ -53,7 +52,8 @@ asm_offset.h: asm_offset.c @$(SED) -n "/#define/p" $(<:.c=.s) > $@ @rm $(<:.c=.s) -VPATH += .. +#VPATH += .. +VPATH += $(ROOTDIR)/system/kernel VPATH += $(ROOTDIR)/arch/$(ARCH_FAM)/$(ARCH)/kernel VPATH += $(ROOTDIR)/arch/$(ARCH_FAM)/$(ARCH)/drivers diff --git a/system/kernel/testsystem/config/Os_Cfg.c b/system/kernel/testsystem/config/Os_Cfg.c index 5a29e0a4..67fb297a 100644 --- a/system/kernel/testsystem/config/Os_Cfg.c +++ b/system/kernel/testsystem/config/Os_Cfg.c @@ -383,7 +383,7 @@ GEN_SCHEDULETABLE_HEAD { struct OsHooks os_conf_global_hooks = { .StartupHook = StartupHook, -#if ( OS_SC2 == STD_ON ) || ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON ) +#if ( OS_SC2 == STD_ON ) || ( OS_SC3 == STD_ON ) || ( OS_SC4 == STD_ON ) .ProtectionHook = ProtectionHook, #endif .ShutdownHook = ShutdownHook, -- 2.39.2