better target name

This commit is contained in:
Lokathor 2018-11-10 13:44:47 -07:00
parent 097dd72124
commit f838103528
9 changed files with 29 additions and 25 deletions

View file

@ -30,7 +30,7 @@ do this stuff.
dots as well as other support files:
* crt0.s
* linker.ld
* thumbv4-none-eabi.json
* thumbv4-nintendo-agb.json
* build.rs
5) Run `arm-none-eabi-as crt0.s -o crt0.o` to build the `crt0.s` into a `crt0.o`
@ -38,7 +38,7 @@ do this stuff.
`build.bat` file it's set to simply run every single time because it's a
cheap enough operation.
6) Build with `cargo xbuild --target thumbv4-none-eabi.json`
6) Build with `cargo xbuild --target thumbv4-nintendo-agb.json`
* The file extension is significant, and `cargo xbuild` takes it as a flag to
compile dependencies with the same sysroot, so you can include crates
normally. Well, crates that can run inside a GBA at least (Which means they
@ -47,7 +47,7 @@ do this stuff.
helpful because it has debug symbols).
7) Also you can patch up the output to be a "real" ROM file:
* `arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/debug/gbatest target/output.gba`
* `arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/debug/gbatest target/output.gba`
* `gbafix target/output.gba`
8) Alternately, you can use the provided `build.bat` file (or write a similar

View file

@ -37,8 +37,10 @@ Now you'll need some particular files each time you want to start a new project.
You can find them in the root of the [rust-console/gba
repo](https://github.com/rust-console/gba).
* `thumbv4-none-eabi.json` describes the overall GBA to cargo-xbuild so it knows
what to do.
* `thumbv4-nintendo-agb.json` describes the overall GBA to cargo-xbuild so it
knows what to do. This is actually a somewhat made up target name since
there's no official target name, but this is the best name to pick based on
[how target names are decided](https://wiki.osdev.org/Target_Triplet).
* `crt0.s` describes some ASM startup stuff. If you have more ASM to place here
later on this is where you can put it. You also need to build it into a
`crt0.o` file before it can actually be used, but we'll cover that below.
@ -55,7 +57,7 @@ Once you've got something to build, you perform the following steps:
might as well do it every time so that you never forget to because it's a
practically instant operation.
* `cargo xbuild --target thumbv4-none-eabi.json`
* `cargo xbuild --target thumbv4-nintendo-agb.json`
* This builds your Rust source. It accepts _most of_ the normal options, such
as `--release`, and options, such as `--bin foo` or `--examples`, that you'd
expect `cargo` to accept.
@ -81,7 +83,7 @@ emulators can also do it.
However, if you want a "real" ROM that works in all emulators and that you could
transfer to a flash cart there's a little more to do.
* `arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/MODE/BIN_NAME target/ROM_NAME.gba`
* `arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/MODE/BIN_NAME target/ROM_NAME.gba`
* This will perform an [objcopy](https://linux.die.net/man/1/objcopy) on our
program. Here I've named the program `arm-none-eabi-objcopy`, which is what
devkitpro calls their version of `objcopy` that's specific to the GBA in the
@ -95,7 +97,7 @@ transfer to a flash cart there's a little more to do.
`cargo` arranges stuff in the `target/` directory, and between RLS and
`cargo doc` and stuff it gets kinda crowded, so it goes like this:
* Since our program was built for a non-local target, first we've got a
directory named for that target, `thumbv4-none-eabi/`
directory named for that target, `thumbv4-nintendo-agb/`
* Next, the "MODE" is either `debug/` or `release/`, depending on if we had
the `--release` flag included. You'll probably only be packing release
mode programs all the way into GBA roms, but it works with either mode.

View file

@ -43,9 +43,11 @@ locations on the screen.
## CGB Mode
Bit 3 is read only. It's on if you're running in CGB mode. Since we're making
GBA games you'd think that it'll never be on at all, but I guess you can change
it with BIOS stuff. Still, basically not an important bit.
Bit 3 is effectively read only. Technically it can be flipped using a BIOS call,
but when you write to the display control normally it won't write to this bit,
so we'll call it effectively read only.
This bit is on if the CPU is in CGB mode.
## Page Flipping

View file

@ -3,12 +3,12 @@
arm-none-eabi-as crt0.s -o crt0.o
@rem Build all examples, both debug and release
cargo xbuild --examples --target thumbv4-none-eabi.json
cargo xbuild --examples --target thumbv4-none-eabi.json --release
cargo xbuild --examples --target thumbv4-nintendo-agb.json
cargo xbuild --examples --target thumbv4-nintendo-agb.json --release
@echo Packing examples into ROM files...
@for %%I in (.\examples\*.*) do @(
echo %%~nI
arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/release/examples/%%~nI target/example-%%~nI.gba >nul
arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/release/examples/%%~nI target/example-%%~nI.gba >nul
gbafix target/example-%%~nI.gba >nul
)

View file

@ -169,7 +169,7 @@ cargo will figure it all out for you.</p>
You can find them in the root of the <a href="https://github.com/rust-console/gba">rust-console/gba
repo</a>.</p>
<ul>
<li><code>thumbv4-none-eabi.json</code> describes the overall GBA to cargo-xbuild so it knows
<li><code>thumbv4-nintendo-agb.json</code> describes the overall GBA to cargo-xbuild so it knows
what to do.</li>
<li><code>crt0.s</code> describes some ASM startup stuff. If you have more ASM to place here
later on this is where you can put it. You also need to build it into a
@ -190,7 +190,7 @@ practically instant operation.</li>
</ul>
</li>
<li>
<p><code>cargo xbuild --target thumbv4-none-eabi.json</code></p>
<p><code>cargo xbuild --target thumbv4-nintendo-agb.json</code></p>
<ul>
<li>This builds your Rust source. It accepts <em>most of</em> the normal options, such
as <code>--release</code>, and options, such as <code>--bin foo</code> or <code>--examples</code>, that you'd
@ -219,7 +219,7 @@ emulators can also do it.</p>
transfer to a flash cart there's a little more to do.</p>
<ul>
<li>
<p><code>arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/MODE/BIN_NAME target/ROM_NAME.gba</code></p>
<p><code>arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/MODE/BIN_NAME target/ROM_NAME.gba</code></p>
<ul>
<li>This will perform an <a href="https://linux.die.net/man/1/objcopy">objcopy</a> on our
program. Here I've named the program <code>arm-none-eabi-objcopy</code>, which is what
@ -235,7 +235,7 @@ bare memory dump of the program.</li>
<code>cargo doc</code> and stuff it gets kinda crowded, so it goes like this:
<ul>
<li>Since our program was built for a non-local target, first we've got a
directory named for that target, <code>thumbv4-none-eabi/</code></li>
directory named for that target, <code>thumbv4-nintendo-agb/</code></li>
<li>Next, the &quot;MODE&quot; is either <code>debug/</code> or <code>release/</code>, depending on if we had
the <code>--release</code> flag included. You'll probably only be packing release
mode programs all the way into GBA roms, but it works with either mode.</li>

View file

@ -181,7 +181,7 @@ cargo will figure it all out for you.</p>
You can find them in the root of the <a href="https://github.com/rust-console/gba">rust-console/gba
repo</a>.</p>
<ul>
<li><code>thumbv4-none-eabi.json</code> describes the overall GBA to cargo-xbuild so it knows
<li><code>thumbv4-nintendo-agb.json</code> describes the overall GBA to cargo-xbuild so it knows
what to do.</li>
<li><code>crt0.s</code> describes some ASM startup stuff. If you have more ASM to place here
later on this is where you can put it. You also need to build it into a
@ -202,7 +202,7 @@ practically instant operation.</li>
</ul>
</li>
<li>
<p><code>cargo xbuild --target thumbv4-none-eabi.json</code></p>
<p><code>cargo xbuild --target thumbv4-nintendo-agb.json</code></p>
<ul>
<li>This builds your Rust source. It accepts <em>most of</em> the normal options, such
as <code>--release</code>, and options, such as <code>--bin foo</code> or <code>--examples</code>, that you'd
@ -231,7 +231,7 @@ emulators can also do it.</p>
transfer to a flash cart there's a little more to do.</p>
<ul>
<li>
<p><code>arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/MODE/BIN_NAME target/ROM_NAME.gba</code></p>
<p><code>arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/MODE/BIN_NAME target/ROM_NAME.gba</code></p>
<ul>
<li>This will perform an <a href="https://linux.die.net/man/1/objcopy">objcopy</a> on our
program. Here I've named the program <code>arm-none-eabi-objcopy</code>, which is what
@ -247,7 +247,7 @@ bare memory dump of the program.</li>
<code>cargo doc</code> and stuff it gets kinda crowded, so it goes like this:
<ul>
<li>Since our program was built for a non-local target, first we've got a
directory named for that target, <code>thumbv4-none-eabi/</code></li>
directory named for that target, <code>thumbv4-nintendo-agb/</code></li>
<li>Next, the &quot;MODE&quot; is either <code>debug/</code> or <code>release/</code>, depending on if we had
the <code>--release</code> flag included. You'll probably only be packing release
mode programs all the way into GBA roms, but it works with either mode.</li>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -18,7 +18,7 @@
"linker": "arm-none-eabi-ld",
"linker-flavor": "ld",
"linker-is-gnu": true,
"llvm-target": "thumbv4-none-eabi",
"llvm-target": "thumbv4-nintendo-agb",
"os": "none",
"panic-strategy": "abort",
"pre-link-args": {