Skip to content

Commit 78aab45

Browse files
authored
Merge pull request kotetuco#5 from kotetuco/feature/draw_string
文字列表示処理を実装。
2 parents 12fc115 + fd0e501 commit 78aab45

File tree

11 files changed

+379
-100
lines changed

11 files changed

+379
-100
lines changed

Cargo.lock

Lines changed: 0 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,3 @@ lto = true
1717
panic = "abort"
1818
opt-level = 2
1919
lto = true
20-
21-
[dependencies]
22-
rlibc = "1.0.0"
23-
compiler_builtins = { git = "https://github.com/rust-lang-nursery/compiler-builtins" }

Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ default:
1313
mkdir -p $(BUILD_DIR)
1414
make $(BUILD_DIR)/$(BUILD_NAME).mb
1515

16-
$(BUILD_DIR)/$(BUILD_NAME).mb: $(BUILD_DIR)/$(BUILD_NAME).elf Makefile
17-
$(TARGET_ARCH)-objcopy -O binary $(BUILD_DIR)/$(BUILD_NAME).elf $(BUILD_DIR)/$(BUILD_NAME).mb
16+
$(BUILD_DIR)/$(BUILD_NAME).mb: $(BUILD_DIR)/$(BUILD_NAME).elf
17+
$(TARGET_ARCH)-objcopy -O binary $(BUILD_DIR)/$(BUILD_NAME).elf \
18+
$(BUILD_DIR)/$(BUILD_NAME).mb
1819

19-
$(BUILD_DIR)/$(BUILD_NAME).elf: $(BUILD_DIR)/crt.o rom.ld target/$(TARGET_ARCH_RUST)/$(BUILD_MODE)/librust_basemetal_gba.a
20-
$(TARGET_ARCH)-ld --gc-sections -t -T rom.ld -o $(BUILD_DIR)/$(BUILD_NAME).elf $(BUILD_DIR)/crt.o --library-path=target/$(TARGET_ARCH_RUST)/$(BUILD_MODE) -lrust_basemetal_gba -Map $(BUILD_DIR)/$(BUILD_NAME).map
20+
$(BUILD_DIR)/$(BUILD_NAME).elf: $(BUILD_DIR)/crt.o rom.ld \
21+
target/$(TARGET_ARCH_RUST)/$(BUILD_MODE)/librust_basemetal_gba.a
22+
$(TARGET_ARCH)-ld --gc-sections -t -T rom.ld -o $(BUILD_DIR)/$(BUILD_NAME).elf \
23+
$(BUILD_DIR)/crt.o --library-path=target/$(TARGET_ARCH_RUST)/$(BUILD_MODE) \
24+
-lrust_basemetal_gba -Map $(BUILD_DIR)/$(BUILD_NAME).map
2125

22-
target/$(TARGET_ARCH_RUST)/$(BUILD_MODE)/librust_basemetal_gba.a: $(TARGET_ARCH_RUST).json Cargo.toml src/*.rs
23-
RUST_TARGET_PATH=$(PWD) rustup run nightly `which xargo` build -v --target=$(TARGET_ARCH_RUST)
26+
target/$(TARGET_ARCH_RUST)/$(BUILD_MODE)/librust_basemetal_gba.a: \
27+
$(TARGET_ARCH_RUST).json Cargo.toml src/*.rs
28+
RUST_TARGET_PATH=$(PWD) rustup run nightly `which xargo` build -v \
29+
--target=$(TARGET_ARCH_RUST)
2430

2531
$(BUILD_DIR)/crt.o: crt.S
2632
$(TARGET_ARCH)-as crt.S -o $(BUILD_DIR)/crt.o

arm-none-eabi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"relocation-model": "static",
1010
"archive-format": "gnu",
1111
"target-env": "gnu",
12-
"no-compiler-rt": false,
12+
"no-compiler-rt": true,
1313
"linker-is-gnu": true,
1414
"disable-redzone": true,
1515
"cpu": "arm7tdmi"

crt.S

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,7 @@
11
.text
22

3-
.global _start
3+
.global _start
44
_start:
5-
b entry @ Branch to entry()
5+
b entry @ Branch to entry()
66
loop:
7-
b loop
8-
9-
@ multi-threading is also not supportd
10-
.global __sync_val_compare_and_swap_1
11-
.global __sync_val_compare_and_swap_2
12-
.global __sync_val_compare_and_swap_4
13-
__sync_val_compare_and_swap_1:
14-
__sync_val_compare_and_swap_2:
15-
__sync_val_compare_and_swap_4:
16-
1: b 1b
17-
18-
@ floating point operations are not supported
19-
.global __aeabi_ul2f
20-
.global __aeabi_ul2d
21-
.global __aeabi_fmul
22-
.global __aeabi_fdiv
23-
.global __aeabi_dmul
24-
.global __aeabi_ddiv
25-
__aeabi_ul2f:
26-
__aeabi_ul2d:
27-
__aeabi_fmul:
28-
__aeabi_fdiv:
29-
__aeabi_dmul:
30-
__aeabi_ddiv:
31-
1: b 1b
7+
b loop

src/font.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// kotetuco, 2017
3+
//
4+
5+
use font_def::FONT_DATAS;
6+
7+
pub struct Font {
8+
size_width: u16,
9+
size_height: u16,
10+
}
11+
12+
impl Font {
13+
pub fn new() -> Self {
14+
Font {
15+
size_width: 8,
16+
size_height: 16,
17+
}
18+
}
19+
20+
pub fn get_character(&self, ch: char) -> [u8; 16] {
21+
let index = ch as usize;
22+
return FONT_DATAS[index];
23+
}
24+
25+
pub fn font_width(&self) -> u16 {
26+
return self.size_width;
27+
}
28+
29+
pub fn font_height(&self) -> u16 {
30+
return self.size_height;
31+
}
32+
}

0 commit comments

Comments
 (0)