Problems with bootloader port: target bootloader does not use upload_port

I try to upload an urboot bootloader in a plain avr c project. No Arduino-Framework used.

First problem:

I get an error message, that the bootloader image can’t be found, but it is exactly in the path from the error message:

\bootloaders\urboot\atmega328pb\watchdog_1_s\autobaud\uart0_rxd0_txd1\led+b5\urboot_atmega328pb_pr_ee_ce.hex

The bootloader image resides below C:\Users\username\.platformio\packages\framework-arduino-avr-minicore\ When I enter the full path in the ini-file, it works.

My settings:

[env:Bootloader]
platform = atmelavr
board = ATmega328PB
board_build.mcu = atmega328pb
board_build.f_cpu  =  16000000UL
board_bootloader.file = C:\Users\username\.platformio\packages\framework-arduino-avr-minicore\bootloaders\urboot\atmega328pb\watchdog_1_s\autobaud\uart0_rxd0_txd1\led+b5\urboot_atmega328pb_pr_ee_ce.hex

board_fuses.lfuse = 0xFF
board_fuses.hfuse = 0xDF
board_fuses.efuse = 0xF7

upload_protocol = stk500v1
upload_port = COM13
upload_speed = 19200

;upload_flags = -P$UPLOAD_PORT -b$UPLOAD_SPEED

extra_scripts = post:extra_script.py

and when I enter the command: pio run -e Bootloader -t bootloader I get the following target configuration printed:

TARGET CONFIGURATION:
---------------------
Target = atmega328pb
Clock speed = 16000000UL
Oscillator = external
BOD level = 2.7v
Save EEPROM = yes
Bootloader type = urboot
UART port = uart0
Clock output = no
CFD enable = no
---------------------

followed by an avrdude error message: avrdude: ser_open(): can’t open device “unknown”

Where can I configure the UART port for uploading the bootloader?

What I am missing, that the bootloader image file can’t be found, even when it is on the location, where it was installed by platformio.

Does Windows allow the character ‘+’ in a path name nowadays? Your path to the bootloader contains “led+b5”.

Cheers,
Norm.

To normandunbar:
There is no problem with using the “+” symbol.

Ok, thank you. Apologies for the noise, i havent had to use windows since version 7.

Whats the maximum path length in Windows now? Is your bootloader file path exceeding any Windows limit?

Cheers,
Norm.

Path length is for sure not the problem, because when I enter the full path in platformio.ini the bootloader is found.

The problem exists only, when there is not bootloader file configured. And pio knows about the correct bootloader, as i have the pathname and filename from the error-message, where it complains, that the bootloader can’t be found. The only thing I did, was searching where below the local pio directory this path and file is located and configured the whole path.

But that is not my biggest problem, I need a solution for the serial port to upload the bootloader: Why the hell pio is not using the configured “upload_port = COM13”?

How can I tell pio, to use COM13 for uploading the bootloader and that Windows has no uart0?

Damn! I was hoping it might have been the path length.

Sadly, I don’t know anything about windows COM ports or how they do or don’t work, sorry.

Good luck.

Cheers,
Norm.

Ok, I finally managed to install vscode with platformio under a linux box.

The same two problems, configured the serial port to be /dev/ttyUSB1, but when I try to flash the bootloader I get the same target configuration:

TARGET CONFIGURATION:
---------------------
Target = atmega328pb
Clock speed = 16000000UL
Oscillator = external
BOD level = 2.7v
Save EEPROM = yes
Bootloader type = urboot
UART port = uart0
Clock output = no
CFD enable = no
---------------------

and avrdude can’t connect to uart0. :frowning:

Where the hell can I configure the port for flashing the bootloader? Everything I find, tells me that upload_port is the right place, to configure it. Uploading code works!

Same problem with the bootloader location, even here the error message tells:

Error: Couldn't find bootloader image bootloaders/urboot/atmega328pb/watchdog_1_s/autobaud/uart0_rxd0_txd1/led+b5/urboot_atmega328pb_pr_ee_ce.hex

and when I enter the full path to platformio.ini:

board_bootloader.file =  /home/username/.platformio/packages/framework-arduino-avr-minicore/bootloaders/urboot/atmega328pb/watchdog_1_s/autobaud/uart0_rxd0_txd1/led+b5/urboot_atmega328pb_pr_ee_ce.hex

the bootloader can be found.

The bootloader image is on that location, where pio has installed it. Pio knows exactly, which of those many bootloader should be used, but is not able to find it below /home/username/.platformio/packages/framework-arduino-avr-minicore

So both problems are general problems and not associated with Windows vs. Linux