How to autonomously download programs to the two STM32 chips in Pixhawk?

As we all know, there are two stm32 chips in Pixhawk, f4 and F1. However, downloading PX4 firmware with QGC can not completely distinguish the programs in fmu(f4) and io(f1) chips. I hope to be able to compile the PX4 firmware and get the hex files (including bootloader) downloaded from the firmware to fmu and io, so that it is convenient for the development of Pixhawk hardware peripheral circuits. I would like to ask if my brother has done similar work before, can you guide me? Contact email: pskyy616@gmail.com