Hi,
something that might be useful to people.
When developing, you can use printf to print stuff to the debugger. It's very useful to see the output from a core right there in Eclipse (or whatever your choice of debugging environment is).
But you can't do this if you build with the internal LDF because the stdio standard library, which contains printf, is too big to fit in the 32k of onboard memory. So if you want printf support you must build using either the fast or legacy LDF. Using fast or legacy LDFs makes things more complicated to get started because it goes to shared memory and might overwrite your variables etc. Plus it'll be a lot slower (not that you should be worried to much about speed when debugging anyway).
Which got me thinking - I don't really need the standard io library, I just want to print stuff. So I had a look around and found tinyprintf, which was developed for debugging embedded systems over a serial port. I've modified it to work nicely with e-gdbserver (it needs to buffer the output otherwise e-gdbserver and e-gdb will display the output as one character on each line, and I've prevented overruns etc.)
So just just compile this into your project and you don't need stdio so you can still run everything internally. You don't even need to change your printf statements.
The max buffer size at the moment is defined as 256 which should be loads for most things, but obviously increase it if you need to. If you don't increase it your strings will simply be truncated. This was a quick and dirty way of doing it but I wanted to minimise changes to the file as I didn't want to break anything else and spend lots of time on it.
It does't handle floating points (there's an older version here which does but it would need to be modified similarly to how I have done it: ). For now though it's good enough for what I need it for and hopefully will be useful to other people. It makes things a lot easier being able to do it this way.
From looking at the output of e-size it seems to only add about 1.5kB to your binary.
I've been using it for a week now and it works great so I thought it was time to share.
The two files you need are attached to this post in a zip file.
I hope it helps.
Thanks,
Eoghan.