Fri 15 Nov 2013 10:12:16 PM UTC, original submission:
I found it a bit cumbersone to remember for each run of a simulation for which device the binary was compiled for. Obviously, storing these parameters right at compilation time makes running simulations easier.
I found simavr to have a nice concept: store these parameters in custom sections of the ELF file. This way they're available to the simulator and get ignored when uploaded to real hardware. On how to use it, see the comments in src/simulavr_info.h (new file). It's really simple, at compilation time we know best for which device we compile, after all.
For now this is a proof of concept. Storing parameters works fine, reading them back, too, but instead of being used, they're simple written to the console. For now the parameters are device type and cpu frequency, but the concept can be extended easily to all other command line parameters. As soon as the values are actually applied, the -d and -F command line parameters become obsolete (but should override the stored info if given anyways for those who know what they're doing).
The proof is applied to the simple_serial example.
Please find the patch attached and enjoy!
|