ATmega4808 upload via UPDI through jtag2updi

Unable to get the 328 which I usually use for my projects, I am moving to the 4808 version atmega.
Up to now I have installed MegaCoreX in the arduino IDE, uploaded a bootloader via jtag2updi installed on a nano using the UPDI pins on the 4808.

Then I have programmed the 4808 using a FTDI link via platformio (full normal stuff)

However, having to add both UPDI and FTDE headers takes some space up, for little advantage, as you can program etc via UPDI alone. Indeed, if I knock up a simple 4808 with UPDI on the UPDI pin and FTDE on pins PF6(via 100nf cap to rst), PC0 and PC1 to Tx/Rx. then just a couple of 100nf on the supply and an LED on the built-in-LED pin PA7; I can then program this via the above method, or by just uploading say blink via jtag2updi in the arduino IDE.

But, I usually use platformio to develop code, when I try to use the same nano with jtag2updi via Platformio although it appears to work (see dialogue below) nothing appears to work on the 4808 - load blink via FTDE - 4808 happily blinks, use UPDI and the built-in-LED just stays illuminated. (There is a warning about not having flash or boot - but it continues and gives success)

Try any other program, build in platformio, load via FTDE - all good, load via UPDI - no go just the illuminated LED

Transfer the code to arduino IDE, it builds and uploads correctly via UPDI

Any suggestions on fixing this?

Output dialogue following build:

Configuring upload protocol…
AVAILABLE: jtag2updi
CURRENT: upload_protocol = jtag2updi
Looking for upload port…
Auto-detected: COM7
Uploading .pio\build\ATmega4808\firmware.hex

avrdude: jtagmkII_initialize(): Cannot locate “flash” and “boot” memories in description
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.15s

avrdude: Device signature = 0x1e9650 (probably m4808)
avrdude: NOTE: “flash” memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file “.pio\build\ATmega4808\firmware.hex”
avrdude: writing flash (780 bytes):

Writing | ################################################## | 100% 0.23s

avrdude: 780 bytes of flash written
avrdude: verifying flash memory against .pio\build\ATmega4808\firmware.hex:
avrdude: load data flash data from input file .pio\build\ATmega4808\firmware.hex:
avrdude: input file .pio\build\ATmega4808\firmware.hex contains 780 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.16s

avrdude: verifying …
avrdude: 780 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:FF, L:FF)

avrdude done. Thank you.

============================== [SUCCESS] Took 3.37 seconds ==============================

  • Terminal will be reused by tasks, press any key to close it.

the ini file is just:

[env:ATmega4808]

platform = atmelmegaavr

board = ATmega4808

framework = arduino

; upload_protocol= arduino

(I un-comment the last line when using FTDE)

Okay so as I understand you have one piece of code, that if you upload it via jtag2updi in the Arduino IDE, the LED blinks, but if you use the same code and the jtag2updi upload method in PlatformIO, it does not blink.

In the Arduino, go to File → Preferences and set checkmarks on both vebose compilation and upload. Upload again. Post the avrdude command that it uses here.

In the PlatformIO, use the project task → Advanced → Verbose Upload and upload the same log.

