rust-console / cargo-n64 Goto Github PK
View Code? Open in Web Editor NEWMake Nintendo 64 games in Rust! ๐ฆ
License: MIT License
Make Nintendo 64 games in Rust! ๐ฆ
License: MIT License
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.
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.
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.
.sdata
section from ELF.sdata
and .sbss
sections to linker script.sbss
section in rrt0
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!)
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).
rust-src
is required by cargo-xbuild
, rls
, and clippy
.
rls
is going to be used by the "rls" command: #4clippy
is going to be used by rls
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.
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!
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:
rls.toml
config for the N64 target (and revert the Cargo workspace)rrt0
(otherwise same as above)rls
to be aware of architecture-specific crates in a workspace?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:
6102.bin
with some minor adjustments.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.
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
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.
cargo-n64/cargo-n64/src/cargo.rs
Line 137 in 1dbff85
--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.
cargo-n64/cargo-n64/src/cargo.rs
Line 124 in 1dbff85
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.
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... ๐
Example of broken build: https://travis-ci.org/rust-console/cargo-n64/builds/650914215
Reported upstream: rust-osdev/cargo-xbuild#60
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.
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.
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?)
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.