1 2 Previous Next 26 Replies Latest reply on May 7, 2020 7:46 AM by ThBa_282891 Go to original post
      • 15. Re: PSoC Creator C++?

        Dear Cypress,

           

        Here's another vote for C++.  It makes many things (e.g. importing code from the rest of the world!) much easier.

           

        Isn't Cypress the least bit embarrassed that the lowly Arduino supports C++?  You guys and your products are generally pretty great, but really!

        • 16. Re: PSoC Creator C++?
          MoTa_728816

          Dear Sirs at Cypress,

           

          Yes, I vote for C++, too.

           

          I've written dozens of sensor drivers and sample programs in C++.

           

          Although I have already ported a few of them into PSoC Creator, it was not a fun work.

           

          Reinventing the wheel is a waste, but parting with one is, being the politest, misfortune.

           

          moto

          • 17. Re: PSoC Creator C++?
            JoMe_264151

            According to this survey is C more often used as C++. So you should have started with C for your drivers ;-)

             

            Bob

            • 18. Re: PSoC Creator C++?

              The survey you mention Bob covers all the programming languages, where the embedded world only uses a subset of them (C#, VB, SQL don't have much sense here).

               

              Thanks to this survey you can select what type of device you're interested in.

               

              By selecting "Embedded" only, C++ arrives second, right behind C.

              Arduino arrives third, and one could argue that Arduino is C++ as well.

              Cpp_2.PNG

               

              Now if we select the "Languages popular on open source hubs", C++ arrives first.

              Cpp_1.png

               

              Furthermore, PSoC Creator 4.1 is already shipped with C AND C++ compilers and it can compile C++ source files with a bit of tweaking as already demonstrated here.

               

              What is stopping Cypress from implementing C++ support in the PSoC Creator IDE ?

              • 19. Re: PSoC Creator C++?

                C++ for the lads. surely.

                • 20. Re: PSoC Creator C++?
                  NiBu_1198441

                  I agree, I've asked the FAE's over the years for C++ support. It doesn't appear to be anywhere close to Cypress's radar. For those that argue these parts are too small to support C++, you are wrong. I've deployed 30+ commercial products over the years that all use C++. They are all embedded super loop systems. The smallest system had 256 KB of flash and 32 KB of RAM. Many systems have more resources, but it is all in how you write your code. If you stay away from exception handling, RTII, and massive layers of polymorphism, we have found our C++ code to be more compact and faster than straight C (BIG caveat emptor ***if you are careful with how you write your code***). We did get a simple Hello World C++ program running with a PSoC 5 a few years ago. You have to export your design and use makefiles. Then you have to do a lot of linker magic. I believe we ran into some issue with the configuration of the part and abandoned C++ for C on the PSoC.

                  • 21. Re: PSoC Creator C++?
                    KaPa_2418181

                    We too would much like to see native C++ support in PSoC Creator. Of course on embedded devices you do not use things like exceptions, dynamic memory allocation, or dynamic casts, but C++ has lots of other features that are very useful and efficient for use in embedded projects. Most other device manufacturers support C++ in their IDEs, even for some 8-bit devices with low memory. C++ is in itself not any more memory-hungry or inefficient than C when used correctly, while at the same time offering many useful features.

                     

                    Please Cypress, support C++ in your IDEs.

                    • 22. Re: PSoC Creator C++?
                      romi_644456

                      The thing is, it's not complicated (or at least shouldn't be). One can say all they want about how one should have written code, or whether C++ is "appropriate" for an embedded application or not. None of that matters. The simple fact is that there EXISTS a lot of code out there already in C++ already on embedded platforms. For example, a ton of Arduino code. It is ridiculous that Cypress will not enable the ability to reuse this code base just because they are too lazy to enable EXISTING C++ compilers on their platform. I mean, the compiler tool chain naturally supports C++, so it's like they have to go out of their way to not allow it.

                       

                      I, for example, have a bunch of Arduino code I would LIKE very much to migrate to the PSoC platform. But Cypress seems to be resistant to the idea of making it EASY for people to migrate TO THEIR PLATFORM from other platforms, like Arduino. This makes no sense. They do a great job of making it easy to use their platform from scratch but make it impossible to migrate existing code from other platforms that happen to utilize C++. I can easily drop in modules and all sorts of things...except for existing C++ code. For that I either have to rewrite the code or do a major amount of hacking of the platform to get it to work.

                       

                      And how does it make sense that lower power processors (most Arduinos) seem to be able to utilize C++ by default, but I can't migrate to a more powerful platform because it for some reason lacks C++ that lesser platforms have? So it's like I have to choose between a better processor platform but with lesser language tools and reuse, or a lesser processor platform with better language tools and reuse.

                      • 23. Re: PSoC Creator C++?
                        gmNe_4689871

                        Furthermore, PSoC Creator 4.1 is already shipped with C AND C++ compilers and it can compile C++ source files with a bit of tweaking as already demonstrated here.

                        Would vote for C++ support in PSoc Creator as well because it is not only about enhanced features, but also a habit of thinking and programming. Even basic encapsulation in C++ is also very helpful.


                        @rofoc_1675286 Thank you very much for the link on tweaking for PSoc Creator 4.1.

                         

                        I have had a look into the linked page. I suppose maybe the reason why Cypress has not supported C++ is as stated in this paragraph from the above link:

                        The standard C++ library contains many powerful utilities, however, most of these come at the expense of using plenty of code/RAM space, as well as potentially using exceptions (I have not got exceptions to work correctly on a PSoC device).

                        For example, including <iostream> can cause your memory to instantly overflow. I assume this is probably because of advanced features such a locale support. Upon removing the include, the memory usage didn’t shrink back to normal until I did a clean build.

                        Because of this, I almost use no standard C++ library features for embedded firmware. Instead, I have written a number of firmware modules which emulate the most useful standard C++ library features (such as strings, vectors, e.t.c) but are suitable for running on microcontrollers. You can download the modules from the MToolkit repository on GitHub.

                         

                        It has suggested a solution: emulating those memory-eating features of C++.

                         

                         

                        If you have libraries or codes programmed in C++ to migrate onto PSoc, maybe you can compile C++ into C using some tools as mentioned here.

                        • 24. Re: PSoC Creator C++?
                          WaMa_286156

                          Look at this article from 2013:

                          https://blog.mbedded.ninja/programming/microcontrollers/psoc/using-cplusplus-with-psoc-creator/

                           

                          The only thing missing when doing it that way is the try { }catch() which could be important.

                          • 25. Re: PSoC Creator C++?
                            gmNe_4689871

                            I have followed the mentioned steps in the mbedded.ninja link of tweaking PSoc Creator for compiling C++ programs. It works.

                             

                            Now my only problem is that the syntax highlighting does not recognise the keyword "class" although the compilation and building can all be successfully done.

                             

                            Anyone has any solution to solve this problem?

                            • 26. Re: PSoC Creator C++?
                              ThBa_282891

                              We use the eclipse plugin with a lot of nasty workarounds for C++. It works and makes perfectly sense, also on this small controller but the usability is a nightmare.

                               

                              If Creator would support C++ naively and would get rid of the logical file structure, it would be definitely the best embedded IDE in existence for me.

                              1 2 Previous Next