Skip to content

Commit 7f2a1f1

Browse files
author
Dimitar Dimitrov
committed
libgloss: pru: Add support for older PRU cores
Do not use FILL/ZERO instructions in CRT0 and syscalls. These instructions are not supported by older PRU cores in AM18xx SoCs. Avoiding FILL/ZERO does increase the code size a bit, but it has no impact on real projects because: - syscalls.S is used only by firmware built for the GNU Simulator. - Real firmware projects are supposed to use crt0-min.S, which is not impacted. - crt0.S is intended to be full-featured, so that can be used for regression testing GCC using GNU Simulator. An alternative would be to add a special crt0-am18xx.S variant, but that would add unnecessary complexity. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
1 parent a373d2c commit 7f2a1f1

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

libgloss/pru/crt0.S

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,13 @@ ctors_loop:
6060
jmp ctors_loop
6161
ctors_done:
6262

63-
/* Just in case main() tries to access argc, argv[] and envp. */
64-
zero r14, 3 * 4
63+
/* Just in case main() tries to access argc, argv[] and envp.
64+
Do not use "zero" instruction because it is not available on
65+
older cores. Increased code size is not a concern - real
66+
firmware projects should use crt0-minrt anyway. */
67+
ldi r14, 0
68+
ldi r15, 0
69+
ldi r16, 0
6570

6671
.weak __c_args__
6772
ldi32 r5, __c_args__

libgloss/pru/syscalls.S

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ __SC_ret:
4545
ldi32 r1, _impure_ptr
4646
lbbo r1, r1, 0, 4
4747
sbbo r14, r1, 0, 4
48-
/* Return -1 (for both int32_t or int64_t). */
49-
fill r14, 8
48+
/* Return -1 (for both int32_t or int64_t).
49+
Do not use "fill" instruction because it is not available on
50+
older cores. Increased code size is not a concern - syscalls
51+
are used only by the simulator. */
52+
ldi32 r14, -1
53+
ldi32 r15, -1
5054

5155
__SC_ret_skip_errno_set:
5256
ret

0 commit comments

Comments
 (0)