This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is it possible to write variables to a file

Hi,

I'm currently writing a series of unit tests for a module which is included within our embedded firmware. There is a high possibility that this module will evolve so these tests will need to be re-run. I'm running the unit tests within the simulator and was hoping to be able to hit run, the tests get executed and once complete the results get outputted to a file so that I have the necessary evidence that the tests have been carried since I'd rather not have to sit and manually copy out the test case results. I've had a look at the C51 manual and it says that fopen isn't supported. Is there an alternative solution to logging my test results?

Cheers for any help that is forth coming.

  • Capturing debug output on the serial port?

  • Yes if this can be emulated using the simulator debug session as I don't have any hardware at present. Even if I did I don't have a serial port available to me on the intended hardware.

    The code that I'm testing is the algorithmic / functionality side of things rather than the hardware abstraction layer and in an ideal world I'd use Visual Studio or the like which would allow me to write data to a file, but the test cases need to be written in Keil so that I don't have to worry about the differences between the compilers...endinness, data types etc.

    At present I'm placing a breakpoint at the end of the last test and selecting run. When the simulator hits the breakpoint, I then have to observe the results (values returned from the test case functions) via a watch window and copy them over into a spread sheet/csv file for the records. Being able to have Keil to automate this transfer of results into a file would save me no end of time, avoid finger troubles and let me get on with coding.

  • The debugger can capture the serial port data from the simulated processor.

    If your processor has a serial port, and you haven't configured the processor to allocate the relevant pins or baudrate timer for other tasks, then it doesn't matter that your target hardware does not have a serial port.

    On the other hand - if your test code does not depend on any hardware resource that collides with the UART function, then you can reconfigure your simulated processor to have a serial port just for these tests.