[gem5-users] Re: AttributeError when using my own binary

2023-05-22 Thread Giacomo Travaglini via gem5-users
Thanks Ziyao,

Gem5 does not support macOS syscall emulation (nor it supports Mac-O loading).. 
You can still run a gem5 simulation on macOS but you should compile the binary 
for a linux target (I don’t know If it possible to cross-compile on the M1 to 
aarch64-linux, but you can definitely (cross)compile it on a different Linux 
machine)

Hope it helps

Giacomo

From: Ziyao Yan via gem5-users 
Date: Sunday, 21 May 2023 at 15:52
To: The gem5 Users mailing list 
Cc: Ziyao Yan 
Subject: [gem5-users] Re: AttributeError when using my own binary
Hi Giacomo,

Oh I'm sorry for that confusion. The FS_ruby.py is my modified script which I 
forgot to change the name, it's actually a SE workload and works fine with the 
Gem5 provided hello binary (gem5/tests/test-progs/hello/bin/arm/linux/hello). 
Here is the code snippet of that script

binary = os.path.join('gem5/assembly/test')

# Create a process for a simple "multi-threaded" application
process = Process()
# Set the command
# cmd is a list which begins with the executable (like argv)
process.cmd = [binary]
# Set the cpu to use the process as its workload and create thread contexts
for cpu in system.cpu:
cpu.workload = process
cpu.createThreads()

system.workload = SEWorkload.init_compatible(binary)


The gem5/assembly/test executes successfully on my local environment, and I'm 
using M1 arm64 cpu

Thanks,
Ziyao

On Sun, May 21, 2023 at 10:39 PM Giacomo Travaglini via gem5-users 
mailto:gem5-users@gem5.org>> wrote:
Hi,

If the command line is just

$ build/ARM_MESI/gem5.opt configs/FS_ruby.py,

Are you sure you are passing the object file to the Workload object? 
(_is_compatible_with is called with a None object)
Also the script is called FS ruby but you seem to have instantiated a SE 
workload (ArmSeWorkload).

There’s something wrong in the custom script…

Kind Regards

Giacomo

From: Ziyao Yan via gem5-users mailto:gem5-users@gem5.org>>
Date: Sunday, 21 May 2023 at 09:30
To: gem5-users@gem5.org<mailto:gem5-users@gem5.org> 
mailto:gem5-users@gem5.org>>
Cc: Ziyao Yan mailto:ziyao...@umich.edu>>
Subject: [gem5-users] AttributeError when using my own binary
Hi all,

I'm currently working on ISA-level tasks and have generated my own binary using 
an assembler and linker. The binary executes successfully on my local 
environment (M1 ARM). However, when I attempt to run it on gem5, it fails to be 
recognized.

I used the following commands to assemble and link a simple "Hello World" 
assembly code (test.s):

$ as -arch arm64 -o test.o test.s
$ ld test.o -o test -l System -syslibroot `xcrun -sdk macosx --show-sdk-path` 
-e _start -arch arm64
$ ./test
Hello World!

While this works well on my local environment, I encounter an error when 
executing it in gem5 using the command:

$ build/ARM_MESI/gem5.opt configs/FS_ruby.py
The error message I receive is as follows:

AttributeError: 'NoneType' object has no attribute 'get_arch'
At:
  build/ARM_MESI/arch/arm/ArmSeWorkload.py(43): _is_compatible_with
  build/ARM_MESI/sim/Workload.py(91): 
  build/ARM_MESI/sim/Workload.py(91): find_compatible
  build/ARM_MESI/sim/Workload.py(100): init_compatible
  configs/FS_ruby.py(109): 
  build/ARM_MESI/python/m5/main.py(434): main

I would greatly appreciate it if anyone who has encountered a similar issue 
could provide some insights or guidance.

Thank you,
Ziyao

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
gem5-users mailing list -- gem5-users@gem5.org<mailto:gem5-users@gem5.org>
To unsubscribe send an email to 
gem5-users-le...@gem5.org<mailto:gem5-users-le...@gem5.org>
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] Re: AttributeError when using my own binary

2023-05-21 Thread Ziyao Yan via gem5-users
Hi Giacomo,

Oh I'm sorry for that confusion. The FS_ruby.py is my modified script which
I forgot to change the name, it's actually a SE workload and works fine
with the Gem5 provided hello binary
(gem5/tests/test-progs/hello/bin/arm/linux/hello). Here is the code snippet
of that script

binary = os.path.join('gem5/assembly/test')


# Create a process for a simple "multi-threaded" application
process = Process()
# Set the command
# cmd is a list which begins with the executable (like argv)
process.cmd = [binary]
# Set the cpu to use the process as its workload and create thread contexts
for cpu in system.cpu:
cpu.workload = process
cpu.createThreads()

