]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Initial ARM port
authormahi <devnull@localhost>
Wed, 16 Sep 2009 20:12:34 +0000 (22:12 +0200)
committermahi <devnull@localhost>
Wed, 16 Sep 2009 20:12:34 +0000 (22:12 +0200)
- The ARM port is now building (Not on the buildbot though. Have to build the multilib ARM GCC first)
  It's just switches down to IDLE for for. Interrupts are coming in a couple of days.
- A new tiny example added to handle systems with small RAM/ROM footprint.
  It make very little use of the clib.
- Lauterbach T32 scripts now updated so that they can be used anyone?
  The wiki is also updated.
- Size configuration possible for RAMLOG and HEAP.
- Support for SIMPLE_PRINTF is now optional.

41 files changed:
arch/arm/arm_cm3/drivers/stm32f10x.h
arch/arm/arm_cm3/kernel/arch.c
arch/arm/arm_cm3/kernel/arch_krn.S
arch/arm/arm_cm3/kernel/irq.h
arch/arm/arm_cm3/kernel/stack.h
arch/arm/arm_cm3/kernel/system_stm32f10x.c
arch/arm/arm_cm3/scripts/linkscript_gcc.ldf
arch/ppc/mpc55xx/kernel/arch.c
boards/board_common.mk
boards/et_stm32_stamp/build_config.mk
boards/mpc5516it/build_config.mk
boards/mpc551xsim/build_config.mk
boards/mpc5554sim/build_config.mk
boards/mpc5567qrtech/build_config.mk
boards/mpc5567qrtech/config.h [deleted file]
common/newlib_port.c
common/printf.c
common/ramlog.c
examples/simple/build_config.mk
examples/simple/config/Os_Cfg.c
examples/simple/simple_main.c
examples/tiny/build_config.mk [new file with mode: 0644]
examples/tiny/config/Os_Cfg.c [new file with mode: 0644]
examples/tiny/config/Os_Cfg.h [new file with mode: 0644]
examples/tiny/makefile [new file with mode: 0644]
examples/tiny/tiny.c [new file with mode: 0644]
include/Ramlog.h
include/Trace.h
include/simple_printf.h [new file with mode: 0644]
scripts/build_arm.sh
scripts/cc_gcc.mk
scripts/rules.mk
system/kernel/include/arch.h
system/kernel/include/internal.h
system/kernel/include/task_i.h
system/kernel/makefile
system/kernel/swap.c
tools/t32/lay.cmm
tools/t32/load.cmm
tools/t32/start.cmm
tools/t32/term.cmm

index e730f92606b8af8bd6c9c08f0d716ec2f9b65a83..0d2ee46caf98ca82f651a2d73a5221c651f73ec9 100644 (file)
@@ -68,9 +68,9 @@
 \r
 #if !defined (STM32F10X_LD) && !defined (STM32F10X_MD) && !defined (STM32F10X_HD) && !defined (STM32F10X_CL)\r
   /* #define STM32F10X_LD */   /*!< STM32F10X_LD: STM32 Low density devices */\r
-  /* #define STM32F10X_MD */   /*!< STM32F10X_MD: STM32 Medium density devices */\r
+  #define STM32F10X_MD   /*!< STM32F10X_MD: STM32 Medium density devices */\r
   /* #define STM32F10X_HD */   /*!< STM32F10X_HD: STM32 High density devices */\r
-  #define STM32F10X_CL   /*!< STM32F10X_CL: STM32 Connectivity line devices */\r
+  /* #define STM32F10X_CL */   /*!< STM32F10X_CL: STM32 Connectivity line devices */\r
 #endif\r
 /*  Tip: To avoid modifying this file each time you need to switch between these\r
         devices, you can define the device in your toolchain compiler preprocessor.\r
index 7942dd5c273ce2e50943588881669097bb51b21d..c7d465c3986a758e3ff5652067eab122df1e2c08 100644 (file)
@@ -38,7 +38,7 @@
 \r
 void os_arch_first_call( void )\r
 {\r
-       // TODO: make swicth here... for now just call func.\r
+       // TODO: make switch here... for now just call func.\r
        os_sys.curr_pcb->entry();\r
 }\r
 \r
@@ -59,9 +59,9 @@ void os_arch_setup_context( pcb_t *pcb ) {
 \r
        /* Set LR to start function */\r
        if( pcb->proc_type == PROC_EXTENDED ) {\r
-               context[C_LR_OFF/4] = (uint32_t)os_proc_start_extended;\r
+               context[VGPR_LR_OFF/4] = (uint32_t)os_proc_start_extended;\r
        } else if( pcb->proc_type == PROC_BASIC ) {\r
-               context[C_LR_OFF/4] = (uint32_t)os_proc_start_basic;\r
+               context[VGPR_LR_OFF/4] = (uint32_t)os_proc_start_basic;\r
        }\r
 // os_arch_setup_context_asm(pcb->stack.curr,NULL);\r
 }\r
index 450ecb6eb5238186ecb406100f778e509998a9dc..61972757ccc9e53d641b2299741ae15b836d3e17 100644 (file)
@@ -12,8 +12,6 @@
        .fpu softvfp\r
        .thumb\r
 \r
-       .global os_arch_swap_context_to\r
-       .global os_arch_swap_context\r
        .section .text\r
 /* r0 - pcb for old task\r
  * r1 pcb for new task\r
  * ----------    <- JABBA\r
  *\r
  */\r
+       .global os_arch_swap_context\r
+       .type   os_arch_swap_context_to, %function\r
 os_arch_swap_context:\r
     mov     r0, sp\r
-    push    {r0,r4-r8,r10,r11,lr}\r
-\r
+    push    {r4-r8,r10,r11,lr}\r
 \r
     // Store c-frame\r
     sub.w   sp,sp,#C_SIZE\r
+\r
     mov.w   r4,#SC_PATTERN\r
