cancel
Showing results for 
Search instead for 
Did you mean: 

Hardfault created when changing working TouchGFX project to Generate peripheral initialization as a pair of '.c/.h' files

FJB2069
Associate III

I have a working touch GFX project.  I want to break out the individual peripheral initializations, so I open the ioc file in cubeMX and Check to Generate peripheral initializations as a pair of '.c/.h' ... in the Project manager.

The code builds, but when I debug it immediately goes to hard fault before is gets thru MPU_Config

I created another touchGFX project the only has one screen and only loads a background.  After verifying that it runs I tried to Generate peripheral initializations as a pair of '.c/.h' . and this will not build because non of the peripherals .h files were created   (crc.h, dma2d.h  etc..)

 

How can I create a touchGFX project without having all the peripherals in main.c?

1 REPLY 1
GaetanGodart
ST Employee

Hello @FJB2069 ,

 

Splitting into pairs of c and h files often leads to issues with the generated code which require manual fixes.
It is therefore recommended to not select that option if you can avoid it.

However, if you want to use that option, the generated and user code for the init of the various files will be missing.
A simple way to fix this is to create the same project without the pairs of c and h and look at the generated code and manually add it in the initial project.

You can find an example of that fix here .

 

I hope this helps you! :smiling_face_with_smiling_eyes:

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)