Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion libcpu/arm/cortex-a/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
rt_uint8_t *stack_addr, void *texit)
{
rt_uint32_t *stk;
#ifdef RT_USING_FPU
rt_uint32_t i;
#endif

stack_addr += sizeof(rt_uint32_t);
stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
Expand Down Expand Up @@ -61,7 +64,25 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
*(--stk) = 0; /* user sp*/
#endif
#ifdef RT_USING_FPU
*(--stk) = 0; /* not use fpu*/
/* 1. D0-D15 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

既然前面是赋值成0,那么使用memset设置到0吧。前面的i变量报错,是当FPU不定义时,i变量没使用,报警告了。(目前ci检查是非常严格的,警告做为错误处理)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已提交。给变量i添加了宏定义

for (i = 0; i <= 15; i++)
{
*(--stk) = 0x00000000;
*(--stk) = 0x00000000;
}

/* 2. D16-D31 */
for (i = 16; i <= 31; i++)
{
*(--stk) = 0x00000000;
*(--stk) = 0x00000000;
}

/* 3. FPSCR */
*(--stk) = 0x00000000;

/* 4. FPEXC: EN=1 */
*(--stk) = 0x40000000;
#endif

/* return task's current stack address */
Expand Down