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

For manual startup, place memtest_shared.bin anywhere into your board RAM. Set registers as follows: #2

Open
AchyuthAGNA5675 opened this issue Nov 8, 2022 · 2 comments

Comments

@AchyuthAGNA5675
Copy link

Hi sir,
For this above issue, can you please provide me the steps to load memtest_shared.bin into board RAM & also procedures to set registers and run memtest86 , i have a RISCV board from si-five. I need to observe and valuate individual CPU cores ie; Hart[0] to Hart [3], can you please help me? am a complete newbiee to this.

@atrosinenko
Copy link
Owner

atrosinenko commented Nov 13, 2022

Hi @AchyuthAGNA5675,

First of all, I would strongly suggest experimenting a lot on a full-system emulator such as QEMU before trying to run it on real hardware. I never tested my port on a RISC-V board, just on emulator and FPGA-based soft-processor, so I cannot say if it is safe enough taking into account, say, one-time-programmable fuses or maybe some hard-to-restore firmware of the real board.

Unfortunately, I wrote this readme long ago and I cannot remember all of the details. I guess memtest_shared was an ELF image that can be used by GDB for functions, debug info, etc. and each of memtest_shared.bin and memtest.uboot is probably a self-contained executable. Please note that U-Boot bootloader has its own format for bundling kernel, initrd and other blobs together, each with its own load address written to bundle's header. memtest_shared.bin, on the other hand, is simply raw memory contents (thus, loader has to be instructed where to load it via command line).

You can use something like fatload command of U-Boot shell (or similar command for your filesystem) to load a file into memory at a specified address. I cannot remember right now which command to use to actually transfer control to that binary - maybe it is named go or some of boot* commands, then $a0 and $a1 are "arguments" in order.

Please note that U-Boot has its own shell and this shell can execute shell scripts. The shell is not /bin/sh compatible, so it is worth reading the docs on its syntax and a lot of builtin commands are available to inspect that are quite frequently implemented as a script strings composed of simpler commands.

The nice thing with raw image (*.bin) is that GDB has a command to copy a file from host file system into target's memory and registers can be set just as set $a0 = 0x1234. In case of real hardware you can usually debug anything, even the bootloader, over JTAG (say, in my case I instantiated a JTAG on spare pins in the RocketChip design and after a bit of googling found a manual on using RaspberryPi running an OpenOCD as a JTAG adapter). In case of QEMU you should probably just enable gdbserver on QEMU command line and connect to it instead of OpenOCD.

@atrosinenko
Copy link
Owner

These days, I have written a series of articles on step-by-step porting a soft-processor to a cheap Zeowaa board bought on AliExpress and then adjusting bootloaders and Linux kernel for that soft-processor. This part covers specifically MemTest86+: https://habr.com/ru/post/484026/ - these are in Russian but hope Google Translate helps.

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

No branches or pull requests

2 participants