6 Replies Latest reply on Jul 6, 2019 1:25 AM by FaBi_2763241

    include in project header file result in error

    FaBi_2763241

      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.

        • 1. Re: include in project header file result in error
          NoriakiT_91

          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

          • 2. Re: include in project header file result in error
            NoriakiT_91

            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

            2 of 2 people found this helpful
            • 3. Re: include in project header file result in error
              FaBi_2763241

              Hello Noriaki

              I will test your suggestions later and report back here.

              many thanks.

               

              Fausto

              • 4. Re: include in project header file result in error
                FaBi_2763241

                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?

                • 5. Re: include in project header file result in error
                  NoriakiT_91

                  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

                  • 6. Re: include in project header file result in error
                    FaBi_2763241

                    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