+    str     r4,[sp,#C_CONTEXT_OFFS]\r
+    str     r0,[sp,#C_SP_OFF]\r
+       // ---> We have saved NVGPR+C\r
 \r
-    str     r4,[sp,#4]\r
     // store old stack for old task\r
     str     sp,[r0,#PCB_STACK_CURR_P]\r
+\r
+// R1 - new PCB\r
+       .global os_arch_swap_context_to\r
+       .type   os_arch_swap_context_to, %function\r
 os_arch_swap_context_to:\r
+\r
     // Get stack for new task\r
-    ldr     sp,[r1,#PCB_STACK_CURR_P]\r
+    ldr        r2,[r1,#PCB_STACK_CURR_P]\r
+    msr                msp,r2\r
 \r
 // TODO: Fix this for all arch's..call pre,post hooks. Done here or after?\r
 // Set new current pcb\r
@@ -48,7 +56,7 @@ os_arch_swap_context_to:
     str     r1,[r5,#SYS_CURR_PCB_P]\r
 \r
 // Restore C context\r
-    ldr     r6,[sp,#4]\r
+    ldr     r6,[sp,#C_CONTEXT_OFFS]\r
     cmp     r6,#SC_PATTERN\r
     beq     os_sc_restore\r
     cmp     r6,#LC_PATTERN\r
@@ -59,13 +67,14 @@ os_stack_problem:
 \r
 os_sc_restore:\r
     add.w   sp,sp,#C_SIZE\r
+\r
     pop     {r4-r8,r10,r11,lr}\r
         // ehh, we are in handler mode so a bx instruction works here\r
     bx      lr\r
 \r
 os_lc_restore:\r
     add.w   sp,sp,#C_SIZE\r
-    pop     {r4-r8,r10,r11,lr}\r
+    pop     {lr,r11,r10,r8,r7,r6,r5,r4}\r
     // ehh, we are in handler mode so a bx instruction works here\r
     bx      lr\r
 \r
index 69ac9472eaca09fe44c4024dc73d7d9a131e836f..387d653e75894d6705d62e3937967fa0c49390a7 100644 (file)
@@ -34,7 +34,7 @@
 \r
 typedef IRQn_Type IrqType;\r
 \r
-#define NUMBER_OF_INTERRUPTS_AND_EXCEPTIONS (OTG_FS_IRQn+15)\r
+#define NUMBER_OF_INTERRUPTS_AND_EXCEPTIONS (USBWakeUp_IRQn+15)\r
 \r
 typedef enum {\r
        CPU_0=0,\r
index b294b9d279a3fd508eeb2e3c1fa30af3dc39afcd..a2169ae352ef3878c5f89f22353ed5140ed5ae4d 100644 (file)
@@ -99,7 +99,8 @@
 /* Large context (interrupt) */\r
 #define SAVE_ALL_GPR(_x,_y)\r
 #define RESTORE_ALL_GPR(_x,_y)\r
-\r
+
+#if 0\r
 #define C_SIZE                 16\r
 #define C_SP_OFF               0\r
 #define C_CONTEXT_OFF  4\r
 #define C_CR_OFF               12\r
 \r
 #define C_CONTEXT_OFFS 10\r
+#endif
+
+// NVREGS: r4+r5+r6+r7+r8+r10+r11+lr = 8*4
+#define NVGPR_SIZE             32
+// VGPR: 9*4 = 36
+#define VGPR_SIZE              36
+// SP + context
+#define C_SIZE                 8
+
+//...
+#define VGPR_LR_OFF            (C_SIZE+28)
+#define C_CONTEXT_OFFS  4
+#define C_SP_OFF               0
+
 \r
-#define SC_SIZE                        32\r
+#define SC_SIZE                        (NVGPR_SIZE+C_SIZE)
 \r
 #if !defined(_ASSEMBLER_)\r
 \r
index 1023f6f273ffc1ef6bd740170d1e74b56c312188..42da786d9bf54fdbd0b2812bd531489afa701e03 100644 (file)
@@ -254,7 +254,8 @@ void SystemInit (void)
   * @retval None\r
   */\r
 static void SetSysClock(void)\r
-{\r
+{
+#if !defined(CFG_SIMULATOR)\r
 #ifdef SYSCLK_FREQ_HSE\r
   SetSysClockToHSE();\r
 #elif defined SYSCLK_FREQ_24MHz\r
@@ -267,6 +268,7 @@ static void SetSysClock(void)
   SetSysClockTo56();  \r
 #elif defined SYSCLK_FREQ_72MHz\r
   SetSysClockTo72();\r
+#endif
 #endif\r
  \r
  /* If none of the define above is enabled, the HSI is used as System clock\r
@@ -910,8 +912,9 @@ static void SetSysClockTo72(void)
 #endif /* STM32F10X_CL */\r
 \r
     /* Enable PLL */\r
-    RCC->CR |= RCC_CR_PLLON;\r
-\r
+    RCC->CR |= RCC_CR_PLLON;
+
+
     /* Wait till PLL is ready */\r
     while((RCC->CR & RCC_CR_PLLRDY) == 0)\r
     {\r
@@ -920,7 +923,7 @@ static void SetSysClockTo72(void)
     /* Select PLL as system clock source */\r
     RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));\r
     RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;    \r
-\r
+
     /* Wait till PLL is used as system clock source */\r
     while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x08)\r
     {\r
index 06878a1d255f83cdcd9818693fa1bc49007acbbc..ae60ea6dde9e791f56f4ca565ebac0226e666b77 100644 (file)
@@ -32,12 +32,16 @@ _Minimum_Stack_Size = 0x100 ;
 /*\r
 Linker subscript for STM32F10x definitions with 512K Flash and 1024K RAM */\r
 \r
+ENTRY(Reset_Handler)\r
+\r
 /* Memory Spaces Definitions */\r
 \r
 MEMORY\r
 {\r
-  RAM (xrw) : ORIGIN = 0x68000000, LENGTH = 64K\r
-  FLASH (rx) : ORIGIN = 0x0000000, LENGTH = 512K\r
+       /* ST32F103, 128K flash, 20K RAM */\r
+\r
+  RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K\r
+  FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K\r
   FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0\r
   EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0\r
   EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0\r
@@ -46,8 +50,7 @@ MEMORY
 }\r
 \r
 /* higher address of the user mode stack */\r
-_estack = 0x68100000;\r
-\r
+_estack = 0x20005000;\r
 \r
 \r
 /* include the sections management sub-script for FLASH mode */\r
index 06c957bc27fd76122c90ba76a2b032e0c6e09fbf..5256eb996b83e8fb9357e334da1316f889c6a4e2 100644 (file)
  * -------------------------------- Arctic Core ------------------------------*/
 
 
-
-
-
-
-
-
 \r
 #include "types.h"\r
 #include "Cpu.h"\r
@@ -135,11 +129,13 @@ void os_arch_setup_context( pcb_t *pcb ) {
        // Note! stack.curr already points to where to save the context\r
 \r
        // Check that the stack size is enough\r
-       #define STACK_SIZE_MIN  (SC_SIZE + 16*2 )\r
+       #define STACK_SIZE_MIN  (SC_SIZE + 16*2 )
+\r
        if( pcb->stack.size < (STACK_SIZE_MIN) ) {\r
                os_arch_stack_to_small(pcb, STACK_SIZE_MIN);\r
        }\r
-\r
+
+#if 0\r
        // Fill stack with a nice pattern STACK_PATTERN\r
        {\r
                uint8_t *p = pcb->stack.curr;\r
@@ -151,6 +147,7 @@ void os_arch_setup_context( pcb_t *pcb ) {
                        *p = STACK_PATTERN;\r
                }\r
        }\r
+#endif
 \r
        msr = MSR_EE;\r
 \r
@@ -175,7 +172,9 @@ void os_arch_setup_context( pcb_t *pcb ) {
                } else if( pcb->proc_type == PROC_BASIC ) {\r
                        context[C_LR_OFF/4] = (uint32_t)os_proc_start_basic;\r
                }\r
-       }\r
+       }
+
+       os_arch_stack_set_endmark(pcb);\r
 }\r
 \r
 \r
index 2e8cb260122d75a825492e49da33b334fc03c20b..b88cdab7c9cca3ca42de33b466dc8e6e6a7ff8de 100644 (file)
@@ -1,7 +1,8 @@
 \r
 obj-$(CFG_PPC) += crt0.o\r
-vpath-$(CFG_ARM_CM3) += $(ARCH_PATH-y)kernel  \r
-obj-$(CFG_ARM_CM3) += startup_stm32f10x_hd.o\r
+vpath-$(CFG_ARM_CM3) += $(ARCH_PATH-y)kernel\r
+# This is not true, md=medium,ld=low,hd=high  \r
+obj-$(CFG_ARM_CM3) += startup_stm32f10x_md.o\r
 obj-$(CFG_ARM_CM3) += system_stm32f10x.o\r
 obj-$(CFG_ARM_CM3) += core_cm3.o\r
 \r
@@ -155,8 +156,8 @@ vpath-$(USE_PDUR) += $(ROOTDIR)/communication/PduR
 \r
 # Common\r
 obj-y += xtoa.o\r
-obj-y += ramlog.o\r
-obj-y += printf.o\r
+obj-$(USE_RAMLOG) += ramlog.o\r
+obj-$(USE_PRINTF) += printf.o\r
 VPATH += $(ROOTDIR)/common\r
 \r
 obj-y += newlib_port.o\r
index 572609272f0cf3c0a1952edf2ac148597e3c452e..b1813f70dfe897c2d7353e45620b236667668978 100644 (file)
@@ -5,7 +5,7 @@ ARCH_FAM=arm
 ARCH_MCU=arm_cm3
 
 # CFG (y/n) macros
-CFG=ARM ARM_CM3 BRD_ET_STM32_STAMP
+CFG=ARM ARM_CM3 BRD_ET_STM32_STAMP SIMULATOR
 
 
 # What buildable modules does this board have, 
@@ -14,3 +14,6 @@ MOD_AVAIL=KERNEL MCU T32_TERM
 
 # Needed by us
 MOD_USE=KERNEL MCU
+
+# Use little head
+def-y += HEAPSIZE=600
index 9730c3b94bf08cbfe51c07c20327c9ddd257de2b..f2ee8f03ceccf39e4f43b8a3fdfb62e70864af3a 100644 (file)
@@ -9,7 +9,7 @@ CFG=PPC BOOKE E200Z1 MPC55XX MPC5516 BRD_MPC5516IT
 
 # What buildable modules does this board have, 
 # default or private
-MOD_AVAIL+=KERNEL MCU GPT LIN CAN CANIF PORT DIO WDG WDGM T32_TERM PWM WINIDEA_TERM COM ADC DMA
+MOD_AVAIL+=KERNEL RAMLOG MCU GPT LIN CAN CANIF PORT DIO WDG WDGM T32_TERM PWM WINIDEA_TERM COM ADC DMA SIMPLE_PRINTF
 
 # Needed by us
 MOD_USE=KERNEL MCU
index 5478e4f340af59b878a218eb40300b1303418f5f..419aca22e1491817863bbb530d2727c58afd3de7 100644 (file)
@@ -9,7 +9,7 @@ CFG=PPC BOOKE E200Z1 MPC55XX MPC5516 BRD_MPC551XSIM SIMULATOR
 
 # What buildable modules does this board have, 
 # default or private
-MOD_AVAIL=KERNEL MCU GPT LIN CAN WDG WDGM T32_TERM WINIDEA_TERM
+MOD_AVAIL=KERNEL RAMLOG MCU GPT LIN CAN WDG WDGM T32_TERM WINIDEA_TERM SIMPLE_PRINTF
 
 # Needed by us
 MOD_USE=KERNEL MCU
index 6d2c6ca3afc2f23a7e3dd6ce1918f082d6e51118..09689749645cbb5b1f45ffc052ade5859356445d 100644 (file)
@@ -9,7 +9,7 @@ CFG=PPC BOOKE SPE E200Z6 MPC55XX MPC5554 BRD_MPC5554SIM SIMULATOR
 
 # What buildable modules does this board have, 
 # default or private
-MOD_AVAIL+=KERNEL MCU GPT LIN CAN COM WDG WDGM T32_TERM WINIDEA_TERM
+MOD_AVAIL+=KERNEL RAMLOG MCU GPT LIN CAN COM WDG WDGM T32_TERM WINIDEA_TERM
 
 # Needed by kernel
 MOD_USE+=KERNEL MCU
index 01e01318895e61555665ce7b0ef03f3b43e4dc34..266955cee58060558377c9df7f0680a0255981c5 100644 (file)
@@ -9,8 +9,9 @@ CFG=PPC BOOKE E200Z6 MPC55XX MPC5567 BRD_MPC5567QRTECH SPE
 
 # What buildable modules does this board have, 
 # default or private
-MOD_AVAIL=KERNEL MCU WDG WDGM PORT DIO WDG WDGM T32_TERM WINIDEA_TERM PWM CAN CANIF COM ADC DMA
+MOD_AVAIL=KERNEL RAMLOG MCU WDG WDGM PORT DIO WDG WDGM T32_TERM WINIDEA_TERM PWM CAN CANIF COM ADC DMA SIMPLE_PRINTF
 
 # Needed by us
 MOD_USE=KERNEL MCU
 
+
diff --git a/boards/mpc5567qrtech/config.h b/boards/mpc5567qrtech/config.h
deleted file mode 100644 (file)
index ac640dc..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -------------------------------- Arctic Core ------------------------------
- * Arctic Core - the open source AUTOSAR platform http://arccore.com
- *
- * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
- *
- * This source code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by the
- * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * for more details.
- * -------------------------------- Arctic Core ------------------------------*/
-
-
-
-
-
-
-
-
-/*\r
- * config.h\r
- *\r
- *  Created on: 2009-jul-08\r
- *      Author: mahi\r
- */\r
-\r
-#ifndef CONFIG_H_\r
-#define CONFIG_H_\r
-\r
-/* For makefile's only (used to get the directory search paths right) */\r
-#define ARCH        mpc55xx\r
-#define ARCH_FAM    ppc\r
-#define ARCH_MCU    mpc5567\r
-/*\r
- * CPU and board\r
- */\r
-#define CFG_PPC                   1\r
-#define CFG_BOOKE                 1\r
-#define CFG_E200Z6                1\r
-#define CFG_MPC55XX               1\r
-#define CFG_MPC5567               1\r
-\r
-#define USE_KERNEL                1\r
-#define USE_MCU                   1\r
-\r
-\r
-/*\r
- * Misc\r
- */\r
-//#define USE_T32_TERM              1\r
-//#define CFG_CONSOLE_T32           1\r
-#define USE_WINIDEA_TERM       1\r
-#define CFG_CONSOLE_WINIDEA       1\r
-\r
-#define USE_PROTECTIONHOOK        1\r
-#define USE_STARTUPHOOK           1\r
-#define USE_SHUTDOWNHOOK          1\r
-#define USE_ERRORHOOK             1\r
-#define USE_PRETASKHOOK           1\r
-#define USE_POSTTASKHOOK          1\r
-\r
-#endif /* CONFIG_H_ */\r
-\r
index 29689198b20affd4f425a3cdbe3d0cb31fcff9ef..fa5a2df35e416bb7e7d7da922274bfe1e0532164 100644 (file)
@@ -17,7 +17,8 @@
 #include <sys/stat.h>\r
 #include <sys/types.h>\r
 #include <errno.h>\r
-#include <stdlib.h>\r
+#include <stdlib.h>
+#include "Ramlog.h"\r
 //#include "clibsupport_gcc.h"\r
 
 #if defined(CFG_ARM)
@@ -214,12 +215,14 @@ int write(  int fd, char *buf, int nbytes)
        }\r
        else\r
        {
+#if defined(USE_RAMLOG)
                /* RAMLOG support */\r
                if(fd == FILE_RAMLOG) {\r
                        for (int i = 0; i < nbytes; i++) {\r
                                ramlog_chr (*(buf + i));\r
                        }\r
-               }\r
+               }
+#endif\r
        }\r
 \r
        return (nbytes);\r
@@ -232,8 +235,10 @@ int write(  int fd, char *buf, int nbytes)
 extern char _end[];\r
 \r
 //static char *curbrk = _end;\r
-\r
+
+#ifndef HEAPSIZE\r
 #define HEAPSIZE 16000\r
+#endif
 unsigned char _heap[HEAPSIZE];\r
 \r
 caddr_t sbrk( int incr )\r
index 77fd0cb27ff63ab93e4f581f06b1bcfe1c899858..2d767725313c26ec0274b0f0fb0d8d2f4f8602cf 100644 (file)
  * -------------------------------- Arctic Core ------------------------------*/
 
 
-
-
-
-
-
-
-
-//#include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include "simple_printf.h"
 
 #define BUF_SIZE       60
 
index 448126f4ade6bf315555264de3e46a72f45f13a9..e29411e0e0e963c81d16df3b6d125ab759e9d5de 100644 (file)
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
-
-
-
-
-
-
-
-
 \r
 #include <stdio.h>\r
-#include <stdarg.h>\r
+#include <stdarg.h>
+#include "simple_printf.h"\r
 \r
-extern int simple_sprintf(char *, const char *format, ...);\r
-\r
-#define CONFIG_RAMLOG_SIZE  2000\r
+
+#ifndef CFG_RAMLOG_SIZE\r
+#define CFG_RAMLOG_SIZE  2000
+#endif\r
 \r
-static unsigned char ramlog[CONFIG_RAMLOG_SIZE] __attribute__ ((section (".ramlog")));\r
+static unsigned char ramlog[CFG_RAMLOG_SIZE] __attribute__ ((section (".ramlog")));\r
 static unsigned ramlog_curr __attribute__ ((section (".ramlog")));\r
 static unsigned ramlog_session __attribute__ ((section (".ramlog")));\r
 \r
@@ -37,7 +31,7 @@ static FILE *ramlogFile = 0;
 \r
 void ramlog_chr( char c ) {\r
   ramlog[ramlog_curr++] = c;\r
-  if( ramlog_curr >= 2000 ) {\r
+  if( ramlog_curr >= CFG_RAMLOG_SIZE ) {\r
          ramlog_curr = 0;\r
   }\r
 }\r
@@ -64,7 +58,7 @@ void ramlog_printf( const char *format, ... ) {
 void ramlog_init()\r
 {\r
        char buf[32];\r
-    if( ramlog_curr>CONFIG_RAMLOG_SIZE)\r
+    if( ramlog_curr>CFG_RAMLOG_SIZE)\r
     {\r
       ramlog_curr = 0;\r
       ramlog_session = 0;\r
index 5690e776aee83b9fd8867aa1ada9ac078d9e72b6..44eae0a6d6c35703c74af5edd0e4832a7ce1119a 100644 (file)
@@ -1,3 +1,3 @@
 \r
-MOD_USE+=KERNEL MCU T32_TERM\r
+MOD_USE+=KERNEL MCU T32_TERM RAMLOG SIMPLE_PRINTF\r
 \r
index b30db729c739454d17ae8cb1768d332f144b442c..4d4f1e44331921818963e6344ed7b12680a3a2ab 100644 (file)
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
 
-
-
-
-
-
-
-
-/*\r
- * Os_Cfg.c\r
- *\r
- *  Created on: 15 jul 2009\r
- *      Author: mahi\r
- */\r
-\r
 #include <stdlib.h>\r
 #include <stdint.h>\r
 #include "os_config_macros.h"\r
index bfe1df18594bdd7745f1e4ec25c97c5170db50c8..04edb597e9b836f744b6ec69e40cb30b91cfdaab 100644 (file)
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
 
-
-
-
-
-
-
-
 \r
 #include "Os.h"\r
 #include "Mcu.h"\r
diff --git a/examples/tiny/build_config.mk b/examples/tiny/build_config.mk
new file mode 100644 (file)
index 0000000..5690e77
--- /dev/null
@@ -0,0 +1,3 @@
+\r
+MOD_USE+=KERNEL MCU T32_TERM\r
+\r
diff --git a/examples/tiny/config/Os_Cfg.c b/examples/tiny/config/Os_Cfg.c
new file mode 100644 (file)
index 0000000..4d4f1e4
--- /dev/null
@@ -0,0 +1,150 @@
+/* -------------------------------- Arctic Core ------------------------------
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com
+ *
+ * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
+ *
+ * This source code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ * -------------------------------- Arctic Core ------------------------------*/
+
+#include <stdlib.h>\r
+#include <stdint.h>\r
+#include "os_config_macros.h"\r
+#include "Platform_Types.h"\r
+#include "Os.h"                                // includes Os_Cfg.h\r
+#include "kernel.h"\r
+#include "kernel_offset.h"\r
+#include "alist_i.h"\r
+#include "Mcu.h"\r
+\r
+extern void dec_exception( void );\r
+\r
+// atleast 1\r
+#define SERVICE_CNT 1\r
+\r
+GEN_TRUSTEDFUNCTIONS_LIST\r
+\r
+//--- APPLICATIONS ----\r
+\r
+GEN_APPLICATION_HEAD {\r
+\r
+       GEN_APPLICATON( 0,\r
+                                       "application_1",\r
+                                       true,\r
+                                       NULL,NULL,NULL , 0,0,0,0,0,0 )\r
+};\r
+\r
+// --- RESOURCES ---\r
+\r
+GEN_RESOURCE_HEAD {\r
+       GEN_RESOURCE(RES_SCHEDULER,RESOURCE_TYPE_STANDARD,0,0,0),               // Standard resource..\r
+};\r
+\r
+//--- TASKS ----\r
+\r
+DECLARE_STACK(OsIdle,PRIO_STACK_SIZE);\r
+DECLARE_STACK(etask_1,PRIO_STACK_SIZE);\r
+DECLARE_STACK(etask_2,PRIO_STACK_SIZE);\r
+DECLARE_STACK(btask_3,PRIO_STACK_SIZE);\r
+\r
+GEN_TASK_HEAD {\r
+       GEN_ETASK(      OsIdle,\r
+                               0,\r
+                               true/*auto*/,\r
+                               NULL/*tm*/,\r
+                               APPLICATION_ID_application_1/*app*/,\r
+                               NULL/*rsrc*/),\r
+\r
+       GEN_ETASK(      etask_1,\r
+                               1,\r
+                               true/*auto*/,\r
+                               NULL/*tm*/,\r
+                               APPLICATION_ID_application_1/*app*/,\r
+                               NULL/*rsrc*/),\r
+\r
+       GEN_ETASK(      etask_2,\r
+                               2,\r
+                               true/*auto*/,\r
+                               NULL/*tm*/,\r
+                               APPLICATION_ID_application_1/*app*/,\r
+                               NULL/*rsrc*/),\r
+\r
+\r
+       GEN_BTASK(      btask_3,\r
+                               3,\r
+                               false/*auto*/,\r
+                               NULL/*tm*/,\r
+                               APPLICATION_ID_application_1/*app*/,\r
+                               NULL/*rsrc*/),\r
+};\r
+\r
+GEN_PCB_LIST()\r
+\r
+// --- INTERRUPTS ---\r
+\r
+uint8_t os_interrupt_stack[OS_INTERRUPT_STACK_SIZE] __attribute__ ((aligned (0x10)));\r
+\r
+// The vector table\r
+void * intc_vector_tbl[NUMBER_OF_INTERRUPTS_AND_EXCEPTIONS] __attribute__ ((aligned (0x1000),section(".data")))= {\r
+};\r
+\r
+// The type of vector\r
+uint8 intc_type_tbl[NUMBER_OF_INTERRUPTS_AND_EXCEPTIONS] = {\r
+};\r
+\r
+// --- COUNTERS ---\r
+GEN_COUNTER_HEAD {\r
+       GEN_COUNTER(    OS_TICK_COUNTER,\r
+                                       "OS_TICK_COUNTER",\r
+                                       COUNTER_TYPE_HARD,\r
+                                       COUNTER_UNIT_NANO,\r
+                                       0xffff,1,1,0 ),\r
+};\r
+\r
+// --- MESSAGES ---\r
+\r
+// --- ALARMS ---\r
+#define ALARM_USE\r
+\r
+GEN_ALARM_HEAD {\r
+       GEN_ALARM(      0,"Alarm1",OS_TICK_COUNTER,\r
+                               1,100,10,0,             /*active,start,cycle,app_mask */\r
+                               ALARM_ACTION_SETEVENT, TASK_ID_etask_1, 2, 0 ),\r
+};\r
+\r
+// --- SCHEDULETABLES ---\r
+\r
+// --- HOOKS ---\r
+\r
+GEN_HOOKS( StartupHook, ProtectionHook, ShutdownHook, ErrorHook, PreTaskHook, PostTaskHook )\r
+\r
+\r
+\r
+// --- MISC ---\r
+\r
+uint32 os_dbg_mask = \\r
+       D_MASTER_PRINT |\\r
+       D_ISR_MASTER_PRINT |\\r
+       D_RAMLOG |\\r
+    D_ISR_RAMLOG | D_TASK | D_ALARM;\r
+\r
+\r
+// | D_ALARM | D_TASK;\r
+\r
+\r
+#include "os_config_funcs.h"\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/examples/tiny/config/Os_Cfg.h b/examples/tiny/config/Os_Cfg.h
new file mode 100644 (file)
index 0000000..0b66229
--- /dev/null
@@ -0,0 +1,70 @@
+/* -------------------------------- Arctic Core ------------------------------
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com
+ *
+ * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
+ *
+ * This source code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ * -------------------------------- Arctic Core ------------------------------*/
+
+
+
+
+
+
+
+
+/*\r
+ * Os_Cfg.h\r
+ *\r
+ *  Created on: 2008-dec-22\r
+ *      Author: mahi\r
+ */\r
+\r
+#ifndef OS_CFG_H_\r
+#define OS_CFG_H_\r
+\r
+/* os_config.h */\r
+\r
+#define APPLICATION_ID_application_1   0\r
+#define APPLICATION_CNT                                        1\r
+\r
+#define TASK_ID_OsIdle                                 0\r
+#define TASK_ID_etask_1                                        1\r
+#define TASK_ID_etask_2                                        2\r
+#define TASK_ID_btask_3                                        3\r
+\r
+void etask_1( void );\r
+void etask_2( void );\r
+void btask_3( void );\r
+\r
+//#define TASK_ID_os_tick                                      8\r
+\r
+\r
+// OS_TICK_COUNTER located in Os.h\r
+\r
+// NOT GENERATED( for test system only )\r
+#define SYSTEM_COUNTER_PERIOD                          100\r
+\r
+#define PRIO_STACK_SIZE                                                200\r
+#define OS_INTERRUPT_STACK_SIZE                                200\r
+\r
+// Just define them if you want to use them.\r
+#undef ALARM_USE\r
+#undef SCHEDULETABLE_USE\r
+#undef MESSAGE_USE\r
+#undef EVENT_USE\r
+#undef SERVICE_USE\r
+\r
+#define EVENT_0        (1<<0)\r
+#define EVENT_1        (1<<1)\r
+#define EVENT_2 (1<<2)\r
+\r
+\r
+#endif /* OS_CFG_H_ */\r
diff --git a/examples/tiny/makefile b/examples/tiny/makefile
new file mode 100644 (file)
index 0000000..5ee5caa
--- /dev/null
@@ -0,0 +1,33 @@
+\r
+# Our object files\r
+obj-y += tiny.o\r
+# OS object files.\r
+obj-y += Os_Cfg.o\r
+\r
+VPATH += ..\r
+VPATH += ../config\r
+\r
+inc-y += ../config\r
+inc-y += $(ROOTDIR)/system/kernel/$(objdir)\r
+inc-y += $(ROOTDIR)/system/kernel/include\r
+\r
+# The more precise configuration, the higher preceedance.\r
+VPATH := ../config/$(BOARDDIR) ../config $(VPATH)\r
+inc-y := ../config/$(BOARDDIR) ../config $(inc-y)\r
+\r
+# Board object files\r
+include $(ROOTDIR)/boards/board_common.mk\r
+\r
+# libs needed by us \r
+libitem-y += $(ROOTDIR)/libs/libkernel_$(ARCH_MCU).a\r
+\r
+#linkfile\r
+ldcmdfile-y = -T $(ROOTDIR)/$(ARCH_PATH-y)/scripts/linkscript_gcc.ldf\r
+\r
+# What I want to build\r
+build-exe-y = simple.elf\r
+\r
+\r
+\r
+\r
+\r
diff --git a/examples/tiny/tiny.c b/examples/tiny/tiny.c
new file mode 100644 (file)
index 0000000..04edb59
--- /dev/null
@@ -0,0 +1,188 @@
+/* -------------------------------- Arctic Core ------------------------------
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com
+ *
+ * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
+ *
+ * This source code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ * -------------------------------- Arctic Core ------------------------------*/
+
+\r
+#include "Os.h"\r
+#include "Mcu.h"\r
+\r
+#define USE_DEBUG\r
+#include "Trace.h"\r
+\r
+// How many errors to keep in error log.\r
+#define ERROR_LOG_SIZE 20\r
+\r
+\r
+/**\r
+ * Just an example of a basic task.\r
+ */\r
+\r
+void btask_3( void ) {\r
+       StackInfoType si;\r
+       TaskType currTask;\r
+       dbg_printf("[%08d] btask_3 start\n", GetOsTick() );\r
+\r
+       GetTaskID(&currTask);\r
+       Os_GetStackInfo(currTask,&si);\r
+       dbg_printf("btask_3: Stack usage %d%%\n",OS_STACK_USAGE(&si));\r
+\r
+       TerminateTask();\r
+}\r
+\r
+/**\r
+ * An extended task is auto-started and is also triggered by an alarm\r
+ * that sets event 2.\r
+ */\r
+\r
+void etask_1( void ) {\r
+       volatile float tryFloatingPoint = 0.0F;\r
+       StackInfoType si;\r
+       TaskType currTask;\r
+\r
+\r
+       dbg_printf("etask_1 start\n");\r
+       for(;;) {\r
+               SetEvent(TASK_ID_etask_2,1);\r
+               WaitEvent(2);\r
+               ClearEvent(2);\r
+               tryFloatingPoint += 1.0F;\r
+               GetTaskID(&currTask);\r
+               Os_GetStackInfo(currTask,&si);\r
+               dbg_printf("etask_1: Stack usage %d%% \n",OS_STACK_USAGE(&si));\r
+\r
+       }\r
+}\r
+\r
+/**\r
+ * An extended task that receives events from someone\r
+ * and activates task: btask_3.
+ */\r
+void etask_2( void ) {\r
+       dbg_printf("etask_2 start\n");\r
+\r
+       for(;;) {\r
+               WaitEvent(1);\r
+               ClearEvent(1);\r
+               ActivateTask(TASK_ID_btask_3);\r
+               {\r
+                       StackInfoType si;\r
+                       TaskType currTask;\r
+                       GetTaskID(&currTask);\r
+                       Os_GetStackInfo(currTask,&si);\r
+                       dbg_printf("etask_1: Stack usage %d%% \n",OS_STACK_USAGE(&si));\r
+               }\r
+       }\r
+}\r
+\r
+\r
+/*\r
+ * Functions that must be supplied by the example\r
+ */\r
+\r
+void OsIdle( void ) {\r
+       for(;;);\r
+}\r
+\r
+\r
+/* Global hooks */\r
+ProtectionReturnType ProtectionHook( StatusType FatalError ) {\r
+       dbg_printf("## ProtectionHook\n");\r
+       return PRO_KILLAPPL;\r
+}\r
+\r
+void StartupHook( void ) {\r
+       uint32_t sys_freq = McuE_GetSystemClock();\r
+\r
+       dbg_printf("## StartupHook\n");\r
+\r
+       dbg_printf("Sys clock %d Hz\n",sys_freq);\r
+       Frt_Init();\r
+       Frt_Start(sys_freq/1000);\r
+}\r
+\r
+void ShutdownHook( StatusType Error ) {\r
+       dbg_printf("## ShutdownHook\n");\r
+       while(1);\r
+}\r
+\r
+struct LogBad_s {\r
+       uint32_t param1;\r
+       uint32_t param2;\r
+       uint32_t param3;\r
+       TaskType taskId;\r
+       OsServiceIdType serviceId;\r
+       StatusType error;\r
+};\r
+\r
+void ErrorHook( StatusType Error ) {\r
+\r
+       TaskType task;\r
+       static struct LogBad_s LogBad[ERROR_LOG_SIZE];\r
+       static uint8_t ErrorCount = 0;\r
+\r
+       GetTaskID(&task);\r
+\r
+\r
+       OsServiceIdType service = OSErrorGetServiceId();\r
+\r
+       /* Grab the arguments to the functions\r
+        * This is the standard way, see 11.2 in OSEK spec
+        */\r
+       switch(service) {\r
+       case OSServiceId_SetRelAlarm:\r
+       {\r
+               // Read the arguments to the faulty functions...\r
+               AlarmType alarm_id = OSError_SetRelAlarm_AlarmId;\r
+               TickType increment = OSError_SetRelAlarm_Increment;\r
+               TickType cycle = OSError_SetRelAlarm_Cycle;\r
+               // ... Handle this some way.\r
+               break;\r
+       }\r
+       /*\r
+        * The same pattern as above applies for all other OS functions.\r
+        * See Os.h for names and definitions.
+        */\r
+\r
+       default:\r
+               break;\r
+       }\r
+\r
+       dbg_printf("## ErrorHook err=%d\n",Error);\r
+\r
+       /* Log the errors in a buffer for later review */\r
+       LogBad[ErrorCount].param1 = os_error.param1;\r
+       LogBad[ErrorCount].param2 = os_error.param2;\r
+       LogBad[ErrorCount].param3 = os_error.param3;\r
+       LogBad[ErrorCount].serviceId = service;\r
+       LogBad[ErrorCount].taskId = task;\r
+       LogBad[ErrorCount].error = Error;\r
+\r
+       ErrorCount++;\r
+\r
+       // Stall if buffer is full.\r
+       while(ErrorCount >= ERROR_LOG_SIZE);\r
+}\r
+\r
+void PreTaskHook( void ) {\r
+       TaskType task;\r
+       GetTaskID(&task);\r
+//     dbg_printf("## PreTaskHook, taskid=%d\n",task);\r
+}\r
+\r
+void PostTaskHook( void ) {\r
+       TaskType task;\r
+       GetTaskID(&task);\r
+//     dbg_printf("## PostTaskHook, taskid=%d\n",task);\r
+}\r
+\r
index 38e2f704edd9294f9e64981150899653097d3529..f7c9d7cff0372f4db2d919a45bcb410fbb317d7c 100644 (file)
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
-
-
-
-
-
-
-
-
-/*\r
- * Ramlog.h\r
- *\r
- *  Created on: 2009-apr-19\r
- *      Author: mahi\r
- */\r
 \r
 #ifndef RAMLOG_H_\r
 #define RAMLOG_H_\r
-\r
+
+#include <stdint.h>\r
 #include "xtoa.h"\r
-\r
+
+#if !defined(USE_RAMLOG)\r
+#define ramlog_str( _x)
+#define ramlog_dec( _x)
+#define ramlog_hex( _x)
+
+#else
+
 void ramlog_puts( char *str );\r
 \r
 /*\r
@@ -52,10 +46,17 @@ static inline void ramlog_hex( uint32_t val ) {
   ultoa(val,str,16);\r
   ramlog_str(str);\r
 }\r
+#endif
+
 \r
 /*\r
  * var args ramlog functions\r
- */\r
+ */
+#if defined(USE_RAMLOG_PRINTF)\r
 int ramlog_printf(const char *format, ...);\r
+#else
+#define ramlog_printf(format,...)
+#endif
+\r
+#endif /* RAMLOG_H_ */
 \r
-#endif /* RAMLOG_H_ */\r
index 67f1badff25ce7a243d2aaae94436b0970d67238..77fe5f5784fd1d73de5d60facb2d324f35bd2e14 100644 (file)
@@ -22,7 +22,8 @@
 
 #ifndef TRACE_H_\r
 #define TRACE_H_\r
-\r
+
+#include "simple_printf.h"\r
 /**\r
  *\r
  * NOTE!!!!\r
 #define DEBUG_LVL              2\r
 #endif\r
 \r
-extern int simple_printf(const char *format, ...);\r
-\r
-//#define USE_DEBUG\r
-//#define USE_TRACE\r
-\r
 #define CH_ISR         0\r
 #define CH_PROC                1\r
 \r
diff --git a/include/simple_printf.h b/include/simple_printf.h
new file mode 100644 (file)
index 0000000..d3ed22e
--- /dev/null
@@ -0,0 +1,11 @@
+\r
+#ifndef SIMPLE_PRINTF_H_\r
+#define SIMPLE_PRINTF_H_\r
+\r
+#if defined(USE_SIMPLE_PRINTF)\r
+#define simple_printf(format,...) simple_printf(format,## __VA_ARGS__ )\r
+#else\r
+#define simple_printf(format,...)\r
+#endif\r
+\r
+#endif /* SIMPLE_PRINTF_H_ */\r
index 926c6481c68a116096de0a5ba25e53d35f668523..243b44599ff62b82d755f398431888bd4ae18b1d 100755 (executable)
@@ -20,7 +20,8 @@ if [ "aa $CROSS_COMPILE aa" == "aa  aa" ]; then
   fi
 fi;
 
-export BDIR=system/kernel/testsystem
+#export BDIR=system/kernel/testsystem
+export BDIR=examples/tiny
 make BOARDDIR=et_stm32_stamp clean
 make BOARDDIR=et_stm32_stamp all
 if [ $? -ne 0 ]; then quit 1
index 781d9cce49734f17cbaff8d53ebfb894c26ae535..2c1df893402a3c12d5ef082a281702f60c8556fd 100644 (file)
@@ -3,8 +3,9 @@
 HOST := $(shell uname)\r
 export prefix\r
 \r
+cygpath:= $(shell cygpath -m $(shell which cygpath))\r
 # If we are using codesourcery and cygwin..\r
-export CYGPATH=c:/cygwin/bin/cygpath\r
+export CYGPATH=$(cygpath)\r
 \r
 # ---------------------------------------------------------------------------\r
 # Compiler\r
index 9b57595beee3f6fbe70af02513e035470850f04e..128ac2f2d8e8fda62369d92bf70f10836d45c259 100644 (file)
@@ -6,6 +6,9 @@ RELDIR := $(subst $(TOPDIR)/,,$(CURDIR))
 # Create the target name... \r
 target := $(subst /,_,$(SUBDIR))\r
 \r
+#goal=$(subst /cygdrive/c/,c:/,$(abspath $@))\r
+goal=$@\r
+\r
 #===== MODULE CONFIGURATION =====\r
 include $(ROOTDIR)/boards/$(BOARDDIR)/build_config.mk\r
 -include ../build_config.mk\r
@@ -79,19 +82,16 @@ inc-y += ../include
 # Compile\r
 %.o: %.c\r
        @echo "  >> CC $<"\r
-       $(Q)$(CC) -c $(CFLAGS) -o $(abspath $@) $(addprefix -I ,$(inc-y)) $(addprefix -D,$(def-y)) $(realpath $<)\r
+       $(Q)$(CC) -c $(CFLAGS) -o $(goal) $(addprefix -I ,$(inc-y)) $(addprefix -D,$(def-y)) $(realpath $<)\r
 \r
 # Assembler\r
 \r
 %.o: %.s\r
        @echo "  >> AS $< $(ASFLAGS)"\r
-       $(Q)$(AS) $(ASFLAGS) -o $@ $<\r
+       $(Q)$(AS) $(ASFLAGS) -o $(goal) $<\r
        \r
-#$(Q)$(AS) -o /cygdrive/c/apa.o $<\r
-\r
-\r
 # PP Assembler \r
-.SECONDARY %.s:\r
+#.SECONDARY %.s:\r
 \r
 %.s: %.S\r
        @echo " >> CPP $<"\r
index cf6be3dd5c7eb40d81b8fe13f88a096d0f0fab9f..bf6b8070c319395d4e5e654a6b48b33447509703 100644 (file)
@@ -102,6 +102,11 @@ void *os_arch_get_stack_usage( pcb_t * );
 _Bool os_arch_stack_endmark_ok( pcb_t *);
 #endif
 
+static inline void os_arch_stack_set_endmark( pcb_t *pcb ) {
+       uint8_t *end = pcb->stack.top;
+       *end = STACK_PATTERN;
+}
+
 static inline _Bool os_arch_stack_endmark_ok( pcb_t *pcb ) {
        uint8_t *end = pcb->stack.top;
        return ( *end == STACK_PATTERN);
index 6fd8b8c244e7afbf2fe6a2714ca837f0c772ad18..eda95dc6fdeb9497b9a9af76d55ddb89f4f0c839 100644 (file)
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
 
-
-
-
-
-
-
-
 #ifndef INTERNAL_H_\r
 #define INTERNAL_H_\r
 \r
 #include <assert.h>\r
 #include "Ramlog.h"\r
-\r
+#include "simple_printf.h"\r
 \r
 extern uint32 os_dbg_mask;\r
 \r
index a0b18b679ba1a630b6e65e501028698624a463cc..8afa465b5410a1c1824cbcb4af9f1c26b592b43d 100644 (file)
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
 
-
-
-
-
-
-
-
 #ifndef TASK_I_H_\r
 #define TASK_I_H_\r
 \r
 #include <stdlib.h>\r
 #include <assert.h>\r
-#include "internal.h"\r
+#include "internal.h"
+#include "Ramlog.h"\r
 \r
 static inline void os_pcb_print_rq( void ) {\r
        pcb_t *i_pcb;\r
index 6a26965117a70804223400a0b9d3cad5dfb8c437..8b4b605985237192672a33a6e2870fecd03e0dc0 100644 (file)
@@ -2,7 +2,7 @@
 \r
 #VPATH += $(ROOTDIR)/arch/arm/arm_cm3/kernel\r
 vpath-y += $(ARCH_PATH-y)/kernel\r
-#obj-y += asm_sample.o\r
+obj-y += asm_sample.o\r
 obj-y += arch_krn.o\r
 \r
 \r
index 54712062827be5f989015cdb703356d1d534ed1f..e6916456ee47e6ae84eb16176519372a79688b22 100644 (file)
@@ -110,8 +110,10 @@ void os_swap_context(pcb_t *old_pcb, pcb_t *new_pcb ) {
 /**\r
  * Called when a task is to be run for the first time.\r
  */\r
-void os_swap_context_to(pcb_t *old_pcb, pcb_t *new_pcb ) {\r
- os_arch_swap_context_to(old_pcb,new_pcb);\r
+void os_swap_context_to(pcb_t *old_pcb, pcb_t *new_pcb ) {
+
+\r
+       os_arch_swap_context_to(old_pcb,new_pcb);\r
        /* TODO: When do we return here ?? */\r
 }\r
 \r
index 8ad68f8b74dcb7a82606dc9a0138304d132eb10f..3d1d262c235b33df5b9e3ba22465e14b745a037b 100644 (file)
@@ -7,20 +7,18 @@
  WINPAGE.RESET\r
  \r
  WINCLEAR\r
- WINPOS 78.714 50.538 72. 24. 12. 1. W002\r
- WINTABS 13. 0. 0. 0. 0. 0. 0.\r
- ws.b.l\r
\r
- WINPOS 146.57 50.692 89. 22. 0. 0. W005\r
- ws.Var.View %open Det_RamLog\r
\r
- WINPOS 1.8571 50.154 83. 28. 0. 0. W001\r
- ws.area\r
\r
- WINPOS 2.2857 0.076923 134. 62. 13. 1. W000\r
- WINTABS 10. 10. 25. 62.\r
- ws.d.l\r
+ WINPOS 0% 0% 50% 69%\r
+ d.l\r
+\r
+ WINPOS 0% 70% 50% 30%\r
+ area\r
+\r
+ WINPOS 50% 0% 50% 30%\r
+ var.ref\r
  \r
+ do term\r
+\r
  WINPAGE.SELECT P000     \r
  \r
  ENDDO\r
+\r
index 36bb91cedfdc810ac46ba37edad93f506a098669..8c4fcebc164c8d3f208e2ef162373c4d91dd7a87 100644 (file)
@@ -27,10 +27,10 @@ load:
     \r
   do config save   \r
   do flash open\r
-  data.load.elf &cfg_loadfile_g /CYGDRIVE /GNU \r
+  data.load.elf &cfg_loadfile_g /CYGDRIVE /GNU \r
   do flash close\r
   print "&cfg_loadfile_g"\r
-  \r
+\r
   enddo\r
 \r
 //-------------------------------------------------------------  \r
@@ -40,10 +40,44 @@ reload:
   r.reset  \r
   do flash init\r
   do flash open\r
-  data.load.elf &cfg_loadfile_g /GNU \r
+  data.load.elf &cfg_loadfile_g /GNU /CYGDRIVE\r
 // /CYGDRIVE\r
   do flash close\r
+\r
+  GOSUB postload_&cfg_cpu_g\r
+\r
   enddo\r
+\r
+postload_CortexM3:\r
+  r.s MSP 0x20005000\r
+  RETURN\r
+\r
+postload_MPC5516:\r
+postload_MPC5554:\r
+  RETURN\r
+\r
+//-------------------------------------------------------------\r
+\r
+path_fast:\r
+  y.spath.SETRECURSEDIR &cfg_project_path_g\r
+  RETURN\r
+\r
+//-------------------------------------------------------------\r
+path:\r
+  y.spath.reset\r
+  y.spath + &cfg_project_path_g/arch/arm/arm_cm3/kernel\r
+  y.spath + &cfg_project_path_g/arch/arm/arm_cm3/drivers\r
+  y.spath + &cfg_project_path_g/system/kernel\r
+  y.spath.SETRECURSEDIR &cfg_project_path_g\r
+  RETURN\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
     \r
 \r
 \r
@@ -83,6 +117,8 @@ reload:
 \r
 \r
 \r
+\r
+\r
 \r
 \r
 \r
index 6199cf95757980b46fd6a88635f4b8d0e727cf3d..83d1dd6bda1fc836f39102bd98808ecab96a77d7 100644 (file)
@@ -69,26 +69,16 @@ IF !SIMULATOR()
 \r
 \r
 // Setup how to view variables and code\r
-setup.var %SYMBOL.on %HEX.on %decimal.on %index.on\r
+setup.var %SYMBOL.on %HEX.on %decimal.on %index.on %string.on\r
 setup.tabsize 2.\r
 \r
 menu.rp autosar.men\r
 \r
-//winclear\r
-winpos 0% 0% 50% 68%\r
-w.d.l\r
-winpos 50% 0% 50% 50%\r
-w.v.f /l /c\r
 winpos 0% 70% 50% 30%\r
 area\r
 \r
 area.select\r
-//area.reset\r
-//w.v.w\r
-//v.aw flags ast\r
-\r
 print "## Welcome to Arc-Core simulator environment for T32   ##"\r
-print "## Select example to load from the menu Arc-Core->Load ##"\r
 print ""\r
 \r
 \r
@@ -129,6 +119,8 @@ enddo
 \r
 \r
 \r
+\r
+\r
 \r
 \r
 \r
index 6bf684c2c8524178d8f551c84f670985204295cd..1764c1ad8e30a338bce54bd3b0467d085e43e69d 100644 (file)
@@ -1,5 +1,5 @@
 winclear my_term\r
-WinPOS 60% 0% 50% 30. 1. 1. my_term\r
+WinPOS 50% 50% 50% 50% 1. 1. my_term\r
 term.size 80. 300.\r
 term.scroll on\r
 term.mode ASCII\r
@@ -25,3 +25,4 @@ enddo
 \r
 \r
 \r
+\r