|[ << ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
This chapter documents the Backend for the c16x/st10 microcontroller family.
This backend provides the following additional options:
Place identical floating point constants at the same memory location. This can reduce program size and increase compilation time.
By default constant data will be placed in a read-only section. Using this option it will be placed in the data section.
By default arguments of function calls are not always popped from the stack immediately after the call, so that the arguments of several calls may be popped at once. With this option vbcc can be forced to pop them after every function call. This may simplify debugging and very slightly reduce the stack size needed by the compiled program.
Do not perform peephole-optimizations.
Produce output for the Tasking assembler.
Assume all functions are within one code-segment. Shorter instructions for calling functions are used and function-pointers will be only 2 bytes long. This results in shorter and faster code.
All objects which are not explicitly qualified are assumed to be far (i.e. they may be in different segments but must not cross one segment-boundary). The default pointer size will be 4.
All objects which are not explicitly qualified are assumed to be huge (i.e. they may be in different segments and may cross segment-boundaries). The default pointer size will be 4.
Do not use.
This backend supports the following registers:
R15for the general purpose registers
Additionally, the register pairs
R2/R3, R3/R4, R4/R5, R6/R7, R7/R8, R8/R9, R12/R13, R13/R14,
R1, R11 and
R12 are reserved by the backend.
The current version generates assembly output for use with the vasm
assembler. Optionally, assembly code for the Tasking
assembler can be generated.
The default memory model corresponds to the Tasking small-memory
model with 16bit data-pointers and 32bit function-pointers.
DPPx registers have to be set up in a way to
create a linear 16bit address space (i.e.
The generated code should work on systems with c161, c163, c164, c165
and c167 microcontrollers as well as ST10 derivates. Old versions like
the c166 are not supported
R10-R15 are used as scratch registers (i.e. they
can be destroyed in function calls), all other registers are preserved.
R0 is used as user stack pointer. Automatic variables and temporaries
are put on the user stack. Return addresses are pushed on the system
The first 4 function arguments which have integer or pointer types
are passed in registers
Integers and pointers are returned in
All other types are returned by passing the function the address
of the result as a hidden argument - so when you call such a function
without a proper declaration in scope you can expect a crash.
The elementary data types are represented like:
type size in bits alignment in bytes char 8 1 short 16 2 int 16 2 long 32 2 long long n/a n/a near pointers 16 2 far pointers 32 2 huge pointers 32 2 float n/a n/a double n/a n/a
The c16x-backend offers the following variable attributes:
Return with rfi rather than blr.
MDL/MDH will be saved, however it is recommended
to switch to a new register bank as the gprs are
DPP0-DPP3 are not saved (the compiler does not
__interrupt, but also places a jump-instruction
to the interrupt service at the corresponding vector table
address (needs support from library and linker file).
Place this object/function in section <name>.
Switch to another register-bank for this function.
The c16x-backend offers the following type attributes:
Object resides within the same segment.
Object may reside in a different segment, but does not cross a segment-boundary.
Object may reside in a different segment and may cross a segment-boundary
Place this function or object in section <name>.
Used to declare a special function register at <addr>.
__sfr(0xff10) volatile unsigned int PSW;
The same for extended special function registers.
Declare a single bit in the bit-addressable area.
__sfr(0xff10,11) volatile __bit IEN;
The same for the extended bit-addressable area.
The c16x-backend offers the following additional types:
A single bit in the bit-addressable inernal RAM-area. Only static and external variables may use this type. It is not allowed for auto or register storage-class. Also, arrays of bits, pointers to bits or bits within aggregates are not allowed. Conversion of a bit to an integral type yields 0 if the bit is cleared and 1 if it is set.. Conversion of an integral type to a bit clears the bit if the integer is equal to 0 and sets it otherwise.
This backend defines the following macros:
If the ‘-stack-check’ option is used, every function-prologue will
call the function
__stack_check with the stacksize needed by this
function in register
R1. This function has to consider its own
stacksize and must restore all registers.
Only stack-checking of the user-stack is supported. Checking the system-stack is supported by hardware.
A possible <stdarg.h> could look like this:
typedef char *va_list; va_list __va_start(void); #define __va_rounded_size(__TYPE) \ (((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) #define va_start(__AP,__LA) (__AP=__va_start()) #define va_arg(__AP, __TYPE) \ (__AP = ((char *) (__AP) + __va_rounded_size (__TYPE)), \ *((__TYPE *)((__AP) - __va_rounded_size (__TYPE)))) #define va_end(__AP) ((__AP) = 0)
|[ << ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
This document was generated by vb on January 3, 2015 using texi2html 1.82.