Enabling FPU results in erroneous assembly (Cortex-M4F)
Hi,
I guess I encountered a bug that exists since version 4.9, but so far I am having issues to create a minimal example that reproduces the error. Maybe one of you guys is better with compiler debugging than me and can give me some advice ;)
What I want to to:
I am developing code for an STM32F405 (Cortex-M4F) using ChibiOS (kernel 3.1.x of branch stable_16.1.x) and want to make use of the hardware floating point unit (-mfloat-abi=hard -mfpu=fpv4-sp-d16). When compiling my code with arm-none-
What the assembly says:
I had a brief look at the generated assembly code and found an interesting difference at the very beginning. Here are four examples of the first assembly lines:
GCC 4.8.3 no FPU:
0: e92d 43f0 stmdb sp!, {r4, r5, r6, r7, r8, r9, lr}
4: b083 sub sp, #12
GCC 4.8.3 with FPU:
0: e92d 43f0 stmdb sp!, {r4, r5, r6, r7, r8, r9, lr}
4: ed2d 8b02 vpush {d8}
8: b083 sub sp, #12
GCC 5.4.1 no FPU
0: e92d 43f0 stmdb sp!, {r4, r5, r6, r7, r8, r9, lr}
4: b083 sub sp, #12
GCC 5.4.1 with FPU:
0: b5f0 push {r4, r5, r6, r7, lr}
2: ed2d 8b02 vpush {d8}
6: b085 sub sp, #20
Seems to me as if GCC 5.4.1 generated a false 'push' instead of the 'stmdb' as the very first command. Unfortunately I can not reproduce the issue with the ChibiOS demos (no 'stmdb' is generated at all).
Since I am no expert in assembly and did never debug GCC before, I appreciate any help in this. Actually it is even possible that I messed up the compiler arguments (arm-none-eabi-g++ -c -mcpu=cortex-m4 -g -O2 -fomit-
Maybe someone can give me some advice?
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Thargon for more information if necessary.