Help!app software cannot startup

I change the number from 0 to 1 ,then i build and upload the software by usb.
Then after rebooting, the led (B/E)of stm32f4 flicker only about 5 seconds then turn off .the led(B/E) of stm32f1 only turn on about 1 seconds at the power start then turn off.
And then i change the number back from 1 to 0. then build and upload the software the console tells can not find the usb device (i think the software dead in the (for( ; ; ))) but i think the boot should be ok ,so i restart the pix hawk by unplug de usb line which connect between the pc and pixhawd.Then the led(B/E) flicker and the console erase program very successful. But after restart the pixhawk it still like before.
Why?
1.The software stil have problem ?
No. I use other’s project and other’s computer upload is still no ok;
2.The erase did not erase the app of STM32F4?
No,I unplug the usb line after erased ok when uploading the software.Then the led(B/E) of STM32F4 always ficker ,but the led of STM32F1 always turn off. SO i think the erase is useful.
3.The boot loader of STM32F1 is beed destory?
Do i need download the boot loader and use jlink to erase all chip and download the hex or bin of the boot loader into the STM32F1 ?

Counld you help me ?

Also after erase but not program the chip by usb.When i re give the power of pixhak the led(B/E) of STM32F1 flicker only about 4/5 times in the first seconds then turn off.And the led (ACT) turn on then immediately turn off.

When i read this software i gus may be the reason is than the code make the uart of stm32f1 always send the data 0xfa and 0xa0 .so the connection of stm32f1 and stm32f4 will always lost.So the software upload can not make the stm32f1 erase or upload ?
It means
1.powe on
2. Stm32f4 led flicker and check the address of app is 0xffffffff so the led is flicker.
3.stm32f1 check ok so it run into app ,but the function dead in while(1)
so i must erase the chip of stm32f1 ,right?
And i have a question ? how the code update of stm32f1?
That means usb connection with stm32f4,so the pc send the code to stm32f4 .and display the status :erase program and verify. so it that put the code into flash of stm32f4 and then the stm32f4 send the code to stm32f1 by uart? and the process is finished by the start of power on?

The px4io firmware is within the main firmware binary. At startup it flashes the px4io if needed (checks a crc first). https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/rcS#L326

Thanks first;
I had resolved this problem yesterday.After view the project of px4 .i guess the process of the firmware update is like this:
1 bootloader of stm32f4 checked the data in USB and then copy the code(bin) into the flash
2after reboot it means maybe the stm32f4 send one command about reboot to stm32f1 by uart or just re give the power of px4
3bootloader of stm32f1 wait the data by usart from stm32f4,this moment the stm32f4 is in the app ,the stm32f1 in the boot ,f4 send the code(bin) to f1.then the update firmware finished.

My problem is that I make the uart of stm32f1 dead .So the normal process f4 can not connect with f1,so it can not update the new code in the normal state.
But if I make the f4 is run .then just press the restart button of f1 some times wait the f1 in boot and monitor the uart2 .it’s ok.the program be well download into f1.