/*1* Copyright (c) 2018 naehrwert2*3* This program is free software; you can redistribute it and/or modify it4* under the terms and conditions of the GNU General Public License,5* version 2, as published by the Free Software Foundation.6*7* This program is distributed in the hope it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for10* more details.11*12* You should have received a copy of the GNU General Public License13* along with this program. If not, see <http://www.gnu.org/licenses/>.14*/1516.section .text._start17.arm1819.extern _reloc_ipl20.type _reloc_ipl, %function2122.extern memset23.type memset, %function2425.extern loader_main26.type loader_main, %function2728.globl _start29.type _start, %function30_start:31ADR R0, _start32LDR R1, =__ipl_start33CMP R0, R134BEQ _real_start3536/* If we are not in the right location already, copy a relocator to upper IRAM. */37ADR R2, _reloc_ipl38LDR R3, =0x4003FF0039MOV R4, #(_real_start - _reloc_ipl)40_copy_loop:41LDMIA R2!, {R5}42STMIA R3!, {R5}43SUBS R4, #444BNE _copy_loop4546/* Use the relocator to copy ourselves into the right place. */47LDR R2, =__ipl_end48SUB R2, R2, R149LDR R3, =_real_start50LDR R4, =0x4003FF0051BX R45253_reloc_ipl:54LDMIA R0!, {R4-R7}55STMIA R1!, {R4-R7}56SUBS R2, #0x1057BNE _reloc_ipl58/* Jump to the relocated entry. */59BX R36061_real_start:62/* Initially, we place our stack in IRAM but will move it to SDRAM later. */63LDR SP, =0x4000700064LDR R0, =__ldr_end65BL loader_main66B .67.word 068.word 069.word 070.word 071.word 072.word 0737475