- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to override printf's in PSoC4?
Overriden the printf function in retarget.c, but still crashing in "__sinit" arm lib function call.
How can we skip (/ override) __sinit function call in PSoC4 compilation?
Aim is to go to fputc function defined in retarget.c from printf.
Attaching project for reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Your project doesn't open in PSoC Creator 3.1 Service pack 3.
2. PFA better way to overide printf's, very crisp and small. In my opinion it is better than 100 projects in 100 Projects. - Test No. 23 tinyprintf Example.
3. If you would have answered to my problem of __sinit solution, I would have provided even crispier solution. I think, ARM GNU toolchain issue, ARM RVDS compiler have far better solution.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Latest Creator version is 3.3, so yours is more than a bit outdated. There is a new release announced for coming end of the year (usually a bit later).
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Bob. I'm running PSoC creator 3.3 on a Pioneer BLE kit with Cy8C-4248-LQI-583. I've set the pins in the cydwr to rx=p1[4] and tx=p1[5].
I can build and upload your file, and it prints "PuTTY Output" but then does not print the prompt or scanf for input. Looks like the PuTTY_UartPutString works, but that printf does not.
Is stdio functionality better in creator 4.0? I tend not to like .0 releases of toolchains, and am not enthused by the "BLE Code Examples Fail Digital Placement" erratum...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Best (and fastest, less resource consuming) way to print formatted:
Use
sprintf(Buffer,Format,Values);
UART_PutString(Buffer);
In Project -> Build Settings -> Linker Set Use newlib nano to true (default)
Set Use newlib nano float formatting to true
In Workspace -> System set the Heap size to 0x0200
Configure your UART Rx and Tx Buffer size to 80 .. 200 using the internal interrupt
The function family scanf() is not supported by newlib nano, you'll need to use atoi() macro
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob / Cypress team,
Here is the best solution for printf overriding. PFA attached project.
ARM GNU toolchain, I am not confident, as I have an option of ARM MDK compiler. Compiled image size with MDK compiler is far smaller than GNU tool chain. And MDK follows all standard definition and have documentation available.
Always prefer MDK over GNU toolchain.
File system simplest solution will also follow up on this post.
Thanks,
Rajender