--- /dev/null
+# use glob syntax.\r
+syntax: glob\r
+\r
+*.d\r
+*.o\r
+*.elf\r
+*.map\r
+*.hex\r
+*.bak\r
+*~\r
+\r
+# switch to regexp syntax.\r
+syntax: regexp\r
+^.*obj_.*\.[h|c|s]\r
+\r
+\r
\r
/* Includes ------------------------------------------------------------------*/\r
#include "misc.h"\r
+
+#define assert_param(expr) ((void)0)
\r
/** @addtogroup STM32F10x_StdPeriph_Driver\r
* @{\r
SysTick_Config(period_ticks);
+ /* Set SysTick Priority to 3 */
+ NVIC_SetPriority(SysTick_IRQn, 0x0C);
+
#if 0
// SysTick interrupt each 250ms with counter clock equal to 9MHz
if (SysTick_Config((SystemFrequency / 8) / 4)) {
#include "arch_offset.h"\r
#include "stm32f10x.h"\r
#include "core_cm3.h"\r
+#include "arch.h"
\r
/**\r
* Function make sure that we switch to supervisor mode(rfi) before\r
context[VGPR_LR_OFF/4] = (uint32_t)os_proc_start_extended;\r
} else if( pcb->proc_type == PROC_BASIC ) {\r
context[VGPR_LR_OFF/4] = (uint32_t)os_proc_start_basic;\r
- }\r
+ }
+ os_arch_stack_set_endmark(pcb);\r
// os_arch_setup_context_asm(pcb->stack.curr,NULL);\r
}\r
\r
*\r
*/\r
.global os_arch_swap_context\r
- .type os_arch_swap_context_to, %function\r
+ .type os_arch_swap_context, %function\r
os_arch_swap_context:\r
- mov r0, sp\r
+// mov r2, sp\r
push {r4-r8,r10,r11,lr}\r
\r
// Store c-frame\r
\r
mov.w r4,#SC_PATTERN\r
str r4,[sp,#C_CONTEXT_OFFS]\r
- str r0,[sp,#C_SP_OFF]\r
+// str r2,[sp,#C_SP_OFF]\r
// ---> We have saved NVGPR+C\r
\r
// store old stack for old task\r
- str sp,[r0,#PCB_STACK_CURR_P]\r
+ mov.w r4,sp\r
+ str r4,[r0,#PCB_STACK_CURR_P]\r
\r
// R1 - new PCB\r
.global os_arch_swap_context_to\r
\r
// Get stack for new task\r
ldr r2,[r1,#PCB_STACK_CURR_P]\r
- msr msp,r2\r
+// msr msp,r2\r
+ mov.w sp,r2\r
+ \r
\r
// TODO: Fix this for all arch's..call pre,post hooks. Done here or after?\r
// Set new current pcb\r
\r
os_lc_restore:\r
add.w sp,sp,#C_SIZE\r
- pop {lr,r11,r10,r8,r7,r6,r5,r4}\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
#include "hooks.h"
#include "swap.h"
#include "stm32f10x.h"
+#include "misc.h"
#include "int_ctrl.h"
extern void * intc_vector_tbl[NUMBER_OF_INTERRUPTS_AND_EXCEPTIONS];
*/
void IntCtrl_AttachIsr2(TaskType tid,void *int_ctrl,uint32_t vector ) {
pcb_t *pcb;
+ NVIC_InitTypeDef irqInit;
+
+ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
+
+ irqInit.NVIC_IRQChannel = vector;
+ irqInit.NVIC_IRQChannelPreemptionPriority = 4;
+ irqInit.NVIC_IRQChannelSubPriority = 4;
+ irqInit.NVIC_IRQChannelCmd = ENABLE;
pcb = os_find_task(tid);
// TODO: Same as for AttachIsr1
-
+ NVIC_Init(&irqInit);
}
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
+build-exe-y = tiny.elf\r
+build-hex-y = tiny.hex\r
+\r
+\r
+\r
\r
\r
\r
\r
comma = ,\r
empty = \r
-space = $(empty) $(empty) \r
+space = $(empty) $(empty)\r
\r
# Note!\r
# Libs related to GCC(libgcc.a, libgcov.a) is located under \r
# lib/gcc/<machine>/<version>/<multilib>\r
# Libs related to the library (libc.a,libm.a,etc) are under:\r
# <machine>/lib/<multilib>\r
-gcc_lib_path := "$(subst /libgcc.a,,$(shell $(CC) $(CFLAGS) --print-libgcc-file-name $(conv_path)))"\r
-#$(error $(gcc_lib_path)) \r
-lib_lib_path := "$(subst /libc.a,,$(shell $(CC) $(CFLAGS) --print-file-name\=libc.a $(conv_path)))"\r
+\r
+# It seems some versions of make want "\=" and some "="\r
+# "=" - msys cpmake on windows 7 \r
+gcc_lib_path := "$(subst /libgcc.a,,$(shell $(CC) $(CFLAGS) --print-libgcc-file-name))" \r
+lib_lib_path := "$(subst /libc.a,,$(shell $(CC) $(CFLAGS) --print-file-name=libc.a))"\r
libpath-y += -L$(lib_lib_path)\r
libpath-y += -L$(gcc_lib_path)\r
# ---------------------------------------------------------------------------\r
@echo $(MOD) ${def-y}\r
\r
# build- targets are "end" target that the included makefile want's to build\r
-all: $(build-lib-y) $(build-exe-y)\r
+all: $(build-lib-y) $(build-exe-y) $(build-hex-y)\r
\r
# Determine what kind of filetype to build from \r
VPATH += $(ROOTDIR)/$(SUBDIR)/src\r
# PP Assembler \r
#.SECONDARY %.s:\r
\r
-%.s: %.S\r
- @echo " >> CPP $(notdir $<)"\r
- $(Q)$(CPP) -o $@ $(addprefix -I ,$(inc-y)) $(addprefix -D,$(def-y)) $<\r
-\r
-%.s: %.ps\r
+%.s: %.sx\r
@echo " >> CPP $(notdir $<)"\r
$(Q)$(CPP) -x assembler-with-cpp -o $@ $(addprefix -I ,$(inc-y)) $(addprefix -D,$(def-y)) $<\r
\r
@echo " >> AR $@" \r
$(Q)$(AR) -r -o $@ $(obj-y) 2> /dev/null\r
\r
+$(build-hex-y): $(build-exe-y)\r
+ @echo " >> OBJCOPY $@" \r
+ $(Q)$(CROSS_COMPILE)objcopy -O ihex $< $@\r
+\r
# Could use readelf -S instead of parsing the *.map file.\r
$(build-exe-y): $(obj-y) $(sim-y) $(libitem-y) \r
@echo " >> LD $@"\r
dep-y += asm_offset.h\r
dep-y += kernel_offset.h\r
dep-$(CFG_ARM_CM3) += arch_offset.h\r
+obj-$(CFG_ARM_CM3) += misc.o\r
+\r
\r
# ARM assembler generates "define STACK_APA $12". The extra '$' we want to go.\r
# Assembler offsets\r
\r
do config save \r
do flash open\r
- data.load.elf &cfg_loadfile_g c /CYGDRIVE /GNU \r
+ data.load.elf &cfg_loadfile_g /CYGDRIVE /GNU \r
do flash close\r
print "&cfg_loadfile_g"\r
\r
\r
\r
\r
+\r
\r
\r