Re: mixing C and assembly
- From: David Brown <david.brown@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 23 Apr 2008 23:03:38 +0200
cbarn24050@xxxxxxx wrote:
On Apr 23, 7:27�pm, Walter Banks <wal...@xxxxxxxxxxxxx> wrote:Stefan Reuther wrote:register_sp SP;What you're doing here is writing assembly with C syntax. It relies upon
SP = int_value;
a heavily non-standard language extension, and makes assumptions about
how the compiler behaves (you don't want the compiler to use the stack
before your SP assignment, do you?). So instead of writing assembly in
C, I prefer using the real thing.
Yes, thats what he always does! He can then claim his compiler can
beat assembler for speed,code size ect. To Walter if it looks Cish,
ends in a semicolon and his compiler can change it into machine code
then its C.
I actually agree with you it is very low level C. The purpose of ISO/IEC
18037 was to define the low level syntax. Most start up code is very processor
family specific. �Writting start up code in C makes good use of C's
optimization like the branch/jump to main.
Whats to optimise? Why bother optimising a one time instruction?
Sometimes I think you'll say anything to sell a compiler.
Why would you bother optimising a traditional call to main into a jump? On some targets (in particular, several that Bytecraft target), the saved stack space is significant - and even the couple of saved flash bytes is worth doing (given the negligible cost of the compiler's effort).
There is also the question of why would one bother to write code that you know is less than optimal, if it is just as easy to write better code?
.
- Follow-Ups:
- Re: mixing C and assembly
- From: Walter Banks
- Re: mixing C and assembly
- From: cbarn24050
- Re: mixing C and assembly
- References:
- mixing C and assembly
- From: Lax
- Re: mixing C and assembly
- From: Hans-Bernhard Bröker
- Re: mixing C and assembly
- From: Chris H
- Re: mixing C and assembly
- From: Walter Banks
- Re: mixing C and assembly
- From: Mark Borgerson
- Re: mixing C and assembly
- From: Walter Banks
- Re: mixing C and assembly
- From: Stefan Reuther
- Re: mixing C and assembly
- From: Walter Banks
- Re: mixing C and assembly
- From: cbarn24050
- mixing C and assembly
- Prev by Date: STMicroelectronics Introduces ARM9 Microcontroler with 2.1 Mbytes Flash
- Next by Date: Re: Getting fit with embedded systems
- Previous by thread: Re: mixing C and assembly
- Next by thread: Re: mixing C and assembly
- Index(es):
Relevant Pages
|