Talking to a 'C' program

Mark Barton mark at
Fri Nov 8 15:39:21 CET 2013

On 11/8/13 9:23 AM, John Pote wrote:
> Hi all,
> I have the task of testing some embedded 'C' code for a small micro-controller. Thought it would be a good idea to test it on the PC first to make sure the algorithm is correct then perhaps test it on the controller via RS232 and an appropriate wrapper round the 'C' functions.
> On the PC I can use Python's unit test library module and logging to create a nice and easy to use environment (I like Python). So my question is how to communicate from Python to the C module on the PC. What I'd like is simplicity and ease of setting up. All I can think of myself is to use sockets.
> Any ideas on how to do this would be gratefully appreciated.
> Also as I don't have any microsoft offerings of a C compiler any suggestions as to a suitable C compiler for a PC appreciated as well. llvm? mingw? gcc?
> Thanks a lot everyone,
> John
Hi John,
I know this is not answering you question, but 
have you considered using one of the many "C" unit 
test programs that are available for testing the 
embedded code? I would hazard to guess that it 
would be much easier to use something that is 
specifically C friendly that trying to adapt 
Python unit test. You can however still use Python 
as a wrapper or even a slick GUI for invoking the 
C unit test using a subprocess and getting the 
results.  I have used CUnit in the past and I know 
that it has several different methods for 
returning the results. I'm sure other C unit test 
programs are similar.


More information about the Python-list mailing list