mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2025-07-04 11:16:35 +02:00
fxsdk: basic fx-CP support using HH2 as a loader
This commit is contained in:
parent
a443fa59e1
commit
b8f546c67e
6 changed files with 138 additions and 20 deletions
|
@ -33,7 +33,7 @@ syntax (names can contain dots). For example:
|
||||||
|
|
||||||
Some formats differ between platforms so you should specify it when possible:
|
Some formats differ between platforms so you should specify it when possible:
|
||||||
--fx CASIO fx-9860G family (black-and-white calculators)
|
--fx CASIO fx-9860G family (black-and-white calculators)
|
||||||
--cg CASIO fx-CG 50 family (16-bit color calculators)
|
--cg, --cp CASIO fx-CG 50 / fx-CP 400 family (16-bit color calcs)
|
||||||
|
|
||||||
Finally, there is some support (non-final) for PythonExtra, in which case the
|
Finally, there is some support (non-final) for PythonExtra, in which case the
|
||||||
output file is as Python file instead of an object file.
|
output file is as Python file instead of an object file.
|
||||||
|
@ -76,7 +76,7 @@ def main():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
longs = ["help", "output=", "toolchain=", "arch=", "section=", "fx",
|
longs = ["help", "output=", "toolchain=", "arch=", "section=", "fx",
|
||||||
"cg", "converters=", "py", "py-compact"] + types.split()
|
"cg", "cp", "converters=", "py", "py-compact"] + types.split()
|
||||||
opts, args = getopt.gnu_getopt(sys.argv[1:], "hsbifo:", longs)
|
opts, args = getopt.gnu_getopt(sys.argv[1:], "hsbifo:", longs)
|
||||||
except getopt.GetoptError as error:
|
except getopt.GetoptError as error:
|
||||||
return err(error)
|
return err(error)
|
||||||
|
@ -90,6 +90,8 @@ def main():
|
||||||
output = value
|
output = value
|
||||||
elif name in [ "--fx", "--cg" ]:
|
elif name in [ "--fx", "--cg" ]:
|
||||||
model = name[2:]
|
model = name[2:]
|
||||||
|
elif name == "--cp":
|
||||||
|
model = "cg"
|
||||||
elif name == "--toolchain":
|
elif name == "--toolchain":
|
||||||
target['toolchain'] = value
|
target['toolchain'] = value
|
||||||
elif name == "--arch":
|
elif name == "--arch":
|
||||||
|
|
|
@ -6,6 +6,7 @@ project(MyAddin)
|
||||||
|
|
||||||
include(GenerateG1A)
|
include(GenerateG1A)
|
||||||
include(GenerateG3A)
|
include(GenerateG3A)
|
||||||
|
include(GenerateHH2Bin)
|
||||||
include(Fxconv)
|
include(Fxconv)
|
||||||
find_package(Gint 2.9 REQUIRED)
|
find_package(Gint 2.9 REQUIRED)
|
||||||
|
|
||||||
|
@ -41,4 +42,6 @@ elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_G3A)
|
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_G3A)
|
||||||
generate_g3a(TARGET myaddin OUTPUT "MyAddin-fx.g3a"
|
generate_g3a(TARGET myaddin OUTPUT "MyAddin-fx.g3a"
|
||||||
NAME "MyAddin-fx" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
NAME "MyAddin-fx" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
||||||
|
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCP)
|
||||||
|
generate_hh2_bin(TARGET myaddin OUTPUT "MyAddin-hh2.bin")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# Build files
|
# Build files
|
||||||
/build-fx
|
/build*/
|
||||||
/build-cg
|
|
||||||
/build-cg-push
|
|
||||||
/build-fxg3a
|
|
||||||
/*.g1a
|
/*.g1a
|
||||||
/*.g3a
|
/*.g3a
|
||||||
|
|
||||||
|
|
56
fxsdk/cmake/FXCP.cmake
Normal file
56
fxsdk/cmake/FXCP.cmake
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
# fxSDK toolchain file for Casio graphing calculators
|
||||||
|
# Models: fx-CP 400
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
set(FXSDK_PLATFORM cp)
|
||||||
|
set(FXSDK_PLATFORM_LONG fxCP)
|
||||||
|
|
||||||
|
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_FXCP)
|
||||||
|
|
||||||
|
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)
|
36
fxsdk/cmake/GenerateHH2Bin.cmake
Normal file
36
fxsdk/cmake/GenerateHH2Bin.cmake
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
include(FxsdkUtils)
|
||||||
|
|
||||||
|
function(generate_hh2_bin)
|
||||||
|
cmake_parse_arguments(HH2 "" "TARGET;OUTPUT" "" ${ARGN})
|
||||||
|
|
||||||
|
# Check arguments
|
||||||
|
|
||||||
|
if(DEFINED HH2_UNPARSED_ARGUMENTS)
|
||||||
|
message(FATAL_ERROR "generate_hh2_bin: Unrecognized arguments ${HH2_UNPARSED_ARGUMENTS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED HH2_TARGET)
|
||||||
|
message(FATAL_ERROR "generate_hh2_bin: TARGET argument is required")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find output file name
|
||||||
|
|
||||||
|
if(DEFINED HH2_OUTPUT)
|
||||||
|
get_filename_component(HH2_OUTPUT "${HH2_OUTPUT}" ABSOLUTE
|
||||||
|
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
shell_escape("${HH2_OUTPUT}" HH2_OUTPUT)
|
||||||
|
else()
|
||||||
|
set(HH2_OUTPUT "${HH2_TARGET}-hh2.bin")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Generate objcopy command
|
||||||
|
|
||||||
|
string(REPLACE "gcc" "objcopy" OBJCOPY "${CMAKE_C_COMPILER}")
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
TARGET "${HH2_TARGET}" POST_BUILD
|
||||||
|
COMMAND ${OBJCOPY} -O binary -R .bss -R .gint_bss ${HH2_TARGET} ${HH2_OUTPUT}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
COMMAND_EXPAND_LISTS
|
||||||
|
)
|
||||||
|
endfunction()
|
|
@ -22,7 +22,7 @@ ${R}fxsdk new${n} ${g}<FOLDER>${n} [${R}--makefile${n}|${R}--cmake${n}] \
|
||||||
Create a new project in the specified folder. The default build system is
|
Create a new project in the specified folder. The default build system is
|
||||||
CMake. Project name can be specified now or in the project files later.
|
CMake. Project name can be specified now or in the project files later.
|
||||||
|
|
||||||
${R}fxsdk${n} (${R}build${n}|${R}build-fx${n}|${R}build-cg${n}) [${R}-c${n}] \
|
${R}fxsdk${n} (${R}build${n}|${R}build-fx${n}|${R}build-cg${n}|${R}build-cp${n}) [${R}-c${n}] \
|
||||||
[${R}-s${n}] [${R}--${n}] [${g}<ARGS>${n}...]
|
[${R}-s${n}] [${R}--${n}] [${g}<ARGS>${n}...]
|
||||||
Build the current project for fx-9860G (usually for .g1a add-ins) or fx-CG 50
|
Build the current project for fx-9860G (usually for .g1a add-ins) or fx-CG 50
|
||||||
(usually for .g3a add-ins). The first form compiles in every existing build
|
(usually for .g3a add-ins). The first form compiles in every existing build
|
||||||
|
@ -46,7 +46,7 @@ ${R}fxsdk${n} ${R}build-fxg3a${n} [${R}-c${n}] [${R}-s${n}] [${R}--${n}] \
|
||||||
Builds the current project for fx-CG 50 (.g3a file) from a code source
|
Builds the current project for fx-CG 50 (.g3a file) from a code source
|
||||||
initially targeting the fx-9860G(II).
|
initially targeting the fx-9860G(II).
|
||||||
|
|
||||||
${R}fxsdk${n} (${R}send${n}|${R}send-fx${n}|${R}send-cg${n})
|
${R}fxsdk${n} (${R}send${n}|${R}send-fx${n}|${R}send-cg${n}|${R}send-cp${n})
|
||||||
Sends the target file to the calculator. Uses p7 (which must be installed
|
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,
|
externally) for the fx-9860G, and fxlink for the fx-CG. For the G-III series,
|
||||||
call fxlink directly instead of this command.
|
call fxlink directly instead of this command.
|
||||||
|
@ -150,7 +150,7 @@ fxsdk_load_config() {
|
||||||
|
|
||||||
|
|
||||||
fxsdk_build() {
|
fxsdk_build() {
|
||||||
[[ ! -e build-fx && ! -e build-cg && ! -e build-fxg3a ]]
|
[[ ! -e build-fx && ! -e build-cg && ! -e build-fxg3a && ! -e build-cp ]]
|
||||||
none_exists=$?
|
none_exists=$?
|
||||||
|
|
||||||
if [[ -e build-fx || $none_exists == 0 ]]; then
|
if [[ -e build-fx || $none_exists == 0 ]]; then
|
||||||
|
@ -167,6 +167,11 @@ fxsdk_build() {
|
||||||
echo "$TAG Making into build-fxg3a"
|
echo "$TAG Making into build-fxg3a"
|
||||||
fxsdk_build_fxg3a "$@"
|
fxsdk_build_fxg3a "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -e build-cp || $none_exists == 0 ]]; then
|
||||||
|
echo "$TAG Making into build-cp"
|
||||||
|
fxsdk_build_cp "$@"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
fxsdk_build_fx() {
|
fxsdk_build_fx() {
|
||||||
|
@ -181,6 +186,9 @@ fxsdk_build_cg_push() {
|
||||||
fxsdk_build_fxg3a() {
|
fxsdk_build_fxg3a() {
|
||||||
fxsdk_build_in "fxg3a" "FX9860G_G3A" "$@"
|
fxsdk_build_in "fxg3a" "FX9860G_G3A" "$@"
|
||||||
}
|
}
|
||||||
|
fxsdk_build_cp() {
|
||||||
|
fxsdk_build_in "cp" "FXCP" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
fxsdk_build_in() {
|
fxsdk_build_in() {
|
||||||
platform="$1"
|
platform="$1"
|
||||||
|
@ -242,20 +250,21 @@ fxsdk_build_in() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fxsdk_send() {
|
fxsdk_send() {
|
||||||
if [[ -e "build-fx" && ! -e "build-cg" && ! -e "build-fxg3a" ]]; then
|
fx=$([[ ! -e "build-fx" ]]; echo $?)
|
||||||
fxsdk_send_fx
|
cg=$([[ ! -e "build-cg" ]]; echo $?)
|
||||||
fi
|
f3=$([[ ! -e "build-fxg3a" ]]; echo $?)
|
||||||
|
cp=$([[ ! -e "build-cp" ]]; echo $?)
|
||||||
|
e=${fx}${cg}${f3}${cp}
|
||||||
|
|
||||||
if [[ -e "build-cg" && ! -e "build-fx" && ! -e "build-fxg3a" ]]; then
|
[[ $e = 1000 ]] && fxsdk_send_fx
|
||||||
fxsdk_send_cg
|
[[ $e = 0100 ]] && fxsdk_send_cg
|
||||||
fi
|
[[ $e = 0010 ]] && fxsdk_send_cg
|
||||||
|
[[ $e = 0001 ]] && fxsdk_send_cp
|
||||||
|
|
||||||
if [[ -e "build-fxg3a" && ! -e "build-fx" && ! -e "build-cg" ]]; then
|
if [[ $(($fx + $cg + $f3 + $cp)) != 1 ]]; then
|
||||||
fxsdk_send_cg
|
echo "either no or several platforms are targeted, use 'fxsdk send-*' to"
|
||||||
|
echo "specify which calculator to send to."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "either no or several platforms are targeted, use 'fxsdk send-fx' or"
|
|
||||||
echo "'fxsdk send-cg' to specify which calculator to send to."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fxsdk_send_fx() {
|
fxsdk_send_fx() {
|
||||||
|
@ -295,6 +304,17 @@ fxsdk_send_fxg3a() {
|
||||||
fxsdk_send_cg "$@"
|
fxsdk_send_cg "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fxsdk_send_cp() {
|
||||||
|
echo "$TAG Installing for fx-CP using fxlink"
|
||||||
|
if ! command -v fxlink >/dev/null 2>&1; then
|
||||||
|
echo "error: fxlink is not installed or not available"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
hh2_bin_files=$(find -maxdepth 1 -name '*-hh2.bin')
|
||||||
|
echo "$TAG Running: fxlink -sw ${hh2_bin_files}"
|
||||||
|
fxlink -sw ${hh2_bin_files}
|
||||||
|
}
|
||||||
|
|
||||||
fxsdk_path() {
|
fxsdk_path() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"sysroot")
|
"sysroot")
|
||||||
|
@ -330,6 +350,8 @@ case "$1" in
|
||||||
fxsdk_build_cg_push "${@:2}";;
|
fxsdk_build_cg_push "${@:2}";;
|
||||||
"build-fxg3a"|"bf3"|"bfx3")
|
"build-fxg3a"|"bf3"|"bfx3")
|
||||||
fxsdk_build_fxg3a "${@:2}";;
|
fxsdk_build_fxg3a "${@:2}";;
|
||||||
|
"build-cp"|"bcp")
|
||||||
|
fxsdk_build_cp "${@:2}";;
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
"send"|"s")
|
"send"|"s")
|
||||||
|
@ -338,6 +360,8 @@ case "$1" in
|
||||||
fxsdk_send_fx;;
|
fxsdk_send_fx;;
|
||||||
"send-cg"|"sc"|"scg")
|
"send-cg"|"sc"|"scg")
|
||||||
fxsdk_send_cg;;
|
fxsdk_send_cg;;
|
||||||
|
"send-cp"|"scp")
|
||||||
|
fxsdk_send_cp;;
|
||||||
|
|
||||||
# Utilities
|
# Utilities
|
||||||
"gdb")
|
"gdb")
|
||||||
|
|
Loading…
Add table
Reference in a new issue