From a3aa537e84c618ff2b2773269f16f582b67a2c53 Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Fri, 10 Mar 2023 16:51:27 +0100 Subject: [PATCH] Start working on a build target FX9860G_AS_CG for fxSDK & gint --- fxsdk/assets/CMakeLists.txt | 3 ++ fxsdk/cmake/FX9860G_AS_CG.cmake | 58 +++++++++++++++++++++++++++++++++ fxsdk/fxsdk.sh | 24 +++++++++++++- 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 fxsdk/cmake/FX9860G_AS_CG.cmake diff --git a/fxsdk/assets/CMakeLists.txt b/fxsdk/assets/CMakeLists.txt index da80467..5fce5a2 100644 --- a/fxsdk/assets/CMakeLists.txt +++ b/fxsdk/assets/CMakeLists.txt @@ -38,4 +38,7 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G) elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) generate_g3a(TARGET myaddin OUTPUT "MyAddin.g3a" NAME "MyAddin" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png) +elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_AS_CG) + generate_g3a(TARGET myaddin OUTPUT "MyAddin.g3a" + NAME "MyAddin" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png) endif() diff --git a/fxsdk/cmake/FX9860G_AS_CG.cmake b/fxsdk/cmake/FX9860G_AS_CG.cmake new file mode 100644 index 0000000..c44f437 --- /dev/null +++ b/fxsdk/cmake/FX9860G_AS_CG.cmake @@ -0,0 +1,58 @@ +# fxSDK toolchain file for Casio graphing calculators +# Models: Prizm fx-CG 10, fx-CG 20, fx-CG 50, fx-CG 50 emulator +# Target triplet: sh-elf (custom sh3eb-elf supporting sh3 and sh4-nofpu) + +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR sh) + +# Base plateform is fx to pick the assets for the fx9860G +set(FXSDK_PLATFORM fx) +# the long name is change to be able to separate in CMakeLists.txt the different targets +set(FXSDK_PLATFORM_LONG fx9860G_AS_CG) + +set(FXSDK_TOOLCHAIN sh-elf-) +set(CMAKE_C_COMPILER sh-elf-gcc) +set(CMAKE_CXX_COMPILER sh-elf-g++) + +set(CMAKE_C_FLAGS_INIT "") +set(CMAKE_CXX_FLAGS_INIT "") + +add_compile_options(-m4-nofpu -mb -ffreestanding -nostdlib -Wa,--dsp) +add_link_options(-nostdlib -Wl,--no-warn-rwx-segments) +link_libraries(-lgcc) +add_compile_definitions(TARGET_FXCG50) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +set(FXSDK_CMAKE_MODULE_PATH "${FXSDK_CMAKE_MODULE_PATH}") + +# Add the fxSDK prefix path to the search +set(FXSDK_PREFIX "$ENV{FXSDK_PREFIX}") +foreach(DIR IN LISTS FXSDK_PREFIX) + include_directories("${DIR}/include") + link_directories("${DIR}/lib") +endforeach() + +# Determine compiler install path +execute_process( + COMMAND ${CMAKE_C_COMPILER} --print-file-name=. + OUTPUT_VARIABLE FXSDK_COMPILER_INSTALL + OUTPUT_STRIP_TRAILING_WHITESPACE) + +# Provide fxSDK sysroot and standard install folders +execute_process( + COMMAND fxsdk path sysroot + OUTPUT_VARIABLE FXSDK_SYSROOT + OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process( + COMMAND fxsdk path include + OUTPUT_VARIABLE FXSDK_INCLUDE + OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process( + COMMAND fxsdk path lib + OUTPUT_VARIABLE FXSDK_LIB + OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/fxsdk/fxsdk.sh b/fxsdk/fxsdk.sh index d0f6668..ca674bf 100755 --- a/fxsdk/fxsdk.sh +++ b/fxsdk/fxsdk.sh @@ -41,6 +41,14 @@ ${R}fxsdk${n} ${R}build-cg-push${n} [${R}-c${n}] [${R}-s${n}] [${R}--${n}] \ are identical to other build commands. Typical workflows will always set -s (which requires libusb support in fxlink). +${R}fxsdk${n} ${R}build-fx-as-cg${n} [${R}-c${n}] [${R}-s${n}] [${R}--${n}] \ +[${g}${n}...] + Builds the current project for fx-CG 50 from a code source initially + targetting the fx-9860G. It will generate a .g3a add-in in lieu of a .g1a + add-in. Upscaling of the screen will be performed to accomodate the higher + resolution of the screen of the fx-CG 50 (396x224px) instead of one of the + fx-9860G (128x64px). + ${R}fxsdk${n} (${R}send${n}|${R}send-fx${n}|${R}send-cg${n}) Sends the target file to the calculator. Uses p7 (which must be installed externally) for the fx-9860G, and fxlink for the fx-CG. For the G-III series, @@ -127,7 +135,10 @@ fxsdk_new_project() { cp "$assets"/icon-cg-sel.png "$1"/assets-cg/icon-sel.png echo "Created a new project $NAME (build system: $generator)." - echo "Type 'fxsdk build-fx' or 'fxsdk build-cg' to compile the program." + echo "Type 'fxsdk build-fx' or 'fxsdk build-cg' or 'fxsdk build-fx-as-cg'" + echo "to compile the program." + echo "Type 'fxsdk build-cg-push' or 'fxsdk build-fx-as-cg-push' to compile" + echo "a bin to be send to Add-In Push by circuit10" } fxsdk_load_config() { @@ -161,6 +172,12 @@ fxsdk_build_cg() { fxsdk_build_cg_push() { fxsdk_build_in "cg-push" "FXCG50" "$@" } +fxsdk_build_fx_as_cg() { + fxsdk_build_in "fx-as-cg" "FX9860G_AS_CG" "$@" +} +fxsdk_build_fx_as_cg_push() { + fxsdk_build_in "fx-as-cg-push" "FX9860G_AS_CG" "$@" +} fxsdk_build_in() { platform="$1" @@ -300,6 +317,11 @@ case "$1" in fxsdk_build_cg "${@:2}";; "build-cg-push"|"bcgp") fxsdk_build_cg_push "${@:2}";; + "build-fx-as-cg"|"bfxcg"|"bfcg") + fxsdk_build_fx_as_cg "${@:2}";; + "build-fx-as-cg-push"|"bfxcgp"|"bfcgp") + fxsdk_build_fx_as_cg_push "${@:2}";; + # Install "send"|"s")