From 5fd1213e73275d57489f879d5841e3ba3b8ab43f Mon Sep 17 00:00:00 2001 From: xuzhuoyi Date: Mon, 3 Sep 2018 21:39:56 +0800 Subject: [PATCH] [bsp][tms320f28379d] __rt_ffs() problem caused by 16-bit int --- bsp/tms320f28379d/rtconfig.h | 5 ++--- libcpu/c28x/context.s | 1 + libcpu/c28x/cpuport.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bsp/tms320f28379d/rtconfig.h b/bsp/tms320f28379d/rtconfig.h index 5fafc1da5e..b88a49d3d2 100644 --- a/bsp/tms320f28379d/rtconfig.h +++ b/bsp/tms320f28379d/rtconfig.h @@ -8,10 +8,9 @@ #define RT_NAME_MAX 8 #define RT_ALIGN_SIZE 4 -#define RT_THREAD_PRIORITY_32 -#define RT_THREAD_PRIORITY_MAX 32 +#define RT_THREAD_PRIORITY_MAX 16 #define RT_TICK_PER_SECOND 100 -#define RT_USING_OVERFLOW_CHECK +//#define RT_USING_OVERFLOW_CHECK #define RT_USING_HOOK #define RT_IDEL_HOOK_LIST_SIZE 4 #define IDLE_THREAD_STACK_SIZE 1024 diff --git a/libcpu/c28x/context.s b/libcpu/c28x/context.s index 9efec09fb2..020325e126 100644 --- a/libcpu/c28x/context.s +++ b/libcpu/c28x/context.s @@ -164,6 +164,7 @@ switch_to_thread: ;#endif MOV @SP, AR1 + INC SP RT_CTX_RESTORE ; pop r4 - r11 register rtosint_exit: diff --git a/libcpu/c28x/cpuport.c b/libcpu/c28x/cpuport.c index 720bb01776..2300eb0e9c 100644 --- a/libcpu/c28x/cpuport.c +++ b/libcpu/c28x/cpuport.c @@ -79,6 +79,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, stack_frame->exception_stack_frame.dp_st1 = (0x00000000) | rt_hw_get_st1(); /* dp_st1 */ stack_frame->exception_stack_frame.dbgstat_ier = 0; /* dbgstat_ier */ stack_frame->exception_stack_frame.return_address = (unsigned long)tentry; /* return_address */ + stack_frame->rpc = (unsigned long)texit; /* return task's current stack address */ return stk + sizeof(struct stack_frame);