Re: C- Programming for ARM Microcontrollers
- From: "Robert Adsett" <sub2@xxxxxxxxxxxxxxxxxxxxx>
- Date: 30 Oct 2006 06:03:09 -0800
Stefan Reuther wrote:
Agreed. I didn't have the pleasure(?) to code for a 8051 yet, but as
long as it's just the memory allocation directives, you can probably
easily #define them away if needed. I just pumped a 15 year old DOS C
source through a C++ compiler, the only thing I had to change was to add
a '#define far' (their excuse for not having to use Huge memory model
which generates less efficient code), and convert the K&R function
headings to prototypes.
Well huge model does generate less efficient code but as I remember the
only advantage it offered over large was that it could address across a
64K boundary in a single unit. If you had no single allocation larger
than 64K there was no reason to use huge. Most of the pointer
modifiers I ever saw on x86 code were mis-guided optimizations. The
code would have been clearer and just as fast and small if the authours
had just picked the right model to begin with and left off the
modifiers.
Of course this wasn't helped by the fact that there was no agreed
definition for all the various memory models. Microsoft, Borland and
Watcom all had different definitions.
That would have been a little harder if they'd used other platform
specifics such as *(char far*)0x00400017, asm { ... }, <dos.h> etc.,
even if that'd have saved a cycle here and there.
Well, once you include any I/O other than stdio you are definitely in
for a porting job. Even that wasn't portable across DOS compilers. Of
course stdio isn't going to be a lot of good on a lot of embedded
targets.
Robert
.
- Follow-Ups:
- Re: C- Programming for ARM Microcontrollers
- From: Robert Adsett
- Re: C- Programming for ARM Microcontrollers
- References:
- C- Programming for ARM Microcontrollers
- From: techie.embedded@xxxxxxxxx
- Re: C- Programming for ARM Microcontrollers
- From: Vadim Barshaw
- Re: C- Programming for ARM Microcontrollers
- From: techie.embedded@xxxxxxxxx
- Re: C- Programming for ARM Microcontrollers
- From: Robert Adsett
- Re: C- Programming for ARM Microcontrollers
- From: Chris Hills
- Re: C- Programming for ARM Microcontrollers
- From: Robert Adsett
- Re: C- Programming for ARM Microcontrollers
- From: Chris Hills
- Re: C- Programming for ARM Microcontrollers
- From: Stefan Reuther
- Re: C- Programming for ARM Microcontrollers
- From: Chris Hills
- Re: C- Programming for ARM Microcontrollers
- From: Stefan Reuther
- C- Programming for ARM Microcontrollers
- Prev by Date: Re: Private baby GPS
- Next by Date: Re: Private baby GPS
- Previous by thread: Re: C- Programming for ARM Microcontrollers
- Next by thread: Re: C- Programming for ARM Microcontrollers
- Index(es):
Relevant Pages
|