Arduino stuff (note My PC details removed)

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\xxxxxxxxx\AppData\Local\Arduino15\packages -hardware C:\Users\xxxxxxxxx\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\xxxxxxxxx\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\xxxxxxxxxx\Documents\Arduino\libraries -fqbn=MegaCoreX:megaavr:4808:pinout=32pin_standard,eeprom=keep,resetpin=reset,BOD=2v6,clock=internal_16MHz,bootloader=uart1_default -vid-pid=1A86_7523 -ide-version=10813 -build-path C:\Users\xxxxxxxxxx\AppData\Local\Temp\arduino_build_37612 -warnings=none -build-cache C:\Users\xxxxxxxxx\AppData\Local\Temp\arduino_cache_941201 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\xxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\tools\avrdude\7.0.0-arduino2 -prefs=runtime.tools.avrdude-7.0.0-arduino2.path=C:\Users\xxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\tools\avrdude\7.0.0-arduino2 -prefs=runtime.tools.avr-gcc.path=C:\Users\xxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\xxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\xxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\xxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\xxxxxxxx\AppData\Local\Arduino15\packages -hardware C:\Users\xxxxxxxx\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\xxxxxxxx\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\xxxxxxxxxx\Documents\Arduino\libraries -fqbn=MegaCoreX:megaavr:4808:pinout=32pin_standard,eeprom=keep,resetpin=reset,BOD=2v6,clock=internal_16MHz,bootloader=uart1_default -vid-pid=1A86_7523 -ide-version=10813 -build-path C:\Users\xxxxxxxxx\AppData\Local\Temp\arduino_build_37612 -warnings=none -build-cache C:\Users\xxxxxxx\AppData\Local\Temp\arduino_cache_941201 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\xxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\tools\avrdude\7.0.0-arduino2 -prefs=runtime.tools.avrdude-7.0.0-arduino2.path=C:\Users\xxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\tools\avrdude\7.0.0-arduino2 -prefs=runtime.tools.avr-gcc.path=C:\Users\xxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\xxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\xxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\xxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
Using board '4808' from platform in folder: C:\Users\xxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0
Using core 'coreX-corefiles' from platform in folder: C:\Users\xxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0
Detecting libraries used...
"C:\\Users\\xxxxxxxx\\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=atmega4808 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_ATmega4808 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\xxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\xxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles" "-IC:\\Users\\xxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\variants\\32pin-standard" "C:\\Users\\xxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612\\sketch\\Blink.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Generating function prototypes...
"C:\\Users\\xxxxxxxxx\\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=atmega4808 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_ATmega4808 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\xxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\xxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles" "-IC:\\Users\\xxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\variants\\32pin-standard" "C:\\Users\\xxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612\\sketch\\Blink.ino.cpp" -o "C:\\Users\\xxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\xxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\xxxxxxxxx\\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=atmega4808 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_ATmega4808 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\xxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\xxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\cores\\coreX-corefiles" "-IC:\\Users\\xxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.1.0\\variants\\32pin-standard" "C:\\Users\\xxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612\\sketch\\Blink.ino.cpp" -o "C:\\Users\\xxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612\\sketch\\Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\xxxxxxxxxx\AppData\Local\Temp\arduino_cache_941201\core\core_c14c0fab76815fc111c18ba506c86e49.a
Linking everything together...
"C:\\Users\\xxxxxxxxxxx\\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=0x200 -mmcu=atmega4808 -o "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612/Blink.ino.elf" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612\\sketch\\Blink.ino.cpp.o" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612/..\\arduino_cache_941201\\core\\core_c14c0fab76815fc111c18ba506c86e49.a" "-LC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612" -lm
"C:\\Users\\xxxxxxxxxxx\\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\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612/Blink.ino.elf" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612/Blink.ino.eep"
"C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612/Blink.ino.elf" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612/Blink.ino.hex"
cmd /C "C:\\Users\\xxxxxxxxxxx\\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\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612/Blink.ino.elf" > "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612/Blink.ino_atmega4808_16000000L.lst"
"C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_37612/Blink.ino.elf"
Sketch uses 756 bytes (1%) of program storage space. Maximum is 48640 bytes.
Global variables use 4 bytes (0%) of dynamic memory, leaving 6140 bytes for local variables. Maximum is 6144 bytes.
C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\tools\avrdude\7.0.0-arduino2/bin/avrdude -CC:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0/avrdude.conf -v -patmega4808 -cjtag2updi -PCOM7 -Uflash:w:C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_37612/Blink.ino.with_bootloader.hex:i -Ufuse0:w:0x00:m -Ufuse1:w:0x54:m -Ufuse2:w:0x01:m -Ufuse4:w:0x00:m -Ufuse5:w:0b11001001:m -Ufuse6:w:0x06:m -Ufuse7:w:0x00:m -Ufuse8:w:0x02:m -Ulock:w:0xC5:m 

avrdude: Version 7.0
         Copyright (c) Brian Dean, http://www.bdmicro.com/
         Copyright (c) Joerg Wunsch

         System wide configuration file is "C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.1.0/avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : jtag2updi
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
         AVR Part                      : ATmega4808
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Memory Detail                 :

                                           Block Poll               Page                       Polled
           Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature               0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig                 0     0     0    0 no         61   61      0     0     0 0x00 0x00
           sernum                  0     0     0    0 no         10    0      0     0     0 0x00 0x00
           osccal16                0     0     0    0 no          2    0      0     0     0 0x00 0x00
           osccal20                0     0     0    0 no          2    0      0     0     0 0x00 0x00
           tempsense               0     0     0    0 no          2    0      0     0     0 0x00 0x00
           osc16err                0     0     0    0 no          2    0      0     0     0 0x00 0x00
           osc20err                0     0     0    0 no          2    0      0     0     0 0x00 0x00
           fuses                   0     0     0    0 no          9   10      0     0     0 0x00 0x00
           fuse0       wdtcfg      0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1       bodcfg      0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2       osccfg      0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4       tcd0cfg     0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5       syscfg0     0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6       syscfg1     0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7       append      0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8       bootend     0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock                    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data                    0     0     0    0 no          0    0      0     0     0 0x00 0x00
           userrow     usersig     0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash                   0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom                  0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU HW version: 1
         M_MCU FW version: 6.00
         S_MCU HW version: 1
         S_MCU FW version: 6.00
         Serial number   : 00:00:00:00:00:00
         Vtarget         : 5.0 V

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.16s

