cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

FaBi_2763241
Contributor II

Hello all,

when I build a project with PSOC 6 I have 127 build errors saying that #include is nested too deeply in project.h

what on earth could be going on?

Any idea what circumstances cause this to happen?

Thanks.

PS see attached output during build.

0 Likes
Reply
1 Solution
NoriakiT_91
Employee

I can reproduce the issue by creating a custom component.

1) Create a component without pins.

GS004278.png

2) Add a header file to the component as follows.

#include "project.h"

extern uint32_t `$INSTANCE_NAME`_global_variable;

Declare a global variable.  project.h is included to use the uint32_t type.

3) Add a C file to the component as follows.

#include "`$INSTANCE_NAME`.h"

uint32_t `$INSTANCE_NAME`_global_variable;

Define a global variable body.

4) Put the component instance on a top level schematic.

GS004279.png

5) Build the project and got huge number of error.

GS004280.png

I have two solutions.

Solution 1)

In the header file, include "stdin.h" instead of "project.h"

#include <stdint.h>

extern uint32_t `$INSTANCE_NAME`_global_variable;

Solution 2)

In the header file, add #ifdef structure to prevent recursive inclusion.

#if !defined(`$INSTANCE_NAME`_H)

#define `$INSTANCE_NAME`_H

#include "project.h"

extern uint32_t `$INSTANCE_NAME`_global_variable;

#endif  /* End `$INSTANCE_NAME`_H */

It is better to combine both solutions.

#if !defined(`$INSTANCE_NAME`_H)

#define `$INSTANCE_NAME`_H

#include <stdint.h>

extern uint32_t `$INSTANCE_NAME`_global_variable;

#endif  /* End `$INSTANCE_NAME`_H */

This can reduce the number of header file inclusion to reduce the compile time.

Regards,

Noriaki

View solution in original post

6 Replies
NoriakiT_91
Employee

Please check the content of the project.h file.

There should be #include line to include the project.h file directly or indirectly.

Regards,

Noriaki

0 Likes
Reply
NoriakiT_91
Employee

I can reproduce the issue by creating a custom component.

1) Create a component without pins.

GS004278.png

2) Add a header file to the component as follows.

#include "project.h"

extern uint32_t `$INSTANCE_NAME`_global_variable;

Declare a global variable.  project.h is included to use the uint32_t type.

3) Add a C file to the component as follows.

#include "`$INSTANCE_NAME`.h"

uint32_t `$INSTANCE_NAME`_global_variable;

Define a global variable body.

4) Put the component instance on a top level schematic.

GS004279.png

5) Build the project and got huge number of error.

GS004280.png

I have two solutions.

Solution 1)

In the header file, include "stdin.h" instead of "project.h"

#include <stdint.h>

extern uint32_t `$INSTANCE_NAME`_global_variable;

Solution 2)

In the header file, add #ifdef structure to prevent recursive inclusion.

#if !defined(`$INSTANCE_NAME`_H)

#define `$INSTANCE_NAME`_H

#include "project.h"

extern uint32_t `$INSTANCE_NAME`_global_variable;

#endif  /* End `$INSTANCE_NAME`_H */

It is better to combine both solutions.

#if !defined(`$INSTANCE_NAME`_H)

#define `$INSTANCE_NAME`_H

#include <stdint.h>

extern uint32_t `$INSTANCE_NAME`_global_variable;

#endif  /* End `$INSTANCE_NAME`_H */

This can reduce the number of header file inclusion to reduce the compile time.

Regards,

Noriaki

View solution in original post

FaBi_2763241
Contributor II

Hello Noriaki

I will test your suggestions later and report back here.

many thanks.

Fausto

0 Likes
Reply
FaBi_2763241
Contributor II

Hi Noriaki

yes, following your method the error has disappeared.

I have another question, less critical.

How could I avoid these info messages related to pins which happen only with PSOC 6 during build?

0 Likes
Reply
NoriakiT_91
Employee

Do you mean the Notes messages like this?

GS004292.png

Actually I don't know.

I see these messages disappeared when the "Programming\Debugging>Debug Selection" option is set to "GPIO" in the "System" tab of the "Design Wide Resource"  but I don't think this is a solution what your are expecting.

Regards,

Noriaki

0 Likes
Reply
FaBi_2763241
Contributor II

They are not errors or warning, so the code still compiles okay. I was just wondering if there is a note somewhere in PSOC 6 documentation that mentions these build messages.

Regards

Fausto

0 Likes
Reply
Top labels