Compiling and uploading with Arduino framework but not using bootloader

Hi,

Using arduino framework I am running out of memory with my atmega32 project on custom board.

I require to program using the usbasp ICSP board and to not use bootloader. At the moment the AVR is fresh from the fab house and untouched by any programmer.

I have in platformio.ini (excluding all the lib_deps)

[env:ATmega32]
platform = atmelavr
board = ATmega32
framework = arduino
upload_protocol = custom
upload_port = usb
upload_flags =
    -C
    ; use "tool-avrdude-megaavr" for the atmelmegaavr platform
    ${platformio.packages_dir}/tool-avrdude/avrdude.conf
    -p
    $BOARD_MCU
    -P
    $UPLOAD_PORT
    -c
    usbasp

upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

I have spent some hours searching for how to build and upload this project to my newly recevied atmega32 boards without the bootloader being present. To my simple mind there are a mish-mash of concepts and instructions around bootloaders, fuses and avrdude and platformio, the atmel framework and the arduino framework. It seems straightofrward in the arduino IDE but I never want to go back to that !

Would some knowledgeable person be able to just tell me what I do to my project so that run pio --target upload will actually compile and upload my file and not use a bootloader. Is it just a few lines in the platformio.ini ? Is it a few terminal commands ? A combination ?

Help !

Thanks

Eloso

It already is. Unless you do a pio run -t bootloader, the uploaded binary does not include a bootloader (Optiboot).

Thank you very much. That makes sense and is what I originally thought.

I am distracted by the fact that whether I select a USBasp programmer, or use a bootloader option the generated hexfile is identical. To reiterate:

Start a new project with a board, ATmega32 in my case. Build and get a hexfile.
Now intorduce the previously mentioned directives in platformio.ini to identify that we are using a programmer.
Clean (tried cleanall too) and repeat build to obtain new hexfile.

Both hexfiles are identical.

I must be misunderstanding something, but I was expecting the second hexfile to be different, and smaller.

Using avr-objectdump to dissassemble the hex files I can see they are identical.

If they are identical how does that fit with the idea that there is no bootloader added to the code ?

Thanks again for taking the time and trouble to deal with this.

Cheers

Eloso

Cancel the last post. I have double checked everything and platformio is indeed reporting 32768 available for flash when using the programmer and 32256 when not using the programmer.

Apologies for the distraction!

Cheers

Eloso

Hello, can you help me spot what’s wrong with my configuration. I’m also wanting to use the extra 512bytes of flash with a ATMega328P, but PlatformIO keeps saying that the available flash is 32256.

Here’s my .ini file:

[env:program_via_ArduinoISP]
platform = atmelavr
board = ATmega328P

board_build.f_cpu = 8000000L
board_hardware.oscillator = external

framework = arduino
upload_protocol = custom
upload_port = COM6
upload_speed = 19200
upload_flags =
    -C
    ; use "tool-avrdude-megaavr" for the atmelmegaavr platform
    ${platformio.packages_dir}/tool-avrdude/avrdude.conf
    -p
    $BOARD_MCU
    -P
    $UPLOAD_PORT
    -b
    $UPLOAD_SPEED
    -c
    stk500v1
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

And here’s what terminal says after uploading the code:

Flash: [====== ] 61.2% (used 19728 bytes from 32256 bytes)

Notice I’m not yet next to the limit, either way I would like to know how to achive this because I also have other projects using the Arduino IDE (which I don’t want to use anymore) and are closer to the limit. Thank you!

See

I don’t see you setting

board_hardware.uart = no_bootloader

in your platformio.ini anywhere.

All of this is documented

https://docs.platformio.org/en/latest/platforms/atmelavr.html#minicore-megacore-mightycore-majorcore-and-microcore

Which applies since

Oh! I did not know about the no_bootloader option. I’ll try that and let you know