FPU-related code in SB.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13000 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2019-09-19 06:12:53 +00:00
parent 4430e2c8a1
commit af38956b67
5 changed files with 18 additions and 5 deletions

View File

@ -66,7 +66,7 @@ endif
# Enables the use of FPU (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = no
USE_FPU = hard
endif
# FPU-related options.

View File

@ -720,6 +720,8 @@
/* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/
#define PORT_USE_SYSCALL TRUE
#endif /* CHCONF_H */
/** @} */

View File

@ -33,7 +33,7 @@
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;xPSR-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;r2-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;r1-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;r0-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;s_psp-port_unprivileged_jump-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;s_psp-SVC_Handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;psp-SVC_Handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;psp-SVC_Handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;s_psp-SVC_Handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;s_psp-port_unprivileged_jump-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;r0-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;r1-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;r2-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;xPSR-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;globalVariableList/&gt;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList&gt;&#10;&lt;memoryBlockExpressionItem&gt;&#10;&lt;expression text=&quot;0x20000300&quot;/&gt;&#10;&lt;/memoryBlockExpressionItem&gt;&#10;&lt;/memoryBlockExpressionList&gt;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>

View File

@ -166,7 +166,7 @@ void SVC_Handler(void) {
newctxp->pc = (uint32_t)port_syscall;
newctxp->xpsr = 0x01000000U;
#if CORTEX_USE_FPU == TRUE
newctxp->fpscr = (regarm_t)FPU->FPDSCR;
newctxp->fpscr = FPU->FPDSCR;
#endif
}
else
@ -362,7 +362,7 @@ void _port_irq_epilogue(void) {
/* Setting up a fake XPSR register value.*/
ectxp->xpsr = 0x01000000U;
#if CORTEX_USE_FPU == TRUE
ectxp->fpscr = (regarm_t)FPU->FPDSCR;
ectxp->fpscr = FPU->FPDSCR;
#endif
/* Writing back the modified S-PSP value.*/

View File

@ -29,6 +29,8 @@
/* Module constants. */
/*===========================================================================*/
#define FPU 0xE000EF30
/*===========================================================================*/
/* Module pre-compile time settings. */
/*===========================================================================*/
@ -114,8 +116,12 @@ UsageFault_Handler:
/* This thread is going to die so going back on
S-PSP and working safely from there.*/
bl port_get_s_psp
sub.w r0, r0, #32 // TODO: FPU
#if CORTEX_USE_FPU
sub.w r0, r0, #104
#else
sub.w r0, r0, #32
msr PSP, r0
#endif
/* Forcing return on exit syscall code with PSR
value as exit message.*/
@ -125,6 +131,11 @@ UsageFault_Handler:
str r2, [r0, #24]
ldr r2, =0x01000000
str r2, [r0, #28]
#if CORTEX_USE_FPU
ldr r2, =FPU
ldr r2, [r2, #12] /* FPDSCR*/
str r2, [r0, #96] /* port_extctx.fpscr */
#endif
/* Back to privileged mode.*/
mrs r3, CONTROL