| .extern UpdaterMain | |
| .global __main | |
| __main: | |
| /* Clear BSS of Updater */ | |
| LDR r3, =__bss_start @ get the start of the BSS section | |
| LDR r4, =__bss_end @ get the end of the BSS section | |
| ClearBSS: | |
| MOV r5, #0 | |
| WriteZeroes: | |
| STR r5, [r3], #4 @ write a zero, then increment 'start address' by 4 | |
| CMP r3, r4 @ compare the 'start' and 'end' addresses | |
| BLT WriteZeroes @ continue writing zeros till we finish clearing the area | |
| LDR R3, =UpdaterMain | |
| BX R3 |