What is the most "C unfriendly" architecture for which a workable C compiler exists ?

Even rather stupid compilers like sdcc will create rotate instructions for code like this: c = (c > 7); c = (c > 1);

Philipp

Reply to
Philipp Klaus Krause
Loading thread data ...

Certainly would, it would bring C code to where Modula-2 has been for over 15 years :)

I think Walter's example should also expand for Ports, as he creates a struct of bits ( tho each element is int :1, not bit, which I thought was now C-legal ? )

ie if one can accsss Carry as CC.C, then any port should be accessible as PortName.BitName ?

-jg

Reply to
Jim Granville

please change the subject line when you change the subject

CBFalc> Walter Banks wrote:

Reply to
Walter Banks

Our C compilers can access PortName.BitName. In the more general case ports can more than one bit field be typed or mapped on structs.

There was a lot of effort in when TR18037 was written to include those things that collectively we has some experience with.

Access to the registers and user defined memory have seen a lot of use.

w..

Jim Granville wrote:

Reply to
Walter Banks

Many do, but is it "Embedded C"?

But can you define which register you are using?

The IAR construct: __no_init __regvar unsigned char my_register_variable @ 2; tells you to use register 2.

This is very useful for small applications, allowing global variables in regusters.

--
Best Regards,
Ulf Samuelsson
ulf@a-t-m-e-l.com
This message is intended to be my own personal view and it
may or may not be shared by my employer Atmel Nordic AB
Reply to
Ulf Samuelsson

The Embedded TR18037 formally defined this wide spread practice.

Global variables can be allocated to specific registers or allocated to the next available register. The compiler sees this as an application constraint and creates code using the remaining registers for locals and temporaries.

Agreed.

w..

Reply to
Walter Banks

Le Sat, 03 Jun 2006 10:05:04 +0200, Anton Erasmus a écrit :

PIC and 6805, 6808

C Code generated for 68xx and 8051 is usually bloated.

If you design with a PIC you will prefer a C Compiler, CCS does a good one that masks all the weird stuff and you don't have to worry about the ridiculous paging system.

--
Tired of Microsoft's rebootive multitasking?
then it's time to upgrade to Linux.
http://home.comcast.net/~mcatudal
We are the Cybernetic Entomology Experts
Reply to
Michel Catudal

I thought someone else would mention it by now, but another notorious example is the word-addressed DG Nova, which required a separate pointer format to address bytes. C compilers existed for this architecture; Chris Torek and Michael Meissner often mention its quirks:

formatting link
formatting link
ek

Reply to
toby

The same problems occurred with the Univac-11xx series, which used word addressing with 36 bit words and 6/9 bit characters.

This problem also occurs with any 16/24/32 bit DSP, which do not have byte addressing.

In many Pascal systems, this problem was solved with the "packed array of char", which had a limited set of operands compared to "array of char", in which each character occupied a memory word.

In future high level systems with 64 bit ALUs, do we really need 8 bit byte addressing ? The 8 bit byte is insufficient to express all characters in many major languages of the world.

The Unicode scalar value (USV) range is 0.. 0x10FFFF, thus requiring

21 bits, thus, three Unicode characters would nicely fit into a 64 bit word with one spare bit ("UTF-64"). Some kind of packed array of char mechanism would be required to access individual characters.

Paul

Reply to
Paul Keinanen

Now I'm really getting d=E9j=E0 vu.

Reply to
toby

Now I'm really getting d=E9j=E0 vu.

Reply to
toby

I had to program that thing in Interpreted BASIC.... It ran the whole company!

>
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
/\/\/ chris@phaedsys.org      www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Reply to
Chris Hills

Someone who programmed the Singer minis once told me about their architecture. They had to be programmed in assembler and the assembly language was so convoluted that they had to use a pre-processor written in Snobol.

Leon

Reply to
Leon

The Novas were a great step forward from the previous one, the Digital PDP-8. The history of Novas is tied tightly with PDP-8 and PDP-11. The Nova is what was initially thought to become a PDP-11, but the designers spun off Digital and set up an own company.

IIRC, the Novas are older than the C language, which was initially set up on a PDP-11.

The idea of addressing everything as bytes was new in the minicomputer world with the PDP-11, although on the mainframe side it was already used in the IBM S/360.

--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio

"[..]

If you design with a PIC you will prefer a C Compiler, CCS does a good one [..]"

Though ANSI/ISO C compliance is not something one expects in a microcontroller, I had portable ISO C code compiled with various compilers on various desktops and workstations. Trying to get CCS's C compiler to work with it was a struggle I never succeeded in, though it was possible after fewer modifications than with CCS to compile it with SDCC for the

8051 (though I admit in that case, SDCC's resultant object code was too large for 64KB).
Reply to
Colin Collin Paul Gloster

Le Mon, 12 Jun 2006 16:29:26 +0200, Colin Collin Paul Gloster a écrit :

I've used that compiler for a sunroof controller with a pic and it did a good job. It was not ansi compliant but well done for that processor. The only issue was with the debugging as I had to keep in mind that it replaced routine calls with jumps. That processor is not meant at all for C and CCS did a very good job and managed to do good optimized code. I used IAR when I moved to the AVR.

--
Tired of Microsoft's rebootive multitasking?
then it's time to upgrade to Linux.
http://home.comcast.net/~mcatudal
We are the Cybernetic Entomology Experts
Reply to
Michel Catudal

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.