Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: GNU inline assembler return value

2005-07-15 by brendanmurphy37

Hi,

Thanks for the comment, though I'm not sure what you mean by "C
startup"

Just to clarify:

- we use GCC as compiler for LPC2000
- we don't use any standard libraries: this avoids the most common 
argument against GCC of large size overhead
- the startup is the assembler I included in previous e-mail
- the first thing the "main" does (in 'C') is to copy initialised
data 
from flash to RAM, and clear out uninitialised data: after that it's 
fully initialised
- all hardware setup is done from 'C', using MACROs to typecast the 
register addresses to volatile integer pointers
- only other assembler used is a dispatcher for IRQ interrupts 
(allowing nested interrupts), and the usual very small functions to 
enable/disable interrupts etc.

I couldn't agree more with inline assebler: much better in a separate 
assembler file.

Also, we don't use any special keywords for interrupt handlers:
they're 
just declared as regular 'C' functions: the assembler dispatcher code 
takes are of any special issues, such as additional register saves
etc.)

All this is geared to making the 'C' code as clean and "portable" as 
possible, reducing dependencies on special compiler/dev tool features 
as much as possible.

I'm not sure on you comment on the V850 as well: we use this 
archiecture a lot. By the way, I'd highly recommend GCC for
generating 
code that actually matches the source: we use IAR for V850 and have
had 
a couple of very bad experiences of the compiler generating incorrect 
code at high optimisation levels.

No doubt you've guessed I'm a bit wary of tools that come with large 
amounts of built-in or generated code to "make things easier". Great 
for playing around with a new system with, but if problems arise
(which 
they will in any significant development), they're more a hinderence 
than anything.

I guess I'm getting a bit "off-topic" here: though hopefully the
above 
will be food for thought for some, though. 

Thoughts anyone, on any of the above?

Brendan.

--- In lpc2000@yahoogroups.com, 42Bastian Schick <bastian42@m...>
wrote:
> brendan
> 
> > By the way, memory and other hardware initialisation is all done
> > in 'C' in this case: the less assembler the better, I think.
> 
> But be really careful to use C before the C startup. This might work
> on this chip with this compiler but fail on another.
> 
> (Seen e.g. on a V850 where some registers hold constant like 0xff
and 
> 0xffff
> for masking.)
> 
> BTW: My opion adds one point:
> If assembler then in a separate file, not inline.
> 
> -- 
> 42Bastian Schick

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.