Skip to content
This repository was archived by the owner on Sep 5, 2020. It is now read-only.

Commit f375653

Browse files
committed
Update version to June 2020.
Add Example code/
1 parent 8b2afd5 commit f375653

File tree

157 files changed

+127274
-282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+127274
-282
lines changed

.idea/STM32-FreeRTOS-float.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 224 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
# Configuring STM32 to work with float and double (converting values ​​to char type) under FreeRTOS.
1+
# Configuring STM32 to work with float and double (converting values to char type) under FreeRTOS use printf, sprintf, snprintf.
22

33
If you use standard tools for converting float and double to char type such as printf, sprintf, snprintf, then when you run these conversions under FreeRTOS and using the GNU Arm Embedded Toolchain (https://developer.arm.com/tools-and-software/ open-source-software / developer-tools / gnu-toolchain / gnu-rm) the microcontroller hangs and a Hard Fault error occurs.
44
According to research on this topic http://www.nadler.com/embedded/newlibAndFreeRTOS.html, this error is associated with incorrect operation of dynamic memory allocation (malloc / malloc_r).
55

6+
Source code https://github.com/DRNadler/FreeRTOS_helpers
7+
68
How is it all corrected.
7-
1. Remove the heap_4.c file from the \ Middlewares \ Third_Party \ FreeRTOS \ Source \ portable \ MemMang \ directory of your project
8-
2. Copy the heap_useNewlib.c file from the given repository (src) to the above directory;
9-
3. Open the FreeRTOS configuration file (FreeRTOSConfig.h) and add an additional define to the section;
9+
1. Remove the ```heap_4.c``` file from the ```\Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\``` directory of your project
10+
2. Copy the ```heap_useNewlib_ST.c``` file from the given repository (src) to the above directory(src);
11+
3. Comment or delete define function ```caddr_t _sbrk(int incr)``` in file ```Core\Src\syscalls.c```
12+
4. Open the FreeRTOS configuration file (```FreeRTOSConfig.h```) and add an additional define to the section;
1013
```
1114
/* USER CODE BEGIN Defines */
1215
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
@@ -21,7 +24,7 @@ This completes the setup. Compilation and operation of the printf, sprintf, snpr
2124

2225
### Do not forget that when you re-generate the project in STM32CubeMX, the procedure will need to be repeated!
2326

24-
p.s. The version of the heap_useNewlib.c file provided in this repository is slightly different from the original (http://www.nadler.com/embedded/newlibAndFreeRTOS.html) in terms of fixing compilation errors. It was tested on the following versions of the STM32F103C8T6 and STM32F401CCU6 microcontrollers under Windows 10 and Ubuntu 19.10
27+
p.s. The version of the ```heap_useNewlib_ST.c``` file provided in this repository is slightly different from the original (https://github.com/DRNadler/FreeRTOS_helpers) in terms of fixing compilation errors. It was tested on the following versions of the STM32F401CCU6 microcontrollers under Windows 10 and Ubuntu 20.04
2528

2629

2730
# Настройка STM32 для работы с float и double (преобразования значений к типу char) под FreeRTOS.
@@ -31,9 +34,10 @@ p.s. The version of the heap_useNewlib.c file provided in this repository is sli
3134
Согласно исследованиям этой темы http://www.nadler.com/embedded/newlibAndFreeRTOS.html данная ошибка связанна с некорректной работой динамического выделения памяти (malloc/malloc_r).
3235

3336
Как это все правиться:
34-
1. Удалите из директори \Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\ вашего проекта файл heap_4.c;
35-
2. Скопируйте в вышеуказанную директорию файл heap_useNewlib.c из данного репозитария (src);
36-
3. Откройте конфигурационный файл FreeRTOS (FreeRTOSConfig.h) и добавьте в секцию дополнительный define;
37+
1. Удалите из директори `````\Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\``` вашего проекта файл ```heap_4.c```;
38+
2. Скопируйте в вышеуказанную директорию файл ```heap_useNewlib.c``` из данного репозитария (src);
39+
3. Закоментируйте или удалите функцию ```caddr_t _sbrk(int incr)``` в файле ```Core\Src\syscalls.c```
40+
4. Откройте конфигурационный файл FreeRTOS (FreeRTOSConfig.h) и добавьте в секцию дополнительный define;
3741
```
3842
/* USER CODE BEGIN Defines */
3943
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
@@ -49,4 +53,4 @@ p.s. The version of the heap_useNewlib.c file provided in this repository is sli
4953

5054
### Не забывайте, что при пере генерации проекта в STM32CubeMX процедуру необходимо будет повторить!
5155

52-
p.s. Версия файла heap_useNewlib.c приведенного в данном репозитарии немного отличается от исходной (http://www.nadler.com/embedded/newlibAndFreeRTOS.html) в части исправления ошибок компиляции. Проверялось на следующих версиях микроконтроллеров STM32F103C8T6 и STM32F401CCU6 под Windows 10 и Ubuntu 19.10
56+
p.s. Версия файла ```heap_useNewlib.c``` приведенного в данном репозитарии немного отличается от исходной (https://github.com/DRNadler/FreeRTOS_helpers) в части исправления ошибок компиляции. Проверялось на следующих версиях микроконтроллеров STM32F401CCU6 под Windows 10 и Ubuntu 20.04

0 commit comments

Comments
 (0)