1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
6 * This source code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * -------------------------------- Arctic Core ------------------------------*/
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
27 #define DECLARE(sym,val) \
\r
28 __asm("#define\t" #sym "\t%0" : : "n" ((val)))
\r
30 void asm_foo(void) {
\r
31 DECLARE(PCB_STACK_CURR_P, offsetof(OsPcbType, stack));
\r
32 DECLARE(PCB_ENTRY_P, offsetof(OsPcbType, entry));
\r
33 DECLARE(SYS_CURR_PCB_P, offsetof(sys_t, curr_pcb));
\r
34 DECLARE(SYS_INT_NEST_CNT, offsetof(sys_t, int_nest_cnt));
\r
35 DECLARE(SYS_INT_STACK, offsetof(sys_t, int_stack));
\r