It runs successfully when is compiled with C32 compiler and goes into an endless reboot cycle, when is compiled with XC32. I didn't change anything in both compilers' settings. But there must be a subtle difference between them that affects my program. Or it's just a pure black magic.I certainly can go along with an older C32, but I want to test Harmony framework, and it supports only XC32, as far as I know. Btw, when I load a sample harmony project (CDC), MCU doesn't go into reboot, but it just ignores my code and always fires both LEDs, even if I force them to be off in the program.

Are you compiling for release or debug?Are you keeping the programmer connected? Have you allowed the programmer to release the \MCLR\ line (or is the programmer keeping the device in reset)?How do you know that it is an endless reboot cycle?Susan

I don't know whether it's release or debug It was easy to figure it out in old Mplab, but in MplabX it's not so obvious. But I find hex file under `production` folder, so I think it's release.I'm using a bootloader from `mikroElektronika`, because it's their dev-board. So it's identified as a USB device in my PC, and when I upload a bad program, I hear an endless sequence of Windows' usb attachment/removal sound: *tu-dum*.

ogremage wrote:It was easy to figure it out in old Mplab, but in MplabX it's not so obvious. But I find hex file under `production` folder, so I think it's release.I'm using a bootloader from `mikroElektronika`, because it's their dev-board.

Are you sure that you fulfill all the additional requirements for the bootloader?Are there any examples from mikroElectronica to set up a project suitable for their bootloader with xc compiler?I you use a bootloader you possibly should right click on the top node of the project you wish to build(this is the "chip" icon in the project tree) and select "Export Hex" from the popup menu.

I'm starting to think that I have MplabX version from parallel universe I didn't find any signs of either debug or release build and didn't find "Export hex" menu.Nevertheless, the problem is now solved. I've just used PICkit3 instead of bootloader Still it's a mystery for me, why it works with C32 and can not with XC32 (did C32 have special linker file?), but that doesn't matter anymore.