Removing bootloader ATMEGA32u4

Using Lora32u4II board / Visual Micro / Arduino 1.8.9

I update my sketch with an ISP Programmer.

My sketch is a little to big for my ATMega32u4 chip.
So, I want to remove the bootloader, but I'm a little confused.

What I'm reading is: Upload you sketch with

avrdude.exe -v -v -v -v -p atmega32u4 -c stk500v2 -PCOM64 -b19200 -D -U flash:w:led.hex
-U hfuse:w:0xDF:m

But the fuses con"fuses" me.

my boards.txt says:

bootloader.low_fuses 0XFF
bootloader.high_fuses 0xd8
bootloader.extended_fuses 0xcb

When I use a fuse calculator, I read strange things like using a external oscillator with these values.

Anyhow It's not working I still got 28.672 bytes instead of 32768 byte for my sketch.

I don't want to use a bigger chip...

Can someone help me to understand this all ?

I don't know anything about Visual Micro, but I seem to remember that it uses the Arduino IDE installation so maybe the following information will be of some use to you.

The maximum program memory size is set for the Arduino IDE in the boards.txt file of each hardware core (Arduino AVR Boards in this case):


So even if you are using an ISP programmer to upload to the Leonardo and have the ATmega32U4's fuses set for no boot section, it will still fail the compilation if program memory usage exceeds 28672. The solution is to edit boards.txt accordingly.

The Arduino IDE comes with a bundled copy of Arduino AVR boards under {Arduino IDE installation folder}/hardware/arduino/avr. However, if you update your version of Arduino AVR Boards using Boards Manager, it is installed to C:\Users{user name}\AppData\Local\Arduino15\packages\arduino\hardware\avr{version}\ and the copy of Arduino AVR Boards bundled with the Arduino IDE is no longer used.

Once you get the program compiled using the boards.txt entry that has the big enough upload.maximum_size setting as pert mentions in the post above, you can do the "upload using programmer" option on the Sketch menu. Look at the console at the bottom of the IDE window and it will show you the command avrdude did to upload the sketch. Copy that to a text editor and take off the "-U flash:w:filename" part and add on the fuse writing part "-U hfuse:w:0xDF:m" to write the high fuse. Copy the command to the command line, and write the fuse.

What you are doing is altering the reset vector fuse BOOTRST. The default boards.txt entry for high fuse, D8, tells the MCU to start execution upon power up or reset in the bootloader area of flash. You don't want to do that when you have a large program and no bootloader, because execution will begin near the end of your program and give unpredictable results. The high fuse DF will tell the MCU to begin execution at the beginning of flash in the user program area.

You'll notice on the fuse calculator page:

...if you change D8 to DF and click apply, you'll see the differences in the fuses happen, unchecking the bootloader-related fuses. Read the ATmega32u4 datasheet to learn lots of details about what the various fuses do.

Thank you all for this information, this helped me to solve my problem, and now I understand how these things works, I'm happy...