summaryrefslogtreecommitdiff
path: root/ports/risc-v64/gnu/example_build/erbium/entry.S
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-10-02 10:42:44 -0400
committerGitHub <[email protected]>2026-10-02 10:42:44 -0400
commit93387b0a60382a29579bbad5045c68328e3751df (patch)
tree42be790d602cb76f55090e5a7c418df7ea2b3428 /ports/risc-v64/gnu/example_build/erbium/entry.S
parent44d7c95c582d415c4ad84527180b29c93c3bf664 (diff)
parent28281cd5647d4671236ca08d19bd18ed15b2265a (diff)
Merge pull request #783 from eclipse-threadx/devv6.5.2.202603_rel
Merged changes ahead of the v6.5.2.202603 release
Diffstat (limited to 'ports/risc-v64/gnu/example_build/erbium/entry.S')
-rw-r--r--ports/risc-v64/gnu/example_build/erbium/entry.S50
1 files changed, 50 insertions, 0 deletions
diff --git a/ports/risc-v64/gnu/example_build/erbium/entry.S b/ports/risc-v64/gnu/example_build/erbium/entry.S
new file mode 100644
index 00000000..201f986e
--- /dev/null
+++ b/ports/risc-v64/gnu/example_build/erbium/entry.S
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (c) 2026 Eclipse ThreadX contributors
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the MIT License which is available at
+ * https://opensource.org/licenses/MIT.
+ *
+ * AI Disclosure: This file was largely AI-generated by Claude Code (Opus 5.5).
+ * The AI-generated portions may be considered public domain (CC0-1.0)
+ * and not subject to the project's licence. The human contributor has
+ * reviewed and verified that the code is correct.
+ *
+ * SPDX-License-Identifier: MIT and CC0-1.0
+ **************************************************************************/
+
+/* Reset entry for the Erbium example. Hart 0 sets up the global pointer,
+ the system stack and .bss, then calls main(). Any other hart is parked. */
+
+ .section .text.entry, "ax", @progbits
+ .align 2
+ .global _start
+ .extern main
+ .extern _sysstack_end
+ .extern _bss_start
+ .extern _bss_end
+_start:
+ csrr t0, mhartid
+ bnez t0, _park
+
+.option push
+.option norelax
+ la gp, __global_pointer$ // norelax keeps this load absolute
+.option pop
+
+ la sp, _sysstack_end
+
+ la t0, _bss_start // .bss is 16-byte aligned in link.lds
+ la t1, _bss_end
+_bss_clear:
+ bgeu t0, t1, _bss_done
+ sd zero, 0(t0)
+ addi t0, t0, 8
+ j _bss_clear
+_bss_done:
+
+ call main
+
+ /* The example never executes WFI; a parked hart spins. */
+_park:
+ j _park