fxsdk: cleanup for building fx code as g3a (#11)

- Feature name: "fx g3a" or "fx as g3a"
- No need for a special send function
- Remove leftover bld file
This commit is contained in:
Lephenixnoir 2024-03-21 08:51:49 +01:00
parent 883ca77167
commit 519b4201fc
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
4 changed files with 23 additions and 46 deletions

4
bld
View File

@ -1,4 +0,0 @@
PREFIX=$HOME/.local make -f giteapc.make configure
sudo make -C build install

View File

@ -30,7 +30,6 @@ fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os)
target_link_options(myaddin PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage)
target_link_libraries(myaddin Gint::Gint)
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
@ -39,7 +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)
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_G3A)
generate_g3a(TARGET myaddin OUTPUT "MyAddin.g3a"
NAME "MyAddin" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()

View File

@ -1,15 +1,15 @@
# 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)
# Special file selecting an fx-CG target while running fx API code.
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR sh)
# TODO: Use gint's flexible configuration for fx9860g-g3a
# 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_PLATFORM_LONG fx9860G_G3A)
set(FXSDK_TOOLCHAIN sh-elf-)
set(CMAKE_C_COMPILER sh-elf-gcc)
@ -18,6 +18,7 @@ set(CMAKE_CXX_COMPILER sh-elf-g++)
set(CMAKE_C_FLAGS_INIT "")
set(CMAKE_CXX_FLAGS_INIT "")
# set -DFXCG50 and -DTARGET_FXCG50 to get the CG drivers
add_compile_options(-m4-nofpu -mb -ffreestanding -nostdlib -Wa,--dsp -DFXCG50)
add_link_options(-nostdlib -Wl,--no-warn-rwx-segments)
link_libraries(-lgcc)

View File

@ -41,13 +41,10 @@ ${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-fxascg${n} [${R}-c${n}] [${R}-s${n}] [${R}--${n}] \
${R}fxsdk${n} ${R}build-fxg3a${n} [${R}-c${n}] [${R}-s${n}] [${R}--${n}] \
[${g}<ARGS>${n}...]
Builds the current project for fx-CG 50 from a code source initially
targetting the fx-9860G(II). 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).
Builds the current project for fx-CG 50 (.g3a file) from a code source
initially targeting the fx-9860G(II).
${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
@ -135,10 +132,8 @@ 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' or 'fxsdk build-fxascg'"
echo "to compile the program."
echo "Type 'fxsdk build-cg-push' to compile a bin to be send to"
echo "Add-In Push by circuit10"
echo "Type 'fxsdk build-fx' or 'fxsdk build-cg' to compile the program."
echo "Other options are available, see fxsdk --help."
}
fxsdk_load_config() {
@ -149,7 +144,7 @@ fxsdk_load_config() {
fxsdk_build() {
[[ ! -e build-fx && ! -e build-cg && ! -e build-fxascg ]]
[[ ! -e build-fx && ! -e build-cg && ! -e build-fxg3a ]]
none_exists=$?
if [[ -e build-fx || $none_exists == 0 ]]; then
@ -162,9 +157,9 @@ fxsdk_build() {
fxsdk_build_cg "$@"
fi
if [[ -e build-fxascg || $none_exists == 0 ]]; then
echo "$TAG Making into build-fxascg"
fxsdk_build_fxascg "$@"
if [[ -e build-fxg3a || $none_exists == 0 ]]; then
echo "$TAG Making into build-fxg3a"
fxsdk_build_fxg3a "$@"
fi
}
@ -177,8 +172,8 @@ fxsdk_build_cg() {
fxsdk_build_cg_push() {
fxsdk_build_in "cg-push" "FXCG50" "$@"
}
fxsdk_build_fxascg() {
fxsdk_build_in "fxascg" "FX9860G_AS_CG" "$@"
fxsdk_build_fxg3a() {
fxsdk_build_in "fxg3a" "FX9860G_G3A" "$@"
}
fxsdk_build_in() {
@ -241,20 +236,20 @@ fxsdk_build_in() {
}
fxsdk_send() {
if [[ -e "build-fx" && ! -e "build-cg" && ! -e "build-fxascg" ]]; then
if [[ -e "build-fx" && ! -e "build-cg" && ! -e "build-fxg3a" ]]; then
fxsdk_send_fx
fi
if [[ -e "build-cg" && ! -e "build-fx" && ! -e "build-fxascg" ]]; then
if [[ -e "build-cg" && ! -e "build-fx" && ! -e "build-fxg3a" ]]; then
fxsdk_send_cg
fi
if [[ -e "build-fxascg" && ! -e "build-fx" && ! -e "build-cg" ]]; then
fxsdk_send_fxascg
if [[ -e "build-fxg3a" && ! -e "build-fx" && ! -e "build-cg" ]]; then
fxsdk_send_cg
fi
echo "either no or several platforms are targeted, use 'fxsdk send-fx' or"
echo "'fxsdk send-cg' or 'fxsdk send-fxascg' to specify which calculator to send to."
echo "'fxsdk send-cg' to specify which calculator to send to."
}
fxsdk_send_fx() {
@ -290,18 +285,6 @@ fxsdk_send_cg-push() {
fxlink -pw ${bin_files}
}
fxsdk_send_fxascg() {
echo "$TAG Installing for fx-CG using fxlink"
if ! command -v fxlink >/dev/null 2>&1; then
echo "error: fxlink is not installed or not available"
return 1
fi
g3a_files=$(find -maxdepth 1 -name '*.g3a')
echo "$TAG Running: fxlink -sw ${g3a_files}"
fxlink -sw ${g3a_files}
}
fxsdk_path() {
case "$1" in
"sysroot")
@ -335,8 +318,8 @@ case "$1" in
fxsdk_build_cg "${@:2}";;
"build-cg-push"|"bcgp")
fxsdk_build_cg_push "${@:2}";;
"build-fxascg"|"bfxcg"|"bfcg")
fxsdk_build_fxascg "${@:2}";;
"build-fxg3a"|"bf3"|"bfx3")
fxsdk_build_fxg3a "${@:2}";;
# Install
"send"|"s")
@ -345,8 +328,6 @@ case "$1" in
fxsdk_send_fx;;
"send-cg"|"sc"|"scg")
fxsdk_send_cg;;
"send-fxascg"|"sfxcg"|"sfcg")
fxsdk_send_fxascg;;
# Utilities
"path")