Per mention here, I figured it would do to spin off the topic of Prizm SDK organization.
For libfxcg (and thus the GCC Prizm SDK) we have a smattering of include files variously pretending to be either standard C (stdio.h etc) and Simon's FX-9850 (I may have misremembered that number, but meh) derived-SDK (RTC_syscalls.h etc).
First, I find that organization to be hideous, and second, since we have at least three competing toolchain implementations (see linked topic at the top of the post), it would be useful to keep some sort of source compatibility between them.
As for what may be done, I have a few suggestions:
Don't put nonstandard routines in files that share names with standard C libraries.
stdio.h contains the Bfile_* routines in libfxcg, which just serves to muddy the waters. I propose that Prizm-specific routines be placed in an include subdirectory and be given names compatible with those used in Simon's SDK. For example, APP_syscalls.h would be moved to fxcg/APP_syscalls.h. This approach makes it more obvious where unusual-looking library functions come from, and can maintain source compatibility with Simon's SDK with an include path addition (-I $LIBFXCG_PATH/fxcg or such).
Implement C library wrappers
There's been discussion of porting a C library for the prizm, but nobody (read: Jonimus) has been willing to really dig into newlib (or anything else) to really give the port a try. I am of the opinion that we don't need a whole C library, but there are a number of useful routines that we can provide, such as limited portions of stdio (string formatting, for example) and stdlib (particularly to wrap the idiosyncrasies of the Bfile_* syscalls). These would go in the root include directory and fill in the usual standard header files.
There would necessarily be some additional overhead in providing C library wrappers, but that is true of any implementation. For GCC at least, we can mitigate most effects by turning on link-time code generation by default for both libfxcg and the SDK packages (-O2 -flto).
That's all I have to say for now. Thoughts?
I'm willing to put some work into building C library wrappers if there's interest, but the lack of a testing platform puts me at a disadvantage there.
For libfxcg (and thus the GCC Prizm SDK) we have a smattering of include files variously pretending to be either standard C (stdio.h etc) and Simon's FX-9850 (I may have misremembered that number, but meh) derived-SDK (RTC_syscalls.h etc).
First, I find that organization to be hideous, and second, since we have at least three competing toolchain implementations (see linked topic at the top of the post), it would be useful to keep some sort of source compatibility between them.
As for what may be done, I have a few suggestions:
Don't put nonstandard routines in files that share names with standard C libraries.
stdio.h contains the Bfile_* routines in libfxcg, which just serves to muddy the waters. I propose that Prizm-specific routines be placed in an include subdirectory and be given names compatible with those used in Simon's SDK. For example, APP_syscalls.h would be moved to fxcg/APP_syscalls.h. This approach makes it more obvious where unusual-looking library functions come from, and can maintain source compatibility with Simon's SDK with an include path addition (-I $LIBFXCG_PATH/fxcg or such).
Implement C library wrappers
There's been discussion of porting a C library for the prizm, but nobody (read: Jonimus) has been willing to really dig into newlib (or anything else) to really give the port a try. I am of the opinion that we don't need a whole C library, but there are a number of useful routines that we can provide, such as limited portions of stdio (string formatting, for example) and stdlib (particularly to wrap the idiosyncrasies of the Bfile_* syscalls). These would go in the root include directory and fill in the usual standard header files.
There would necessarily be some additional overhead in providing C library wrappers, but that is true of any implementation. For GCC at least, we can mitigate most effects by turning on link-time code generation by default for both libfxcg and the SDK packages (-O2 -flto).
That's all I have to say for now. Thoughts?
I'm willing to put some work into building C library wrappers if there's interest, but the lack of a testing platform puts me at a disadvantage there.