commit 25ffbde1ab5dada6f063ab01aae3c793ead0c302 Author: Antoine Date: Mon Jul 15 13:37:06 2019 +0200 Ajout des sources diff --git a/Code/Makefile b/Code/Makefile new file mode 100755 index 0000000..93a942d --- /dev/null +++ b/Code/Makefile @@ -0,0 +1,136 @@ +#! /usr/bin/make -f +# Default Makefile for fxSDK add-ins. This file was probably copied there by +# the [fxsdk] program. +#--- + +# +# Configuration +# + +include project.cfg + +# Compiler flags +cf := -mb -ffreestanding -nostdlib -Wall -Wextra \ + -fstrict-volatile-bitfields $(CFLAGS) +cf-fx := $(cf) -m3 -DFX9860G +cf-cg := $(cf) -m4-nofpu -DFXCG50 + +# Linker flags +lf-fx := $(LDFLAGS) -Tfx9860g.ld -lgint-fx -lgcc -Wl,-Map=build-fx/map +lf-cg := $(LDFLAGS) -Tfxcg50.ld -lgint-cg -lgcc -Wl,-Map=build-cg/map + +dflags = -MMD -MT $@ -MF $(@:.o=.d) -MP +cpflags := -R .bss -R .gint_bss + +g1af := -i "$(ICON_FX)" -n "$(NAME)" --internal="$(INTERNAL)" +g3af := -n basic:"$(NAME)" -i uns:"$(ICON_CG_UNS)" -i sel:"$(ICON_CG_SEL)" + +# +# File listings +# + +null := +filename := $(subst $(null) $(null),-,$(NAME)) + +elf = $(dir $<)$(filename).elf +bin = $(dir $<)$(filename).bin +target-fx := $(filename).g1a +target-cg := $(filename).g3a + +# Source files +src := $(wildcard src/*.c) +assets-fx := $(wildcard assets-fx/**/*) +assets-cg := $(wildcard assets-cg/**/*) + +# Object files +obj-fx := $(src:%.c=build-fx/%.o) $(assets-fx:assets-fx/%=build-fx/assets/%.o) +obj-cg := $(src:%.c=build-cg/%.o) $(assets-cg:assets-cg/%=build-cg/assets/%.o) + +# Additional dependencies +deps-fx := $(ICON_FX) +deps-cg := $(ICON_CG_UNS) $(ICON_CG_SEL) + +# All targets +all := +ifneq "$(wildcard build-fx)" "" +all += all-fx +endif +ifneq "$(wildcard build-cg)" "" +all += all-cg +endif + +# +# Build rules +# + +all: $(all) + +all-fx: $(target-fx) +all-cg: $(target-cg) + +$(target-fx): $(obj-fx) $(deps-fx) + + sh3eb-elf-gcc -o $(elf) $(obj-fx) $(cf-fx) $(lf-fx) + sh3eb-elf-objcopy -O binary $(cpflags) $(elf) $(bin) + fxg1a $(bin) -o $@ $(g1af) + +$(target-cg): $(obj-cg) $(deps-cg) + + sh4eb-elf-gcc -o $(elf) $(obj-cg) $(cf-cg) $(lf-cg) + sh4eb-elf-objcopy -O binary $(cpflags) $(elf) $(bin) + mkg3a $(g3af) $(bin) $@ + +# C sources +build-fx/%.o: %.c + @ mkdir -p $(dir $@) + sh3eb-elf-gcc -c $< -o $@ $(cf-fx) $(dflags) +build-cg/%.o: %.c + @ mkdir -p $(dir $@) + sh4eb-elf-gcc -c $< -o $@ $(cf-cg) $(dflags) + +# Images +build-fx/assets/img/%.o: assets-fx/img/% + @ mkdir -p $(dir $@) + fxconv -i $< -o $@ name:img_$(basename $*) + +build-cg/assets/img/%.o: assets-cg/img/% + @ echo -ne "\e[31;1mWARNING: image conversion for fxcg50 is not " + @ echo -ne "supported yet\e[0m" + @ mkdir -p $(dir $@) + fxconv -i $< -o $@ name:img_$(basename $*) + +# Fonts +build-fx/assets/fonts/%.o: assets-fx/fonts/% + @ mkdir -p $(dir $@) + fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*) + +build-cg/assets/fonts/%.o: assets-cg/fonts/% + @ mkdir -p $(dir $@) + fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*) + +# +# Cleaning and utilities +# + +# Dependency information +-include $(shell find build* -name *.d 2> /dev/null) +build-fx/%.d: ; +build-cg/%.d: ; +.PRECIOUS: build-fx build-cg build-fx/%.d build-cg/%.d %/ + +clean: + @ rm -rf build* +distclean: clean + @ rm -f $(target-fx) $(target-cg) + +install-fx: $(target-fx) + p7 send -f $< +install-cg: $(target-cg) + @ while [[ ! -h /dev/Prizm1 ]]; do sleep 1; done + @ mount /dev/Prizm1 + @ rm -f /mnt/prizm/$< + @ cp $< /mnt/prizm + @ umount /dev/Prizm1 + @- eject /dev/Prizm1 + +.PHONY: all all-fx all-cg clean distclean install-fx install-cg diff --git a/Code/assets-cg/icon-cg-sel.png b/Code/assets-cg/icon-cg-sel.png new file mode 100755 index 0000000..cafbe9e Binary files /dev/null and b/Code/assets-cg/icon-cg-sel.png differ diff --git a/Code/assets-cg/icon-cg-uns.png b/Code/assets-cg/icon-cg-uns.png new file mode 100755 index 0000000..cc57f73 Binary files /dev/null and b/Code/assets-cg/icon-cg-uns.png differ diff --git a/Code/assets-cg/img/cessna_172SP.png b/Code/assets-cg/img/cessna_172SP.png new file mode 100644 index 0000000..9b0ec04 Binary files /dev/null and b/Code/assets-cg/img/cessna_172SP.png differ diff --git a/Code/assets-cg/img/cockpit.png b/Code/assets-cg/img/cockpit.png new file mode 100644 index 0000000..46b296b Binary files /dev/null and b/Code/assets-cg/img/cockpit.png differ diff --git a/Code/assets-fx/icon-fx.png b/Code/assets-fx/icon-fx.png new file mode 100755 index 0000000..c92f12a Binary files /dev/null and b/Code/assets-fx/icon-fx.png differ diff --git a/Code/project.cfg b/Code/project.cfg new file mode 100644 index 0000000..af8a3a8 --- /dev/null +++ b/Code/project.cfg @@ -0,0 +1,19 @@ +#--- +# fxSDK project configuration file for FlySim +#--- + +# Project name, should be at most 8 bytes long. +NAME = FlySim +# Internal name, should be '@' followed by at most 7 uppercase letters. +INTERNAL = @FLYSIM + +# fx-9860G icon location +ICON_FX = assets-fx/icon-fx.png +# fx-CG 50 icon locations +ICON_CG_UNS = assets-cg/icon-cg-uns.png +ICON_CG_SEL = assets-cg/icon-cg-sel.png + +# Additional compiler flags +CFLAGS = -std=c11 -Os +# Additional linker flags +LDFLAGS = diff --git a/Code/src/main.c b/Code/src/main.c new file mode 100755 index 0000000..b295f14 --- /dev/null +++ b/Code/src/main.c @@ -0,0 +1,12 @@ +#include +#include + +int main(void) +{ + dclear(C_WHITE); + dtext(1, 1, "Sample fxSDK add-in.", C_BLACK, C_NONE); + dupdate(); + + getkey(); + return 1; +}