gem5-users@gem5.org

The gem5 Users mailing list

View all threads

About simulating simple C program in gem5 FS mode

EV
elio.vinciguerra@phd.unict.it
Thu, Feb 1, 2024 3:15 PM

Hi all, I am looking for a way to emulate with gem5 in FS (Full System) mode simple C executables, compiled in RISC-V, even containing a single infinite while loop. Could someone please point me to how to do this?

Hi all, I am looking for a way to emulate with gem5 in FS (Full System) mode simple C executables, compiled in RISC-V, even containing a single infinite while loop. Could someone please point me to how to do this?
S
sun2k23
Fri, Feb 2, 2024 1:43 AM

Hi,

Generally, firstly you need to boot the linux on RISCV model successfully. And then you need to develop your own c application program and compile it with cross-compiler statically, then you copy the test executable to the mounted disk(The riscv OS disk, let's assume you put it on /tmp/test). Then after you re-boot the OS on RISCV, you can find the file test under /tmp/ folder.
Then just execute it by /tmp/test.

That's the general flow we can use.

Leizu

At 2024-02-01 23:15:26, "elio.vinciguerra--- via gem5-users" gem5-users@gem5.org wrote:

Hi all, I am looking for a way to emulate with gem5 in FS (Full System) mode simple C executables, compiled in RISC-V, even containing a single infinite while loop. Could someone please point me to how to do this?

Hi, Generally, firstly you need to boot the linux on RISCV model successfully. And then you need to develop your own c application program and compile it with cross-compiler statically, then you copy the test executable to the mounted disk(The riscv OS disk, let's assume you put it on /tmp/test). Then after you re-boot the OS on RISCV, you can find the file test under /tmp/ folder. Then just execute it by /tmp/test. That's the general flow we can use. Leizu At 2024-02-01 23:15:26, "elio.vinciguerra--- via gem5-users" <gem5-users@gem5.org> wrote: Hi all, I am looking for a way to emulate with gem5 in FS (Full System) mode simple C executables, compiled in RISC-V, even containing a single infinite while loop. Could someone please point me to how to do this?
EV
elio.vinciguerra@phd.unict.it
Fri, Feb 2, 2024 7:21 AM

Is it possible to simulate with only the C program, without linux underneath?

I recently saw that you should use the bare-metal option, but I don't really understand how to use it.

Elio

Is it possible to simulate with only the C program, without linux underneath? I recently saw that you should use the bare-metal option, but I don't really understand how to use it. Elio
S
sun2k23
Sun, Feb 4, 2024 1:08 AM

Then you can use SE mode to run every standalone executables without OS in FS mode.

S2K23

At 2024-02-02 15:21:03, "elio.vinciguerra--- via gem5-users" gem5-users@gem5.org wrote:

Is it possible to simulate with only the C program, without linux underneath?

I recently saw that you should use the bare-metal option, but I don't really understand how to use it.

Elio

Then you can use SE mode to run every standalone executables without OS in FS mode. S2K23 At 2024-02-02 15:21:03, "elio.vinciguerra--- via gem5-users" <gem5-users@gem5.org> wrote: Is it possible to simulate with only the C program, without linux underneath? I recently saw that you should use the bare-metal option, but I don't really understand how to use it. Elio