Talking to a 'C' program

Grant Edwards invalid at invalid.invalid
Fri Nov 8 10:00:31 EST 2013


On 2013-11-08, John Pote <johnhpote at o2.co.uk> 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.

Sockets are nice and simple.  Depending on what you're doing,
stdin/stdout may be even simpler.

For the RS232 part of the problem, don't forget about pyserial:

  http://pyserial.sourceforge.net/pyserial.html

> 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?

I've occasionaly used mingw (which _is_ gcc), and it worked well.
Cygwin (also gcc) works well, but it's a bit more involved.

I do all my embedded development on a Linux host.  I find Linux to be
far more suitable for the task -- the entire Unix system basically
evolved as a software development platform.  I've yet to figure out
what MS-Windows is suited for other than lining Bill Gates' pockets.

Before Linux, I used Solaris/SunOS, and before that I used Unix V7.
Everytime I've been involved in a Microsoft-hosted embedded
development project, I just end up walking a way afterwards shaking my
head in puzzlement.

-- 
Grant Edwards               grant.b.edwards        Yow! I'm having a
                                  at               tax-deductible experience!
                              gmail.com            I need an energy crunch!!



More information about the Python-list mailing list