What is the best way of porting the ‘compiler-rt’ Profile library for an embedded system with no file-system (and hence no ‘fopen’, etc.)?
What I would like to do is use it as normal, but then use a custom solution for getting the resulting data off the system. It seems that this library (and the other compiler-rt libraries) are designed only to work with a hosted system.
Are there any other embedded targets that this has been adapted for which would have similar constraints?
Well you could always write a ‘filesystem’ that shunts all data out the serial port (or similar).
Yep, done that already, but it is not at all a good fit when the device is inside a drone flying around What we do have, is a fake file-system that keeps everything in memory, and after the profiling is completed we offload it for analysis. I guess I was hoping that there would be a more robust system agnostic implementation. Use of ‘mmap’ is similarly constraining.
Can’t you just port enough to get the existing:
functionality working? This shouldn’t depend on IO. You then have free choice of how to get that buffer to somewhere persistent.
This is something we use on PlayStation, in addition to the more usual “write a file” path.
Right this is the way. One feature that is missing for the buffer writer is the value profiling support.