If you are using the Optiboot bootloader from the IDE, I don't know how to preserve the EEPRIOM.
I use the MiniCore core to bootload all of my mega328 processors. The MiniCore core uploads the Optiboot core, but you have control over many parameters. The linked page has installation instructions. Using that core makes it easy to select many bootloader options like clock frequency, clock source, retain or erase EEPROM and others. Below is an image of the menu.
Core replacement is a promising idea. I haven't tried substitutions yet (compatibility issues are a little scary), but I'll look this way, thanks!
What if I change \Arduino15\packages\arduino\hardware\avr\1.8.6\boards.txt in
pro.name=Arduino Pro or Pro Mini section?
In this case i can use default core now.
Would that be considered a good solution?
Hi @n_a. After changing the fuse values in the board definition at boards.txt file, you must perform some additional actions before the change will take effect on the board:
Select File > Quit from the Arduino IDE menus and then start Arduino IDE again. ā Changes to boards.txt and other platform configuration files only take effect after restarting Arduino IDE>
Connect an ISP programmer to your board and computer.
Select the board with the modified configuration from the Tools > Board menu.
Select the appropriate programmer from the Tools > Programmer menu.
Select Tools > Burn Bootloader from the Arduino IDE menus.
Wait for the "Burn Bootloader" operation to complete successfully.
In addition to flashing the bootloader, the "Burn Bootloader" operation also sets the fuses on the board. "Upload Using Programmer" does not do that. So even though you don't need the bootloader flashed, you must perform the "Burn Bootloader" operation solely for the purposes of updating the fuses on the board.