I installed IDE 2.0(Windows 10) and discovered an issue with compiling/linking a sketch for the Nano Every when using MegaCoreX.
Using the example sketch "Bare Minimum" and the board selection for the ATmega 4809 and all the settings I normally uses with 1.8.19 it compiles as normal but fails when linking with an issue related to a call for cmd /C and results in the error
'C:\Users\myName' is not recognized as an internal or external command,
operable program or batch file.
If I select the Nano Every as an Arduino megaAVR board the compile and linking are successful.
All my other third party boards available with the board selection compile and link successfully.
Hi @cattledog. I'm going to ask you to post some additional information that might help us to identify the problem.
NOTE: These instructions will not solve the problem. They are only intended to possibly gather some more information about the problem, which might provide a clue that leads to a solution.
Please do this:
Select File > Preferences from the Arduino IDE menus.
Check the box next to "Show verbose output during: ☐ compilation".
Click the OK button.
Select Sketch > Verify/Compile from the Arduino IDE menus.
Wait for the compilation to fail.
You will see a "Compilation error: ..." notification at the bottom right corner of the Arduino IDE window. Click the COPY ERROR MESSAGES button on that notification.
Open a forum reply here by clicking the Reply button.
Click the </> icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
Press Ctrl+V.
This will paste the compilation output into the code block.
Move the cursor outside of the code tags before you add any additional text to your reply.
The short answer is the problem is related to the spaces in your Windows user name, which results in spaces in the paths in this command:
The reason why it doesn't occur in Arduino IDE 1.x is because it uses the Windows "8.3" format path (notice the RICHAR~1 instead of Richard Marantz):
Spaces in paths are normally handled just fine. The reason megaCoreX is different is because it uses cmd /C to run this command. That sends us into the nightmare of trying to work with the Windows command interpreter. In this application, the paths with spaces are not so easy to work with.
I identified a workaround for this problem and submitted it to the MegaCoreX repo:
There are more details about the problem at the link above.
Applying the fix manually
If accepted, the problem should no longer occur once the next release of MegaCoreX comes out. However, you might prefer to apply the fix manually right now so that you don't have to wait.
You can see the small change that needs to be made here:
I figured I would start with MegaCoreX. Once that PR has been reviewed and approved it should be fairly easy to apply the same fix to the others as well.
I think I was to quick to mark this thread solved.
When I moved beyond the compile issue to actually upload, there are new errors.
As before, there are no issues with 1.8.19
Again with the bare minimum sketch it appears there are issues with avrdude and the configuration file. Perhaps because of a path name with a space in the user name?
Using board '4809' from platform in folder: C:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0
Using core 'coreX-corefiles' from platform in folder: C:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0
Detecting libraries used...
"C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -mrelax -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=20000000L -DARDUINO=10607 -DARDUINO_AVR_ATmega4809 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles" "-IC:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\variants\\nano-every" "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD\\sketch\\BareMinimum.ino.cpp" -o nul
Generating function prototypes...
"C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -mrelax -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=20000000L -DARDUINO=10607 -DARDUINO_AVR_ATmega4809 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles" "-IC:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\variants\\nano-every" "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD\\sketch\\BareMinimum.ino.cpp" -o "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\builtin\\tools\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mrelax -mmcu=atmega4809 -DF_CPU=20000000L -DARDUINO=10607 -DARDUINO_AVR_ATmega4809 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles" "-IC:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\variants\\nano-every" "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD\\sketch\\BareMinimum.ino.cpp" -o "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD\\sketch\\BareMinimum.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\Richard Marantz\AppData\Local\Temp\arduino-core-cache\core_c812ab8444a644249c91c8f6a9534b5e.a
Linking everything together...
"C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -mrelax -Wl,--gc-sections -Wl,--section-start=.text=0x0 -mmcu=atmega4809 -o "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD/BareMinimum.ino.elf" "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD\\sketch\\BareMinimum.ino.cpp.o" "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD/..\\arduino-core-cache\\core_c812ab8444a644249c91c8f6a9534b5e.a" "-LC:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD" -lm
"C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD/BareMinimum.ino.elf" "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD/BareMinimum.ino.eep"
"C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD/BareMinimum.ino.elf" "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD/BareMinimum.ino.hex"
cmd /C echo. && "C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objdump" --disassemble --source --line-numbers --demangle --section=.text "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD/BareMinimum.ino.elf" > "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD/BareMinimum.ino_atmega4809_20000000L.lst"
"C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-6D830A1BDFDB5CFE1DC2FBA60B4F7CDD/BareMinimum.ino.elf"
Sketch uses 468 bytes (0%) of program storage space. Maximum is 49152 bytes.
Global variables use 4 bytes (0%) of dynamic memory, leaving 6140 bytes for local variables. Maximum is 6144 bytes.
avrdude: error at C:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0/avrdude.conf:366: programmer type xbee not found
avrdude: error reading system wide configuration file "C:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0/avrdude.conf"
Failed uploading: uploading error: exit status 1
Please provide the full output from the upload when in verbose mode.
NOTE: These instructions will not solve the problem. They are only intended to possibly gather some more information about the problem, which might provide a clue that leads to a solution.
Please do this:
Select File > Preferences from the Arduino IDE menus.
Uncheck the checkbox next to Show verbose output during: ☑ compilation
Check the checkbox next to Show verbose output during: ☐ upload.
Click the OK button.
Attempt an upload, as you did before.
Wait for the upload to fail.
You will see a "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the COPY ERROR MESSAGES button on that notification.
Open a forum reply here by clicking the Reply button.
Click the </> icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
Press Ctrl+V.
This will paste the error output from the upload into the code block.
Move the cursor outside of the code tags before you add any additional text to your reply.
Sketch uses 468 bytes (0%) of program storage space. Maximum is 49152 bytes.
Global variables use 4 bytes (0%) of dynamic memory, leaving 6140 bytes for local variables. Maximum is 6144 bytes.
Performing 1200-bps touch reset on serial port COM3
"C:\Users\Richard Marantz\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0/avrdude.conf" -v -V -patmega4809 -cjtag2updi -PCOM3 -e "-Uflash:w:C:\Users\Richard Marantz\AppData\Local\Temp\arduino-sketch-363BA61147A3A79C58AA0ADC5AF0128A/BareMinimum.ino.hex:i" "-Ufuse0:w:0x00:m" "-Ufuse1:w:0x54:m" "-Ufuse2:w:0x02:m" "-Ufuse4:w:0x00:m" "-Ufuse5:w:0b11001001:m" "-Ufuse6:w:0x06:m" "-Ufuse7:w:0x00:m" "-Ufuse8:w:0x00:m" "-Ulock:w:0xC5:m"
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0/avrdude.conf"
avrdude: error at C:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0/avrdude.conf:366: programmer type xbee not found
avrdude: error reading system wide configuration file "C:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0/avrdude.conf"
Failed uploading: uploading error: exit status 1
So why isn't that information being used? I suspect it is because you don't have the package index URL in your preferences. Arduino IDE 2.x uses a different preferences store from Arduino IDE 1.x, so it is necessary to manually migrate the URLs to the "Additional Boards Manager URLs" field.
Select File > Preferences from the Arduino IDE menus.
Enter the following URL into the "Additional Boards Manager URLs" field:
It's now correctly picking "7.0.0-arduino2" but there is some sort of windows error about .net.
Failed uploading: uploading error: exit status 0xc0000135
"C:\\Users\\Richard Marantz\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\Richard Marantz\\AppData\\Local\\Temp\\arduino-sketch-693B63A856F55C17B7FAD42FFC61E54F/BareMinimum.ino.elf"
Sketch uses 468 bytes (0%) of program storage space. Maximum is 49152 bytes.
Global variables use 4 bytes (0%) of dynamic memory, leaving 6140 bytes for local variables. Maximum is 6144 bytes.
Performing 1200-bps touch reset on serial port COM3
"C:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\tools\avrdude\7.0.0-arduino2/bin/avrdude" "-CC:\Users\Richard Marantz\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0/avrdude.conf" -v -V -patmega4809 -cjtag2updi -PCOM3 -e "-Uflash:w:C:\Users\Richard Marantz\AppData\Local\Temp\arduino-sketch-693B63A856F55C17B7FAD42FFC61E54F/BareMinimum.ino.hex:i" "-Ufuse0:w:0x00:m" "-Ufuse1:w:0x54:m" "-Ufuse2:w:0x02:m" "-Ufuse4:w:0x00:m" "-Ufuse5:w:0b11001001:m" "-Ufuse6:w:0x06:m" "-Ufuse7:w:0x00:m" "-Ufuse8:w:0x00:m" "-Ulock:w:0xC5:m"
Failed uploading: uploading error: exit status 0xc0000135
I just gave it a try and was not able to reproduce the issue. It does seem like it is a problem with missing dependencies (e.g., a DLL or something) in the Windows environment.
If you want to try an experiment, Arduino has produced a tester build of AVRDUDE 7.0. Arduino's build configuration is specifically designed to avoid this sort of external dependency.
The tester build download links are listed under the "Assets" section of this page:
For windows, use the "avrdude_7.0-arduino.3_Windows_32bit.tar.gz" link.
After extracting the downloaded file, take the file avrdude_Windows_32bit\bin\avrdude.exe from the extracted folder and use it to replace the one at this path:
You can rename the original file from that path to something like avrdude.exe.original in order to make it easy to later revert the replacement if you decide to do so.
I replaced the original averdude with the alternative.
I used WinZip to decompress and extract the file.
It has a different created date Tuesday, June 21, 2022, 12:40:26 AM
than the original Saturday, July 9, 2022, 10:58:28 PM so I think I managed the download and extraction correctly. The forum software won't let me attach the extracted file for you to verify.
If the issue is a missing DLL, why does 1.8.19 work properly. What is the dependency of 2.0 on what DLL?
My assumption was that it is AVRDUDE that has the dependency, not Arduino IDE. The error messages that come from the process is expected to be from AVRDUDE.
Please try this:
Attempt an upload in Arduino IDE.
Wait for the upload to fail.
Copy the avrdude command line the Arduino IDE generated.
For example, in your output above, the command was:
(but make sure to use the one freshly generated in the IDE so you can make sure the files in the temporary build folder still exist)
Run that command from the command line.
Upload to the Nano Every board requires a "1200-bps touch", which is done by Arduino IDE/Arduino CLI separately from AVRDUDE (AVRDUDE doesn't have this capability), so the upload is expected to fail when you run it from the command line. But it should fail in a different way than what you are seeing in the Arduino IDE, at a stage farther along in the upload process from the point where you are getting this mysterious error. So even without the "1200-bps touch", this should still serve the purposes of effectively eliminating the Arduino IDE and Arduino CLI from the equation.
The libus0.dll file appears to be included at several places
In 1.8.19 is see it in Arduino>hardware>tools>avr>bin
In Programs x86 I also see it at a top level.
I do not see it in the file with Arduino 2.0.
C:\Users\Richard Marantz\AppData\Local\Programs\Arduino IDE
I see this is a known issue with Arduino's tester build of AVRDUDE 7.0 (Arduino does not yet use this version of AVRDUDE in any of the boards platforms):
As for the question of why this error does not occur when using Arduino IDE 1.x, I see now that the Arduino IDE 1.x installation includes the file libusb0.dll in the root of the installation folder, so maybe it is able to pick it up there?
I also see that Arduino's production releases of AVRDUDE contain a copy of libusb0.dll in the same folder as avrdude.exe.
After further investigation, I see that MCUdude is distributing Arduino's build of AVDUDE with MegaCoreX (though it is an older release 7.0-arduino.2). So you actually might find that the official AVRDUDE build does not have this DLL dependency.
You can download it from the link on the "Assets" section of this page:
Use the "avrdude-v7.0-windows-x64.zip" download link
Arduino IDE 1.x installation includes the file libusb0.dll in the root of the installation folder, so maybe it is able to pick it up there?
I added libusb0.dll to 2.0 IDE program file at the top level of the installation folder like it is in 1.8.19.
C:\Users\Richard Marantz\AppData\Local\Programs\Arduino IDE
The upload to the Nano Every with MegaCoreX was successful.
I suggest that you include libusb0 in the installation folder of IDE as was previously done.
I have left the Averdude 7.0 which I installed following post #16. Should I leave it or replace it with the original. Both the original and the file I exchanged have the same number of bytes. Are they indeed different?
Thank you for all your assistance. The use of the command line to find the missing .dll was the key.
Without your continued support I would have abandoned using 2.0 until there were a few more releases. I hope my adventure will help others.
We are trying to keep the IDE installation dedicated as much as possible to the application itself, as a general purpose tool for Arduino sketch development.
Arduino IDE 1.x was developed in a time when all boards were AVR, which resulted in the approach where the AVR boards platform, toolchain, drivers, and dependencies were bundled with the IDE installation. But this approach does not scale and also does not accommodate 3rd party boards.
So I would try to avoid adding a file that is a dependency of board-specific tools to the IDE installation. I think the better approach would be to include it with the AVRDUDE installation, or even better to avoid the dependency altogether if possible.
My advice is to stay as close as possible to a vanilla MegaCoreX installation. So if the original works just as well for you as the replacement then I recommend switching back to using the original. The replacement was intended more as an experiment while I was in the "grasping at straws" stage of the investigation.
Not in this application. The difference between the 7.0-arduino.2 version installed with MegaCoreX and the latest 7.0-arduino.3 version is a fix for a bug in an ATtiny85-specific patch applied to Arduino's avrdude.conf configuration file:
But MegaCoreX does not even use that file you find under the etc folder of the AVRDUDE download. It uses this one instead:
There were no changes to the AVRDUDE source code between 7.0-arduino.2 and 7.0-arduino.3
You are welcome.
Thanks also for your feedback. MegaCoreX and the other MCUdude boards platforms are very important parts of the Arduino ecosystem. The Arduino Tooling team does try to give attention to ensuring the tools we create and maintain are compatible with the 3rd party boards platforms in addition to Arduino's official platforms.