Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

FreeRTOS 9.0.0 on Zynq ZC702 float not working

Posted by ea4mz on January 16, 2017

Hi,

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: ~~~

define SIZEOFHEADER 4
define SIZEOFANSWER 3
define FIRSTBYTEANSWERPTR ((uint8t *)(pucTxBuffer + SIZEOFHEADER + SIZEOFANSWER))

~~~

Thanks again, best regards, Moises.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists