summaryrefslogtreecommitdiff
path: root/riscv/riscv-probe/examples/memory/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/riscv-probe/examples/memory/main.c')
-rw-r--r--riscv/riscv-probe/examples/memory/main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/riscv/riscv-probe/examples/memory/main.c b/riscv/riscv-probe/examples/memory/main.c
new file mode 100644
index 0000000..01c5d0b
--- /dev/null
+++ b/riscv/riscv-probe/examples/memory/main.c
@@ -0,0 +1,17 @@
+#include "femto.h"
+#ifdef __riscv
+#include "arch/riscv/encoding.h"
+#include "arch/riscv/machine.h"
+#endif
+
+extern char _memory_start;
+
+int main(int argc, char **argv)
+{
+#ifdef __riscv
+ memory_info_t info = memory_probe();
+ printf("memory_start=0x%lx - 0x%lx\n", info.start, info.end);
+#else
+ puts("architecture-not-supported");
+#endif
+}