PSOC Designer 5.0 code porting

Cypress switched back to the ImageCraft compiler, and now we’re left with the task of fixing our existing codebase that was developed with the HiTech compiler.

Not too problematic. The only thing that bothers me a bit is the lack of good/up-to-date documentation. I spent an hour to figure our how to get the printf’s that I used in my code compiling again. Once you know how to do it, it is simple…

Example code:

printf("Test printf without parameters\n");

Compiling your HiTech code with the ImageCraft compiler, the printf fails with the following error:

type error in argument 1 to `printf'; found `pointer to __flash char' expected `pointer to char'

Seems that in for ImageCraft you need to use another printf function if the strings are in ROM. And this function is called… tada: cprintf.

Replace the existing printf with cprintf and you’re up and running again. I guess it would have need nice if this info was added to the ‘migrating from HiTech to ImageCraft’ document that is bundled with PSOC Designer. Maybe eventually, it will be…

Also notice: to get the ImageCraft printf functions working, you need to replace the ‘putch’ helper function for printf by:

// Helper function for the printf function.
int putchar(char c) {
 // Send characters to the Lantronix interface
 return 1;

Finally, if you fancy some more advanced printf functionality like modifiers, or support for long/float, you’ll need to update your ‘’ (‘Project’ -> open and add the option


CODECOMPRESSOR:=$(CODECOMPRESSOR) -llpm8c // For long support

Hope this helps you saving some time until the documentation gets updated!