2014-06-24 01:52 PM
I've started trying to use software floating point with the STM32F205.
I'm sure this has to do with the Yagarto/GCC toolchain, but I'm hoping someone can give me some ideas as to what might be going wrong. At this point, I'm simply trying to multiply to #s, ie. printf( ''got here 1'' ); float x = 2.0f; printf( ''got here 2'' ); float y; printf( ''got here 3'' ); y = x * 4.0f; printf( ''got here 4'' ); I get a hard fault before the ''got here 4'' line prints. The dump shows that PC and LR are pointing to locations in the above routine (not sure exactly where). Never did get the debugging working. These are my compiler settings: -Wstrict-prototypes -Werror=return-type -Wformat -Wmissing-format-attribute -fno-common -std=gnu99 -mcpu=cortex-m3 -mfloat-abi=soft -mthumb and these are my linker settings -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -msoft-float I increased my stack size 4 times normal. The map file shows that _arm_addsubsf3.o, _arm_muldivsf3.o, etc are included with the routines __subsf3, __addsf3, __mulsf3, __aeabi_fmul, __aeabi_fsub, __aeabi_fadd, etc. Though, for some reason, the double versions appear to be included as well. I know this should not be difficult, but I've run out of ideas. Any thoughts will be appreciated! Vance2014-06-26 10:44 AM
Thanks for giving this a try Clive!
I tried your code and it is hard faulting in the same manner. What compiler & linker settings did you use? mine are compiler: -Wstrict-prototypes -fno-common -std=gnu99 -g -mthumb -mcpu=cortex-m3 -mfloat-abi=soft -ggdb3 -fno-exceptions -fverbose-asm -ffunction-sections -fdata-sections -gdwarf-2 and linker -Wl,-Map=%TARGET_OUTPUT_DIR%%TARGET_OUTPUT_BASENAME%.map,--cref,--no-warn-mismatch -Wl,--gc-sections -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -nostartfiles -T./stm32f205zc_flash.ld -g I tried swapping the printf( %f ) and the x*x and the fault occurs on the both of those statements. I verified printf works when %f is not specified. Vance2014-06-26 11:22 AM
I ended up installing another toolchain (launchpad)and did not change anything else and now it works. I see that there does seem to be a new version of Yagarto. I'll try that and report back.
EDIT: Sorry, I do seem to have the latest version 20121222! Vance2014-06-26 01:08 PM
I compiled the original (BIG) project with the Launchpad toolchain and floating point now works! The new toolchain is a little more strict, but that is good 😉
So, it seems that either there is an issue with Yagarto or my settings (which I did not change for Launchpad) were not compatible. Thanks for all the help! If there are any additional things I could try with Yagarto, please let me know. It is not difficult to switch between toochains and may be important to others. Vance2014-06-26 01:15 PM
I'm using the 4.7.2 Yagarto for this, straight out of the box.
I've built and tested it with the makefile, I don't specify the float abi, the cpu/arch selection should be sufficient.Compiling file: main.c
arm-none-eabi-gcc -c -mcpu=cortex-m3 -mthumb -Os -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wextra -std=gnu89 -g -ggdb3 -fverbose-asm -Wa,-ahlms=out/main.lst -DUSE_STDPERIPH_DRIVER -DSTM32F2XX -DHSE_VALUE=16000000 -MD -MP -MF out/main.d -I. -Iinc main.c -o out/main.o
2014-06-26 05:14 PM
Clive,
Not sure why yours work and mine doesn't. Can you zip up the files that comprise your test a make them available to me? I'll download a fresh copy of Yagarto and see if I can see your setup work. If so, I'll start trading in my stuff in place of your stuff until things start failing.. Vance2014-06-26 05:43 PM
Can you zip up the files that comprise your test a make them available to me?
Was attached to earlier post, basically just have a batch file pointing to the Yagarto compiler and tools, and can run make from the command line. The comments on the front end of main point to the tools I used. I did have issues with 4.7.1, but 4.6.2 and 4.7.2 and several others have been without problems.2014-06-28 09:40 AM
Thanks to all who helped me figure this problem out!
Clive1, I installed your demo and switched the toolchain back to Yagarto and your example work, as expected. I systematically replaced your support files and rebuilt the project each time and tested. It always worked! When done, there was only your main.* files left. One thing I had noticed was that the library ...\thumb\v7m was always referenced for the toolchain libraries where most of the references in my main project were to the ...\thumb library, only occasionally to the v7m version.. Turned out that I had specified that library as a place that the linker should resolve default routines. I removed that reference and floating point started working! So, it turned out to be my fault, as usual 😉 Thanks again for your help! Vance P.S. is there a way to flag this subject as resolved?2014-06-29 04:01 AM
P.S. is there a way to flag this subject as resolved?
The forum software is a bit lacking, you can edit the title of the thread and add [Solved] or something, but you can't technically close it. Your response is actually sufficient to do the job.