Hi, I'm quite new with Arduino so maybe this is a trivial issue. I couldn't find it googling or searching on this forum.
I have an Uno for which I've written quite a large sketch. It uploads just fine and the Arduino IDE says the maximum size is 32256 bytes.
Now, I also have a Pro mini. If I try to upload that same sketch it fails because it's too large. The IDE says that the maximum size is 30720 bytes (I need 30870 after deleting all the unnecessary stuff).
It doesn't seem to have to do with the physical controller. Just changing the board setting in the IDE and compiling already makes the difference. Is the maximum size some kind of setting in the IDE? If so, where can I change this? (Of course I know the maximum flash size).
The Pro Mini uses an outdated bootloader that requires a larger boot section than the Uno's optiboot bootloader. If you're using the Atmega328P 16 MHz Pro Mini and you have an ISP programmer or an extra Arduino to use as an "Arduino as ISP" then you can burn the Uno bootloader to your Pro Mini and then use it as an Uno from there on, which will free up 1.5 kB of program memory. If you have an ATmega168 or 8 MHz Pro Mini then you can do the same only using the appropriate MiniCore board:
It has the optiboot bootloader compiled for those hardware configurations.
You could also do a Sketch > Upload Using Programmer with your ISP programmer to flash the board without the use of a bootloader to free up 2 kB but the IDE still erroneously maintains the maximum size with the boot section.
The maximum size is set in the upload.maximum_size properties in boards.txt but be aware that it's set to that size for a reason, which is total flash capacity - boot section size so it's not incorrect if you're using the bootloader.