ARMmbed / ble-nrf51822

Nordic stack and drivers for the mbed BLE_API
Other
46 stars 51 forks source link

Fix assembly sequence to start bootloader in GCC #63

Closed andresag01 closed 8 years ago

andresag01 commented 8 years ago

The assemble sequence within an mbedOS application that starts the nordic bootloader was being modified by the compiler. The result is that DFU enabled applications could never start the bootloader correctly. This is because the GCC compiler was translating a MOV instruction into a ADDS, which sets the conditional flags in APSR before a conditional branch was executed. The result of the incorrect branch caused the program to believe that it was in interrupt mode when this was not the case.

@rgrover

rgrover commented 8 years ago

I would like for the two assembly sequences (for ARMCC and GCC) to be identical. It would also be nice to relocate the MOV r0, r6 out of the sequence involved in the check of IPSR; the MOV doesn't belong in that sequence. Can we try with the MOV r0, r6 immediately following the LDR into r6?

andresag01 commented 8 years ago

@rgrover I have made the change mentioned in your comment and tested the DFU process once more using S130 in both ARMCC and GCC.

rgrover commented 8 years ago

hi, could you please resubmit this against the 'develop' branch? otherwise it will mess up our release process if I merge it directly into master.