5 Replies Latest reply on Jul 27, 2014 6:36 AM by user_14586677

    PowerPSOC on PSOC 5?

    user_34750447

      I am using a PSOC1 PowerPsoc CY8CLED04G01 in a project.

         

      The project is expanding and it seems I 'll have a shortage on flash and computing power.

         

      So, I asked myself, what touble would it be toport the application from PSOC1 to PSOC5.

         

      Is there software on the PSOC 5 that can do the LED driving as good as on PSOC 1?

         

      What do you think?

         

      Best Regards, Rens Kessener

        • 1. Re: PowerPSOC on PSOC 5?
          user_1377889

          The CY8CLEDxxx PSoCs are dedicated for LED-driving. The required internal hardware has not been ported to PSoC5 (yet).

             

           

             

          Bob

          • 2. Re: PowerPSOC on PSOC 5?
            user_14586677

            If you are running out of code space from experience I can tell

               

            you that HiTech compiler, no longer supported, acheives a 40%

               

            reduction in FLASH space over Imagecraft. So if you can get an

               

            old copy of HiTech I would encourage that.

               

             

               

            Alternatively, or jointly, the following can help you code compress -

               

             

               

                

               

                      

               

            These helped me in a similar experience -

               

             

               

            1 - If any float math minimize the number of lines you do divides, if possible convert

               

            to multiplies. Convert float to integer math where possible. Pay attention to factoring

               

            of expressions, possible operation reduction, hence code reduction may result.

               

             

               

            2 - Lines with function calls, minimize f(g()) compound typed expressions.

               

             

               

            3 - Make sure you only use a variable type no larger than needed.

               

             

               

            4 - Use unsigned variables wherever possible.

               

             

               

            5 - Watchout for structures with mixed const and ram pointers within them,

               

            some compilers choke on this.

               

             

               

            6 - If you are heavy on Flash, light on RAM use, convert routines to RAM based

               

            wherever possible.

               

             

               

            7 - Try test cases of looping structures, to see what affects code size generation.

               

             

               

            8 - Examine .lst file for code that looks wacky in bytes used, understand what

               

            compiler did, and consider rewrite.

               

             

               

            9 - Use inline ASM where .lst file C generation looks excessive.

               

             

               

            10 - Look at module reuse, sharing, dual purpose, to eliminate # modules 

               

            needed, like counters/timers....Also look at data sheets of modules that could

               

            serve function needed, and compare ROM/RAM requirements needed. Optimize

               

            global HW, like clocks VC1/2/3/Sleep, to eliminate need for other timer/counters.

               

            Use register routing control to "share" module from one task to another, one pin

               

            to another.

               

             

               

            11 - Extended library, functions within them are written to be perfectly general,

               

            hence larger code size, you may be able to write one with less code needed for

               

            your specific requirements that result in smaller code size.

               

             

               

            12 – Look for approximations to compute transcendental functions if used.

               

             

               

            13 - Although no longer supported by HiTech or Cypress, the HiTech Pro compiler

               

            yielded on first try ~ 40% code reduction in my design when I first converted

               

            to it. Then the prior comments yielded another 4 K later in design as I was up

               

            against 32 K Flash limitation.

               

             

               

            14 - Some compilers have a setting to optimize code size or speed, the latter

               

            prone to larger code size. Also look at compiler vendors web site for ap notes

               

            and suggestions on optimization, compilers from different vendors behave and

               

            optimize  differently.

               

             

               

            15 - const data, strings, etc.., look for ability to reuse common string mnemonics,

               

            text.

               

             

               

            16 - Pointer usage can lessen code size, see url's below. Look for function calls

               

            passing longs as value vs pointer, convert to latter. Compiler has to copy all these,

               

            if not referenced. Do not pass longs or floats as values, keep always in mind native machine size.

               

             

               

            17 - Most compilers will optimize when indexes, pointers, a power of 2, or divides,

               

            divide becomes a shift.

               

             

               

            18 - Look at how linker distributed code and data segments, sometimes you can discover

               

            a poor decision by linker and force code/data into certain psects using pragma constructs,

               

            thereby minimizing wasted ROM space.

               

             

               

            19 – When you debug generally you want to turn off optimization, as compiler/linker will

               

            remove code and make jumps that do not make “sense” but are the result of optimization.

               

            When you are up to Flash boundary you may not be able to turn it off, otherwise

               

            application will not load. Keep this in mind, that  your debug strategy may have to change.

               

            I also found if using ICE Cube that debugger may no longer report “watch” variables, this

               

            occurred at ~ 31.5K bytes. In either case you may want to comment out large code sections

               

            to effectively debug.

               

             

               

            20 – f() calls take overhead, if you only call a f() once you might eliminate it as a f() call and

               

            place code inline.

               

             

               

            21 – Look for f() opportunities, wherever you are coding and repeating similar  operations.

               

            This is obvious, but sometimes missed.

               

             

               

            22 – Check compiler on macros, to see if they are being optimized or just being used inline

               

            using more code space vs a f() call solution.

               

             

               

            23 – Examine compiler/linker parameter control. For example in HiTech there is the AUTOBANK

               

            setting that controls where local variables are stored, in my case setting to 1 lowered code size by

               

            ~ 250 bytes. READ the MANUAL !

               

             

               

            24 – Use inline variable declarations, vs pre declaration (compiler dependent) -

               

             

               

                            This                        void dosomething ( void  ) {

               

             

               

                                                                            for (  unsigned char I = 0;…..

               

                                                            }

               

             

               

                            Not This               void dosomething ( void  ) {

               

             

               

                                                            Unsigned char I = 0;

               

             

               

                                                                            for (  I = 0;…..

               

                                                            }

               

             

               

            Some help -

               

             

               

            [url]http://www.codeproject.com/Articles/6154/Writing-Efficient-C-and-C-Code-Optimization[/url]

               

             

               

            [url]http://www.eventhelix.com/realtimemantra/basics/optimizingcandcppcode.htm[/url]

               

             

               

            [url]http://www.azillionmonkeys.com/qed/optimize.html[/url]

               

             

               

            By using these techniques I was able to regain ~ 4K Bytes of code space in a 32K design, which

               

            I promptly then used up again :(

               

             

               

            Regards, Dana.

            • 3. Re: PowerPSOC on PSOC 5?
              user_14586677

              Note of caution. I tried generating a basic project for CY8CLED04G01 and I

                 

              got an error that part was not in chipinfo file (psoc.ini). Under HiTech.

                 

               

                 

              Looking at this file seems like you could edit/add the part and its character-

                 

              istics, rom size, pages......easily.

                 

               

                 

              You could file a case on this and get more indepth info -

                 

               

                 

                  

                 

                        

                 

              To create a technical case at Cypress -

                 

               

                 

              www.cypress.com

                 

              “Support”

                 

              “Technical Support”

                 

              “Create a Case”

                 

               

                 

              You have to be registered on Cypress web site first.

                 

               

                 

              Regards, Dana.

              • 4. Re: PowerPSOC on PSOC 5?
                user_34750447

                Thanks for replies.

                   

                Dana, impressive list to gain memory. Some of them I use already.
                However, speed gets more important. I would like to have some calculations and actions done within 250 usecs.
                or even faster (250 usecs is my "timebase") The only way to achieve that is to split calcalations and actions into several parts, that are done in more than one "time slot" I can do it in .5 msec timebase but not faster.
                AND the functionality is expanding in the project. That means that more actions need to be done.

                   

                For future projects the question remains.

                   

                BOB:
                As you say ...........The required internal hardware has not been ported to PSoC5 (yet).
                It is not clear to me yet. ( I didn't go deeply into the specs of Psoc 5 ) I have never used Psoc 5.
                Would it be possible to create with Psoc creator, a device for Psoc 5 that does similar things as the CY8CLEDXXX?

                   

                And if..... would that be very complicated?

                   

                 

                   

                Regards

                   

                Rens
                 

                • 5. Re: PowerPSOC on PSOC 5?
                  user_14586677

                  There is an incredible number of chip solutions for controling

                     

                  power leds, all the major semi manufacturers offering solutions.

                     

                  So in short mating a PSOC 3/4/5lp to these chips would be pretty

                     

                  straightforward. Then your code space would expand to 256K

                     

                  and MIPs to > 80 (PSOC5LP).

                     

                   

                     

                  Regards, Dana.