Closed TommyMurphyTM1234 closed 6 years ago
No, you're not doing anything wrong. The toolchain is broken on 32-bit and has been for some time. I think @shrshore got qemu to build but it's still crashing in BBL ( riscv/riscv-pk#43 )
Thanks - but would it be possible to be more specific (e.g. link to relevant issues/posts?) about the 32 bit toolchain being "broken"? Do you mean 32 bit hosted tools or 32 but RISC-V target support? As far as I can see I can get a 32 bit hosted RV32IM toolchain built and working but I can't build qemu on a 32 bit host. In case it matters I'm only interested in the bare metal and not the linux toolchain support a the moment.
What I mean is that the Foundation and SiFive people all have 64-bit machines and 32-bit support is poorly tested, I've seen several error reports, and very few success reports.
I was able to build the toolchain in a 32-bit container just now but it made a toolchain for riscv64-, not riscv32-. Looks like --with-arch and --with-abi are needed, I'll make a PR to document that, then I'll see about fixing this. There will be more problems later.
With #46 riscv64-softmmu works on a 32-bit Debian chroot using a riscv64 Linux kernel + initramfs built from freedom-u-sdk (be sure to use the version of freedom-u-sdk mentioned in README.md after checking out the PR).
The tests were done on 64-bit Intel hardware + a 32-bit OS, so it's still theoretically possible you could have compatibility problems with 32-bit hardware. Let me know how it goes.
riscv32 support is a separate problem, but this should be enough to get you running.
@sorear Sorry for delayed reply. But I have tried on 32bit ubuntu, just to fail allocating memory. I build a riscv64 Linux Kernel and initramfs according to freedom-u-sdk(git reset --hard 5d28ed), and build qemu with #46 riscv64-softmmu. However, when it comes to
./riscv64-softmmu/qemu-system-riscv64 -kernel freedom-u-sdk/work/riscv-pk/bbl -nographic -machine sifive
It will remind that
qemu-system-riscv32: cannot set up guest memory 'riscv_sifive_board.ram': Cannot allocate memory
Even if I try this patch 8d870e9, the error still exists. Could you offer any help?
Thanks for your effort!
@shrshore Get rid of -machine sifive
for now.
Wow!!! I have boot the kernel now! Thanks so much! And could you commit your fix of sifive_board so other people can also apply?
By the way, do you know how to login in the system? T.T According to http://wiki.in-circuit.de/index.php5?title=Buildroot_login the username should be "root"/"default" and passwd should be empty. But it always reminds "login incorrect". Maybe it's due to ssh connection. But I have no idea how to login in successfully.
Welcome to Buildroot
buildroot login: root
Password:
Login incorrect
buildroot login: default
Password:
Login incorrect
buildroot login:
Login timed out after 60 seconds
@shrshore root / sifive
@sorear Okay, thanks so much. It seems all right now. Still looking forward to RV32 support if possible.
Best Regards!
FWIW (in case the build instructions can/should be updated) this worked for me:
First step was a clean install of Ubuntu 14.04.5 LTS 64 bit and then all available updates installed. Then...
sudo apt-get install git
git clone https://github.com/riscv/riscv-qemu
cd riscv-qemu
git submodule update --init pixman
sudo apt-get install g++
sudo apt-get install zlib1g-dev
sudo apt-get install libglib2.0-dev
sudo apt-get install autoconf
sudo apt-get install libtool
./configure --target-list=riscv64-softmmu,riscv32-softmmu --prefix=`pwd`/riscv-qemu-install
make install
Hope this helps.
Boot tested qemu-system-riscv64
on ubuntu 14.04.5-i386: https://github.com/riscv/riscv-qemu/commit/6273610d5a23d0799a89fa826a97baa23b8781d2
I can't really see how the fix relates to the original issue report? In any case 32 bit linux builds have been working fine for a long time now at least using Liviu's GNU MCU Eclipse scripted docker approach.
It relates pretty much exactly in that it fixes 32-bit builds on ubuntu 14.04.5-i386
Without https://github.com/riscv/riscv-qemu/commit/6273610d5a23d0799a89fa826a97baa23b8781d2 this is what happens when building on ubuntu 14.04.5-i386
/home/mclark/src/riscv-qemu/target-riscv/op_helper.c: In function ‘csr_read_helper’:
/home/mclark/src/riscv-qemu/target-riscv/op_helper.c:531:9: error: left shift count >= width of type [-Werror]
return (1L << (TARGET_LONG_BITS - 5));
^
cc1: all warnings being treated as errors
make[1]: *** [target-riscv/op_helper.o] Error 1
make: *** [subdir-riscv64-softmmu] Error 2
i.e. we had to fix builds on ubuntu 14.04.5-i386 so we could close out the bug
The reason for the build failure on 32-bit linux is because long is 32-bits. It needs to be long long (1LL) so that qemu-system-riscv64 will build on 32-bit linux. Essentially the bug report is about a build failure on 32-bit linux which is exactly what the patch fixes (perhaps a different build failure to the one happening at the time of the report).
In any case builds no longer fail on Ubuntu 14.04.5 32 bit i.e. the bug title
Should it build on 32 bit? When I try on Ubuntu 14.04.5 LTS 32 bit the build fails. I do this:
and get this:
Am I doing something wrong? Thanks.