From: Walter Banks on


David Brown wrote:

> Once support fract/accum/sat becomes common in C compilers, then it will
> certainly make it easier to write legible, portable code working with
> scaled fractional integers. I seriously doubt that it will entirely
> remove the need for extensions and intrinsics to get optimal code from
> powerful DSPs, but it will certainly be a solid step in the right
> direction and will let you write close to optimal code for everything
> but the tightest of inner loops.

David,

ISO/IEC 18037 supports named address spaces and user defined
address spaces. Named address spaces allows direct access to the
processor memory space that is used in some DSP's for mac operations
User defined address space is a little more complex but allows
positioning of mac specific buffering.

Byte Craft found that the data types and better access
to the processors native address space separated a lot of the
implementation specific extensions and intrinsics. My experience
in automotive applications was it refocused the compiler on
mac code generation and the application on algorithms.

Retargeting the automotive code to a different execution platform
in our case required little more than redefining the processor specific
address space.

Our experience is similar to that of other compiler companies
that have implemented ISO/IEC 18037

Regards,

--
Walter Banks
Byte Craft Limited
Tel. (519) 888-6911
http://www.bytecraft.com
walter(a)bytecraft.com






From: Walter Banks on


Mark Borgerson wrote:

> In article <480F2B12.69B62031(a)bytecraft.com>, walter(a)bytecraft.com
> says...
> >
> >
> > Chris H wrote:
> >
> > > As has already been mentioned the start up code has to be in assembler
> > > as it sets up the memory for the stack etc however if you use the
> > > standard one that comes with the compiler you will never need to see it.
> >
> > There is no requirement for the start up code to be in asm. A lot of
> > compilers come with asm sample startup but the code could have
> > been written in C in the same compiler. The same extensions that
> > support embedded systems make this possible
>
> Just out of curiosity, how do you set the initial value of the
> stack pointer in C?

Most embedded systems compilers have extensions that
support processor register access. A lot of the compilers
were implemented from hosted compilers as a base and the
initial startup code was written before they added support
for processor access. The example startup has often been
this early code. My point is that it can be done in C.

In our case the first C compiler was written for the C6805
and that was based on a 6805 mistral compiler we had written
a few years earlier. Our initial startup code was written
in C on a compiler that would support it.

register_sp SP;

SP = int_value;

w..


From: Bill Leary on
"linnix" <me(a)linnix.info-for.us> wrote in message
news:cb7dfc98-3ba4-4a0c-981d-18ddf8057370(a)e67g2000hsa.googlegroups.com...
> On Apr 22, 9:51 am, "Bill Leary" <Bill_Le...(a)msn.com> wrote:
>> "Lax" <Lax.Cla...(a)gmail.com> wrote in message
>>
>> news:2defcf6d-7dab-4699-9ce1-d433240398e4(a)m36g2000hse.googlegroups.com...
>>
>> > Are there any situations where programming an embedded processor
>> > "requires" at least some assembly code?
>>
>> In every case where I've worked an embedded processor directly, I've had
>> to
>> at least initialize the environment so it could run C. Basically, setup
>> the
>> stack, clear RAM and jump to _main.
>
> There are always assembly involved somewhere, but you don't have to
> write them. Why are you re-inventing run-time libraries?

Simplest reason in the world. The development package didn't provide them.
The app notes specifically said to initialize RAM, set the stack pointer, a
couple of other things (ensure interrupts were disabled, I think), then jump
to _main. Provided a couple of examples of how to do it, but did not
provide them.

- Bill

From: Bill Leary on
"Grant Edwards" <grante(a)visi.com> wrote in message
news:3qWdnbveM7gCsJPVnZ2dnUVZ_rjinZ2d(a)visi...
> On 2008-04-22, Bill Leary <Bill_Leary(a)msn.com> wrote:
>> "Lax" <Lax.Clarke(a)gmail.com> wrote in message
>> news:2defcf6d-7dab-4699-9ce1-d433240398e4(a)m36g2000hse.googlegroups.com...
>>> Are there any situations where programming an embedded processor
>>> "requires" at least some assembly code?
>>
>> In every case where I've worked an embedded processor directly, I've had
>> to
>> at least initialize the environment so it could run C. Basically, setup
>> the
>> stack, clear RAM and jump to _main.
>
> For processors without an external bus (IOW they have a fixed
> memory map), many toolchains will provide startup code that
> does all that.

Most do these days.

> That's certainly true for GCC on the Atmel AVR
> and TI MSP430: tell the compiler which part you're using, and
> you don't have to write a lick of startup code.

Very often true.

- Bill

From: Stefan Reuther on
Walter Banks wrote:
> Mark Borgerson wrote:
>>Just out of curiosity, how do you set the initial value of the
>>stack pointer in C?
>
> Most embedded systems compilers have extensions that
> support processor register access.

Those I use don't, at least if you don't count inline assembler macros.

> In our case the first C compiler was written for the C6805
> and that was based on a 6805 mistral compiler we had written
> a few years earlier. Our initial startup code was written
> in C on a compiler that would support it.
>
> register_sp SP;
>
> SP = int_value;

What you're doing here is writing assembly with C syntax. It relies upon
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.

But a program doesn't need much assembler code. Actually, one of my
recent ones has exactly two lines of assembler: the SP assignment,
followed by a call to 'main'. But, to be fair, this program is preceded
by a boot loader which is 90% assembler, and leaves the processor in a
sane state: annoying registers and BSS segment zeroed, compiler startup
code often assumes neither.


Stefan