Skip to content

Commit

Permalink
Merge pull request #293 from VisorFolks/feature/akashkollipara/ibex-s…
Browse files Browse the repository at this point in the history
…im-exit-support

<ibex> Add support for exiting simulation
  • Loading branch information
ishnajain authored Jul 3, 2024
2 parents a07ff55 + 2196645 commit 8202743
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
22 changes: 5 additions & 17 deletions projects/demo_ibex_ss/project.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,22 @@

#include <status.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <terravisor/bootstrap.h>
#include <driver.h>
#include <time.h>
#include <platform.h>

void plug()
{
bootstrap();
driver_setup_all();

printf("Demo Program!\n");
mdelay(1000);
printf("Bye...\n");
exit(EXIT_SUCCESS);
return;
}


void play()
{
static unsigned char i = 0;
char progress[] = "-\\|/";
uint64_t time;
char c = progress[(i++) % strlen(progress)];
get_timestamp(&time);
time /= 1000U;

printf("[%012llu] Running Blinky ... [%c]", time, c);

mdelay(500);

printf("\r");
return;
}
9 changes: 9 additions & 0 deletions src/platform/ibex/simple_system/platform/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#include <terravisor/platform.h>
#include <visor/workers.h>
#include <platform.h>
#include <mmio.h>

static void platform_sim_halt();

void platform_early_setup()
{
Expand Down Expand Up @@ -76,6 +78,7 @@ void platform_setup()
cyancore_insignia();
platform_print_cpu_info();
platform_memory_layout();
atexit(&platform_sim_halt);
return;
}

Expand All @@ -84,3 +87,9 @@ void platform_cpu_setup()
arch_ei();
return;
}

static void platform_sim_halt()
{
uintptr_t sim_ctrl_base = 0x20000;
MMIO32(sim_ctrl_base + 0x8) = 1;
}

0 comments on commit 8202743

Please sign in to comment.