Hi, I'm a bit of a newbie to C and embedded programming. I'm using the ARM Crossworks IDE right now and trying to get the HRM_RX example working on my PCA10028 board. I've imported the code and when ever I attempt to compile it, I get the following errors from the retarget.c file.
error: storage size of '__stdout' isn't known
error: storage size of '__stdin' isn't known
From my reading I understand I have to define the size of these two as Crossworks doesn't do it for me, but I'm at a bit of a loss as to how to do that correctly. Any help is appreciated!
Remove retarget.c, you don't need it.
If you want to send output to the UART then there's an example in the Crossworks manual of how to do that, you customise __putchar() you don't need, nor can you use, retarget.c which has definitions for GCC or ARM libraries only. The manual also shows you how to output to the Crossworks console (very useful). It doesn't tell you how to use the Segger "RTT" library, but Crossworks works natively with that as well giving you a very easy way to output data right out of the JLink. You just follow the instructions you can find online at Segger for RTT and that too appears in the console.
If you want to be able to use app_trace or want to be able to printf to the UART you need retarget.c.
I think it has something to do with the c library you are using but I don't know anything about Crossworks. I use the arm toolchain from launchpad. This includes a newlib nano implementation that works fine.
the retarget.c library is simply overwriting the stdio library such as fputc, fgetc with UART command. I'm not sure how to do it with Crosswork, but you can't, you can simply remove retarge.c and replace those commands to print log with direct UART command to send and receive data.
For anyone else using Crossworks, here are their instructions for input/output, and as I said you can also use the segger RTT library ..
Crossworks putchar instructions
Many thanks! That got it compiling correctly.