Error verifying/uploading to arduino

Hello,

I have an Arduino Uno WiFi Rev2 that I am trying to upload code to. This board was updated to the new firmware version (1.5.0). I did a fresh install of Arduino on my computer and I am using the Arduino megaAVR Board that was installed when I connected my board to the computer.

Every time I try to verify a simple code or upload it to the board, I always get an error. I tried the basic examples like the Blink, but I still get the error. I have tried every single option in the basic examples and still can't seem to find the problem. I have already changed the cable I am using to connect to the board, but still nothing. I have also reset the board multiple times.

(Sorry if this is not in the right category)

ERROR:

FQBN: arduino:megaavr:uno2018
Using board 'uno2018' from platform in folder: C:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8
Using core 'arduino' from platform in folder: C:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8

Detecting libraries used...
C:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO_WIFI_REV2 -DARDUINO_ARCH_MEGAAVR -DUNO_WIFI_REV2_328MODE -DMILLIS_USE_TIMERB3 -IC:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino/api/deprecated -IC:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino -IC:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\variants\uno2018 C:\Users\pedro.moreira\AppData\Local\Temp\arduino\sketches\64382F96FCE5A0508669838416BD5C71\sketch\Blink.ino.cpp -o nul
Generating function prototypes...
C:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO_WIFI_REV2 -DARDUINO_ARCH_MEGAAVR -DUNO_WIFI_REV2_328MODE -DMILLIS_USE_TIMERB3 -IC:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino/api/deprecated -IC:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino -IC:\Users\pedro.moreira\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\variants\uno2018 C:\Users\pedro.moreira\AppData\Local\Temp\arduino\sketches\64382F96FCE5A0508669838416BD5C71\sketch\Blink.ino.cpp -o C:\Users\pedro.moreira\AppData\Local\Temp\3984212690\sketch_merged.cpp
C:\Users\pedro.moreira\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\pedro.moreira\AppData\Local\Temp\3984212690\sketch_merged.cpp
Compiling sketch...
"C:\\Users\\pedro.moreira\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO_WIFI_REV2 -DARDUINO_ARCH_MEGAAVR -DUNO_WIFI_REV2_328MODE -DMILLIS_USE_TIMERB3 "-IC:\\Users\\pedro.moreira\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\megaavr\\1.8.8\\cores\\arduino/api/deprecated" "-IC:\\Users\\pedro.moreira\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\megaavr\\1.8.8\\cores\\arduino" "-IC:\\Users\\pedro.moreira\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\megaavr\\1.8.8\\variants\\uno2018" "C:\\Users\\pedro.moreira\\AppData\\Local\\Temp\\arduino\\sketches\\64382F96FCE5A0508669838416BD5C71\\sketch\\Blink.ino.cpp" -o "C:\\Users\\pedro.moreira\\AppData\\Local\\Temp\\arduino\\sketches\\64382F96FCE5A0508669838416BD5C71\\sketch\\Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
Using previously compiled file: C:\Users\pedro.moreira\AppData\Local\Temp\arduino\sketches\64382F96FCE5A0508669838416BD5C71\core\variant.c.o
Using precompiled core: C:\Users\pedro.moreira\AppData\Local\Temp\arduino\cores\arduino_megaavr_uno2018_mode_on_20b77de573fc40e2f6d91683de4ac6a7\core.a
Linking everything together...
"C:\\Users\\pedro.moreira\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -Wl,--section-start=.text=0x200 -mmcu=atmega4809 -o "C:\\Users\\pedro.moreira\\AppData\\Local\\Temp\\arduino\\sketches\\64382F96FCE5A0508669838416BD5C71/Blink.ino.elf" "C:\\Users\\pedro.moreira\\AppData\\Local\\Temp\\arduino\\sketches\\64382F96FCE5A0508669838416BD5C71\\sketch\\Blink.ino.cpp.o" "C:\\Users\\pedro.moreira\\AppData\\Local\\Temp\\arduino\\sketches\\64382F96FCE5A0508669838416BD5C71\\core\\variant.c.o" "C:\\Users\\pedro.moreira\\AppData\\Local\\Temp\\arduino\\sketches\\64382F96FCE5A0508669838416BD5C71/..\\..\\cores\\arduino_megaavr_uno2018_mode_on_20b77de573fc40e2f6d91683de4ac6a7\\core.a" "-LC:\\Users\\pedro.moreira\\AppData\\Local\\Temp\\arduino\\sketches\\64382F96FCE5A0508669838416BD5C71" -lm "-Wl,-Map,C:\\Users\\pedro.moreira\\AppData\\Local\\Temp\\arduino\\sketches\\64382F96FCE5A0508669838416BD5C71/Blink.ino.map"
c:/users/pedro.moreira/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/avrxmega3/crtatmega4809.o:../../../../crt1/gcrt1.S:310: undefined reference to `main'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

This looks like a build error rather than anything to do with your actual board. This discussion may help you:

Hello Mark,

So i was reading the discussion you sent and the solution they give is to delete a file on the Temp, when i look for it i can't find it, the only arduino related folders i have is Arduino15 and arduino-ide-updater.

There seem to be various mentions of that error message - some suggesting that it is a corrupted installation of the Arduino IDE. Which version of the IDE are you using?

You could try moving your question over into the IDE 1.x or IDE 2.x folder as appropriate to see if you get a response from one of the Arduino team.

As @ptillisch suggested a solution previously, they may respond here in this thread with other solutions as I'm not familiar with the inner workings of either versions of the IDE.

I already removed everything from Arduino IDE and installed it again, still can't seem to make it work. The version i am using is 2.3.2.

I would move your question over to the IDE 2.x section as I think you are more likely to get a reply from one of the Arduino team there.

Done, thanks for the help!

Hi @impedro07.

The error you are encountering might be caused by the core cache having been corrupted. If so, the solution will be to force Arduino IDE to generate a fresh cache.

This can be accomplished by reinstalling the "Arduino megaAVR Boards" platform.

I'll provide instructions you can follow to do that:

  1. Select Tools > Board > Boards Manager... from the Arduino IDE menus to open the "Boards Manager" view in the left side panel.
  2. Scroll down through the list of boards platforms until you see the "Arduino megaAVR Boards" entry.
  3. Hover the mouse pointer over the "Arduino megaAVR Boards" entry.
    You will see a ●●● icon appear at the top right corner of the entry.
  4. Click the ●●● icon.
    A menu will open.
  5. Select "Remove" from the menu.
    An "Uninstall" dialog will open.
  6. Click the "YES" button in the "Uninstall" dialog.
    The dialog will close.
  7. Wait for the uninstall process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:

    Successfully uninstalled platform ...

  8. Click the "INSTALL" button at the bottom of the "Arduino megaAVR Boards" entry.
  9. Wait for the installation process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:

    Successfully installed platform ...

Now try compiling your sketch again. Hopefully this time it will be successful.

Additional Information

In case you are interested in learning more about this subject, I'll provide the boring details below. If you aren't curious then you are welcome to skip reading the rest of the post.

The standard API (e.g., digitalWrite, delay) we use when writing Arduino sketches is implemented in what is known as a "core". You can think of this as a special library that is always available for use in your sketch. The main function referenced in that "undefined reference to `main'" error message is defined in the core.

The code of the core is compiled as part of your sketch program. The first time you compile a sketch for a given board, Arduino IDE automatically saves the objects that were generated when compiling the core.

This caching is done to reduce the time it takes to compile a sketch, since the core has a lot of code and thus takes quite a bit of time to compile.

If that cached precompiled core is already present, Arduino IDE will use it during subsequent compilations of sketches for that board rather than compiling the core from the source code. The core cache is only regenerated if the core's source code has changed (e.g., if you used Boards Manager to update the boards platform or manually modified the core code).

The reinstallation of the boards platform changes the timestamps on the core files, which makes Arduino IDE think the source code might have changed and so it automatically regenerates the core cache.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.