Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

Not applicable



I have been using fopencookie to create custom streams in PSoC Creator 3.0 and just recently started a new, empty, project in Creator 3.1 for a different application. I duplicated my cookie code from the old project with copy/paste, and made a minimal startup design which routes stdout to the LCD (to allow printf, etc to work). After some time investigating, I found that setvbuf() was hanging the processor in the following function which is called directly from my main() after LCD_Start():


void stdoutToLCD()
    cookie_io_functions_t iofun;
    iofun.close = CookieClean;   //pointer to function that does nothing = CookieRead;     //pointer to function that returns nothing = CookieSeek;     //pointer to function that does nothing
    iofun.write = CookieWrite;     //pointer to function that places chars on the LCD from the passed-in buffer
    stdout = fopencookie(NULL, "w", iofun);     //opens the LCD as a file for writing to and attaches to stdout


    setvbuf(stdout, NULL, _IONBF, 0);               //freezes here (setting stream to unbuffered)


I assumed I must be doing something wrong, because the old code created in Creator 3.0 still compiles and works fine on Creator 3.1 even after I allow the component update tool to update cyboot and all the other components in the design.


To further test this mystery I rebooted into Windows XP, and created a minimal project in exactly the same way using Creator 3.0. It runs perfectly well. I rebooted to Win 8.1 to load the project into Creator 3.1 again, updated components and recompiled and it still runs perfectly well.


My final test was to once again follow exactly the same copy-paste steps in Creator 3.1 in another empty project, just to verify that it indeed doesn't work in 3.1 (which it didn't!).


Now I have looked through compiler options and made sure they are identical, I have also looked under every other menu I could find containing project settings, and I don't see any differences. Creator 3.0 is using GCC 4.7.3, while 3.1 is using 4.8.4, but this can't be the problem either as far as I know because the Creator 3.0 project compiles and works in Creator 3.1 no problem. I suspect I'm overlooking a setting, but I can't for the life of me figure out where it is!


I've attached both projects in "PSoC" which contains "" and "".


The "" project has been updated when it was loadded into Creator 3.1, and re-saved, but still runs fine. The "" project was built in Creator 3.1 using EXACTLY the same staps as I used in Creator 3.0, but it hangs in setvbuf(stdout, NULL, _IONBF, 0) as described above.


Please, please please, can anyone see why?


Thanks for your time 🙂

3 Replies
Not applicable

Forgot to mention: The project is developed for the PSoC 5LP, CY8CKIT-050.

Expert II

Creator 3.1 has got different default values for stack and heap size. Change your 3.1 version to


Heap 0x1000


Stack 0x4000





Not applicable

Thankyou very much for that! I feel a bit silly for not having looked through those settings!