From 627fe14290ba07798ae7c9de2fa87a2914d24514 Mon Sep 17 00:00:00 2001 From: Lephe Date: Tue, 3 Sep 2019 23:23:24 +0200 Subject: [PATCH] fxsdk: add update command and fix LD flag order --- fxsdk/assets/Makefile | 4 ++-- fxsdk/fxsdk.sh | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/fxsdk/assets/Makefile b/fxsdk/assets/Makefile index f7e8a72..022ab12 100755 --- a/fxsdk/assets/Makefile +++ b/fxsdk/assets/Makefile @@ -16,8 +16,8 @@ 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 +lf-fx := -Tfx9860g.ld -lgint-fx $(LDFLAGS) -lgcc -Wl,-Map=build-fx/map +lf-cg := -Tfxcg50.ld -lgint-cg $(LDFLAGS) -lgcc -Wl,-Map=build-cg/map dflags = -MMD -MT $@ -MF $(@:.o=.d) -MP cpflags := -R .bss -R .gint_bss diff --git a/fxsdk/fxsdk.sh b/fxsdk/fxsdk.sh index cd5c025..3757463 100755 --- a/fxsdk/fxsdk.sh +++ b/fxsdk/fxsdk.sh @@ -39,6 +39,13 @@ Installation: Sends the target file to the calculator. Uses p7 (which must be installed externally) for fx-9860G. Currently not implemented for fx-CG 50, as it requires detecting and mounting the calculator (same of the Graph 35+E II). + +Project update: + fxsdk update + + Copies the latest version of the Makefile to your project. *This will + discard any changes made to your Makefile.* If you have edited your + Makefile, make a backup and merge the changes after updating. EOF ) @@ -138,7 +145,8 @@ ICON_CG_SEL = assets-cg/icon-cg-sel.png # Additional compiler flags CFLAGS = -std=c11 -Os -# Additional linker flags +# Additional linker flags. This is followed by -lgcc. When using fxlib, add +# libfx.a to the projet directory and set LDFLAGS to "-L . -lfx". LDFLAGS = EOF } @@ -222,6 +230,17 @@ fxsdk_send_cg() { echo "error: this is tricky and not implemented yet, sorry x_x" } +fxsdk_update() { + if [[ ! -e "project.cfg" ]]; then + echo "No file 'project.cfg' was found. This does not look like an fxSDK" + echo "project folder. (Nothing done.)" + fi + + assets="$PREFIX/share/fxsdk/assets" + cp "$assets"/Makefile . + echo "Succesfully copied $assets/Makefile to the current directory." +} + # Parse command name case $1 in @@ -250,6 +269,10 @@ case $1 in "send-cg"|"sc"|"scg") fxsdk_send_cg;; + # Project update + "update") + fxsdk_update;; + # Misc -h|--help|-\?) usage 0;;