-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright 2020 ETH Zurich and University of Bologna. | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "../shared/start_snitch.S" | ||
|
||
#include <spatz_cluster_peripheral.h> | ||
|
||
//.global BOOTDATA | ||
|
||
# Function to terminate execution. | ||
# | ||
# Expecting: | ||
# - a0: exit code | ||
# - a1: device tree ptr | ||
_snrt_exit: | ||
.globl _snrt_exit | ||
# Determine global core index. | ||
addi sp, sp, -8 | ||
sw a0, 0(sp) | ||
sw ra, 4(sp) | ||
call snrt_global_core_idx | ||
# reload exit code into t0 | ||
lw t0, 0(sp) | ||
lw ra, 4(sp) | ||
addi sp, sp, 8 | ||
|
||
# Only first core triggers exit. | ||
# - a0: global core index | ||
# - t0: exit code | ||
bnez a0, 1f | ||
slli t0, t0, 1 | ||
ori t0, t0, 1 | ||
|
||
# Load the start address and size of the TCDM | ||
li t1, @MEM_TCDM_ORIGIN@ | ||
li t2, @MEM_TCDM_SIZE@ | ||
|
||
# Final address of the TCDM | ||
add t1, t1, t2 | ||
|
||
# Address of the EOC register | ||
addi t1, t1, SPATZ_CLUSTER_PERIPHERAL_CLUSTER_EOC_EXIT_REG_OFFSET | ||
|
||
# Return to EOC register | ||
sw t0, 0(t1) | ||
|
||
# Return to HTIF | ||
la t1, tohost | ||
sw t0, 0(t1) | ||
1: ret | ||
|
||
# HTIF sections | ||
.pushsection .htif,"aw",@progbits; | ||
.align 6; .global tohost; tohost: .dword 0; | ||
.align 6; .global fromhost; fromhost: .dword 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters