4 Replies Latest reply on Oct 29, 2019 6:37 AM by user_3856526

    How to execute programs in SRAM PSoC6

    user_3856526

      The datasheet of PSoC6 describes that it is possible to execute code from the code and the sram regions.

      Are there any code examples available for executing a whole program in the SRAM?

       

       

       

      Many thanks,

      Nadja

        • 1. Re: How to execute programs in SRAM PSoC6
          ShipingW_81

          If you want to put whole program in SRAM, put the sections originally defined in flash to ram by modifying the linker file for each core, just like below section .text:

           

          .text :

              {

                  . = ALIGN(4);

                  __Vectors = . ;

                  KEEP(*(.vectors))

                  . = ALIGN(4);

                  __Vectors_End = .;

                  __Vectors_Size = __Vectors_End - __Vectors;

                  __end__ = .;

           

                  . = ALIGN(4);

                  *(.text*)

           

                  KEEP(*(.init))

                  KEEP(*(.fini))

           

                  /* .ctors */

                  *crtbegin.o(.ctors)

                  *crtbegin?.o(.ctors)

                  *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)

                  *(SORT(.ctors.*))

                  *(.ctors)

           

                  /* .dtors */

                  *crtbegin.o(.dtors)

                  *crtbegin?.o(.dtors)

                  *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)

                  *(SORT(.dtors.*))

                  *(.dtors)

           

                  /* Read-only code (constants). */

                  *(.rodata .rodata.* .constdata .constdata.* .conststring .conststring.*)

           

                  KEEP(*(.eh_frame*))

              } > flash  ->  ram

           

          If you just want to put single function in SRAM, you can refer to the method mentioned in the following artical for P5 - Running code in RAM using PSoC5 and the GCC compiler

          • 2. Re: How to execute programs in SRAM PSoC6
            user_3856526

            Thanks for your answer.

             

            I tried this with the Dual Core Blinky Example in PSoc Creator with the PSoC 6 BLE Poineer Kit. In both linkerfiles (cy8c6xx7_cm0plus.ld and cy8c6xx7_cm4.ld) I replaced every "} > flash" with "} > ram".

            I can build the software, but after programming it is not running on the device. Do I need to do something else?

            • 3. Re: How to execute programs in SRAM PSoC6
              ShipingW_81

              I realized that the my previous post might be misleading. Actually you can not use PSoC Creator/Programmer to program SRAM, because the tools are a command cluster manipulating inside flash.

               

              The feasible way for you might be to conduct a copy of code from flash to sram after each time power on.

              • 4. Re: How to execute programs in SRAM PSoC6
                user_3856526

                Thank you very much, this is the right way for me!