From c6bfaf05464e7dd897f4c0051fa01fa692f0c89c Mon Sep 17 00:00:00 2001 From: Hongyu Liu Date: Fri, 14 Mar 2025 17:53:49 +0100 Subject: [PATCH] adds volatile to array passed to tohost and updates bsp submodule --- bare-metal-bsp | 2 +- hello-world/hello.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bare-metal-bsp b/bare-metal-bsp index 3042e0e..ada4881 160000 --- a/bare-metal-bsp +++ b/bare-metal-bsp @@ -1 +1 @@ -Subproject commit 3042e0e1243ff816fa0bc3a24d71ae4501e1ca17 +Subproject commit ada4881d335e079b1ea655461e03e1e6fd90d63f diff --git a/hello-world/hello.c b/hello-world/hello.c index 29a9145..399a95e 100644 --- a/hello-world/hello.c +++ b/hello-world/hello.c @@ -19,13 +19,15 @@ extern volatile uint32_t tohost; extern volatile uint32_t fromhost; int main() { volatile int result = factorial(10); - char string[] = "hello world with write"; + volatile char string[] = "hello world with write in hello"; + + volatile uint64_t payload[4] = {64, 0, (uintptr_t)string, + (strlen(string) + 1)}; + tohost = (uint32_t)payload; write(STDOUT_FILENO, string, sizeof(string)); - uint64_t payload[4] = {64, 0, (uintptr_t)string, (strlen(string) + 1)}; - // tohost = (uint32_t)payload; printf("Factorial is %d", result); - // printf("End of execution"); + // printf("End of execution"); return 0; }