Errors can take many forms in the IDE, most commonly shown by icons in windows or messages in the Output window. Hovering over icons will pop up text that may explain the issue. For text messages, please refer to online help to search for the error.
Some common errors and resolutions for the IDE or Editor are listed in the sections below:
When a project’s makefile is run, each command that is executed is passed to the local native shell. For Windows operating systems, there is a limit of 8191 characters. Therefore, for a project with hundreds of C files that link, the limit could be surpassed and this error will be displayed.
Linux OS and macOS can usually take very long command lines. If you
want to find out the length limit for your system, you can type on the command line
getconf ARG_MAX
.
Response File Workaround
If you are using the MPLAB XC8 or MPLAB XC32 C compiler v1.01 and above, or MPLAB XC16 C compiler v1.22 and above, you may be able to use a response file when calling the linker to work around this issue.
* To open the Project Properties window, see Open Project Properties.
Library Workaround
For all other compilers, you can create an MPLAB X IDE library project and move some source files from your main project to the library project. Then add the library project to your main project.
To create a library project select File>New Project, click the “Microchip Embedded” category, and then select “Library Project” as the project.
To add the library to your main project, open the Project Properties window i.e., File>Project Properties), click in “Categories” under “Libraries,” and then click the Add Library Project button.
Archive Checkbox Workaround
For MPLAB XC16 and MPLAB XC32, there is now a check box you can use when archiving long sets of files into libraries that might push the link line over the character limit. The “Break into multiple lines” option can be used to tell the compiler to break up the archive line into smaller lines to avoid this limitation.
Find this option in:
Project Properties window, “xc16-ar” or “xc32-ar” category, “General” option category, “Break into multiple lines” check box.
MPLAB X IDE uses the MinGW in its make process. In Windows OS, you may have virtual memory allocation issues.
Windows 7 or 8
To change the Virtual Memory settings, click Start>Control Panel. Then click System and then Security>System>Advanced Systems Setting or System Protection. On the Advanced tab, click on the Performance Settings button. In this dialog click the Advanced tab and then click on the Change button. Enter a custom size value as follows:
Click Set, click OK, and reboot your personal computer.
Windows 10
See:
https://www.geeksinphoenix.com/blog/post/2016/05/10/how-to-manage-windows-10-virtual-memory.aspx
Windows OS has a maximum path length of 260 characters. For details, see Path, File and Folder Name Restrictions.
The #asm
and #endasm
statements are
valid constructs for declaring in-line assembly code within an MPLAB XC8 C program. But
in the IDE Editor, the C preparser does not see these as valid directives and will
display a red bang next to these statements. However, this code will still work.
If you want to eliminate the red bangs in the Editor, you can use the
asm()
statement. This is the preferred method of using in-line
assembly for all MPLAB XC C compilers.
Example:
// Inline Code that causes error
#asm
movlw 0x20;
nop;
nop;
#endasm
// Workaround for inline assembly - that will not cause error
// (Multi line asm code)
asm("\
movlw 0x20;\
nop;\
nop;");
// Workaround for inline assembly - that will not cause Error
// (Single line asm code)
asm("movlw 0x20; nop; nop");
The following statement is marked as an error by the compiler parser but will build:
unsigned long long Bits8 : 8 __attribute__ ((packed));
The parser rules for qualifiers allow for any order, but the expectation is that the qualifiers are all specified before the identifier. Therefore, use one of the statements below to not produce an error:
unsigned long long attribute ((packed)) Bits8 : 8;
OR
attribute ((packed)) unsigned long long Bits8 : 8;
When Hexmate generates a conflict report, the address of the conflict in the hex file is sometimes not the same as the address shown in a memory window (where the data resides in memory.) For example:
Device Family | Address in Hex File | Address in Memory |
---|---|---|
Baseline | 0x100 | 0x80* |
Midrange | 0x100 | 0x80* |
PIC18 MCUs | 0x100 | 0x100 |
16-bit Devices | 0x100 | 0x80* |
32-bit Devices | 0x100 | 0x100 |
* For some devices, the address shown in the conflict report is twice as large as the address of the data in memory. |
If you code protect a device and then attempt to program it, you will receive a programming failure error for an address region.
The “Erase Device Memory Main Project” function
can help to determine if this is the programming issue. This function is available as an
optional icon that you can add to a toolbar (View>Toolbars>Customize).
Alternately, use MPLAB IPE.
If programming succeeds, then code protect was the issue.
A device that has too many configuration (config) words currently cannot support Programmer to Go (PTG). PTG is expecting config words to be sent all at once, but MPLAB X IDE sends each config word one at a time for devices with a large amount of config words.
When using mouseovers to reveal values in the Editor, ensure:
Error codes in the -10000 range represents Microsoft error codes. To determine the Microsoft error code, make the number positive (-10121 becomes 10121) and subtract 10000 (10121 - 10000 = 121). Microsoft error codes can be found at:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx