Dhole / CopperBoy

CopperBoy is a portable fully working Arduboy emulator written in Rust.
GNU General Public License v3.0
16 stars 0 forks source link

Tips to compile for armv7l linux #3

Closed arthurlutz closed 3 years ago

arthurlutz commented 3 years ago

Hi,

Project looks awesome, congrats!

Am trying to compile it for armv7l (more specifically the gameshell by clockworkpi https://www.clockworkpi.com/ with a debian bullseye/sid installed)

cpi@clockworkpi :~/CopperBoy/sdl$ cargo --version
cargo 1.46.0
cpi@clockworkpi :~/CopperBoy/sdl$ rustc --version
rustc 1.48.0
cpi@clockworkpi :~/CopperBoy/sdl$ uname -a
Linux clockworkpi  5.7.0-clockworkpi-cpi3-g5c715d2cd-dirty #1 SMP Sun Jul 12 20:21:02 CEST 2020 armv7l GNU/Linux
cpi@clockworkpi :~/CopperBoy/sdl$ cargo build --release --target armv7-unknown-linux-gnueabi --bin sdl
   Compiling stable_deref_trait v1.2.0
   Compiling byteorder v1.4.2
   Compiling once_cell v1.5.2
   Compiling cfg-if v1.0.0
error[E0463]: can't find crate for `core`
  |
  = note: the `armv7-unknown-linux-gnueabi` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `core`
  |
  = note: the `armv7-unknown-linux-gnueabi` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `stable_deref_trait`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `core`
  |
  = note: the `armv7-unknown-linux-gnueabi` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
  |
  = note: the `armv7-unknown-linux-gnueabi` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: build failed

Am a bit new to this cargo/rustc stuff and so I'm not even sure that the target is correct.

cpi@clockworkpi :~/CopperBoy/sdl$ rustc --print target-list | grep arm
arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armebv7r-none-eabi
armebv7r-none-eabihf
armv4t-unknown-linux-gnueabi
armv5te-unknown-linux-gnueabi
armv5te-unknown-linux-musleabi
armv6-unknown-freebsd
armv6-unknown-netbsd-eabihf
armv7-apple-ios
armv7-linux-androideabi
armv7-unknown-cloudabi-eabihf
armv7-unknown-freebsd
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
armv7-unknown-netbsd-eabihf
armv7-wrs-vxworks-eabihf
armv7a-none-eabi
armv7a-none-eabihf
armv7r-none-eabi
armv7r-none-eabihf
armv7s-apple-ios

If you have any tips, they would be welcome.

arthurlutz commented 3 years ago

While trying to figure this out, I tried to install rustup and it stated that the arch was armv7-unknown-linux-gnueabihf. Building on that hardware worked. Will come back and comment when I get something working.

arthurlutz commented 3 years ago

Got it compiling and "running" - it's weirdly laggy and probably needs a keymap but here is a first glimpse :

Video on imgur : https://imgur.com/AfWfeLT

Dhole commented 3 years ago

Got it compiling and "running" - it's weirdly laggy and probably needs a keymap but here is a first glimpse :

Video on imgur : https://imgur.com/AfWfeLT

I'm glad to hear that you got it running! And thanks for sharing the video :)

Regarding the performance:

  1. I've managed to build Copperboy for the PSVita via the libretro implementation, and I managed to get around 80% speed in some games. The PSVita is an 32bit ARM at 333/444MHz. Considering that the clockworkPi is using the Raspberry Pi Compute Module 3 which has a 64bit ARM core at 1.2GHz, I believe there is potential for Copperboy to run at fullspeed without trouble.
  2. The sdl frontend currently has some code useful for debugging that may be affecting performance. On the other hand, the libretro implementation has no such code and may perform much better.

Regarding the libretro build, if you take a look at the scripts inside https://github.com/Dhole/CopperBoy/tree/master/ci you'll see how I'm currently doing builds of the libretro version. For ARM linux you should be able to adapt what's happening in build-libretro.sh but setting your particular target. That should build a dynamic library that you can then load with retroarch for example.