Division operation in Cortex-M0
Greetings to all,
I have encountered a problem with the division operation using Cortex-M0. More precisely - it just doesn't work. And as soon as program detects a division operation, Cortex-M0 starts the HardFault Handler procedure. I'm sure this is nothing serious and maybe it just happened because I haven't set the correct linking/compiling options. But I just can't find any solution to that. In fact, disassembling the line with the division operation has shown to me that at some point a function "_aeabi_
Thank you for your help in advance.
P.S. I'm using "gcc-arm-
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- knauf
- Solved:
- 2013-08-06
- Last query:
- 2013-08-06
- Last reply:
- 2013-08-06
Joey Ye (jinyun-ye) said : | #1 |
The correct function to call is __aeabi_uidiv. It could be caused by incorrect compiler/linker options. Can you please share your complete compiler and linker command line?
- Joey
knauf (kaizer-rtk) said : | #2 |
Thank you for your reply Joey. Here is the list of options that I'm using:
1) compiler options: -g -mthumb -Wstrict-prototypes -fverbose-asm -mcpu=cortex-m0
2) linker options: -nostartfiles -mthumb -T linker_file.ld
Joey Ye (jinyun-ye) said : | #3 |
Knauf,
You must also include -mcpu=cortex-m0 in your linker command line, to let
it link libraris for cortex-m0. Or otherwise it links to default library
which doesn't work on cortex-m0. Actually the recommended Makefile is to
include the whole compiler flags into linker command line.
Please try it to see if problem solved.
Joey
On Tue, Aug 6, 2013 at 2:26 PM, knauf
<email address hidden>wrote:
> Question #233519 on GCC ARM Embedded changed:
> https:/
>
> knauf posted a new comment:
> Thank you for your reply Joey. Here is the list of options that I'm using:
> 1) compiler options: -g -mthumb -Wstrict-prototypes -fverbose-asm
> -mcpu=cortex-m0
> 2) linker options: -nostartfiles -mthumb -T linker_file.ld
>
> --
> You received this question notification because you are an answer
> contact for GCC ARM Embedded.
>
knauf (kaizer-rtk) said : | #4 |
Joey,
I did what you asked and it worked. Thank you very much for your help! I feel so stupid right now. :) I thought it is enough to pass this option to compiler.