Frequently Asked Questions (FAQ)
This page contains answers to common questions handled by our customer support staff, along with some tips and tricks that we have found useful and presented here as questions.
FAQ sections:
Eclipse FAQ
- How can I start the Eclipse environment with a specific version of the Java Runtime Environment (JRE)?
- Where can I find the command line arguments of Eclipse?
- Is there a list of problems and feature requests related to Eclipse?
- Can I see the command line invocations of all executed tools during a build?
- Is it possible to show more lines in the Problems and/or Console window?
- Why does macro highlighting doesn't work when using multiple configurations?
- The following error shows up: "An out of memory error has occured. Consult the "Running Eclipse". What does it mean and how to avoid?
- How to add a source file or folder outside the workspace to a project?
- After importing a DAvE project, many E304 assembler errors show up after building the project like "symbol xxxx is already defined as SFR". How to fix this?
- How to generate an error log file after an Eclipse related internal error shows up?
- The size of Eclipse its workspace directory at C:\Documents and Settings\user\workspace_c166_vx.xrx\.metadata is already over 1Gbyte. Can the size of this folder be restricted in some way?
Compiler FAQ
- How can I speed up the compiler?
- Can I change the page number of the user stack during run-time? For example when using an RTOS that uses a separate stack page for each individual task.
- When compiling a .CPP file I get the following error: cc166 F117: ["cc166.spec" 1066/0] cannot generate dependencies for multiple input files in a single dependency file. What does it mean?
- How to pass a constant value to inline assembly by means of a macro?
- How to pass a macro value with double quotes to the compiler invocation?
- The compiler is optimizing away MAC intrinsic code unexpectedly. How to prevent this?
- Why do I get compiler warning W563: '##' does not produce a valid preprocessing token?
Assembler FAQ
Linker/Locator FAQ
- How to order sections within a specific memory range and filling up unused space?
- Why do I get a locate error when I try to locate my code sections into multiple segments?
- When locating an object on a 16K page boundary the following linker error shows up: "lk166 E151: conflicting restrictions for section <section_name> (variable <variable_name>): absolute section crosses page boundary or conflicts with page ranges". What goes wrong?
- How to locate the ROM copy of an initialized data section as well as the RAM data section itself at a dedicated start address?
- How to exclude sections from a select statement?
- When specifying sections for a specific address range, how can I prevent other sections to be located in this area?
- How to locate the default copy table referred to as "table" in the map file?
- How do I know my application needs HEAP memory?
- How to implement my own low level I/O routines instead of File System Simulation (FSS)?
- Why do the user stack and system stack increase when linker option "delete unreferenced sections" is switched off?
Debugger FAQ
- When starting a debug session, the following error shows up: "E128: Couldn't connect to the device DAS_ERROR_DEVICE_ACCESS)". What might be the problem?
- How to suspend a peripheral after hitting a breakpoint using an XE16x derivative without OPSEN register?
Make file FAQ
- How can I run a shell command from my user defined make file?
- Which build steps and/or options are required to MIL link my application?
FLEXlm (license management) FAQ
- For questions about the license management software (FLEXlm), please refer to the FLEXlm FAQ or the FLEXlm Troubleshooting List.
Miscellaneous FAQ
- After removing file cstart.asm from my project, module cstart.obj is still extracted from the libraries. How to get completely rid of the startup code?
- Global C++ objects seems to be uninitialized after startup when using an RTOS. What is wrong?
Eclipse answers:
How can I start the Eclipse environment with a specific version of the Java Runtime Environment (JRE)?
Use option -vm to specify the path for Java when starting Eclipse. For example:
eclipse -vm "C:\Program Files\java\jre1.6.0_01\bin\javaw.exe"
Where can I find the commeand line arguments of Eclipse?
The command line arguments of Eclipse can be found here, see section "Advanced Topics in Running Eclipse".
Is there a list of problems and feature requests related to Eclipse?
A list of reported bugs and enhancements for Eclipse can be found here.
Can I see the command line invocations of all executed tools during a build?
To view the tool invocations during a build, open dialog 'Project | Properties | C/C++ Build | Settings | Global Options' and check "Verbose mode of control program".
Is it possible to show more lines in the Problems and/or Console window?
To show more lines in the Console window, open dialog 'Window | Preferences | C/C++ | Build Console' and increase the number of lines at "Limit console output (#lines)".
To show more lines in the Problems window, click the "menu" icon at the upper right side of the Problems window, select "Preferences" and increase the number at "Limit visible items per group". Or uncheck "Use marker limits" for having no limit at all in the Problems window.
Why does macro highlighting doesn't work when using multiple configurations?
The current default, not to have configuration specific indexing, is chosen for performance reasons, but can be changed at dialog 'Window | Preferences | C/C++ | Indexer | Build configuration for the indexer | Use active build configuration'.
The following error shows up: "An out of memory error has occured. Consult the "Running Eclipse". What does it mean and how to avoid?
This error indicates Eclipse is running out of heap memory. The minimum and maximum memory used by Eclipse can be adjusted in file <install_dir>\eclipse\eclipse.ini. Option -Xms defines the initial minimum heap size (40Mb by default) and option -Xmx defines the maximum size (512Mb by default):
To increase, close Eclipse and increase the maximum size. For example:
Note: reducing the number of files opened can help to limit the amount of allocated heap. Since Eclipse also cashes files, closing Eclipse and restart it sometimes also helps. But when the error shows up more often, increasing the heap size is recommended.
How to add a source file or folder outside the workspace to a project?
To add a link to a file or folder outside your project, follow the next steps:
- Right click your project name in the "C/C++ Projects" view and select "New" and "Other..."
- From the tree view, highlight "General => File" or "General => Folder" and click "Next>"
- Click on the "Advanced>>" button
- Enable check box "Link to file (or folder) in the file system" and use the "Browse..." button to select the file or folder you want to include
- Press "Finish" and the file or folder will be linked to your project. A small arrow shown in the right bottom corner of the icon indicates the file or folder is located outside your project workspace.
After importing a DAvE project, many E304 assembler errors show up after building the project like "symbol xxxx is already defined as SFR". How to fix this?
Check the selected Compiler at DAvE its project settings. It should be "Tasking Viper" and not "Tasking Classic". Please note that the generated file <project>.asm must be excluded from the build in Eclipse. When using the import wizard from Eclipse this file will be excluded automatically. Otherwise exclude this file manually: right click the <project>.asm file, choose "Exclude from Build..." and use "Select All" to select all configurations and press OK. Or simply remove this file from your project directory.
How to generate an error log file after an Eclipse related internal error shows up?
Such an internal error can be recognized by its title "Problem Occurred" and starts with "An internal error occurred during: <description>".
- First be sure the error is showing up
- Open dialog 'Window | Show View | Other... | General | Error log'
- Right click the opened view "Error Log" and select "Export Log..." to export the information into a file
- send this file to TASKING support
The size of Eclipse its workspace directory at C:\Documents and Settings\user\workspace_c166_vx.xrx\.metadata is already over 1Gbyte. Can the size of this folder be restricted in some way?
Inside this meta directory historical information is stored which can grow in size considerably over time. The maximum amount of historical information being saved can be influenced at dialog 'Window | Preferences | General | Workspace | Local history'.
Compiler answers:
How can I speed up the compiler?
SFR files for recent devices like XC2287M define such a large number of SFRs that compiling the SFR file alone already takes up a significant part of the build time. There are two ways to reduce the build time:
- Disable the automatic inclusion of the SFR file and include the SFR file only in the source modules where the SFRs are used, with a #include directive.You can disable the automatic inclusion of the SFR file with option --no-tasking-sfr of the tools. In Eclipse you can find this option on the "C/C++ Compiler | Preprocessing" and the "Assembler | Preprocessing" pages. When you include the SFR file in the source, be aware that the SFR files are in the sfr subdirectory of the include files, so you must use: #include <sfr/regxc2287m.sfr>.
- Since toolset v2.3r1 it is possible to use the alternative SFR file format. The product's include/sfr directory contains SFR files with the suffix .asfr which are much smaller. These alternative SFR files do not include a macro definition for each bit-field and SFRs must be accessed using the correct struct/union fields, for example:PSW.U = 0x0010; (instead of PSW = 0x0010;) PSW.B.N = 0; (instead of N = 0;)You can select the alternative SFR files with the C compiler option --alternative-sfr-file. In Eclipse you can find this option on the "C/C++ Compiler | Preprocessing" page. Of course you can combine both ways: disable automatic SFR file inclusion and use #include <sfr/regxc2287m.asfr> where SFRs are used.
More information can be found in the c166 users guide at section 4.7. "Influencing the Build Time".
Can I change the page number of the user stack during run-time? For example when using an RTOS that uses a separate stack page for each individual task.
With the default static setting the DPP that is used for the stack can only be loaded with the page number at startup. With the fixed-dpp or dynamic mode it is possible to change the DPP contents dynamically afterwards. This can be useful in for example an RTOS that uses a separate stack page for each task.
The stack address conversion mode can be specified by means of compiler option --stack-address-conversion or by applying #pragma stack_address_conversion. Or from Eclipse, open dialog 'Project | Properties | C/C++ Build | Settings | C/C++ Compiler | Code Generation' and select "Stack address conversion".
Compiler option --stack-address-conversion=mode controls how stack addresses are converted to __far and __(s)huge addresses:
- static: Use the linker generated stack symbol. This is the default and is the same as in previous versions.
- fixed-dpp: Use the DPP register that refers to the linker generated stack symbol.
- dynamic: Determine the used DPP register dynamically.
#pragma stack_address_conversion controls how stack addresses are converted. Same as compiler option: --stack-address-conversion.
Examples:
The code generation for the three variants for the line:
When compiling a .CPP file I get the following error: cc166 F117: ["cc166.spec" 1066/0] cannot generate dependencies for multiple input files in a single dependency file. What does it mean?
The standard extensions for C++ files is *.cpp and *.cc. So extension *.CPP is not recognized as a C++ module. To get it working, change the extension to lower case (*.cpp). Or define extension *.CPP as a C++ module by changing file <install_dir>\etc\cc166.spec:
search for line: WILDCARDCPLUS=*.cc *.cpp *.cxx
and change it into:
WILDCARDCPLUS=*.cc *.cpp *.cxx *.CPP
How to pass a constant value to inline assembly by means of a macro?
Quoted strings inside inline assembly are concatenated automatically by the compiler. But macro expansion is not applied on string constants. Therefore we need to quote the macro already before it is used for the inline assembly part:
After the preprocessor the inline assembly will look like this:
Finally these quoted strings will be concatenated by the compiler which results into:
How to pass a macro value with double quotes to the compiler invocation?
Put the macro into an options file and surround the double quoted macro value with single quotes:
Another workaround is to quote the macro not until it is used in the C-program:
The compiler is optimizing away MAC intrinsic code unexpectedly. How to prevent this?
CPU sfr registers including MAC registers are compiler resources which should be left alone on C-level. The same effect will show up when using sfr registers/bits like PSW, IEN, MDL, MDH, MSW, etc. For example:
In this case, use intrinsic __CoSTOREMAH() to retrieve the value of MAH:
The same way, to retrieve the value of MSW, use the intrinsics __CoSTOREMSW() or __CoCMP().
Why do I get compiler warning W563: '##' does not produce a valid preprocessing token?
The ## operator in a macro definition concatenates the adjacent tokens to form a single, new token. Tokens are nothing but small part of program like a variable, constant, function name, keyword, operator etc. For example:
Here, the ## operator results into the new token "foo1_suffix".
But when using the following example:
"x" is the token left of the ## operator and "." (the struct member operator) is the token right of the ## operator. After concatenation, the result will be "x." which is not a valid new token but merely two tokens next to each other. Therefore the warning "W563: '##' does not produce a valid preprocessing token" show up. In this case the ## operator is not needed and the macro can simply be written as:
Assembler answers:
Why does the assembler complains about undefined symbols for sfr registers when using inline assembly?
When using inline assembly like:
sfr ADC0_KSCFG is not recognized by the assembler:
as166 W201: ["test.src" 16] local symbol "ADC0_KSCFG" not defined in this module; made external
This is because the CPU specific sfr file (regxc2287.sfr in this example) is not passed to the assembler automatically when compiling a C-source file. Otherwise the build process would be slowed down unnecessary by these large sfr files.
In case the assembler is complaining about undefined symbols due to inline assembly, the CPU specific sfr file must be passed to the assembler explicitly:
- open dialog 'Project | Properties | C/C++ Build | Settings | Assembler | Miscellaneous'
- specify the CPU with assembler option -C at the field "Additional Options" like -Cxc2287
Linker/Locator answers:
How to order sections within a specific memory range and filling up unused space?
To order sections within a specific memory range and filling up the unused space, specify a so called "output section" in the LSL file by means of the keyword "section" as follows:
This will create a new output section named "ordered_section" which contains the selected sections in an ordered way. For this example, the attribute "r" is applied to tell the locator that only ROM data is allowed and fill byte 0xAA is used to fill up unused space.
Why do I get a locate error when I try to locate my code sections into multiple segments?
When specifying a single address as run_addr the linker wants to put all code sections into a single segment of 64K:
If you want to use multiple segments you have to supply an address range, for example:
When locating an object on a 16K page boundary the following linker error shows up: "lk166 E151: conflicting restrictions for section <section_name> (variable <variable_name>): absolute section crosses page boundary or conflicts with page ranges". What goes wrong?
By default the first byte of a page is reserved to avoid NULL pointer comparison problems with objects allocated at the beginning of the page. If you are absolutely sure this is not an issue in your application, you can remove this restriction by redefining linker macro __PAGE_START:
Add "#define __PAGE_START 0" to the top of your LSL file or specify command line option "-D__PAGE_START=0" at "Additional Options" in dialog 'Project | Properties | C/C++ Build | Settings | Linker | Miscellaneous'.
For more information, see also the comments in file include.lsl/arch_c166.lsl.
How to locate the ROM copy of an initialized data section as well as the RAM data section itself at a dedicated start address?
Specify the "load_addr" to locate the ROM copy of an initialized data section at a dedicated address. The load_addr keyword changes the meaning of the section selection in the group: the linker selects only the load-time ROM copy of the named section(s) instead of the regular sections. Use "run_addr" to locate the RAM data section. For example:
C source file:
LSL file:
Please notice that ROM copy sections are listed in the map file between square brackets like [MY_NEAR] and will always be located in shuge space, independent of the memory type of the RAM data section (near, far, shuge or huge).
How to exclude sections from a select statement?
By first selecting these sections in a dummy select or section_layout, these sections will be skipped later on. This way you can exclude sections from other selects.
For example, the following code will produce a linker warning:
lk166 W159: LSL: section "near_var1" (variable _var1) was not selected because it already has an absolute restriction
To get rid of the warning, exclude section "near_var1" from group "myvars" by selecting it before defining group "myvars":
When specifying sections for a specific address range, how can I prevent other sections to be located in this area?
The easiest way to prevent sections in a specific memory range is to create a "reserved" memory definition for this area:
Of course this memory definition should not overlap existing memory definitions. Now this area will only be filled up with sections which are selected explicitly in the LSL file or by absolute sections which are created with memory qualifier __at(...) in the source file.
Since toolset v2.3r2 it is also possible to locate sections in a reserved area by means of "alloc_allowed = ranged". That means, sections are allowed in this area but only when they are selected explicitly. The following example uses a reserved area in far memory from 0x10000 up to 0x14000 and will only locate sections named "far_data" in this area:
For more detailed information about reserved areas, please refer to the c166 users guide 15.8.3. "Creating or Modifying Special Sections" and look for "Reserved section". Linker macros __PAGE_START and __PAGE_END are explained in file include.lsl/arch_c166.lsl.
How to locate the default copy table referred to as "table" in the map file?
The content of the copy table is created by the linker and will be located in shuge memory. It contains the start address and length of all sections that should be initialized by the startup code. The keyword "copytable" tells the linker to select a section that is used as copy table. For example, to locate the copy table at the end of the shuge memory area:
How do I know my application needs HEAP memory?
To check if heap is needed by your application, open the map file and search for symbol _lc_ub_nheap or _lc_ub_hheap. Only if one of these symbols is present, heap is required. Using the LSL editor, the heap size can be specified at tab "Stack/Heap".
Note: the following library routines do use heap memory: malloc, calloc, realloc, fopen and setvbuf.
How to implement my own low level I/O routines instead of File System Simulation (FSS)?
Override low level routines _read and _write in your source code. See example serio.c.
Why do the user stack and system stack increase when linker option "delete unreferenced sections" is switched off?
The assumption that unreferenced sections do not contribute to the stack size is wrong. The opposite is true: the linker assumes such unreferenced sections might be called from interrupt routines and therefore the full stack tree of each unreferenced function is added to the stack amount.
Debugger answers:
When starting a debug session, the following error shows up: "E128: Couldn't connect to the device DAS_ERROR_DEVICE_ACCESS)". What might be the problem?
The following error message:
indicates there is a USB connection problem with the target board. Please check the following items:
- Check the Target Board Configuration wizard, specially the fields "Target Board" and "Communication type".
- Some Easykit boards do not support "DAS over on-board USB wiggler" although an USB connector is present. An external wiggler should be used instead.
- Run the tool "Start => Programs => DAS => DAS Device Scanner" to see if the device is running and to check if the jtag port number is correct by pressing the Info button. The window should show: "Using Port JTAG 0".
How to suspend a peripheral after hitting a breakpoint using an XE16x derivative without OPSEN register?
The peripherals on an XE16x derivative can be controlled by the Kernel State Configuration Register _KSCCFG.
When bitfield SUMCFG (bit 8,9) is set, the peripheral will be suspended after hitting a breakpoint. When updating this bitfield, bit BPSUM (bit 11) must be set as well to enable write access to bit field SUMCFG.
For example, to enable the suspend mode for timer module GPT12, follow next steps:
- open file cstart.asm
- at the tab "Register", open dialog 'SCU | GPT12E__KSCCFG'
- fill in the value 0x0B01 (Module enabled, Suspend Mode enabled, bit protection for Suspend Mode set to 1)
- do not forget to enable checkbox "Initialize in startup code"
- save file cstart.asm
Now the timer module will be stopped during a break.
Make file answers:
How can I run a shell command from my user defined make file?
Since toolset v2.3r1 a new make utility amk.exe is added to the product. Amk is completely platform independent and therefore the shell must be called explicitly to be able to run a shell command. On Windows you can call the shell with: cmd /C "command". For example to add target "clean" to your make file the shell command "del" with switch /S (delete specified files from all subdirectories) can be executed as follows:
To run amk with target clean: amk -a -f makefile clean
Please notice the default target for amk is the first target found in the makefile which does not start with a dot. Therefore it is recommended to specify target "clean" after target "all" to prevent running "clean" when no target is specified at all.
Which build steps and/or options are required to MIL link my application?
MIL-linking requires a quite complex build process, see the c166_user_guide.pdf, section "Chapter 4. Using the C Compiler" section "MIL linking". It is not so easy to implement this build process yourselves in the make file. Fortunately, you can use our control program cc166.exe with option --mil-link or --mil-split. Now the control program will take care for all necessary build steps needed for MIL-linking. For example, when using our default "blink" example with MIL linking, the command in the makefile running from the "Debug" directory could look like this:
Instead of --mil-link you can also use --mil-split. For a description of --mil-split, see the users guide and search for compiler option --mil-split.Miscellaneous answers:
After removing file cstart.asm from my project, module cstart.obj is still extracted from the libraries. How to get completely rid of the startup code?
Symbol "__cstart" is automatically generated by the compiler as soon as a function "main" is used in a module:
To get rid of symbol __cstart generated by the compiler do not use function "main" but give it another name like "start":
Besides, __cstart is also used in file arch_c166.lsl to define the start address of the application:
To get rid of symbol __cstart in file arch_c166.lsl, define macro __START_SYMBOL at the top of your project its LSL file:
Finally change symbol "__cstart" for the reset vector to "_start" (see also tab "Vector Table" in the LSL editor):
Now the startup code will be completely removed from your application.
Note: When using C++, please be sure function __main is called to initialize static objects. For more information, please read the FAQ below.
Global C++ objects seems to be uninitialized after startup when using an RTOS. What is wrong?
When using an RTOS, function "main" is often already defined inside the kernel and therefore not in your application. The global and static object instantiations are taken care of by a special function _main(). Nevertheless, the C++ compiler only generates a call to this special fuction when it encounters the "main" function in your application. But the RTOS function "main" will likely not have such a call to __main and as a result global objects are not initialized.
To correct this, please call _main() manually right after task initialisation. For example:
