]> git.sur5r.net Git - openocd/commitdiff
Added FPU support for ChibiOS/RT
authorChristian Gudrian <christian.gudrian@gmx.de>
Fri, 24 Oct 2014 21:22:40 +0000 (23:22 +0200)
committerSpencer Oliver <spen@spen-soft.co.uk>
Mon, 24 Nov 2014 22:22:11 +0000 (22:22 +0000)
When an enabled FPU is detected we now use an appropriate stacking.

Change-Id: I1b0f43ec22e1c55c4f10e2ffa97d4aaa77bca5ee
Signed-off-by: Christian Gudrian <christian.gudrian@gmx.de>
Reviewed-on: http://openocd.zylin.com/2354
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/rtos/ChibiOS.c
src/rtos/rtos_chibios_stackings.c
src/rtos/rtos_chibios_stackings.h

index da5dc9fc22b0d5d5acbaa0e89740c29608a73140..cd77f2ae76d7b76e842351864b2049a5d13976b2 100644 (file)
@@ -264,11 +264,9 @@ static int ChibiOS_update_stacking(struct rtos *rtos)
                        /* Check if CP10 and CP11 are set to full access.
                         * In ChibiOS this is done in ResetHandler() in crt0.c */
                        if (cpacr & 0x00F00000) {
-                               /* Found target with enabled FPU */
-                               /* FIXME: Need to figure out how to specify the FPU registers */
-                               LOG_ERROR("ChibiOS ARM v7m targets with enabled FPU "
-                                                 " are NOT supported");
-                               return -1;
+                               LOG_DEBUG("Enabled FPU detected.");
+                               param->stacking_info = &rtos_chibios_arm_v7m_stacking_w_fpu;
+                               return 0;
                        }
                }
 
index 0b5d0632d59c74d6c025bf2032180aabbd7b9ccc..ed485616d3ba16401a82ba38e24446a95be9ddd8 100644 (file)
@@ -55,3 +55,31 @@ const struct rtos_register_stacking rtos_chibios_arm_v7m_stacking = {
        0,                                              /* stack_alignment */
        rtos_chibios_arm_v7m_stack_offsets      /* register_offsets */
 };
+
+static const struct stack_register_offset rtos_chibios_arm_v7m_stack_offsets_w_fpu[ARMV7M_NUM_CORE_REGS] = {
+       { -1,   32 },           /* r0   */
+       { -1,   32 },           /* r1   */
+       { -1,   32 },           /* r2   */
+       { -1,   32 },           /* r3   */
+       { 0x40, 32 },           /* r4   */
+       { 0x44, 32 },           /* r5   */
+       { 0x48, 32 },           /* r6   */
+       { 0x4c, 32 },           /* r7   */
+       { 0x50, 32 },           /* r8   */
+       { 0x54, 32 },           /* r9   */
+       { 0x58, 32 },           /* r10  */
+       { 0x5c, 32 },           /* r11  */
+       { -1,   32 },           /* r12  */
+       { -2,   32 },           /* sp   */
+       { -1,   32 },           /* lr   */
+       { 0x60, 32 },           /* pc   */
+       { -1,   32 },           /* xPSR */
+};
+
+const struct rtos_register_stacking rtos_chibios_arm_v7m_stacking_w_fpu = {
+       0x64,                                                                           /* stack_registers_size */
+       -1,                                                                                     /* stack_growth_direction */
+       ARMV7M_NUM_CORE_REGS,                                           /* num_output_registers */
+       0,                                                                                      /* stack_alignment */
+       rtos_chibios_arm_v7m_stack_offsets_w_fpu        /* register_offsets */
+};
index b5eea647b12fd88385b695c606c6c0d5efc236be..8ba2a6ca39cdccda62ecf9e3c7f6c0f2fac62041 100644 (file)
@@ -28,5 +28,6 @@
 #include "rtos.h"
 
 extern const struct rtos_register_stacking rtos_chibios_arm_v7m_stacking;
+extern const struct rtos_register_stacking rtos_chibios_arm_v7m_stacking_w_fpu;
 
 #endif /* ifndef INCLUDED_RTOS_CHIBIOS_STACKINGS_H_ */