Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


FreeRTOS 9.0.0 on Zynq ZC702 float not working

Posted by ea4mz on January 16, 2017


Thanks for reading this. I am using FreeRTOS 9.0.0 on Zynq ZC702 and trying to implement a binary TCP server on port 7081. Using FreeRtos Labs 160919 and Xilinx SDK 2016.3

Everything goes fine, unless you try to assign a value to a float, then FreeRTOS crashes.

I have already set:

"#define configUSETASKFPU_SUPPORT 2", in FreeRTOSConfig.h

The code snippet that crashes FreeRTOS is:

static uint8t counter; float UL1RMS;

counter = 1; ........ UL1_RMS = (float)counter;

Is there anything more that should be configured in order to handle float values in a task?

Thanks in advance for your help. Mo.

FreeRTOS 9.0.0 on Zynq ZC702 float not working

Posted by heinbali01 on January 16, 2017

Hi Mo,

Your post is a bit similar to this one. Can you try the same conversion somewhere in main(), just before calling vTaskStartScheduler()? Will that also crash? Does the problem also occur when using double?

FreeRTOS 9.0.0 on Zynq ZC702 float not working

Posted by rtel on January 16, 2017

In addition - does this problem occur inside an interrupt? There is a known issue with alignment for floats in V9.0.0. If this is the case please either make the assignment outside of the ISR, or get back to me and I can let you know the fix.

FreeRTOS 9.0.0 on Zynq ZC702 float not working

Posted by ea4mz on January 17, 2017

Hi Hein and RTE, Thank you very much for your answer, I will try to explain more in detail the problem:

The binary parser I am trying to implement on port 7081 is quite similar to the one implemented in FreeRTOS labs for the echo server:

  • There is a server listening for incomming connections to port 7081
  • When there is a new connection it spawns a task to handle it
  • The handler decodes the command and then answer back the data, result, etc.

There is not any interrupt involved in my code, unless the handling of sockets in FreeRTOS is interrupt driven???

Here is the structure I am filling with values inside the task that handle values:

typedef struct { char Ip0; // 1 char Ip1; // 2 char Ip2; // 3 char Ip3; // 4


float	UL1_RMS;
float	UL2_RMS;
float	UL3_RMS;

... } StandardInfo_t;

Then when you handle this inside the task:

uint8_t counter;
StandardInfo_t *StandardInfo_p;

Assign and address to pointer:

StandardInfo_p = (StandardInfo_t *)FIRST_BYTE_ANSWER_PTR;	

Then assing a value to the elements inside the structure:

counter = 1;
StandardInfo_p->Ip0   = (char)counter;
StandardInfo_p->Ip1   = (char)counter;
StandardInfo_p->Ip2   = (char)counter;
StandardInfo_p->Ip3   = (char)counter;

Everything is OK until you start assigning a value to float, then it crashes:

StandardInfo_p->UL1_RMS = (float)counter;
StandardInfo_p->UL2_RMS = (float)counter;
StandardInfo_p->UL3_RMS = (float)counter;

When using another commands that do not use floats everything is OK.

Thanks again for your help. Regards, Mo.

FreeRTOS 9.0.0 on Zynq ZC702 float not working

Posted by rtel on January 17, 2017

What is the value of FIRSTBYTEANSWER_PTR? It must be a value that results in your floating point variables within the structure being 8-byte aligned. I don't think this is a FreeRTOS issue.

FreeRTOS 9.0.0 on Zynq ZC702 float not working

Posted by ea4mz on January 18, 2017

Thank you very much for your help, you are right.

That's the value of FIRSTBYTEANSWER_PTR where pucTxBuffer was allocated previously. That resulted in floats not been 8-byte aligned: ~~~



Thanks again, best regards, Moises.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner