Programming Model

Programming Model

The BCUs have limited memory (256 Byte User Programm Memory and 18 Bytes User Ram for BCU1; 944 Byte User Programm Memory and about 18+24 Byte User Ram in two sections). Therefore the stacksize is restricted to a maximum of 256 bytes. Using larger stacks would increase only the code size and would only avoid regression test failures.

As the architecture has only memory access commands with an offset of 8 Bit, general memory access commands have to be emulated.

The architecture has only two registers. Because gcc needs more registers, some memory allocations are used as registers. This port uses the naming convention of the BCUs, which reserve 13 Bytes. The registers are called RegB to RegN.

The return stack is not useable for the application programm, so a second stack for the software is emulated. Because there are no operations to save/restore the return stack pointer, setjmp/longjmp will not work. The start address of the stack is idicated by a symbol called SPBASE which must be aligned at a 256-Byte boundary. A byte called SP is the offset relative to SPBASE of the last used byte. For the framepointer FP, a second byte is allocated, if needed. The stack grows downward.