1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\r
6 * This source code is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the GNU General Public License version 2 as published by the
\r
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
\r
10 * This program is distributed in the hope that it will be useful, but
\r
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
\r
14 * -------------------------------- Arctic Core ------------------------------*/
\r
16 /* A steal in an idea from
\r
17 * http://blogs.sun.com/nickstephen/entry/some_assembly_required_-_down
\r
18 * According to blog original BSD license..
\r
20 * Generate assembler from this file( -S option for GNU ).
\r
21 * extract the "#defines" with some tool e.g. "sed -n '/#define/p' <asm_file>"
\r
25 #include "internal.h"
\r
27 #if defined(__GNUC__)
\r
28 #define DECLARE(sym,val) \
\r
29 __asm("#define\t" #sym "\t%0" : : "n" ((val)))
\r
31 void asm_foo(void) {
\r
32 #elif defined(__CWCC__)
\r
33 #define DECLARE(_var,_offset) \
\r
34 __declspec(section ".apa") char _var[100+ (_offset)]
\r
35 #pragma section ".apa" ".apa"
\r
37 DECLARE(PCB_STACK_CURR_P, offsetof(OsTaskVarType, stack));
\r
38 DECLARE(PCB_CONST_P, offsetof(OsTaskVarType, constPtr));
\r
39 // DECLARE(PCB_ENTRY_P, offsetof(OsTaskVarType, entry));
\r
40 DECLARE(SYS_CURR_PCB_P, offsetof(Os_SysType, currTaskPtr));
\r
41 DECLARE(SYS_INT_NEST_CNT, offsetof(Os_SysType, intNestCnt));
\r
42 DECLARE(SYS_INT_STACK, offsetof(Os_SysType, intStack));
\r
43 #if defined(__GNUC__)
\r