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.
Eclipse
- How can I start the Eclipse environment with a specific version of the Java Runtime Environment (JRE)?
- Where can I find the comment 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?
Compiler
- 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.
Linker/Locator
- 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?
Debugger
Miscellaneous
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 comment 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.
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:
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?
Since toolset v2.3r2 it is 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.
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".
Miscellaneous 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.