Yahoo Groups archive

Lpc2000

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

Message

RE: [lpc2000] unsigned long versus unsigned int on ARM7

2005-11-11 by Bruce Paterson

> Texas Instruments 320C40 compiler had a 32-bit char, short, 
> int, and long.  Yes, it was not a byte-oriented machine and 
> much trouble with byte-oriented protocols ensued.

Or even less obvious the 24bit gnu based C compiler for the Motorola
series of DSP's (5600x), char, short, int and long were all 24 bits. To
make things work properly using the same code on a test PC we had to
ensure int-like variables were forced to be 32bits (rather than 16bits),
so it was lucky it could be all done in one file where my generic types
were defined. 
A situation like this does mean you should allow for a type that is the
natural int of the machine as well as the specific types like int32_t.
In most cases you probably don't want a 32bit counter on the PC to be
forced into a double word 48bit on the DSP; for most purposes a 24bit
counter will do. I tend towards some global use types like "COUNTER" and
"INDEX" that I set appropriately in the global types file, as well as
min_no_of_bits types like INT32_T where you really do mean you need
32bits (or more).

Cheers,
Bruce

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.