Skip to content

Commit

Permalink
arm/armv8-r: fix armv8 build error without neon
Browse files Browse the repository at this point in the history
Fix the build error:
armv8-r/arm_vectors.S:205:Error: VFP single precision
register expected -- `vstmdb.64 sp!,{d16-d31}'
armv8-r/arm_vectors.S:242:Error: VFP single precision
register expected -- `vldmia.64 r0!,{d16-d31}'

Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
  • Loading branch information
jinliangli authored and hujun260 committed Sep 27, 2024
1 parent 0bf2c9c commit 719150e
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 340 deletions.
4 changes: 2 additions & 2 deletions arch/arm/src/armv8-r/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ ARCHCPUFLAGS += -march=armv8-r
ifeq ($(CONFIG_ARCH_FPU),y)
LLVM_ABITYPE := eabihf

ifeq ($(CONFIG_ARCH_CORTEXR52)$(CONFIG_ARM_NEON),yy)
ifeq ($(CONFIG_ARM_NEON),y)
ARCHCPUFLAGS += -mfpu=neon-fp-armv8
else
ARCHCPUFLAGS += -mfpu=fpv5-sp-d16
ARCHCPUFLAGS += -mfpu=fp-armv8
endif
ifeq ($(CONFIG_ARM_FPU_ABI_SOFT),y)
ARCHCPUFLAGS += -mfloat-abi=softfp
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/cmake/armv8-r.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ endif()

if(CONFIG_ARCH_FPU)

if(CONFIG_ARCH_CORTEXR52 AND CONFIG_ARM_NEON)
if(CONFIG_ARM_NEON)
list(APPEND PLATFORM_FLAGS -mfpu=neon-fp-armv8)
else()
list(APPEND PLATFORM_FLAGS -mfpu=fpv5-sp-d16)
list(APPEND PLATFORM_FLAGS -mfpu=fp-armv8)
endif()
if(CONFIG_ARM_FPU_ABI_SOFT)
list(APPEND PLATFORM_FLAGS -mfloat-abi=softfp)
Expand Down
7 changes: 0 additions & 7 deletions arch/xtensa/src/common/xtensa.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@
#define IDLETHREAD_STACKSIZE ((CONFIG_IDLETHREAD_STACKSIZE + 15) & ~15)
#define IDLETHREAD_STACKWORDS (IDLETHREAD_STACKSIZE >> 2)

/* In the Xtensa model, the state is saved in stack,
* only a reference stored in TCB.
*/

#define xtensa_savestate(regs) ((regs) = up_current_regs())
#define xtensa_restorestate(regs) up_set_current_regs(regs)

/* Context switching via system calls ***************************************/

#define xtensa_context_restore(regs)\
Expand Down
12 changes: 2 additions & 10 deletions arch/xtensa/src/common/xtensa_cpupause.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ int up_cpu_paused_save(void)
sched_note_cpu_paused(tcb);
#endif

/* Save the current context at current_regs into the TCB at the head
* of the assigned task list for this CPU.
*/

xtensa_savestate(tcb->xcp.regs);
UNUSED(tcb);

return OK;
}
Expand Down Expand Up @@ -186,11 +182,7 @@ int up_cpu_paused_restore(void)

nxsched_resume_scheduler(tcb);

/* Then switch contexts. Any necessary address environment changes
* will be made when the interrupt returns.
*/

xtensa_restorestate(tcb->xcp.regs);
UNUSED(tcb);

return OK;
}
Expand Down
22 changes: 13 additions & 9 deletions arch/xtensa/src/common/xtensa_irqdispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs)
{
struct tcb_s *tcb = this_task();

#ifdef CONFIG_SUPPRESS_INTERRUPTS
board_autoled_on(LED_INIRQ);
PANIC();
Expand All @@ -62,15 +64,23 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs)

up_set_current_regs(regs);

if (irq != XTENSA_IRQ_SWINT)
{
/* we are not trigger by syscall */

tcb->xcp.regs = regs;
}

/* Deliver the IRQ */

irq_dispatch(irq, regs);
tcb = this_task();

/* Check for a context switch. If a context switch occurred, then
* current_regs will have a different value than it did on entry.
*/

if (regs != up_current_regs())
if (regs != tcb->xcp.regs)
{
#ifdef CONFIG_ARCH_ADDRENV
/* Make sure that the address environment for the previously
Expand All @@ -92,14 +102,8 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs)
* crashes.
*/

g_running_tasks[this_cpu()] = this_task();
}

/* Restore the cpu lock */

if (regs != up_current_regs())
{
regs = up_current_regs();
g_running_tasks[this_cpu()] = tcb;
regs = tcb->xcp.regs;
}

/* Set current_regs to NULL to indicate that we are no longer in an
Expand Down
Loading

0 comments on commit 719150e

Please sign in to comment.