avrdude: Device signature = 0x1e9650 (probably m4808)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_37612/Blink.ino.with_bootloader.hex"
avrdude: writing flash (1268 bytes):

Writing | ################################################## | 100% 0.33s

avrdude: 1268 bytes of flash written
avrdude: verifying flash memory against C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_37612/Blink.ino.with_bootloader.hex:

Reading | ################################################## | 100% 0.23s

avrdude: 1268 bytes of flash verified
avrdude: reading input file "0x00"
avrdude: writing fuse0/wdtcfg (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse0/wdtcfg written
avrdude: verifying fuse0/wdtcfg memory against 0x00:

Reading | ################################################## | 100% 0.00s

avrdude: 1 bytes of fuse0/wdtcfg verified
avrdude: reading input file "0x54"
avrdude: writing fuse1/bodcfg (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse1/bodcfg written
avrdude: verifying fuse1/bodcfg memory against 0x54:

Reading | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse1/bodcfg verified
avrdude: reading input file "0x01"
avrdude: writing fuse2/osccfg (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse2/osccfg written
avrdude: verifying fuse2/osccfg memory against 0x01:

Reading | ################################################## | 100% 0.00s

avrdude: 1 bytes of fuse2/osccfg verified
avrdude: reading input file "0x00"
avrdude: writing fuse4/tcd0cfg (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse4/tcd0cfg written
avrdude: verifying fuse4/tcd0cfg memory against 0x00:

Reading | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse4/tcd0cfg verified
avrdude: reading input file "0b11001001"
avrdude: writing fuse5/syscfg0 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse5/syscfg0 written
avrdude: verifying fuse5/syscfg0 memory against 0b11001001:

Reading | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse5/syscfg0 verified
avrdude: reading input file "0x06"
avrdude: writing fuse6/syscfg1 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse6/syscfg1 written
avrdude: verifying fuse6/syscfg1 memory against 0x06:

Reading | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse6/syscfg1 verified
avrdude: reading input file "0x00"
avrdude: writing fuse7/append (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse7/append written
avrdude: verifying fuse7/append memory against 0x00:

Reading | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse7/append verified
avrdude: reading input file "0x02"
avrdude: writing fuse8/bootend (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse8/bootend written
avrdude: verifying fuse8/bootend memory against 0x02:

Reading | ################################################## | 100% 0.00s

avrdude: 1 bytes of fuse8/bootend verified
avrdude: reading input file "0xC5"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xC5:

Reading | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock verified

avrdude done.  Thank you.

And from platformio (PC refs removed again)

*  Executing task in folder Stdblink: C:\Users\xxxxxxxxxxx\.platformio\penv\Scripts\platformio.exe run --verbose --target upload --environment ATmega4808 

Processing ATmega4808 (platform: atmelmegaavr; board: ATmega4808; framework: arduino)     
------------------------------------------------------------------------------------------CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/ATmega4808.html
PLATFORM: Atmel megaAVR (1.6.0) > ATmega4808     
HARDWARE: ATMEGA4808 16MHz, 6KB RAM, 48KB Flash  
PACKAGES:
 - framework-arduino-megaavr-megacorex @ 1.0.10  
 - tool-avrdude-megaavr @ 3.60300.220118 (6.3.0) 
 - toolchain-atmelavr @ 3.70300.220127 (7.3.0)   
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 11 compatible libraries
Scanning dependencies...     
No dependencies
Building in release mode     
MethodWrapper(["checkprogsize"], [".pio\build\ATmega4808\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.1% (used 4 bytes from 6144 bytes)
Flash: [          ]   1.0% (used 480 bytes from 49152 bytes)
.pio\build\ATmega4808\firmware.elf  :

section                     size      addr

.data                          0   8398848

.text                        480         0

.bss                           4   8398848

.comment                      17         0

.note.gnu.avr.deviceinfo      64         0

.debug_aranges                64         0

.debug_info                 9170         0

.debug_abbrev               8426         0

.debug_line                  599         0

.debug_str                  3789         0

Total                      22613
<lambda>(["upload"], [".pio\build\ATmega4808\firmware.hex"])
AVAILABLE: jtag2updi
CURRENT: upload_protocol = jtag2updi
BeforeUpload(["upload"], [".pio\build\ATmega4808\firmware.hex"])
Auto-detected: COM7
avrdude -v -p atmega4808 -C C:\Users\xxxxxxxxxxx\.platformio\packages\tool-avrdude-megaavr\avrdude.conf -c jtag2updi -b 115200 -P "COM7" -U flash:w:.pio\build\ATmega4808\firmware.hex:i

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\xxxxxxxxxxx\.platformio\packages\tool-avrdude-megaavr\avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
         AVR Part                      : ATmega4808
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9   10      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU hardware version: 1
         M_MCU firmware version: 6.00
         S_MCU hardware version: 1
         S_MCU firmware version: 6.00
         Serial number:          00:00:00:00:00:00
         Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.15s

avrdude: Device signature = 0x1e9650 (probably m4808)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed        
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file ".pio\build\ATmega4808\firmware.hex"
avrdude: writing flash (480 bytes):

Writing | ################################################## | 100% 0.13s

avrdude: 480 bytes of flash written
avrdude: verifying flash memory against .pio\build\ATmega4808\firmware.hex:
avrdude: load data flash data from input file .pio\build\ATmega4808\firmware.hex:
avrdude: input file .pio\build\ATmega4808\firmware.hex contains 480 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.09s

avrdude: verifying ...
avrdude: 480 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:FF, L:FF)

avrdude done.  Thank you.

============================== [SUCCESS] Took 2.34 seconds ==============================
 *  Terminal will be reused by tasks, press any key to close it.

Okay, there are multiple points of interest here.

The Arduino IDE in the linking phase adds sets the firmware start to be at 0x200 (for the bootloader I presume). I must verify in a verbose build that PlatformIO does the same.

For uploading, the Arduino IDE uses

While PlatformIO uses

The Arduino IDE upload command also sets all fuses during upload, while PlatformIO doesn’t touch them (but that shouldn’t be the problem).

Further, PlatformIO is one version behind in the MegaXCore, using 1.0.10 although 1.1.0 is the latest.

Can you temporarily check that when you downgrade the MegaCorX to 1.0.10 in the Arduino IDE’s board manager, your sketch still works?

Here is the build verbose in platformio

 *  Executing task in folder Stdblink: C:\Users\xxxxxxxxxxx\.platformio\penv\Scripts\platformio.exe run --verbose --environment ATmega4808 

Processing ATmega4808 (platform: atmelmegaavr; board: ATmega4808; framework: arduino)
-----------------------------------------------------------------------------------------------------------CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/ATmega4808.html
PLATFORM: Atmel megaAVR (1.6.0) > ATmega4808    
HARDWARE: ATMEGA4808 16MHz, 6KB RAM, 48KB Flash 
PACKAGES:
 - framework-arduino-megaavr-megacorex @ 1.0.10 
 - toolchain-atmelavr @ 3.70300.220127 (7.3.0)  
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 11 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\ATmega4808\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.1% (used 4 bytes from 6144 bytes)
Flash: [          ]   1.0% (used 480 bytes from 49152 bytes)
.pio\build\ATmega4808\firmware.elf  :

section                     size      addr

.data                          0   8398848

.text                        480         0

.bss                           4   8398848

.comment                      17         0

.note.gnu.avr.deviceinfo      64         0

.debug_aranges                64         0

.debug_info                 9170         0

.debug_abbrev               8426         0

.debug_line                  599         0

.debug_str                  3789         0

Total                      22613
======================================= [SUCCESS] Took 0.79 seconds ======================================= *  Terminal will be reused by tasks, press any key to close it.

Well that basically says addr = 0 for .text, so PlatformIO doesn’t do the relocation to 0x200. This logic is missing from the builder script.

the previous version of megacorex builds and loads via UPDI in arduino ide, and works fine:

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages -hardware C:\Users\xxxxxxxxxxx\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\xxxxxxxxxxx\Documents\Arduino\libraries -fqbn=MegaCoreX:megaavr:4808:pinout=32pin_standard,eeprom=keep,resetpin=reset,BOD=2v6,clock=internal_16MHz,bootloader=uart1_default -vid-pid=1A86_7523 -ide-version=10813 -build-path C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328 -warnings=none -build-cache C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_cache_559948 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avrdude-6.3.0-arduino18.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avr-gcc.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages -hardware C:\Users\xxxxxxxxxxx\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\xxxxxxxxxxx\Documents\Arduino\libraries -fqbn=MegaCoreX:megaavr:4808:pinout=32pin_standard,eeprom=keep,resetpin=reset,BOD=2v6,clock=internal_16MHz,bootloader=uart1_default -vid-pid=1A86_7523 -ide-version=10813 -build-path C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328 -warnings=none -build-cache C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_cache_559948 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avrdude-6.3.0-arduino18.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avr-gcc.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
Using board '4808' from platform in folder: C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10
Using core 'coreX-corefiles' from platform in folder: C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10
Detecting libraries used...
"C:\\Users\\xxxxxxxxxxx\\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=atmega4808 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_ATmega4808 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\variants\\32pin-standard" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Generating function prototypes...
"C:\\Users\\xxxxxxxxxxx\\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=atmega4808 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_ATmega4808 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\variants\\32pin-standard" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp" -o "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\xxxxxxxxxxx\\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=atmega4808 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_ATmega4808 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\variants\\32pin-standard" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp" -o "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_cache_559948\core\core_31b04a28cd9513abeb7a46a43f8b9cef.a
Linking everything together...
"C:\\Users\\xxxxxxxxxxx\\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=0x200 -mmcu=atmega4808 -o "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp.o" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/..\\arduino_cache_559948\\core\\core_31b04a28cd9513abeb7a46a43f8b9cef.a" "-LC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328" -lm
"C:\\Users\\xxxxxxxxxxx\\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\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.eep"
"C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.hex"
cmd /C "C:\\Users\\xxxxxxxxxxx\\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\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf" > "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino_atmega4808_16000000L.lst"
"C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf"
Sketch uses 756 bytes (1%) of program storage space. Maximum is 48640 bytes.
Global variables use 4 bytes (0%) of dynamic memory, leaving 6140 bytes for local variables. Maximum is 6144 bytes.
C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10/avrdude.conf -v -patmega4808 -cjtag2updi -PCOM7 -Uflash:w:C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex:i -Ufuse0:w:0x00:m -Ufuse1:w:0x54:m -Ufuse2:w:0x01:m -Ufuse4:w:0x00:m -Ufuse5:w:0b11001001:m -Ufuse6:w:0x06:m -Ufuse7:w:0x00:m -Ufuse8:w:0x02:m -Ulock:w:0xC5:m 

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10/avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : jtag2updi
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
         AVR Part                      : ATmega4808
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU hardware version: 1
         M_MCU firmware version: 6.00
         S_MCU hardware version: 1
         S_MCU firmware version: 6.00
         Serial number:          00:00:00:00:00:00
         Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.16s

avrdude: Device signature = 0x1e9650 (probably m4808)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex"
avrdude: writing flash (1268 bytes):

Writing | ################################################## | 100% 0.34s

avrdude: 1268 bytes of flash written
avrdude: verifying flash memory against C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex:
avrdude: load data flash data from input file C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex:
avrdude: input file C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex contains 1268 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.23s

avrdude: verifying ...
avrdude: 1268 bytes of flash verified
avrdude: reading input file "0x00"
avrdude: writing fuse0 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse0 written
avrdude: verifying fuse0 memory against 0x00:
avrdude: load data fuse0 data from input file 0x00:
avrdude: input file 0x00 contains 1 bytes
avrdude: reading on-chip fuse0 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse0 verified
avrdude: reading input file "0x54"
avrdude: writing fuse1 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse1 written
avrdude: verifying fuse1 memory against 0x54:
avrdude: load data fuse1 data from input file 0x54:
avrdude: input file 0x54 contains 1 bytes
avrdude: reading on-chip fuse1 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse1 verified
avrdude: reading input file "0x01"
avrdude: writing fuse2 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse2 written
avrdude: verifying fuse2 memory against 0x01:
avrdude: load data fuse2 data from input file 0x01:
avrdude: input file 0x01 contains 1 bytes
avrdude: reading on-chip fuse2 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse2 verified
avrdude: reading input file "0x00"
avrdude: writing fuse4 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse4 written
avrdude: verifying fuse4 memory against 0x00:
avrdude: load data fuse4 data from input file 0x00:
avrdude: input file 0x00 contains 1 bytes
avrdude: reading on-chip fuse4 data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse4 verified
avrdude: reading input file "0b11001001"
avrdude: writing fuse5 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse5 written
avrdude: verifying fuse5 memory against 0b11001001:
avrdude: load data fuse5 data from input file 0b11001001:
avrdude: input file 0b11001001 contains 1 bytes
avrdude: reading on-chip fuse5 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse5 verified
avrdude: reading input file "0x06"
avrdude: writing fuse6 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse6 written
avrdude: verifying fuse6 memory against 0x06:
avrdude: load data fuse6 data from input file 0x06:
avrdude: input file 0x06 contains 1 bytes
avrdude: reading on-chip fuse6 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse6 verified
avrdude: reading input file "0x00"
avrdude: writing fuse7 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse7 written
avrdude: verifying fuse7 memory against 0x00:
avrdude: load data fuse7 data from input file 0x00:
avrdude: input file 0x00 contains 1 bytes
avrdude: reading on-chip fuse7 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse7 verified
avrdude: reading input file "0x02"
avrdude: writing fuse8 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse8 written
avrdude: verifying fuse8 memory against 0x02:
avrdude: load data fuse8 data from input file 0x02:
avrdude: input file 0x02 contains 1 bytes
avrdude: reading on-chip fuse8 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse8 verified
avrdude: reading input file "0xC5"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xC5:
avrdude: load data lock data from input file 0xC5:
avrdude: input file 0xC5 contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude done.  Thank you.

Is that something I can overwrite in the ini file?

But you’re still using the “Tools → Bootloader = Optiboot” settings (from here). Does it work in the Arduino IDE too when set to “no bootloader”? Because that’s what PlatformIO does (unconditionally).

I set the option to no bootloader in arduino IDE and it still loads and works correctly

here is the upload output:

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages -hardware C:\Users\xxxxxxxxxxx\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\xxxxxxxxxxx\Documents\Arduino\libraries -fqbn=MegaCoreX:megaavr:4808:pinout=32pin_standard,eeprom=keep,resetpin=reset,BOD=2v6,clock=internal_16MHz,bootloader=no_bootloader -vid-pid=1A86_7523 -ide-version=10813 -build-path C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328 -warnings=none -build-cache C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_cache_559948 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avrdude-6.3.0-arduino18.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avr-gcc.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages -hardware C:\Users\xxxxxxxxxxx\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\xxxxxxxxxxx\Documents\Arduino\libraries -fqbn=MegaCoreX:megaavr:4808:pinout=32pin_standard,eeprom=keep,resetpin=reset,BOD=2v6,clock=internal_16MHz,bootloader=no_bootloader -vid-pid=1A86_7523 -ide-version=10813 -build-path C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328 -warnings=none -build-cache C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_cache_559948 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avrdude-6.3.0-arduino18.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avr-gcc.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
Using board '4808' from platform in folder: C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10
Using core 'coreX-corefiles' from platform in folder: C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10
Detecting libraries used...
"C:\\Users\\xxxxxxxxxxx\\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=atmega4808 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_ATmega4808 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\variants\\32pin-standard" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Generating function prototypes...
"C:\\Users\\xxxxxxxxxxx\\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=atmega4808 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_ATmega4808 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\variants\\32pin-standard" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp" -o "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\xxxxxxxxxxx\\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=atmega4808 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_ATmega4808 -DARDUINO_ARCH_MEGAAVR "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles/api/deprecated" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\cores\\coreX-corefiles" "-IC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\MegaCoreX\\hardware\\megaavr\\1.0.10\\variants\\32pin-standard" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp" -o "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_cache_559948\core\core_fb8616733d62ae39b53619cdc8e689da.a
Linking everything together...
"C:\\Users\\xxxxxxxxxxx\\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=atmega4808 -o "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328\\sketch\\Blink.ino.cpp.o" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/..\\arduino_cache_559948\\core\\core_fb8616733d62ae39b53619cdc8e689da.a" "-LC:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328" -lm
"C:\\Users\\xxxxxxxxxxx\\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\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.eep"
"C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf" "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.hex"
cmd /C "C:\\Users\\xxxxxxxxxxx\\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\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf" > "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino_atmega4808_16000000L.lst"
"C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\xxxxxxxxxxx\\AppData\\Local\\Temp\\arduino_build_742328/Blink.ino.elf"
Sketch uses 756 bytes (1%) 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.
C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10/avrdude.conf -v -patmega4808 -cjtag2updi -PCOM7 -Uflash:w:C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex:i -Ufuse0:w:0x00:m -Ufuse1:w:0x54:m -Ufuse2:w:0x01: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-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\xxxxxxxxxxx\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10/avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : jtag2updi
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
         AVR Part                      : ATmega4808
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU hardware version: 1
         M_MCU firmware version: 6.00
         S_MCU hardware version: 1
         S_MCU firmware version: 6.00
         Serial number:          00:00:00:00:00:00
         Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.16s

avrdude: Device signature = 0x1e9650 (probably m4808)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex"
avrdude: writing flash (756 bytes):

Writing | ################################################## | 100% 0.18s

avrdude: 756 bytes of flash written
avrdude: verifying flash memory against C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex:
avrdude: load data flash data from input file C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex:
avrdude: input file C:\Users\xxxxxxxxxxx\AppData\Local\Temp\arduino_build_742328/Blink.ino.with_bootloader.hex contains 756 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.14s

avrdude: verifying ...
avrdude: 756 bytes of flash verified
avrdude: reading input file "0x00"
avrdude: writing fuse0 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse0 written
avrdude: verifying fuse0 memory against 0x00:
avrdude: load data fuse0 data from input file 0x00:
avrdude: input file 0x00 contains 1 bytes
avrdude: reading on-chip fuse0 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse0 verified
avrdude: reading input file "0x54"
avrdude: writing fuse1 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse1 written
avrdude: verifying fuse1 memory against 0x54:
avrdude: load data fuse1 data from input file 0x54:
avrdude: input file 0x54 contains 1 bytes
avrdude: reading on-chip fuse1 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse1 verified
avrdude: reading input file "0x01"
avrdude: writing fuse2 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse2 written
avrdude: verifying fuse2 memory against 0x01:
avrdude: load data fuse2 data from input file 0x01:
avrdude: input file 0x01 contains 1 bytes
avrdude: reading on-chip fuse2 data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse2 verified
avrdude: reading input file "0x00"
avrdude: writing fuse4 (1 bytes):

Writing | ################################################## | 100% -0.00s

avrdude: 1 bytes of fuse4 written
avrdude: verifying fuse4 memory against 0x00:
avrdude: load data fuse4 data from input file 0x00:
avrdude: input file 0x00 contains 1 bytes
avrdude: reading on-chip fuse4 data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 1 bytes of fuse4 verified
avrdude: reading input file "0b11001001"
avrdude: writing fuse5 (1 bytes):

Writing | ################################################## | 100% -0.00s

avrdude: 1 bytes of fuse5 written
avrdude: verifying fuse5 memory against 0b11001001:
avrdude: load data fuse5 data from input file 0b11001001:
avrdude: input file 0b11001001 contains 1 bytes
avrdude: reading on-chip fuse5 data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of fuse5 verified
avrdude: reading input file "0x06"
avrdude: writing fuse6 (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of fuse6 written
avrdude: verifying fuse6 memory against 0x06:
avrdude: load data fuse6 data from input file 0x06:
avrdude: input file 0x06 contains 1 bytes
avrdude: reading on-chip fuse6 data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse6 verified
avrdude: reading input file "0x00"
avrdude: writing fuse7 (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of fuse7 written
avrdude: verifying fuse7 memory against 0x00:
avrdude: load data fuse7 data from input file 0x00:
avrdude: input file 0x00 contains 1 bytes
avrdude: reading on-chip fuse7 data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse7 verified
avrdude: reading input file "0x00"
avrdude: writing fuse8 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse8 written
avrdude: verifying fuse8 memory against 0x00:
avrdude: load data fuse8 data from input file 0x00:
avrdude: input file 0x00 contains 1 bytes
avrdude: reading on-chip fuse8 data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse8 verified
avrdude: reading input file "0xC5"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xC5:
avrdude: load data lock data from input file 0xC5:
avrdude: input file 0xC5 contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% -0.00s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude done.  Thank you.

Hm here’s what I think is happening:

In the Arduino IDE, you choose Tools->Bootloader = Optiboot. The core compiles the main sketch .elf with .text offset = 0x200, and then merges the bootloader and sketch in one hex file, as indicated in the Blink.ino.with_bootloader.hex file that is flashed. It also sets all the fuses like BOOTEND=0x2 (probably sets the size of the bootloader vs the application. That works normally.

Now with these settings once flashed, PlatformIO compiles this with “no bootloader” setting, so offset = 0x000 and there is no merge with the bootloader file at all. Uploading this just with the previously set fuses seems to just result in nothing.

But what could work is uploading with the “No Bootloader” settings in the Arduino IDE once, that sets all the fuses to be correct, and then upload the PlatformIO firmware as normal. Can you try that?

I think this starts at section-start=0x00

Exactly, when set to Bootloader = No Bootloader, the Arduino IDE does

-Wl,--section-start=.text=0x0

as expected. Same as leaving it out (what PlatformIO does).

Tried uploading with platformio straight after the previous upload without bootloader from arduino IDE

Says it works, but as previously it actually doesn’t.

Upload date from platformio

 *  Executing task in folder Stdblink: C:\Users\xxxxxxxxxxx\.platformio\penv\Scripts\platformio.exe run --verbose --target upload --environment ATmega4808 

Processing ATmega4808 (platform: atmelmegaavr; board: ATmega4808; framework: arduino)     
------------------------------------------------------------------------------------------CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/ATmega4808.html
PLATFORM: Atmel megaAVR (1.6.0) > ATmega4808
HARDWARE: ATMEGA4808 16MHz, 6KB RAM, 48KB Flash
PACKAGES:
 - framework-arduino-megaavr-megacorex @ 1.0.10
 - tool-avrdude-megaavr @ 3.60300.220118 (6.3.0)
 - toolchain-atmelavr @ 3.70300.220127 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 11 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\ATmega4808\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.1% (used 4 bytes from 6144 bytes)
Flash: [          ]   1.0% (used 480 bytes from 49152 bytes)
.pio\build\ATmega4808\firmware.elf  :

section                     size      addr

.data                          0   8398848

.text                        480         0

.bss                           4   8398848

.comment                      17         0

.note.gnu.avr.deviceinfo      64         0

.debug_aranges                64         0

.debug_info                 9170         0

.debug_abbrev               8426         0

.debug_line                  599         0

.debug_str                  3789         0

Total                      22613
<lambda>(["upload"], [".pio\build\ATmega4808\firmware.hex"])
AVAILABLE: jtag2updi
CURRENT: upload_protocol = jtag2updi
BeforeUpload(["upload"], [".pio\build\ATmega4808\firmware.hex"])
Auto-detected: COM7
avrdude -v -p atmega4808 -C C:\Users\xxxxxxxxxxx\.platformio\packages\tool-avrdude-megaavr\avrdude.conf -c jtag2updi -b 115200 -P "COM7" -U flash:w:.pio\build\ATmega4808\firmware.hex:i

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\xxxxxxxxxxx\.platformio\packages\tool-avrdude-megaavr\avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
         AVR Part                      : ATmega4808
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9   10      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU hardware version: 1
         M_MCU firmware version: 6.00
         S_MCU hardware version: 1
         S_MCU firmware version: 6.00
         Serial number:          00:00:00:00:00:00
         Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.16s

avrdude: Device signature = 0x1e9650 (probably m4808)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed        
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file ".pio\build\ATmega4808\firmware.hex"
avrdude: writing flash (480 bytes):

Writing | ################################################## | 100% 0.13s

avrdude: 480 bytes of flash written
avrdude: verifying flash memory against .pio\build\ATmega4808\firmware.hex:
avrdude: load data flash data from input file .pio\build\ATmega4808\firmware.hex:
avrdude: input file .pio\build\ATmega4808\firmware.hex contains 480 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.09s

avrdude: verifying ...
avrdude: 480 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:FF, L:FF)

avrdude done.  Thank you.

============================== [SUCCESS] Took 2.37 seconds ==============================
 *  Terminal will be reused by tasks, press any key to close it.

Sad, that should have worked.

Can you post your minimal code with which you’re testing? I have a ATmega4809 as a “close chip” to reproduce this issue again.

Platformio:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:ATmega4808]
platform = atmelmegaavr
board = ATmega4808
framework = arduino
;upload_protocol= arduino

main.cpp:

#include <Arduino.h>
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

(Standard blink).

May have an update/work around

If I upload with no bootloader (Arduino ide) then use platformio - no go

BUT
If I upload with no bootloader (Arduino ide) three - four times then use platformio - it does work!

So I don’t know if the chip isn’t properly being cleared - but after a few goes it is.

Is there any way of starting the load at 0x200 in platformio?

That is uhm, very weird.

That is only half the rent, the other one is merging the bootloader.hex when creating the firmware hex. Both of this requires changes in the Python code of platform-atmelmegaavr (or an addition of a extra_script) and some knowledge of PlatformIO and SCOns.

For example, in arduino.py, at e.g. line 76, you would have to add something like

if build_core == "MegaCoreX":
  env.Append(LINKFLAGS=["-Wl,--section-start=.text=0x200"])

and then this would have to be addapted to include the bootloader hex for the board somehow. It’s not super trivial.

Definitely an issue should be opened at Issues · platformio/platform-atmelmegaavr · GitHub

Thanks Max, I have raised an issue.

Thanks for your help, at least there is a work around of sorts.