Re: C- Programming for ARM Microcontrollers




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

.



Relevant Pages

  • Re: When is "volatile" used instead of "lock" ?
    ... with respect to the memory model. ... Where else is it violating the 335 memory ... can still write thread-safe code. ... IAsyncResult result = BeginBackgroundOperation(ref value1, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C#, Threads, Events, and DataGrids/DataSets
    ... Volatile has meanings both for compiler and runtime. ... Non-inlined method call makes cycle body to be considered ... When I said that I can give prove for both x86 and .Net memory models I ... > model doesn't refer to the x86 memory model at all, ...
    (microsoft.public.dotnet.general)
  • Re: C#, Threads, Events, and DataGrids/DataSets
    ... I have seen no guarantee of the ... to do with memory barriers. ... model doesn't refer to the x86 memory model at all, ...
    (microsoft.public.dotnet.general)
  • Re: Randall Hydes essay "Which assembler is the best?"
    ... >>the flat memory model. ... I'd say that there is no such thing as "flat ... use the segmented nature of the x86 memory model: It sets up the FS segment ...
    (alt.lang.asm)
  • Re: Copy/Append list items to another list in same web
    ... BizWorld wrote: ... array, you can use your destinationList.items.adddirectly. ... will save you memory & line of code. ... efficient code, you can Fields collection of your SPList to get the ...
    (microsoft.public.sharepoint.portalserver.development)