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

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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 */

0 Likes
1 Solution
Anonymous
Not applicable

Another option is to make use of the pre-build option in the IDE, and create a simple batch file or Python script or whatever you prefer which copies the modified source file(s) from some special location that you have prepared into the appropriate /Generated_Source/... subfolder for your compile architecture.

There are pros and cons to each approach, but if the component customization approach is harder or more complicated than you anticipated, you might try this instead.

View solution in original post

3 Replies
Anonymous
Not applicable

Another option is to make use of the pre-build option in the IDE, and create a simple batch file or Python script or whatever you prefer which copies the modified source file(s) from some special location that you have prepared into the appropriate /Generated_Source/... subfolder for your compile architecture.

There are pros and cons to each approach, but if the component customization approach is harder or more complicated than you anticipated, you might try this instead.