-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (34 loc) · 1.32 KB
/
Copy pathMakefile
File metadata and controls
40 lines (34 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Malbolge RTOS — host simulation and STM32U585 firmware.
# ---- host build (run the kernel + matrix scroller on your PC) ----
HOST_CC ?= gcc
HOST_CFLAGS ?= -O2 -Wall -Wextra -Isrc
HOST_SRC = host/main_host.c src/malbolge_vm.c src/kernel.c src/display.c
.PHONY: host run clean arm
host: build/host/malbolge_rtos
build/host/malbolge_rtos: $(HOST_SRC)
@mkdir -p build/host
$(HOST_CC) $(HOST_CFLAGS) -o $@ $(HOST_SRC)
run: host
./build/host/malbolge_rtos
# ---- STM32U585 firmware (bare metal) ----
CROSS ?= arm-none-eabi-
ACC = $(CROSS)gcc
AOBJCOPY = $(CROSS)objcopy
ASIZE = $(CROSS)size
MCU_FLAGS = -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard
ACFLAGS = $(MCU_FLAGS) -O2 -g -Wall -Wextra -ffreestanding -Isrc -Iport \
-Iport/cmsis -DSTM32U585xx \
-ffunction-sections -fdata-sections
ALDFLAGS = $(MCU_FLAGS) -T port/stm32u585.ld -nostartfiles \
-Wl,--gc-sections -Wl,-Map=build/arm/firmware.map
ARM_SRC = port/main.c port/startup_stm32u585.c port/board.c \
src/malbolge_vm.c src/kernel.c src/display.c
arm: build/arm/firmware.bin
build/arm/firmware.elf: $(ARM_SRC) port/stm32u585.ld
@mkdir -p build/arm
$(ACC) $(ACFLAGS) $(ALDFLAGS) -o $@ $(ARM_SRC)
$(ASIZE) $@
build/arm/firmware.bin: build/arm/firmware.elf
$(AOBJCOPY) -O binary $< $@
clean:
rm -rf build