Git Product home page Git Product logo

cargo-n64's People

Contributors

command-tab avatar jonil avatar parasyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cargo-n64's Issues

Check for rust-src in build.rs

cargo-xbuild is a dependency for building the MIPS sysroot, and core, alloc, and compiler-builtins crates. rust-src is a dependency of cargo-xbuild.

These dependencies should be checked in build.rs and error out with a clear list of what's missing and how to install it.

Add "rls" command

This command will allow running the rls server and passing default configuration options:

all_targets = false
sysroot = "/path/to/sysroot"
target = "/path/to/target.json"

Because it needs to pass absolute paths, the target.json should be created first, followed by sysroot with cargo-xbuild.

Bonus points if all_targets does not need to be disabled! This is required today because we don't have a test crate.

Issues when compiling the crate

Whenever I run cargo run using the nightly branch, the following error occurs:

error[E0599]: no method named `backtrace` found for reference `&dyn StdError` in the current scope
  --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\cargo-n64-0.2.0\src\lib.rs:62:36
   |
62 |     if let Some(backtrace) = error.backtrace() {
   |                                    ^^^^^^^^^ method not found in `&dyn Error`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `cargo-n64` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...

What can cause this and what can I do to fix this?

Running Windows 11 with latest Rust Nightly but possibly out-of-date Rust Stable.

Also, I'm fairly new to Rust things, so try and explain them like I'm 5 years old.

Replace failure with this-error

I've been making this kind of improvement in some of my other crates, like parasyte/sonant-rs@56fe216

This should help compile-times a little bit (nice to have) and will be much MUCH nicer for anyone interested in using cargo-n64 as a library. (Not that I know of anyone with any such interest. But who knows!)

Add "test" command

This command will build in test mode (requires the test crate or some other test harness), and run the test binary in an emulator like cen64.

The emulator and its command line args will be specified in the project's Cargo.toml metadata table. The emulator will require a way to print to stdout/stderr and exit/terminate on demand (e.g. when the test hardness completes or panics).

Struggling to compile the examples.

I'm trying to get an example to work and not having much luck.

I found an IPL3, and copied some of the stuff in n64lib in to a local project, and the stuff from hello-ipl3font in to main.rs.

> cargo n64 build --ipl3 path/to/ipl3 --package rust-n64
    Building with cargo xbuild
    Finished release [optimized] target(s) in 0.01s
warning: constant is never used: `VI_CURRENT`
  --> src/vi.rs:20:1
   |
20 | const VI_CURRENT: *const u32 = (VI_BASE + 0x10) as *const u32;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default


warning: constant is never used: `VIDEO_MODE`
  --> src/vi.rs:31:1
   |
31 | const VIDEO_MODE: *const u32 = 0x8000_0300 as *const u32;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


warning: enum is never used: `VideoMode`
  --> src/vi.rs:33:10
   |
33 | pub enum VideoMode {
   |          ^^^^^^^^^


warning: function is never used: `get_video_frequency`
  --> src/vi.rs:40:8
   |
40 | pub fn get_video_frequency() -> u32 {
   |        ^^^^^^^^^^^^^^^^^^^


warning: function is never used: `get_video_mode`
  --> src/vi.rs:49:8
   |
49 | pub fn get_video_mode() -> VideoMode {
   |        ^^^^^^^^^^^^^^


warning: function is never used: `wait_for_ready`
  --> src/vi.rs:58:8
   |
58 | pub fn wait_for_ready() {
   |        ^^^^^^^^^^^^^^


warning: 6 warnings emitted


error: Build error
caused by: Subcommand failed
caused by: JSON error: {"reason":"build-finished","success":true}
caused by: missing field `message` at line 1 column 42

Not quite sure what this means or what I'm doing wrong.

If I clone this repo and try to build an example directly, I get:

โฏ cargo n64 build --ipl3 path/to/ipl3 --package hello-ipl3font
    Building with cargo xbuild
WARNING: There is no root package to read the cargo-xbuild config from.
    Updating crates.io index
   Compiling compiler_builtins v0.1.28
   Compiling core v0.0.0 (/Users/samwho/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore)
   Compiling rustc-std-workspace-core v1.99.0 (/Users/samwho/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/var/folders/pq/_d8rmjjn757278bnmtd04qqw0000gn/T/cargo-xbuild.GWJfdBp9hnL6)
    Finished release [optimized] target(s) in 20.20s
   Compiling libm v0.1.4
   Compiling n64lib v0.1.0 (/Users/samwho/Code/cargo-n64/examples/n64lib)
   Compiling rrt0 v0.1.3
   Compiling hello-ipl3font v0.1.0 (/Users/samwho/Code/cargo-n64/examples/hello-ipl3font)
error: could not compile `hello-ipl3font`.

To learn more, run the command again with --verbose.
error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "--script=/var/folders/pq/_d8rmjjn757278bnmtd04qqw0000gn/T/n64-build/linker.ld" "-L" "/Users/samwho/Code/cargo-n64/target/sysroot/lib/rustlib/mips-nintendo64-none/lib" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.0.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.1.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.10.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.11.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.12.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.13.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.14.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.15.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.2.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.3.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.4.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.5.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.6.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.7.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.8.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.9.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.hello_ipl3font.7dqlcqvy-cgu.0.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.hello_ipl3font.7dqlcqvy-cgu.1.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.0.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.1.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.10.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.11.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.12.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.13.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.14.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.15.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.2.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.3.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.4.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.5.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.6.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.7.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.8.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.libm-4ac7c4e807f33b9e.libm.7le2opq2-cgu.9.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.n64lib-2a75047ba4fd50cc.n64lib.77lbtb04-cgu.0.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.n64lib-2a75047ba4fd50cc.n64lib.77lbtb04-cgu.1.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.n64lib-2a75047ba4fd50cc.n64lib.77lbtb04-cgu.2.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.n64lib-2a75047ba4fd50cc.n64lib.77lbtb04-cgu.3.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.n64lib-2a75047ba4fd50cc.n64lib.77lbtb04-cgu.4.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.n64lib-2a75047ba4fd50cc.n64lib.77lbtb04-cgu.5.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.n64lib-2a75047ba4fd50cc.n64lib.77lbtb04-cgu.6.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.n64lib-2a75047ba4fd50cc.n64lib.77lbtb04-cgu.7.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.rrt0-035c3dd6ada14b3c.rrt0.b8umbv1o-cgu.0.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.rrt0-035c3dd6ada14b3c.rrt0.b8umbv1o-cgu.1.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.rrt0-035c3dd6ada14b3c.rrt0.b8umbv1o-cgu.2.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.rrt0-035c3dd6ada14b3c.rrt0.b8umbv1o-cgu.3.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.rrt0-035c3dd6ada14b3c.rrt0.b8umbv1o-cgu.4.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.rrt0-035c3dd6ada14b3c.rrt0.b8umbv1o-cgu.5.rcgu.o.rcgu.o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.rustc_std_workspace_core-34786f4c7745ab99.rustc_std_workspace_core.eh21vnfe-cgu.0.rcgu.o.rcgu.o" "-o" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64" "--gc-sections" "-L" "/Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps" "-L" "/Users/samwho/Code/cargo-n64/target/release/deps" "-L" "/Users/samwho/Code/cargo-n64/target/sysroot/lib/rustlib/mips-nintendo64-none/lib" "--start-group" "--end-group" "-Bstatic" "/Users/samwho/Code/cargo-n64/target/sysroot/lib/rustlib/mips-nintendo64-none/lib/libcompiler_builtins-80c5e482a0271d92.rlib" "-Bdynamic"
  = note: rust-lld: error: incompatible target ISA:
          >>> /Users/samwho/Code/cargo-n64/target/mips-nintendo64-none/release/deps/hello_ipl3font-2d88201d15e71e64.core-f56ecaf20c9030df.core.72mlrb4g-cgu.0.rcgu.o.rcgu.o: mips3
          >>> lto.tmp: mips32
          


error: aborting due to previous error


error: Build error
caused by: Subcommand failed
caused by: JSON error: {"reason":"build-finished","success":false}
caused by: missing field `message` at line 1 column 43

I'm on Mac OSX Catalina.

ABI 'o32' is incompatible with target ABI 'n64'

I'm attempting to link in a Nintendo 64 SDK static library (libnusys.a), but the Rust linker errors out:

rust-lld: error: lto.tmp: ABI 'o32' is incompatible with target ABI 'n64'

Do you think I ought be producing o32 ABI binaries instead of n64 ones to match the static library? I'm curious what you make of this.

Here's my build.rs:

fn main() {
    println!("cargo:rustc-link-lib=static=nusys");
    println!("cargo:rustc-link-search=native=/path/to/n64kit/nusys/lib");
}

Thanks!

Find a better way to organize the example(s)

Using rls with the cargo-n64 repo sucks because it contains code for the native machine (e.g. cargo-n64 runs on macOS, Linux, or Windows) and the examples, which only run on N64. This bifurcation causes rls to barf with unsavory errors when the example code is opened in an IDE.

Available options:

  • Split examples into a new repo with its own rls.toml config for the N64 target (and revert the Cargo workspace)
  • Move examples to rrt0 (otherwise same as above)
  • Try to hax rls to be aware of architecture-specific crates in a workspace?

Open source IPL3 alternative

cargo-n64 does not ship with an IPL ROM for copyright reasons, even though this code is required to cold boot a Nintendo 64. We should add a default open source IPL3, preferably one with MIT license (or equivalent).

I know of two open source IPL3s:

  1. https://github.com/PeterLemon/N64/tree/master/BOOTCODE It is unlicensed and looks like a direct copy of 6102.bin with some minor adjustments.
  2. https://github.com/pseudophpt/pseultra/blob/master/n64/boot/src/boot.sx Minimal implementation. Appears to be incomplete.

The biggest challenge is that IPL2 authenticates IPL3 with the PIF. Exact details of PIF authentication are out of scope for cargo-n64, but there is more on the topic in the links below:

This means that the easiest way to workaround the IPL2 checksum is including a custom CIC implementation with the IPL3 code that sends the appropriate precomputed checksum to the PIF.

Note that the IPL2 checksum is not a problem on emulators or on carts like 64Drive and EverDrive64. These carts include an UltraCIC implementation and boot into a menu (using CIC-NUS-6102).

The 64Drive has a special "USB mode" that makes the cart act like a bare N64 cart with a selectable CIC when powered on with a USB cable plugged in. When running a ROM created with a custom IPL3 in USB mode, it is necessary to reprogram the CIC emulation on the 64drive with the appropriate precomputed checksum. Unfortunately, this is not currently supported by 64drive.

Use cargo-xbuild as a library dependency

The non-dependency-managed cargo-xbuild binary installation is bad for many reasons (see #12 for a recent example). This can be fixed by bringing cargo-xbuild in as a library dependency. Some QoL improvements have been made recently that will help make it a reality, especially rust-osdev/cargo-xbuild#59

CLI improvements

Now that I've started writing my own cargo subcommand as you recommended on the forums, I thought I'd share some of my findings.

// TODO: Add highlighting

You can pass --message-format=json-render-diagnostics instead of just --message-format=json. Then, all warnings will be printed to cargo's stderr with proper formatting, and you can just inherit that to do syntax highlighting.

// Return build artifact

Instead of just grabbing the last artifact, you should grab everything where target.executable exists for when there's multiple binaries, such as in workspaces:

{
  "reason": "compiler-artifact",
  "package_id": "hello-world 1.0.2 (path+file:///path/to/hello-world)",
  "target": {
    "kind": [
      "bin" // Right here
    ],
    "crate_types": [
      "bin"
    ],
    "name": "hello-world",
    "src_path": "/path/to/hello-world/src/main.rs",
    "edition": "2018",
    "doctest": false
  },
  "profile": {
    "opt_level": "0",
    "debuginfo": 2,
    "debug_assertions": true,
    "overflow_checks": true,
    "test": false
  },
  "features": [],
  "filenames": [
    "/path/to/hello-world"
  ],
  "executable": "/path/to/hello-world", // Right here
  "fresh": false
}

You can use cargo_metadata to do that parsing, or whatever JSON parser.

Another thing is that you're requiring the user to pass in a few parameters. What I like to do instead is use the [metadata] section of the Cargo.toml to store that data, so you don't have to keep passing it in. Just thought I'd mention it.

Build periodically on Travis-CI

I was just informed that the hello-ipl3font example is currently failing to build. That should be fixed, but I also want to be notified of when a build starts to break (usually due to changes in the nightly compiler or dependencies).

I'm not always active on every project, so periodic builds will be necessary. Even though it creates interrupt-driven development cycles... ๐Ÿ˜‰

Add commands to interact with 64Drive and EverDrive 64 hardware via USB.

The obvious commands to add are: Upload ROM and Set CIC Type. Some nice to haves would be Set Save Type, Cart Info, and some commands to arbitrarily send and receive data (e.g. for emulating stdin, stdout, stderr, GDB stub, etc.)

There is a crate available for communication with 64Drive: https://github.com/awygle/r64drive It depends on libftdi which is not ideal.

There is another project that uses the serial tty interface instead of libftdi: https://github.com/tj90241/64drive This interface should be available on every major OS. E.g. something like /dev/ttyUSB0 or /dev/ttyS4 on Linux and macOS, and COM4 in Windows. The serialport crate looks handy.

Support executables >1MB

There is a current inherent limit of 1MB executable sizes today. This is a result of Nintendo's official IPL3 code copying the first 1MB of data from the cartridge domain into main memory (at the entry point address specified in the header). The IPL3 uses that 1MB for its checksum computation, and secondarily for executing the code.

That means we get 1MB "for free", but to support larger executables the "IPL4" at the executable entry point will need to pull the rest from ROM. We need an upper bound, like presently the upper bound is 1MB. We might increase it to something like 3MB.

Side note: the .rodata section is linked into RAM directly following the .text section. This makes accessing the read-only data very fast. For large .rodata sections, it would be better to keep the section in ROM. Software optimizations can help with improving access times, e.g. virtual memory.

libm optimizations

We're currently using libm to implement the missing compiler builtins for f32 and f64 primitives. The libm crate implements these builtins in Rust. While it provides a very workable springboard to get started quickly, it leaves a lot to be desired with fast math.

The N64 CPU supports many of these operations natively through the floating point unit, COP1. Here's a table summarizing the builtin to FPU instruction relationships:

builtin FPU instruction
fabs abs.d
fabsf abs.s
ceil ceil.l.d, cvt.d.l
ceilf ceil.w.s, cvt.s.w
floor floor.l.d, cvt.d.l
floorf floor.w.s, cvt.s.w
round round.l.d, cvt.d.l
roundf round.w.s, cvt.s.w
sqrt sqrt.d
sqrtf sqrt.s
trunc trunc.l.d, cvt.d.l
truncf trunc.w.s, cvt.s.w

Another alternative is using LLVM intrinsics from rustc. (How?)

Save target.json and linker script to target directory

The target.json and linker script files are currently written to a temporary directory. These should be written to the target directory instead. It should use a sub-directory like ./target/cargo-n64 to keep the target directory clean. The directory tree will have to be created if it does not exist.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.