Использую контроллер STM32F103.
Без операций с float все нормально работает. Как только начинается использование плавающей точки программа уходит в HardFault_Handler.
Причем это происходит в самой простейшей операции преобразования uint32_t в float, на вызове __aeabi_ui2f все заканчивается.
В чем причина?
GCC ARM, Cortex-M3 и float
- Реклама
Re: GCC ARM, Cortex-M3 и float
Пытается запустить FPU ?
Похоже что то в настройках проекта или либы math /
ЗЫ Гыыыы читай https://my.st.com/public/STe2ecommuniti ... views=2580

The library installer contains prebuilt versions of the libraries in the Lib folder.
arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
arm_cortexM4l_math.lib (Little endian on Cortex-M4)
arm_cortexM4b_math.lib (Big endian on Cortex-M4)
arm_cortexM3l_math.lib (Little endian on Cortex-M3)
arm_cortexM3b_math.lib (Big endian on Cortex-M3)
arm_cortexM0l_math.lib (Little endian on Cortex-M0)
arm_cortexM0b_math.lib (Big endian on Cortex-M3)
The library functions are declared in the public file arm_math.h which is placed in the Include folder. Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single public header file arm_math.h for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants. Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
ЗЫ Гыыыы читай https://my.st.com/public/STe2ecommuniti ... views=2580
ЗЫ2 Ох уж эти гнутые компили, все не как у людей.Perhaps you should #include <math.h>, and provide the linker with the correct path (-L) to the libraries you need.
I think you need to be looking for libm.a in the lib/thumb2 directory (ie appropriate for the STM32) for your tools.
http://www.network-theory.co.uk/docs/gc ... ro_17.html
Re: GCC ARM, Cortex-M3 и float
Да, точно, проблема в настройках проекта
В самом начале указал неправильный флаг, а затем изменил путь поиска libgcc.a.
Потом флаг поставил правильный, а про libgcc.a забыл.
Все заработало! Спасибо!
В самом начале указал неправильный флаг, а затем изменил путь поиска libgcc.a.
Потом флаг поставил правильный, а про libgcc.a забыл.
Все заработало! Спасибо!
- IfoR
- Поставщик валерьянки для Кота
- Сообщения: 2029
- Зарегистрирован: Сб ноя 15, 2008 10:09:56
- Откуда: г. Тула
- Контактная информация:
Re: GCC ARM, Cortex-M3 и float
Кстати, у меня аналогичный случай. Только я не разбирался особо что там происходит.
Re: GCC ARM, Cortex-M3 и float
Подскажите, пожалуйста - coocox, gcc48, printf("%x.yf" , flt) не выводит?
- Реклама
Re: GCC ARM, Cortex-M3 и float
pixar, не выводит куда? Почитай хоть для приличия с чем, с какими протоками работает printf
Вкратце - надо переопределять поток вывода printf на USART ...
Вкратце - надо переопределять поток вывода printf на USART ...
Re: GCC ARM, Cortex-M3 и float
я вроде написал достаточно ясно - встроенный printf из coocox не выводит по спецификатору %f .
fputc настроен куда нужно , вывод по %d без проблем.
fputc настроен куда нужно , вывод по %d без проблем.



