2015-04-11 07:44:37 +08:00
|
|
|
/* swap_macros.h - helper macros for context switch */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SWAP_MACROS__H_
|
|
|
|
#define _SWAP_MACROS__H_
|
|
|
|
|
2016-11-08 23:36:50 +08:00
|
|
|
#include <kernel_structs.h>
|
|
|
|
#include <offsets_short.h>
|
2015-04-11 07:44:37 +08:00
|
|
|
#include <toolchain.h>
|
2015-05-29 01:56:47 +08:00
|
|
|
#include <arch/cpu.h>
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#ifdef _ASMLANGUAGE
|
|
|
|
|
|
|
|
/* entering this macro, current is in r2 */
|
|
|
|
.macro _save_callee_saved_regs
|
|
|
|
|
2016-11-08 23:36:50 +08:00
|
|
|
sub_s sp, sp, ___callee_saved_stack_t_SIZEOF
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
/* save regs on stack */
|
2016-11-08 23:36:50 +08:00
|
|
|
st_s r13, [sp, ___callee_saved_stack_t_r13_OFFSET]
|
|
|
|
st_s r14, [sp, ___callee_saved_stack_t_r14_OFFSET]
|
|
|
|
st_s r15, [sp, ___callee_saved_stack_t_r15_OFFSET]
|
|
|
|
st r16, [sp, ___callee_saved_stack_t_r16_OFFSET]
|
|
|
|
st r17, [sp, ___callee_saved_stack_t_r17_OFFSET]
|
|
|
|
st r18, [sp, ___callee_saved_stack_t_r18_OFFSET]
|
|
|
|
st r19, [sp, ___callee_saved_stack_t_r19_OFFSET]
|
|
|
|
st r20, [sp, ___callee_saved_stack_t_r20_OFFSET]
|
|
|
|
st r21, [sp, ___callee_saved_stack_t_r21_OFFSET]
|
|
|
|
st r22, [sp, ___callee_saved_stack_t_r22_OFFSET]
|
|
|
|
st r23, [sp, ___callee_saved_stack_t_r23_OFFSET]
|
|
|
|
st r24, [sp, ___callee_saved_stack_t_r24_OFFSET]
|
|
|
|
st r25, [sp, ___callee_saved_stack_t_r25_OFFSET]
|
|
|
|
st r26, [sp, ___callee_saved_stack_t_r26_OFFSET]
|
|
|
|
st fp, [sp, ___callee_saved_stack_t_fp_OFFSET]
|
|
|
|
st r30, [sp, ___callee_saved_stack_t_r30_OFFSET]
|
2017-05-17 17:32:43 +08:00
|
|
|
|
boards: Update arc em_starterkit support from 2.2 to 2.3
Here are the main changes:
* board: Update EMSK onboard resources such as Button, Switch and LEDs
+ update soc.h for em7d, em9d, em11d
+ update board.h for em_starterkit board
* arc: Add floating point support and code density support
+ add kconfig configuration
+ add compiler options
+ add register definitions, marcos, assembly codes
+ fixes in existing codes and configurations.
* arc: Update detailed board configurations for cores of emsk 2.3
* script: Provide arc_debugger.sh for debugging em_starterkit board
+ make BOARD=em_starterkit debug
This will start openocd server for emsk, and arc gdb will connect
to this debug server, user can run `continue` command if user just
want to run the application, or other commands if debugging needed.
+ make BOARD=em_starterkit debugserver
This will start an openocd debugger server for emsk, and user can
connect to this debugserver using arc gdb and do what they want to.
+ make BOARD=em_starterkit flash
This will download the zephyr application elf file to emsk,
and run it.
Signed-off-by: Huaqi Fang <huaqi.fang@synopsys.com>
2017-05-17 15:18:51 +08:00
|
|
|
#ifdef CONFIG_FP_SHARING
|
|
|
|
st r58, [sp, ___callee_saved_stack_t_r58_OFFSET]
|
|
|
|
st r59, [sp, ___callee_saved_stack_t_r59_OFFSET]
|
|
|
|
lr r13, [_ARC_V2_FPU_STATUS]
|
|
|
|
st_s r13, [sp, ___callee_saved_stack_t_fpu_status_OFFSET]
|
|
|
|
lr r13, [_ARC_V2_FPU_CTRL]
|
|
|
|
st_s r13, [sp, ___callee_saved_stack_t_fpu_ctrl_OFFSET]
|
|
|
|
|
|
|
|
#ifdef CONFIG_FP_FPU_DA
|
|
|
|
lr r13, [_ARC_V2_FPU_DPFP1L]
|
|
|
|
st_s r13, [sp, ___callee_saved_stack_t_dpfp1l_OFFSET]
|
|
|
|
lr r13, [_ARC_V2_FPU_DPFP1H]
|
|
|
|
st_s r13, [sp, ___callee_saved_stack_t_dpfp1h_OFFSET]
|
|
|
|
lr r13, [_ARC_V2_FPU_DPFP2L]
|
|
|
|
st_s r13, [sp, ___callee_saved_stack_t_dpfp2l_OFFSET]
|
|
|
|
lr r13, [_ARC_V2_FPU_DPFP2H]
|
|
|
|
st_s r13, [sp, ___callee_saved_stack_t_dpfp2h_OFFSET]
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2015-08-20 23:04:01 +08:00
|
|
|
/* save stack pointer in struct tcs */
|
2016-11-08 23:36:50 +08:00
|
|
|
st sp, [r2, _thread_offset_to_sp]
|
2015-04-11 07:44:37 +08:00
|
|
|
.endm
|
|
|
|
|
|
|
|
/* entering this macro, current is in r2 */
|
|
|
|
.macro _load_callee_saved_regs
|
2015-08-20 23:04:01 +08:00
|
|
|
/* restore stack pointer from struct tcs */
|
2016-11-08 23:36:50 +08:00
|
|
|
ld sp, [r2, _thread_offset_to_sp]
|
|
|
|
|
boards: Update arc em_starterkit support from 2.2 to 2.3
Here are the main changes:
* board: Update EMSK onboard resources such as Button, Switch and LEDs
+ update soc.h for em7d, em9d, em11d
+ update board.h for em_starterkit board
* arc: Add floating point support and code density support
+ add kconfig configuration
+ add compiler options
+ add register definitions, marcos, assembly codes
+ fixes in existing codes and configurations.
* arc: Update detailed board configurations for cores of emsk 2.3
* script: Provide arc_debugger.sh for debugging em_starterkit board
+ make BOARD=em_starterkit debug
This will start openocd server for emsk, and arc gdb will connect
to this debug server, user can run `continue` command if user just
want to run the application, or other commands if debugging needed.
+ make BOARD=em_starterkit debugserver
This will start an openocd debugger server for emsk, and user can
connect to this debugserver using arc gdb and do what they want to.
+ make BOARD=em_starterkit flash
This will download the zephyr application elf file to emsk,
and run it.
Signed-off-by: Huaqi Fang <huaqi.fang@synopsys.com>
2017-05-17 15:18:51 +08:00
|
|
|
#ifdef CONFIG_FP_SHARING
|
|
|
|
ld r58, [sp, ___callee_saved_stack_t_r58_OFFSET]
|
|
|
|
ld r59, [sp, ___callee_saved_stack_t_r59_OFFSET]
|
|
|
|
|
|
|
|
ld_s r13, [sp, ___callee_saved_stack_t_fpu_status_OFFSET]
|
|
|
|
sr r13, [_ARC_V2_FPU_STATUS]
|
|
|
|
ld_s r13, [sp, ___callee_saved_stack_t_fpu_ctrl_OFFSET]
|
|
|
|
sr r13, [_ARC_V2_FPU_CTRL]
|
|
|
|
|
|
|
|
#ifdef CONFIG_FP_FPU_DA
|
|
|
|
ld_s r13, [sp, ___callee_saved_stack_t_dpfp1l_OFFSET]
|
|
|
|
sr r13, [_ARC_V2_FPU_DPFP1L]
|
|
|
|
ld_s r13, [sp, ___callee_saved_stack_t_dpfp1h_OFFSET]
|
|
|
|
sr r13, [_ARC_V2_FPU_DPFP1H]
|
|
|
|
ld_s r13, [sp, ___callee_saved_stack_t_dpfp2l_OFFSET]
|
|
|
|
sr r13, [_ARC_V2_FPU_DPFP2L]
|
|
|
|
ld_s r13, [sp, ___callee_saved_stack_t_dpfp2h_OFFSET]
|
|
|
|
sr r13, [_ARC_V2_FPU_DPFP2H]
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2017-05-17 17:32:43 +08:00
|
|
|
ld_s r13, [sp, ___callee_saved_stack_t_r13_OFFSET]
|
|
|
|
ld_s r14, [sp, ___callee_saved_stack_t_r14_OFFSET]
|
|
|
|
ld_s r15, [sp, ___callee_saved_stack_t_r15_OFFSET]
|
|
|
|
ld r16, [sp, ___callee_saved_stack_t_r16_OFFSET]
|
|
|
|
ld r17, [sp, ___callee_saved_stack_t_r17_OFFSET]
|
|
|
|
ld r18, [sp, ___callee_saved_stack_t_r18_OFFSET]
|
|
|
|
ld r19, [sp, ___callee_saved_stack_t_r19_OFFSET]
|
|
|
|
ld r20, [sp, ___callee_saved_stack_t_r20_OFFSET]
|
|
|
|
ld r21, [sp, ___callee_saved_stack_t_r21_OFFSET]
|
|
|
|
ld r22, [sp, ___callee_saved_stack_t_r22_OFFSET]
|
|
|
|
ld r23, [sp, ___callee_saved_stack_t_r23_OFFSET]
|
|
|
|
ld r24, [sp, ___callee_saved_stack_t_r24_OFFSET]
|
|
|
|
ld r25, [sp, ___callee_saved_stack_t_r25_OFFSET]
|
|
|
|
ld r26, [sp, ___callee_saved_stack_t_r26_OFFSET]
|
|
|
|
ld fp, [sp, ___callee_saved_stack_t_fp_OFFSET]
|
|
|
|
ld r30, [sp, ___callee_saved_stack_t_r30_OFFSET]
|
boards: Update arc em_starterkit support from 2.2 to 2.3
Here are the main changes:
* board: Update EMSK onboard resources such as Button, Switch and LEDs
+ update soc.h for em7d, em9d, em11d
+ update board.h for em_starterkit board
* arc: Add floating point support and code density support
+ add kconfig configuration
+ add compiler options
+ add register definitions, marcos, assembly codes
+ fixes in existing codes and configurations.
* arc: Update detailed board configurations for cores of emsk 2.3
* script: Provide arc_debugger.sh for debugging em_starterkit board
+ make BOARD=em_starterkit debug
This will start openocd server for emsk, and arc gdb will connect
to this debug server, user can run `continue` command if user just
want to run the application, or other commands if debugging needed.
+ make BOARD=em_starterkit debugserver
This will start an openocd debugger server for emsk, and user can
connect to this debugserver using arc gdb and do what they want to.
+ make BOARD=em_starterkit flash
This will download the zephyr application elf file to emsk,
and run it.
Signed-off-by: Huaqi Fang <huaqi.fang@synopsys.com>
2017-05-17 15:18:51 +08:00
|
|
|
|
2016-11-08 23:36:50 +08:00
|
|
|
add_s sp, sp, ___callee_saved_stack_t_SIZEOF
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
.endm
|
|
|
|
|
2016-12-22 05:26:17 +08:00
|
|
|
.macro _discard_callee_saved_regs
|
|
|
|
add_s sp, sp, ___callee_saved_stack_t_SIZEOF
|
|
|
|
.endm
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
/*
|
|
|
|
* Must be called with interrupts locked or in P0.
|
|
|
|
* Upon exit, sp will be pointing to the stack frame.
|
|
|
|
*/
|
|
|
|
.macro _create_irq_stack_frame
|
|
|
|
|
2016-11-08 23:36:50 +08:00
|
|
|
sub_s sp, sp, ___isf_t_SIZEOF
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2016-11-08 23:36:50 +08:00
|
|
|
st blink, [sp, ___isf_t_blink_OFFSET]
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
/* store these right away so we can use them if needed */
|
|
|
|
|
2016-11-08 23:36:50 +08:00
|
|
|
st_s r13, [sp, ___isf_t_r13_OFFSET]
|
|
|
|
st_s r12, [sp, ___isf_t_r12_OFFSET]
|
|
|
|
st r11, [sp, ___isf_t_r11_OFFSET]
|
|
|
|
st r10, [sp, ___isf_t_r10_OFFSET]
|
|
|
|
st r9, [sp, ___isf_t_r9_OFFSET]
|
|
|
|
st r8, [sp, ___isf_t_r8_OFFSET]
|
|
|
|
st r7, [sp, ___isf_t_r7_OFFSET]
|
|
|
|
st r6, [sp, ___isf_t_r6_OFFSET]
|
|
|
|
st r5, [sp, ___isf_t_r5_OFFSET]
|
|
|
|
st r4, [sp, ___isf_t_r4_OFFSET]
|
|
|
|
st_s r3, [sp, ___isf_t_r3_OFFSET]
|
|
|
|
st_s r2, [sp, ___isf_t_r2_OFFSET]
|
|
|
|
st_s r1, [sp, ___isf_t_r1_OFFSET]
|
|
|
|
st_s r0, [sp, ___isf_t_r0_OFFSET]
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
mov r0, lp_count
|
2016-11-08 23:36:50 +08:00
|
|
|
st_s r0, [sp, ___isf_t_lp_count_OFFSET]
|
2016-05-07 08:37:40 +08:00
|
|
|
lr r1, [_ARC_V2_LP_START]
|
2015-04-11 07:44:37 +08:00
|
|
|
lr r0, [_ARC_V2_LP_END]
|
2016-11-08 23:36:50 +08:00
|
|
|
st_s r1, [sp, ___isf_t_lp_start_OFFSET]
|
|
|
|
st_s r0, [sp, ___isf_t_lp_end_OFFSET]
|
2015-04-11 07:44:37 +08:00
|
|
|
|
boards: Update arc em_starterkit support from 2.2 to 2.3
Here are the main changes:
* board: Update EMSK onboard resources such as Button, Switch and LEDs
+ update soc.h for em7d, em9d, em11d
+ update board.h for em_starterkit board
* arc: Add floating point support and code density support
+ add kconfig configuration
+ add compiler options
+ add register definitions, marcos, assembly codes
+ fixes in existing codes and configurations.
* arc: Update detailed board configurations for cores of emsk 2.3
* script: Provide arc_debugger.sh for debugging em_starterkit board
+ make BOARD=em_starterkit debug
This will start openocd server for emsk, and arc gdb will connect
to this debug server, user can run `continue` command if user just
want to run the application, or other commands if debugging needed.
+ make BOARD=em_starterkit debugserver
This will start an openocd debugger server for emsk, and user can
connect to this debugserver using arc gdb and do what they want to.
+ make BOARD=em_starterkit flash
This will download the zephyr application elf file to emsk,
and run it.
Signed-off-by: Huaqi Fang <huaqi.fang@synopsys.com>
2017-05-17 15:18:51 +08:00
|
|
|
#ifdef CONFIG_CODE_DENSITY
|
|
|
|
lr r1, [_ARC_V2_JLI_BASE]
|
|
|
|
lr r0, [_ARC_V2_LDI_BASE]
|
|
|
|
lr r2, [_ARC_V2_EI_BASE]
|
|
|
|
st_s r1, [sp, ___isf_t_jli_base_OFFSET]
|
|
|
|
st_s r0, [sp, ___isf_t_ldi_base_OFFSET]
|
|
|
|
st_s r2, [sp, ___isf_t_ei_base_OFFSET]
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
.endm
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Must be called with interrupts locked or in P0.
|
|
|
|
* sp must be pointing the to stack frame.
|
|
|
|
*/
|
|
|
|
.macro _pop_irq_stack_frame
|
|
|
|
|
2016-11-08 23:36:50 +08:00
|
|
|
ld blink, [sp, ___isf_t_blink_OFFSET]
|
2015-04-11 07:44:37 +08:00
|
|
|
|
boards: Update arc em_starterkit support from 2.2 to 2.3
Here are the main changes:
* board: Update EMSK onboard resources such as Button, Switch and LEDs
+ update soc.h for em7d, em9d, em11d
+ update board.h for em_starterkit board
* arc: Add floating point support and code density support
+ add kconfig configuration
+ add compiler options
+ add register definitions, marcos, assembly codes
+ fixes in existing codes and configurations.
* arc: Update detailed board configurations for cores of emsk 2.3
* script: Provide arc_debugger.sh for debugging em_starterkit board
+ make BOARD=em_starterkit debug
This will start openocd server for emsk, and arc gdb will connect
to this debug server, user can run `continue` command if user just
want to run the application, or other commands if debugging needed.
+ make BOARD=em_starterkit debugserver
This will start an openocd debugger server for emsk, and user can
connect to this debugserver using arc gdb and do what they want to.
+ make BOARD=em_starterkit flash
This will download the zephyr application elf file to emsk,
and run it.
Signed-off-by: Huaqi Fang <huaqi.fang@synopsys.com>
2017-05-17 15:18:51 +08:00
|
|
|
#ifdef CONFIG_CODE_DENSITY
|
|
|
|
ld_s r1, [sp, ___isf_t_jli_base_OFFSET]
|
|
|
|
ld_s r0, [sp, ___isf_t_ldi_base_OFFSET]
|
|
|
|
ld_s r2, [sp, ___isf_t_ei_base_OFFSET]
|
|
|
|
sr r1, [_ARC_V2_JLI_BASE]
|
|
|
|
sr r0, [_ARC_V2_LDI_BASE]
|
|
|
|
sr r2, [_ARC_V2_EI_BASE]
|
|
|
|
#endif
|
|
|
|
|
2016-11-08 23:36:50 +08:00
|
|
|
ld_s r0, [sp, ___isf_t_lp_count_OFFSET]
|
2015-04-11 07:44:37 +08:00
|
|
|
mov lp_count, r0
|
2016-11-08 23:36:50 +08:00
|
|
|
ld_s r1, [sp, ___isf_t_lp_start_OFFSET]
|
|
|
|
ld_s r0, [sp, ___isf_t_lp_end_OFFSET]
|
2016-05-07 08:37:40 +08:00
|
|
|
sr r1, [_ARC_V2_LP_START]
|
2015-04-11 07:44:37 +08:00
|
|
|
sr r0, [_ARC_V2_LP_END]
|
|
|
|
|
2016-11-08 23:36:50 +08:00
|
|
|
ld_s r13, [sp, ___isf_t_r13_OFFSET]
|
|
|
|
ld_s r12, [sp, ___isf_t_r12_OFFSET]
|
|
|
|
ld r11, [sp, ___isf_t_r11_OFFSET]
|
|
|
|
ld r10, [sp, ___isf_t_r10_OFFSET]
|
|
|
|
ld r9, [sp, ___isf_t_r9_OFFSET]
|
|
|
|
ld r8, [sp, ___isf_t_r8_OFFSET]
|
|
|
|
ld r7, [sp, ___isf_t_r7_OFFSET]
|
|
|
|
ld r6, [sp, ___isf_t_r6_OFFSET]
|
|
|
|
ld r5, [sp, ___isf_t_r5_OFFSET]
|
|
|
|
ld r4, [sp, ___isf_t_r4_OFFSET]
|
|
|
|
ld_s r3, [sp, ___isf_t_r3_OFFSET]
|
|
|
|
ld_s r2, [sp, ___isf_t_r2_OFFSET]
|
|
|
|
ld_s r1, [sp, ___isf_t_r1_OFFSET]
|
|
|
|
ld_s r0, [sp, ___isf_t_r0_OFFSET]
|
2015-04-11 07:44:37 +08:00
|
|
|
|
boards: Update arc em_starterkit support from 2.2 to 2.3
Here are the main changes:
* board: Update EMSK onboard resources such as Button, Switch and LEDs
+ update soc.h for em7d, em9d, em11d
+ update board.h for em_starterkit board
* arc: Add floating point support and code density support
+ add kconfig configuration
+ add compiler options
+ add register definitions, marcos, assembly codes
+ fixes in existing codes and configurations.
* arc: Update detailed board configurations for cores of emsk 2.3
* script: Provide arc_debugger.sh for debugging em_starterkit board
+ make BOARD=em_starterkit debug
This will start openocd server for emsk, and arc gdb will connect
to this debug server, user can run `continue` command if user just
want to run the application, or other commands if debugging needed.
+ make BOARD=em_starterkit debugserver
This will start an openocd debugger server for emsk, and user can
connect to this debugserver using arc gdb and do what they want to.
+ make BOARD=em_starterkit flash
This will download the zephyr application elf file to emsk,
and run it.
Signed-off-by: Huaqi Fang <huaqi.fang@synopsys.com>
2017-05-17 15:18:51 +08:00
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
/*
|
|
|
|
* All gprs have been reloaded, the only one that is still usable is
|
|
|
|
* ilink.
|
|
|
|
*
|
|
|
|
* The pc and status32 values will still be on the stack. We cannot
|
|
|
|
* pop them yet because the callers of _pop_irq_stack_frame must reload
|
2016-11-01 21:07:34 +08:00
|
|
|
* status32 differently depending on the execution context they are
|
|
|
|
* running in (_Swap(), firq or exception).
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
2016-11-08 23:36:50 +08:00
|
|
|
add_s sp, sp, ___isf_t_SIZEOF
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
.endm
|
|
|
|
|
|
|
|
#endif /* _ASMLANGUAGE */
|
2016-01-23 01:38:49 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#endif /* _SWAP_MACROS__H_ */
|