Skip to content

Commit

Permalink
add sp setting before offloadToCluster
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoling-yi committed Nov 28, 2024
1 parent bbad744 commit 41af047
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sw/tests/kulClusterOffload.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include <regs/soc_ctrl.h>
#include <stdint.h>

// add snitch runtime for getting TCDM address
#include "snrt_TO.h"

static uint32_t *clintPointer = (uint32_t *)CLINT_CTRL_BASE;

void clusterTrapHandler() {
Expand All @@ -28,13 +31,16 @@ int main() {

setupInterruptHandler(clusterTrapHandler);

// set the stack pointer?
// set the stack pointer
// set it to the end of the KUL cluster TCDM (size = 128KB) address - 4
uint32_t stack_start = snrt_cluster_base_addrl() + 128 * 1024 - 4;
asm("mv sp, %0" ::"r"((uint32_t)stack_start)::);

// offload test function to kul cluster
offloadToCluster(kul_cluster_sw_test, kul_clusterId);

// wait fro kul cluster to finish
uint32_t retVal = waitForCluster(kul_clusterId);

return retVal;
return retVal != 1;
}

0 comments on commit 41af047

Please sign in to comment.