FTDI Community

General Category => Discussion - Software => Topic started by: techtoys on May 10, 2019, 06:44:05 PM

Title: Ft_Esd_WidgetSlots in Ft_Esd_Widget.h with third party toolchain
Post by: techtoys on May 10, 2019, 06:44:05 PM
Hi

I am trying to port ESD to ESP32 Wifi SoC in addition to FT9xx MCUs. The HAL part is working with a new directory ESP32 in FT_Eve_Hal/Hdr and FT_Eve_Hal/Src with relevant .c and .h files. New compiling directive added to FT_Platform.h as ESP32_PLATFORM, together with a new LCD model of 480*854.

Toolchain is the development framework base on Cygwin GCC in Eclipse IDE. I also tested Cross GCC and it shows to be working too. Language in pure C.

Now I am proceeding further with FT_Esd_Framework by copying all .c and .h files to project and get them compiled.

There is a problem with Ft_Esd_WidgetSlots structure in Ft_Esd_Widget.h. This structure is initialized in almost each of the .c files under /FT_Esd_Framework with individual function pointers. For example, in Ft_Esd_Layout_Tag.c this structure is initialized as follows:

Code: [Select]
static Ft_Esd_WidgetSlots s_Ft_Esd_Layout_Tag__Slots = {
(void(*)(void *))Ft_Esd_Widget_Initialize,
(void(*)(void *))Ft_Esd_Widget_Start,
(void(*)(void *))Ft_Esd_Widget_Enable,
(void(*)(void *))Ft_Esd_Widget_Update,
(void(*)(void *))Ft_Esd_Layout_Tag_Render,
(void(*)(void *))Ft_Esd_Widget_Idle,
(void(*)(void *))Ft_Esd_Widget_Disable,
(void(*)(void *))Ft_Esd_Widget_End,
};

With official Bridgetek FT9xx GCC, this intialization is giving warning as
Code: [Select]
missing braces around initializer [-Wmissing-braces] Ft_Esd_FixedPointNumericLabel__Generated.c /WidgetOpacity/FT_Esd_Widgets line 26 C/C++ Problem

This is a warning but not error.

Unfortunately, the same code with Cygwin GCC/Cross GCC is giving an error with the same message
Code: [Select]
missing braces around initializer [-Wmissing-braces]
Because Ft_Esd_WidgetSlots is a structure composed of a union of an array of 8 elements, should it be 3 braces in initialization like code snippet below instead of a single brace pair ?

Code: [Select]
static Ft_Esd_WidgetSlots s_Ft_Esd_Layout_Display__Slots = {{{
(void(*)(void *))Ft_Esd_Widget_Initialize,
(void(*)(void *))Ft_Esd_Widget_Start,
(void(*)(void *))Ft_Esd_Widget_Enable,
(void(*)(void *))Ft_Esd_Layout_Display_Update,
(void(*)(void *))Ft_Esd_Layout_Display_Render,
(void(*)(void *))Ft_Esd_Layout_Display_Idle,
(void(*)(void *))Ft_Esd_Widget_Disable,
(void(*)(void *))Ft_Esd_Widget_End,
}}};
I tried three braces with my toolchain and it works OK. Does anybody know why is it so? Is it something with compile options to change it?

Hope it is "legal" to port the ESD to a third party MCU as I notice only FT9xx series MCUs are supported for now. But I do realize that porting guide for ESD 4.5 is on the way. I am not sure if my question here worth an answer.

John
Title: Re: Ft_Esd_WidgetSlots in Ft_Esd_Widget.h with third party toolchain
Post by: FTDI Community on May 14, 2019, 12:08:25 PM
Hello,

Thank you for your post, I have passed this on to the development team to see if they wish to add any comments.

Best Regards,
FTDI Community
Title: Re: Ft_Esd_WidgetSlots in Ft_Esd_Widget.h with third party toolchain
Post by: techtoys on May 15, 2019, 06:04:52 AM
Hi Administrator

I was just curious what would happen if single brace is changed to triple brace pairs for Ft_Esd_WidgetSlots initialization in original BridgeTek toolchain, an attempt was made by randomly pick s_App_Screen__Slots in the source file AppScreen__generated.c with src code changed as below:

Code: [Select]
static Ft_Esd_WidgetSlots s_AppScreen__Slots = {{{
(void(*)(void *))Ft_Esd_Widget_Initialize,
(void(*)(void *))AppScreen_Start,
(void(*)(void *))Ft_Esd_Widget_Enable,
(void(*)(void *))AppScreen_Update,
(void(*)(void *))Ft_Esd_Widget_Render,
(void(*)(void *))Ft_Esd_Widget_Idle,
(void(*)(void *))Ft_Esd_Widget_Disable,
(void(*)(void *))AppScreen_End,
}}};


There is another way to do it like
Code: [Select]
.Initialize = (void(*)(void *))Ft_Esd_Widget_Initialize but a triple brace pairs is more simple. After this change the warning message [-Wmissing-braces] removed in FT90x GCC toolchain as well. Unfortunately there is no real FT90x hardware with me so I cannot test.

Nevertheless, having changed all single brace to triple brace pairs for Ft_Esd_WidgetSlots I am able to run the WidgetOpacity example on my hardware with ESP32 as seen in this hyperlink.

https://www.dropbox.com/s/vctfsx5jhgcay5a/IMG_20190515_120950_HDR.jpg?dl=0

Touch screen is supported so the opacity of these two widgets can be adjusted by the scroll bars underneath.

This example was finished with ESD -> export to Eclipse project -> manually modification on individual files.
The next step is to modify /Libraries folder in installation directory of ESD so that it is possible to export Eclipse project from ESD for third party MCU.

John