system.workload = SEWorkload.init_compatible(binary)


The gem5/assembly/test executes successfully on my local environment, and
I'm using M1 arm64 cpu

Thanks,
Ziyao

On Sun, May 21, 2023 at 10:39 PM Giacomo Travaglini via gem5-users <
gem5-users@gem5.org> wrote:

> Hi,
>
>
>
> If the command line is just
>
>
>
> $ build/ARM_MESI/gem5.opt configs/FS_ruby.py,
>
>
>
> Are you sure you are passing the object file to the Workload object?
> (_is_compatible_with is called with a None object)
>
> Also the script is called FS ruby but you seem to have instantiated a SE
> workload (ArmSeWorkload).
>
>
>
> There’s something wrong in the custom script…
>
>
>
> Kind Regards
>
>
>
> Giacomo
>
>
>
> *From: *Ziyao Yan via gem5-users 
> *Date: *Sunday, 21 May 2023 at 09:30
> *To: *gem5-users@gem5.org 
> *Cc: *Ziyao Yan 
> *Subject: *[gem5-users] AttributeError when using my own binary
>
> Hi all,
>
> I'm currently working on ISA-level tasks and have generated my own binary
> using an assembler and linker. The binary executes successfully on my local
> environment (M1 ARM). However, when I attempt to run it on gem5, it fails
> to be recognized.
>
> I used the following commands to assemble and link a simple "Hello World"
> assembly code (test.s):
>
> $ as -arch arm64 -o test.o test.s
> $ ld test.o -o test -l System -syslibroot `xcrun -sdk macosx
> --show-sdk-path` -e _start -arch arm64
> $ ./test
> Hello World!
>
>
> While this works well on my local environment, I encounter an error when
> executing it in gem5 using the command:
>
> $ build/ARM_MESI/gem5.opt configs/FS_ruby.py
> The error message I receive is as follows:
>
>
> AttributeError: 'NoneType' object has no attribute 'get_arch'
> At:
>   build/ARM_MESI/arch/arm/ArmSeWorkload.py(43): _is_compatible_with
>   build/ARM_MESI/sim/Workload.py(91): 
>   build/ARM_MESI/sim/Workload.py(91): find_compatible
>   build/ARM_MESI/sim/Workload.py(100): init_compatible
>   configs/FS_ruby.py(109): 
>   build/ARM_MESI/python/m5/main.py(434): main
>
>
> I would greatly appreciate it if anyone who has encountered a similar
> issue could provide some insights or guidance.
>
> Thank you,
> Ziyao
>
>
> IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium. Thank you.
> ___
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
>
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] Re: AttributeError when using my own binary

2023-05-21 Thread Giacomo Travaglini via gem5-users
Hi,

If the command line is just

$ build/ARM_MESI/gem5.opt configs/FS_ruby.py,

Are you sure you are passing the object file to the Workload object? 
(_is_compatible_with is called with a None object)
Also the script is called FS ruby but you seem to have instantiated a SE 
workload (ArmSeWorkload).

There’s something wrong in the custom script…

Kind Regards

Giacomo

From: Ziyao Yan via gem5-users 
Date: Sunday, 21 May 2023 at 09:30
To: gem5-users@gem5.org 
Cc: Ziyao Yan 
Subject: [gem5-users] AttributeError when using my own binary
Hi all,

I'm currently working on ISA-level tasks and have generated my own binary using 
an assembler and linker. The binary executes successfully on my local 
environment (M1 ARM). However, when I attempt to run it on gem5, it fails to be 
recognized.

I used the following commands to assemble and link a simple "Hello World" 
assembly code (test.s):

$ as -arch arm64 -o test.o test.s
$ ld test.o -o test -l System -syslibroot `xcrun -sdk macosx --show-sdk-path` 
-e _start -arch arm64
$ ./test
Hello World!

While this works well on my local environment, I encounter an error when 
executing it in gem5 using the command:

$ build/ARM_MESI/gem5.opt configs/FS_ruby.py
The error message I receive is as follows:

AttributeError: 'NoneType' object has no attribute 'get_arch'
At:
  build/ARM_MESI/arch/arm/ArmSeWorkload.py(43): _is_compatible_with
  build/ARM_MESI/sim/Workload.py(91): 
  build/ARM_MESI/sim/Workload.py(91): find_compatible
  build/ARM_MESI/sim/Workload.py(100): init_compatible
  configs/FS_ruby.py(109): 
  build/ARM_MESI/python/m5/main.py(434): main

I would greatly appreciate it if anyone who has encountered a similar issue 
could provide some insights or guidance.

Thank you,
Ziyao

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org