SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By slagment

I wish to define my own stream/IOstream/file descriptor so I can use fprintf with any hardware. I can hi-jack stdout and stderr and write to the UART, e.g., fprintf(stdout,"Comes out the UART %d", someInt).

I would rather have fprintf(myDefinedStream,"Comes out the someDevice %d", someInt).

I have many devices where fprintf would be handy, SDcard, external SRAM, ROM, LCD UART, and would like to define streams for them all.

All the low level code is written to write and read one char at a time, just got to define the stream and map to it.


Using yagarto toolchain for arm. No FDEV functions that I can find.
User avatar
By viskr
You could do this for devices that function somewhat write-only, like SDcard for data logging, and LCD-UART. Maybe the same for reads as well like a ROM, though I don't see how it would be too useful for an SRAM. You'd have to do all the initialization to setup baud rates, pointers...

There's code out there for embedded systems for printf (the stock gcc stuff is not what you want to use, as the overhead is huge).

You could grab the code from our site for fprintf/printf that even handles single precision floats now, and the code is just over 4K for a Cortex ARM.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]