3 Replies Latest reply on Aug 23, 2018 11:19 AM by jeroc_1247746

    In PSoC Creator, is there a way to preserve user modified code across cleans and builds (similar to ISR's  '#START ...' and '#END') in other generated code blocks?  I have to modify a UART bootloader function (SCB_UartCyBtldrCommWrite) to set a GPIO

    mistc_2284496

      Here's what I try:

       

      /*  `#START UART_Boot` */

      #include "TxEnable.h"

      /*  `#end` */

       

      cystatus UART_UartCyBtldrCommWrite(const uint8 pData[], uint16 size, uint16 * count, uint8 timeOut)

      {

          cystatus status;

          status = CYRET_BAD_PARAM;

          if ((NULL != pData) && (size > 0u))

          {

      /*  `#START UART_Boot` */

              TxEnable_Write(1);

              CyDelayUs(5);

      /*  `#end` */

              /* Transmit data. This function does not wait until data is sent. */

              UART_SpiUartPutArray(pData, (uint32) size);

              *count = size;

              status = CYRET_SUCCESS;

              if (0u != timeOut)

              {

                  /* Suppress compiler warning */

              }

      /*  `#START UART_Boot` */

              CyDelayUs(50);

              TxEnable_Write(0);

      /*  `#end` */

          }

          return (status);

      }

       

      ON clean and build, above mods get removed and here's what gets appended to the new generated source:

      /* [] END OF FILE */

      #if 0 /* begin disabled code */

      `#start UART_Boot` -- section removed from template

      #include "TxEnable.h"

      `#end`

       

      #endif /* end disabled code */

      #if 0 /* begin disabled code */

      `#start UART_commwrite` -- section removed from template

              CyDelayUs(50);

              TxEnable_Write(0);

      `#end`

       

      #endif /* end disabled code */