[committed] libgloss: pru: Add support for older PRU cores
Commit Message
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.
Pushed as 7f2a1f19b7badc63af121866c46d155591015407.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
libgloss/pru/crt0.S | 9 +++++++--
libgloss/pru/syscalls.S | 8 ++++++--
2 files changed, 13 insertions(+), 4 deletions(-)
@@ -60,8 +60,13 @@ ctors_loop:
jmp ctors_loop
ctors_done:
- /* Just in case main() tries to access argc, argv[] and envp. */
- zero r14, 3 * 4
+ /* Just in case main() tries to access argc, argv[] and envp.
+ Do not use "zero" instruction because it is not available on
+ older cores. Increased code size is not a concern - real
+ firmware projects should use crt0-minrt anyway. */
+ ldi r14, 0
+ ldi r15, 0
+ ldi r16, 0
.weak __c_args__
ldi32 r5, __c_args__
@@ -45,8 +45,12 @@ __SC_ret:
ldi32 r1, _impure_ptr
lbbo r1, r1, 0, 4
sbbo r14, r1, 0, 4
- /* Return -1 (for both int32_t or int64_t). */
- fill r14, 8
+ /* Return -1 (for both int32_t or int64_t).
+ Do not use "fill" instruction because it is not available on
+ older cores. Increased code size is not a concern - syscalls
+ are used only by the simulator. */
+ ldi32 r14, -1
+ ldi32 r15, -1
__SC_ret_skip_errno_set:
ret