Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24

IAR Embedded workbench can support generic pointers.

--
Best Regards,
Ulf Samuelsson
This is intended to be my personal opinion which may,
or may bot be shared by my employer Atmel Nordic AB
Reply to
A.P. Richelieu
Loading thread data ...

The PIC (the old PIC16 at least - I don't know newer ones) architecture

*is* crap. What you have managed to do (and I highly commend for it) is write a compiler that makes this crap run well. If you wrote a similar compiler for a half-decent architecture like the avr, or a decent one like the msp430, you'd get even better results.

I think we agree that extensions or changes to C for use in embedded systems are a necessary thing, and can often be a good thing even when strictly-speaking unnecessary. But if you have made extensions (like adding "flash" or "near" keywords) or semantic changes (like changing the meaning of "const"), it is no longer standard C. I stress that I don't see that as a bad thing (within reason).

I fully agree here - C is a terrible language for small embedded systems (or big embedded systems, or non-embedded systems for that matter). It should be possible to design an HLL that works far better in every way, be it for a PIC or any other micro. However, pretty much any reasonable HLL will work better on better architectures - the PIC will still be poor in comparison to others.

I'm slightly confused here - your compiler is *not* a C compiler? I thought what you had written was a very smart C compiler. If what you have is not a "C compiler" as such, but a "modified C" or a "C with some bits of C++" compiler (guessing from your overloaded function), then that's fair enough. It's likely to be a good solution - just as long as you don't call it standard C.

mvh.,

David

Reply to
David Brown

unsigned char lives_in_RAM = 'a'; const unsigned char lives_in_ROM = 'b';

works for all the HI-TECH C compilers I have installed at work, for Harvard or von Neumann architectures. As several people have mentioned (but not in detail), they allocate constant objects to addresses in ROM that are outside the range of valid addresses in RAM, so can be distinguished at runtime.

mlp (Disclosure of Interest: employed by, but not speaking for, HI-TECH; just pointing out a mechanism that can be and is used.)

Reply to
Mark L Pappin

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.