Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/pzsdr/u-boot-elf-xil-crt0.S.patch

raw
1 Run generated ELFs using a more normal OS-style exec startup/teardown
2 procedure.
3
4 This allows running generated executables to properly support running in
5 U-Boot. Without this, executables will run but never return execution control
6 to U-Boot on completion.
7
8 In addition, this also returns the exit status of the program so u-boot can use
9 it as necessary.
10
11 Note that for this to work properly the entry point must be changed from
12 _vector_table to _start in the linker script or via an argument to ld.
13
14 --- sdk/bsp/ps7_cortexa9_0/libsrc/standalone_v5_1/src/xil-crt0.S
15 +++ sdk/bsp/ps7_cortexa9_0/libsrc/standalone_v5_1/src/xil-crt0.S
16 @@ -77,6 +77,10 @@
17
18 .globl _start
19 _start:
20 + /* Save u-boot state */
21 + stmfd sp!, {fp, lr}
22 + add fp, sp, #4
23 +
24 bl __cpu_init /* Initialize the CPU first (BSP provides this) */
25
26 mov r0, #0
27 @@ -127,6 +131,9 @@
28 /* Let her rip */
29 bl main
30
31 + /* Save the return value for u-boot */
32 + push {r0}
33 +
34 /* Cleanup global constructors */
35 bl __libc_fini_array
36
37 @@ -135,7 +142,11 @@
38 bl _profile_clean
39 #endif /* PROFILING */
40
41 - /* All done */
42 + /* Return control to u-boot */
43 + pop {r0}
44 + sub sp, fp, #4
45 + ldmfd sp!, {fp, pc}
46 +
47 bl exit
48
49 .Lexit: /* should never get here */