diff --git a/arch/arc/arcem/port_s.s b/arch/arc/arcem/port_s.s index 7918c93e..5609507c 100644 --- a/arch/arc/arcem/port_s.s +++ b/arch/arc/arcem/port_s.s @@ -11,7 +11,6 @@ .global k_curr_task .global k_next_task -.global g_exc_nest_count .global g_context_switch_reqflg .global tos_knl_irq_enter @@ -142,9 +141,9 @@ exc_entry_cpu: mov blink, sp mov r3, sp /* as exception handler's para(p_excinfo) */ - ld r0, [g_exc_nest_count] + ld r0, [k_irq_nest_cnt] add r1, r0, 1 - st r1, [g_exc_nest_count] + st r1, [k_irq_nest_cnt] brne r0, 0, exc_handler_1 /* change to exception stack if interrupt happened in task context */ mov sp, _e_stack @@ -166,7 +165,7 @@ exc_handler_1: /* interrupts are not allowed */ ret_exc: POP sp - mov r1, g_exc_nest_count + mov r1, k_irq_nest_cnt ld r0, [r1] sub r0, r0, 1 st r0, [r1] @@ -233,9 +232,9 @@ exc_entry_int: mov blink, sp clri /* disable interrupt */ - ld r3, [g_exc_nest_count] + ld r3, [k_irq_nest_cnt] add r2, r3, 1 - st r2, [g_exc_nest_count] + st r2, [k_irq_nest_cnt] seti /* enable higher priority interrupt */ brne r3, 0, irq_handler_1 @@ -279,7 +278,7 @@ ret_int: clri /* disable interrupt */ POP r3 /* irq priority */ POP sp - mov r1, g_exc_nest_count + mov r1, k_irq_nest_cnt ld r0, [r1] sub r0, r0, 1 st r0, [r1] diff --git a/arch/arc/common/tos_cpu.c b/arch/arc/common/tos_cpu.c index 5ab6fe3f..8c05fd38 100644 --- a/arch/arc/common/tos_cpu.c +++ b/arch/arc/common/tos_cpu.c @@ -200,7 +200,6 @@ __KNL__ void cpu_standby_mode_enter(void) #endif /* TOS_CFG_PWR_MGR_EN */ uint32_t g_context_switch_reqflg; -uint32_t g_exc_nest_count; extern void start_r(void); diff --git a/board/ARC_NSIM_EM/hello_world/Makefile b/board/ARC_NSIM_EM/hello_world/Makefile index 8a5ab471..f66ee1f0 100644 --- a/board/ARC_NSIM_EM/hello_world/Makefile +++ b/board/ARC_NSIM_EM/hello_world/Makefile @@ -86,6 +86,7 @@ MDB_ARG_FILE := $(EMBARC_OUT_DIR)/embARC_generated/mdb.arg else COMPILER_ARG_FILE := $(EMBARC_OUT_DIR)/embARC_generated/gcc.arg LDF_FILE := $(EMBARC_OUT_DIR)/linker_gnu.ldf +NSIM_PROPS := $(EMBARC_OUT_DIR)/embARC_generated/nsim.props endif ###################################### @@ -120,7 +121,7 @@ PREFIX = CC = $(PREFIX)ccac AS = $(PREFIX)ccac -SZ = $(PREFIX)size +SZ = $(PREFIX)sizeac OBJCOPY = $(PREFIX)elf2bin ELF2HEX = $(PREFIX)elf2hex @@ -129,7 +130,16 @@ ELF2HEX_INOPT = -Q -I ELF2HEX_OUTOPT = -o ELF2BIN_OPT = else +PREFIX = arc-elf32- +CC = $(PREFIX)gcc +AS = $(PREFIX)gcc -x assembler-with-cpp +SZ = $(PREFIX)size +OBJCOPY = $(PREFIX)objcopy +ELF2HEX = $(OBJCOPY) +ELF2HEX_INOPT = -O ihex +ELF2HEX_OUTOPT = +ELF2BIN_OPT = -O binary -S endif ####################################### @@ -201,6 +211,11 @@ CFLAGS = @$(COMPILER_ARG_FILE) -Hnoccm -Hnosdata -Wincompatible-pointer-types - LDFLAGS = -Hhostlink @$(COMPILER_ARG_FILE) -Hnocopyr -Hnosdata -Hnocrt -Hldopt=-Coutput=$(BUILD_DIR)/mw_arcem.map -Hldopt=-Csections -Hldopt=-Ccrossfunc -Hldopt=-Csize -zstdout $(LDF_FILE) else +ASFLAGS = @$(COMPILER_ARG_FILE) -fdata-sections -ffunction-sections -mno-sdata -$(OLEVEL) -g $(C_DEFS) $(C_INCLUDES) -x assembler-with-cpp + +CFLAGS = @$(COMPILER_ARG_FILE) -fdata-sections -ffunction-sections -mno-sdata -$(OLEVEL) -g $(C_DEFS) $(C_INCLUDES) -std=gnu99 + +LDFLAGS = --specs=nsim.specs @$(COMPILER_ARG_FILE) -mno-sdata -nostartfiles -Wl,-M,-Map=$(BUILD_DIR)/gnu_arcem.map -lm -Wl,--script=$(LDF_FILE) endif # default action: build all all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin @@ -264,6 +279,13 @@ nsim_debug : $(BUILD_DIR)/$(TARGET).elf ####################################### # dependencies ####################################### +run : $(BUILD_DIR)/$(TARGET).elf +ifeq ($(TOOLCHAIN),mw) + mdb -nooptions -nogoifmain -toggle=include_local_symbols=1 -nsim -off=binary_stdin -off=binary_stdout -on=load_at_paddr -on=reset_upon_restart -off=flush_pipe -off=cr_for_more -OKN @$(MDB_ARG_FILE) -run $< +else + nsimdrv -p nsim_emt=1 -propsfile $(NSIM_PROPS) $< +endif + -include $(wildcard $(BUILD_DIR)/*.d) # *** EOF *** \ No newline at end of file