Skip to main content
RHug.1
Associate II
February 21, 2020
Question

Imported TouchGFX Project into Visual Studio 2017 & 2019 --> Build failed.

  • February 21, 2020
  • 9 replies
  • 2099 views

Board: STM32F746NGH6

Display: ETEM043005XDH6

I tried creating an Embedded Project (after installing VisualGDB) with following settings:

  • import a project built with command-line tools (since I want to import the existing TouchGFX Project)
    • Generate a new MSBuild project
  • Select my Device: STM32F746NG (leave all settings)
  • Import my Project Folder (TouchGFXProjects/ProjectName)
  • Debug using: USB Input: "ST-Link v2" --> Test sucessful

When trying to build the project I run into several missing included directories as well as View.cpp / Mainbase.cpp and other files

After including those using Visual Studio help I receive a several Error:

"SDL_stdinc.h" Line 261:

  • narrowing conversion of '-1' from 'int' to 'unsigned int' [-Wnarrowing}
  • size '-1' of array 'SDL_dummy_enum' is negative

--> Checking the code I see a comment written by the developers (of TouchGFX) on Line 284

  • /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */

But there is no fix or workaround mentioned.

Flashing the application via TouchGFX Designer takes way too much time. Since I am editing the source files in VS I would also like to flash the application via the integrated ST-Link v2 also receiving a more detailed error log and being able to debug.

Looking forward to any reply or links for further help.

EDIT:

This code fails as stated above:

#define SDL_COMPILE_TIME_ASSERT(name, x) \
 typedef int SDL_dummy_ ## name[(x) * 2 - 1]
 
 
 
//This is the comment from Devs I was taking about 
 
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#if !defined(__ANDROID__)
 /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
typedef enum
{
 DUMMY_ENUM_VALUE
} SDL_DUMMY_ENUM;
 
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
#endif
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */

Best Regards

Rafael

This topic has been closed for replies.

9 replies

LTimm.1
Associate
February 21, 2020

I don't use Visual Studio myself, but I think it's this static assert that fails:

SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));

SDL seems to expect that enums have the same size as an int. Don't know why that's not the case in Visual Studio. Maybe it packs the enum into a smaller size.

LTimm.1
Associate
February 21, 2020

By the way, if you are compiling for target then something is wrong. As I understand it SDL is only used for the simulator.

RHug.1
RHug.1Author
Associate II
February 21, 2020

I imported the project and tried to build it first.

But that very first step already failed

Romain DIELEMAN
ST Employee
February 21, 2020

Hi,

As @LTimm.1 said Visual Studio is only used for the simulator, the issue you have on line 261 is not linked to the target. We use IDE like IAR or keil.

Could you give us more details and information on what you are doing? Do you use the STM32f746G disco board? If yes, did you create a project with the given application template on Designer for that specific board?

RHug.1
RHug.1Author
Associate II
February 21, 2020

I am using STM32F746NGH6 Board.

I have created the specific project in TouchGFX Designer, sucessfully flashed it on the device and was able to transmit data using UART.

Since the flashing process (including compiling the GUI etc.) in TouchGFX takes way too long, I aimed changing to Visual Studio since it's able to integrate the Debugger "ST-Link V2" and giving me the possibility of flashing the device directly.

Please correct me if being wrong.

Martin KJELDSEN
Principal III
February 21, 2020

TouchGFX designer uses make to build with arm-gcc for its Application Templates when you click "Run target". But the visual studio projects also in the Application Templates are simulator only by default (Hence why you're seeing SDL references).

"Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D"

If you want to use Visual Studio for some sort of cross-platform arm-gcc compilation with visualGDB support then you have to do some work - It's not something that comes supported out of the box. In this case we'd just suggest CubeIDE, i think (The STM32F746-DISCO V3 template supports it).

/Martin