Increase size of bootloader from 16KB to 20KB

I am trying to modify the bootloader, now it is exceeding the 16KB size, so to increase the size of the bootloader, I modified hwdwf.dat from “FLASH_BOOTLOADER_LOAD_KB 16” to “FLASH_BOOTLOADER_LOAD_KB 20”.

Now bootloader is getting complied sucessfully but when I am trying to build the complete firmware, I am getting following error:

[774/777] Generating bin/arducopter.bin
[775/777] apj_gen build/CubeBlack/bin/arducopter.bin
[776/777] Generating bin/arducopter.hex
Bad blimage size 16680

Please suggest the fix.

Thank you

I suggest you to use ArduCopter 4.0.7 as basis for your changes instead of 3.6.x

Thanks for your instruction. I updated this t4.0.7 but my build failed, I tied 4.0.6 and that worked, but still I saw same error in that version also.

Bad blimage size 16680

regards,
Zafar

You are constrained by the page layout on the supported stm32 chips when sizing your bootloader.

In particular, check FLASH_RESERVE_START_KB in the hwdef.

I also changed FLASH_BOOTLOADER_LOAD_KB to 20 from 16. I could build the bootloader but when I am trying to build the copter firmware, i am getting the same error mentioned above. This is happening because FLASH_RESERVE_START_KB is set to 16 by default for fmuv3. There is no FLASH_RESERVE_START_KB defined in hwdef.dat. Can you please help me proceed further. I have to get this done using Pixhawk1 only.