I have an embedded system running on a little-endian Cortex-M3. This system is able to accept packets from the network and reply to them. Now, I would like the system to start generating files. These files will then be downloaded and inspected with tools running on regular x86 desktop computers (i.e. also little endian).
For network packets, the best practice is to use big-endian (i.e. network byte order) for packet structures. I designed my packets to always use big-endian for network packets.
Now, I would like to have my system read from files and generate files, all with custom formats/structures. Is there a widely accepted endianness when it comes to files? Why would you select one endianness over the other, particularly when working with embedded systems? I am tempted to keep my files at little-endian, as this will simplify the code (I can just write structures directly from memory), but this makes it inconsistent with network data interface structures that I'm using. Is this considered acceptable?
Also, if these files will contain copies of big endian data (e.g. the network packets I mentioned), and the files are designed to be little-endian, is it a good practice to have the embedded system convert this big endian data to little endian before storing? Shouldn't the file be kept consistent throughout, or does it really not matter?
Note: as this is an embedded system, and bandwidth/storage/compute resources are limited, text formats are not a good idea in general in this case, so I couldn't avoid this. To reduce complexity, serialized formats are also not a good idea in my case.