cpik generates code for PIC-18 processors running in legacy (ie: non-ehanced) mode.
The PIC-18 core is fundamentally a 8 bit processor with 16 bit pointers and distinct program/data spaces.
From the C programmer point of view, up to 64K bytes of program space and 64K bytes of data space are available.
Pointer generally points to data space, but pointer to function points
to program space. Programs can be larger than 64K bytes (when the device has enough memory), but pointers to functions can only reach the lower 64 KB of memory. This is not an issue because it is easy to force the adresses of target functions to be less than
0xFFFF.
cpik has been designed to produce a stack-based code. This kind of code is easy to understand, robust and
potentially reentrant without any trick. Interruptions are easy to support (see section 10.12.4 for details).
Thanks to autoincremented and indirect adressing modes, this design leads to efficient code.
The memory model is flat and covers the totality of program/data spaces.
There is no banks, "small" stacks, "far" pointers or other tricky ways to save memory but to confuse everybody.
Subsections
AG
2013-04-10