Download TASKING VX-toolset for C166 User Guide
Transcript
TASKING VX-toolset for C166 User Guide unsigned char unsigned short char __near int __far __bita bitbyte; __bita bitword; text[] = "No smoking"; array[10][4]; __far and __shuge code generation The __far and __shuge qualifiers have only very little difference in code generation. There are two basic differences: • Accessing __far objects is done using EXTP instructions and accessing __shuge objects is done using EXTS instructions. This has no difference in code size or execution speed, and therefore it is in general preferred to use __shuge, because objects can be as large as 64 kB, while with __far the size of a single object is limited to 16 kB. • Code generation for accessing objects on stack is a little bit more efficient for __far pointers than for __shuge pointers. 1.3.1.1. Pointers with Memory Type Qualifiers Pointers for the C166 can have two types: a 'logical' type and a memory type. For example, char __far * __near p; means p has memory type __near (p itself is allocated in near data), but has logical type 'character in target memory space far'. The memory type qualifier used left to the '*', specifies the target memory of the pointer, the memory type qualifier used right to the '*', specifies the storage memory of the pointer. __far and __shuge pointer comparison By default all __far pointer arithmetic is 14- bit. This implies that comparison of __far pointers is also done as 14-bit. For __shuge the same is true, but then with 16-bit arithmetic. This saves code significantly, but has the following implications: • Comparing pointers to different objects is not reliable. It is only reliable when it is known that these objects are located in the same page. • Comparing with NULL is not reliable. Objects that are located in another page at offset 0x0000 have the low 14 bits (the page offset) zero and will also be evaluated as NULL. In the following example the if( p ) is false, because the page offset of p is zero: __far int i __at(0x10000); __far int *p = &i; if( p ) p++; In most cases these restrictions will not yield any problems, but in case problems exist, the following solutions are available: • Cast the problematic comparison to long, e.g.: if( (long)p ) 6
Related documents
User Manual - v8.8 Cross-Assembler, Linker/Locator, Utilities
8051 Cross-Assembler, Linker, Utilities User`s Manual
ST10F27X firmware development getting started with tasking ST10
AN2142 - STMicroelectronics
Polar Electra Oy Professorintie 5 F,N-90440
User Manual - v8.8 C166/ST10 C Compiler
do Manual
C166/ST10 CrossView Pro Debugger User`s Manual
User Guide - v3.6r1 DSP56xxx Toolchain C++ Compiler