# Questions about FPUs

**URL:** <https://forums.freertos.org/t/questions-about-fpus/16977>\
**Category:** Kernel\
**Created:** [March 18, 2023, 2:13am UTC](https://forums.freertos.org/t/questions-about-fpus/16977 "2023-03-18T02:13:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![UserName1](https://avatars.discourse-cdn.com/v4/letter/u/ee59a6/32.png) [@UserName1](https://forums.freertos.org/u/UserName1)\
**Post date:** [March 18, 2023, 2:13am UTC](https://forums.freertos.org/t/questions-about-fpus/16977/1 "2023-03-18T02:13:05Z")

</div>

I found that performing some single precision floating-point calculations in a task can cause errors that cause the program to enter `Dummy_ Handler`。Then I found the error occurred in the function `prvPortStartFirstTask` from call stack.If I replace single precision floating-point numbers in these tasks with double precision floating-point numbers, then the error did not occur.

I have noticed that my MCU is based on a 32-bit architecture and has a single precision floating-point arithmetic unit，so I changed `- mfloat abi=softfp` to `- mfloat abi=soft` in the compilation settings to turn off the FPU, then this error disappeared.

In the assembly file, I see that when using FPU, the compiler generates instructions that use floating-point registers for “float” operations, while for “double” numbers, the simulation algorithm uses general-purpose registers, so I think there may be a problem with the operation of floating point registers during task scheduling. I wonder if this problem can only be avoided by using “double” numbers.

The two tasks are:

```auto
void led(void* param)
{
	while(1)
	{
		float a = 0.2345;
		float b = 0.2345;
		float c = a + b;
		LED_Toggle(LED0);
		vTaskDelay(500);
	}
}
xTaskCreate( led, "Led", 200, NULL, 3, NULL );

void interrupeTask(void *param)
{
	
	while(1)
	{
		float a = 0.2345;
		float b = 0.2345;
		float c = a + b;
		vTaskDelay(10);
	}
}
xTaskCreate( interrupeTask, "Inter", 200, NULL, 3, NULL );

```

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [March 18, 2023, 3:16am UTC](https://forums.freertos.org/t/questions-about-fpus/16977/2 "2023-03-18T03:16:06Z")

</div>

Are you using a Port that understands that you have a FPU?

For some processors there are several ports depending on which features (like the FPU or the MPU) you are choosing to use, and using a feature not supported by your port can cause problems.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [March 18, 2023, 8:08am UTC](https://forums.freertos.org/t/questions-about-fpus/16977/3 "2023-03-18T08:08:33Z")

</div>

Which FreeRTOS port area you using?

---

<div class="post-metadata">

**Author:** ![UserName1](https://avatars.discourse-cdn.com/v4/letter/u/ee59a6/32.png) [@UserName1](https://forums.freertos.org/u/UserName1)\
**Post date:** [March 19, 2023, 1:18am UTC](https://forums.freertos.org/t/questions-about-fpus/16977/4 "2023-03-19T01:18:14Z")

</div>

My FreeRTOS kernel is automatically imported by the example project in Microchip Studio. The portable file is Cortex-M3/M4, and the FreeRTOS version is 10.0.0 on Atmel SAM4E16E

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [March 19, 2023, 1:29am UTC](https://forums.freertos.org/t/questions-about-fpus/16977/5 "2023-03-19T01:29:33Z")

</div>

The M3 file doesn’t support the FPU, since M3s don’t have it as an option. There should be a separate M4F version that does.

---

<div class="post-metadata">

**Author:** ![UserName1](https://avatars.discourse-cdn.com/v4/letter/u/ee59a6/32.png) [@UserName1](https://forums.freertos.org/u/UserName1)\
**Post date:** [March 20, 2023, 1:32am UTC](https://forums.freertos.org/t/questions-about-fpus/16977/7 "2023-03-20T01:32:20Z")

</div>

Wow ,this is indeed the reason. I really didn’t expect that the routine supporting CM4 officially provided by ASF did not consider the issue of FPU compatibility.
