Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong address space #3390

Open
3 tasks done
mlabaf2 opened this issue Aug 16, 2024 · 4 comments
Open
3 tasks done

wrong address space #3390

mlabaf2 opened this issue Aug 16, 2024 · 4 comments
Labels
problem Problem requiring help

Comments

@mlabaf2
Copy link

mlabaf2 commented Aug 16, 2024

Before start

  • I have read the XiangShan Documents. 我已经阅读过香山文档。
  • I have searched the previous issues and did not find anything relevant. 我已经搜索过之前的 issue,并没有找到相关的。
  • I have searched the previous discussions and did not find anything relevant. 我已经搜索过之前的 discussions,并没有找到相关的。

Describe you problem

Hi
I used below instruction to convert .S file to . O
"• riscv64-linux-gnu-gcc -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -Iriscv-tests/env/p/ -Iriscv-tests/isa/macros/scalar - capstone-ariane/verif/tests/custom/capstone/capcreate.S -o capcreate.o -Wl,--build-id=none"

but after producing .txt file I see wrong address!.
the code must start from 80000000 but start from 100c0!

image

I want to make emu the file on modified XianfShan.

What did you do before

I want to make emu the file on modified XianfShan.

Environment

  • XiangShan branch:
  • XiangShan commit id:
  • NEMU commit id:
  • SPIKE commit id:
  • Operating System:
  • gcc version:
  • mill version:
  • java version:

Additional context

No response

@mlabaf2 mlabaf2 added the problem Problem requiring help label Aug 16, 2024
@cebarobot
Copy link
Member

You have to provide an linker script file to linker/compiler, which will tell the linker where to put those sections.

You could refer to OpenXiangShan/nexus-am for details of building baremental applications. There is an linker script example:

@mlabaf2
Copy link
Author

mlabaf2 commented Aug 16, 2024

thanks for your help
when I "make ARCH=riscv64-xs" I received below error:
"make: *** No rule to make target '/Makefile.app'. Stop"
what does "make ARCH=riscv64-xs" exactly do?

also, what does this sentence means:
"use the ".bin" file as the memory image for RTL simulation"
I create a .bin file from .S assemble of my code. I want to check my .bin file, not the output .bin file of "make ARCH=riscv64-xs" ...

@cebarobot
Copy link
Member

make ARCH=riscv64-xs calls make (an GNU build tool) to build the software according to the Makefile file. You may search "Makefile" on the Internet, and read the Makefile file in the repo for more details.

.bin file refer to "flat binary files", which means it is just instructions and data without any metadata or file header. This kind of file could just put into memory without any modification. Compiler like gcc usually generate ELF files rather than flat binary files. This article explains the difference of ELF files and binary files. You may use objcopy to generate binary file from elf file.

@Tang-Haojin
Copy link
Member

You may also specify AM_HOME before you make in nexus_am.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Problem requiring help
Projects
None yet
Development

No branches or pull requests

3 participants