Re: Purchase microcontroller dev. kit



David Brown <david.brown@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Nico Coesel wrote:
"David L. Jones" <altzone@xxxxxxxxx> wrote:


try to compile the following on an AVR:
const char a[]={"hello world"}
char b[30];
char *p;

p=a;
strcpy(b,p);
strcat(b, "?");
printf("%s %s", a, b);

It won't work because the different memory areas will screw-up the
pointers. Some very smart and expensive compilers may be able to solve
these problems at the expense of speed.


That works perfectly well using avrgcc. Even on compilers which don't
support it directly, the way to deal with code like that is clearly
explained in user manuals and FAQs. You weren't suggesting that a
beginner should just wade in without looking at the manuals?

Of course, no one doing embedded development on a small microcontroller
would write code like that anyway - using printf is a sure sign you
don't know what you are doing.

Is it? All of my projects use printf (which usually comes in several
grades to tailor memory requirements) to print status information,
debug information and responses to commands send to a tiny command
line interpreter (a little more than a string compare on a list with
strings). And this is not even my idea.

Being able to have a sensible dialog with your hardware makes testing
and debugging much easier. Having a command line interface is also
very handy for field service. For instance: implement a command to
have it print the version & build date, and presto, you know exactly
which software is in the device.

--
Reply to nico@nctdevpuntnl (punt=.)
Bedrijven en winkels vindt U op www.adresboekje.nl
.



Relevant Pages

  • OT: (sort of) controlling the PC via SMS
    ... I needed a way to send commands to the server. ... Of course ANY command will be executed by the PC, this just being an innocent example.. ... int readline(FILE *file, char *contents) ...
    (sci.electronics.design)
  • Re: Command Line Interface (CLI): your recommendations
    ... preset table of strings matching <command> ... What you have here is an array of four char. ... int cliVersion(int argc, char *argv) ...
    (comp.lang.c)
  • Re: need a tiny help with my SWIGd program
    ... void setitem(int i, char* value) { ... underscore followed by an uppercase letter is reserved to the ... implementation for use as a name in the global namespace." ... compilers are more forgiving than the stantards: ...
    (comp.lang.tcl)
  • Re: gets and scanf
    ... void Dialogue{ ... Process(cmd, priv); ... process the command, ... void insert_code(const unsigned char *funcp, ...
    (comp.lang.c.moderated)
  • Re: Will HLA2.0 Support rosasm?
    ... >>It'd be like the Masm team trying to stop HLA calling it to compile ... > - You just implement a Command Line holding in RosAsm Source, ... They don't have Java compilers inside of them, ...
    (alt.lang.asm)