-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dbg_printf should not take a buffer argument. #13
Comments
Suggested implementation:
|
Well, I chose an adaptation of sprintf because vsprintf is not a part
of the standard libraries in the bootcode, and this would add tons of
unnecessary code. There's TI's own debugger printf function that works
exactly like yours, but it only works if the emulator byte is set.
|
Actually, I prefer to leave the dbg_printf this way. That way you can write output elsewhere or something rather than to the console. This is one extra argument; it's not that bad :P |
The problem is that I'm trying to maintain API-coherence with the PC version of my code base, and C89 doesn't support variadic macros, so I currently have to have |
@elfprince13: Making a wrapper function that calls the actual one with the argument(s) already setup ( |
void dPrintf(const char* fmt, ...){
va_list args;
va_start(args, fmt);
vsprintf(dbgout, fmt, args);
va_end(args);
} Works well with v1.6 Please note that this code increases the outputted binary by 8105 bytes though. This is pretty substantial when you only have 64kb to work with. I would recommend you change the computer side API, but that's entirely up to you as that would be some work. |
It would be more useful to have
dbg_printf
be an actual function, mimickingprintf
usage. Keepdbgout
as a global variable, and provide a definition thatsprintf
s todbgout
.The text was updated successfully, but these errors were encountered: