mirror of
https://github.com/italicsjenga/gba.git
synced 2024-12-23 19:01:30 +11:00
[new] Initializtion file
This commit is contained in:
parent
8be6836e3e
commit
9ad09cf9f2
|
@ -11,6 +11,12 @@ detailed for you [in the 0th chapter of the
|
||||||
book](https://rust-console.github.io/gba/ch0/index.html) that goes with this
|
book](https://rust-console.github.io/gba/ch0/index.html) that goes with this
|
||||||
crate.
|
crate.
|
||||||
|
|
||||||
|
## For a fast initialization start
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl https://raw.githubusercontent.com/rust-console/gba/master/init.sh -sSf | sh
|
||||||
|
```
|
||||||
|
|
||||||
# Contribution
|
# Contribution
|
||||||
|
|
||||||
This crate is Apache2 licensed and any contributions you submit must also be
|
This crate is Apache2 licensed and any contributions you submit must also be
|
||||||
|
|
63
init.sh
Normal file
63
init.sh
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo -n "Type the name of the application / game, followed by [ENTER]: "
|
||||||
|
read APP_NAME
|
||||||
|
|
||||||
|
TARGET="thumbv4-none-agb"
|
||||||
|
CRT_LOCAL="crt0.s"
|
||||||
|
|
||||||
|
# initialize cargo
|
||||||
|
cargo init $APP_NAME --bin
|
||||||
|
|
||||||
|
# remove old
|
||||||
|
rm -rf $APP_NAME/thumbv4-none-agb.json*
|
||||||
|
rm -rf $APP_NAME/$CRT_LOCAL*
|
||||||
|
rm -rf $APP_NAME/linker.ld*
|
||||||
|
rm -rf $APP_NAME/Makefile*
|
||||||
|
rm -rf $APP_NAME/README.md*
|
||||||
|
|
||||||
|
# download dependencies
|
||||||
|
wget https://raw.githubusercontent.com/rust-console/gba/master/thumbv4-none-agb.json
|
||||||
|
mv $TARGET.json $APP_NAME/$TARGET.json
|
||||||
|
|
||||||
|
wget https://raw.githubusercontent.com/rust-console/gba/master/crt0.s
|
||||||
|
mv crt0.s $APP_NAME/$CRT_LOCAL
|
||||||
|
|
||||||
|
wget https://raw.githubusercontent.com/rust-console/gba/master/linker.ld;
|
||||||
|
mv linker.ld $APP_NAME/linker.ld
|
||||||
|
|
||||||
|
# substitute cargo main file with a new basic one
|
||||||
|
rm -rf $APP_NAME/src/main.rs
|
||||||
|
wget https://raw.githubusercontent.com/rust-console/gba/master/examples/hello1.rs
|
||||||
|
mv hello1.rs $APP_NAME/src/main.rs
|
||||||
|
|
||||||
|
# setup make file
|
||||||
|
echo "CRT_FILE=$(echo $CRT_LOCAL)
|
||||||
|
CRT_OUTPUT=crt0.o
|
||||||
|
PROJECT_NAME=$(echo $APP_NAME)
|
||||||
|
TARGET=$(echo $TARGET)
|
||||||
|
THUMB_TARGET=$(echo $TARGET).json
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build:
|
||||||
|
\tarm-none-eabi-as \$(CRT_FILE) -o \$(CRT_OUTPUT)
|
||||||
|
\tcargo xbuild --target \$(THUMB_TARGET)
|
||||||
|
|
||||||
|
build-prod:
|
||||||
|
\tarm-none-eabi-as \$(CRT_FILE) -o \$(CRT_OUTPUT)
|
||||||
|
\tcargo xbuild --target \$(THUMB_TARGET) --release
|
||||||
|
\tarm-none-eabi-objcopy -O binary target/\$(TARGET)/release/\$(PROJECT_NAME) target/\$(PROJECT_NAME).gba
|
||||||
|
\tgbafix target/\$(PROJECT_NAME).gba
|
||||||
|
" > $APP_NAME/Makefile
|
||||||
|
|
||||||
|
# setup the readme file
|
||||||
|
echo "Rust console project
|
||||||
|
----
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
\`\`\`sh
|
||||||
|
make
|
||||||
|
\`\`\`
|
||||||
|
" > $APP_NAME/README.md
|
Loading…
Reference in a new issue