diff --git a/distro/f256-install-linux.sh b/distro/f256-install-linux.sh index 20c5267..aed971e 100755 --- a/distro/f256-install-linux.sh +++ b/distro/f256-install-linux.sh @@ -29,21 +29,36 @@ LOCAL1=llvm-mos-linux.tar.xz REMOTE2=https://kangaroopunch.com/files/serve/shared/llvm-mos-f256.tar.xz LOCAL2=llvm-mos-f256.tar.xz +REMOTE3=https://github.com/pweingar/FoenixMgr/archive/refs/heads/master.zip +LOCAL3=master.zip + if [[ -d $(basename -s .tar.xz ${LOCAL1}) ]]; then echo "You already have an llvm-mos directory. Exiting." exit 1 fi +PYTHON=$(which pythonx) +if [[ $? != 0 ]]; then + echo "Unable to find Python. Exiting." +fi + +PIP=$(which pip) +if [[ $? != 0 ]]; then + echo "Unable to find pip. Exiting." +fi + CURL=$(which curl) if [[ $? == 0 ]]; then ${CURL} -L ${REMOTE1} > ${LOCAL1} ${CURL} -L ${REMOTE2} > ${LOCAL2} + ${CURL} -L ${REMOTE3} > ${LOCAL3} else WGET=$(which wget) if [[ $? == 0 ]]; then wget ${REMOTE1} wget ${REMOTE2} + wget ${REMOTE3} else echo "Unable to locate curl or wget. Exiting." exit 1 @@ -51,7 +66,42 @@ else fi tar xf ${LOCAL1} -rm ${LOCAL1} - tar xf ${LOCAL2} +unzip -o ${LOCAL3} + +rm ${LOCAL1} rm ${LOCAL2} +rm ${LOCAL3} + +rm -f overlay.windows +rm -f overlay.macos +mv overlay.linux overlay + +rm -f *.bat + +mv FoenixMgr-master FoenixMgr +pushd FoenixMgr + pip install -r requirements.txt +popd + +echo "[DEFAULT]" > foenixmgr.ini +echo "port=/dev/ttyUSB0" >> foenixmgr.ini +echo "labels=sample.lbl" >> foenixmgr.ini +echo "flash_address=380000" >> foenixmgr.ini +echo "chunk_size=1024" >> foenixmgr.ini +echo "cpu=65c02" >> foenixmgr.ini + +pushd llvm-mos/bin + ln -s mos-clang++ mos-f256-clang++ + ln -s mos-clang-cpp mos-f256-clang-cpp + ln -s mos-clang mos-f256-clang +popd + +echo +echo ----------------------------------------------------------------------------- +echo Installation complete! +echo +echo Please visit https://github.com/pweingar/FoenixMgr to learn how to configure +echo FoenixMgr for your machine. Edit the foenixmgr.ini file in this directory. +echo ----------------------------------------------------------------------------- +echo diff --git a/distro/f256-install-windows.bat b/distro/f256-install-windows.bat index ed408ef..c7f437a 100644 --- a/distro/f256-install-windows.bat +++ b/distro/f256-install-windows.bat @@ -64,7 +64,7 @@ if errorlevel 1 ( ) where /q pip.exe if errorlevel 1 ( - echo Unable to find Python. Exiting. + echo Unable to find pip. Exiting. exit /B ) @@ -81,7 +81,7 @@ if errorlevel 1 ( bitsadmin.exe /transfer GoGoWindows /download /priority normal %REMOTE4% "%~dp0%LOCAL4%" ) ) else ( - curl.exe -L %REMOTE1% > %LOCAL1% + curl.exe -L %REMOTE1% > %LOCAL1% curl.exe -L %REMOTE2% > %LOCAL2% curl.exe -L %REMOTE3% > %LOCAL3% curl.exe -L %REMOTE4% > %LOCAL4% @@ -120,21 +120,12 @@ echo @"%%~dp0mos-clang++.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256- echo @"%%~dp0mos-clang-cpp.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256-clang-cpp.bat echo @"%%~dp0mos-clang.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256-clang.bat -call mos-f256-clang.bat --version > NUL 2> NUL -if %ERRORLEVEL% equ 0 goto dontaddpath -setx PATH "%PATH%;%~dp0llvm-mos\bin" -set PATH=%PATH%;%~dp0llvm-mos\bin -:dontaddpath - echo. echo ----------------------------------------------------------------------------- echo Installation complete! echo. echo Please visit https://github.com/pweingar/FoenixMgr to learn how to configure echo FoenixMgr for your machine. Edit the foenixmgr.ini file in this directory. -echo. -echo NOTE: The following has been added to your PATH: -echo %~dp0llvm-mos\bin echo ----------------------------------------------------------------------------- echo. pause diff --git a/distro/f256build.bat b/distro/f256build.bat index 63d0557..d5a6744 100644 --- a/distro/f256build.bat +++ b/distro/f256build.bat @@ -51,6 +51,8 @@ pushd "%PROJECT%" cd .builddir "%ROOT%\overlay.exe" 5 "%BUILD%" "%SOURCE%" if not exist "%PROJECT%\f256.ld" copy /y "%ROOT%\llvm-mos\mos-platform\f256\lib\link.ld" "%PROJECT%\f256.ld" > NUL + set OLDPATH=%PATH% + set PATH=%~dp0llvm-mos\bin;%PATH% call mos-f256-clang.bat -T ..\f256.ld -Wl,-Map=%NAME%.map -o %NAME% -I"%ROOT%" -Os -Wall -lm *.c if errorlevel 1 goto failed ren %NAME% %NAME%.pgz @@ -59,4 +61,6 @@ pushd "%PROJECT%" python.exe %ROOT%\pgz-thunk.py %NAME%.pgz move %NAME%.pgz ..\. > NUL :failed + set PATH=%OLDPATH% + set OLDPATH= popd diff --git a/distro/f256build.sh b/distro/f256build.sh new file mode 100755 index 0000000..18b212d --- /dev/null +++ b/distro/f256build.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# +# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + + +ROOT=$(pwd) + +if [[ -z ${1} ]]; then + echo No project folder provided. + exit 1 +fi + +if ! compgen -G "${1}/src/*.c" > /dev/null; then + echo No src folder containing C files found. + exit 1 +fi + +PROJECT=${ROOT}/${1} +SOURCE=${PROJECT}/src +BUILD=${PROJECT}/.builddir +NAME=$(basename ${PROJECT}) +pushd "${PROJECT}" > /dev/null + if [[ -d .builddir ]]; then + rm -rf .builddir + fi + mkdir -p .builddir + cd .builddir + "${ROOT}/overlay" 5 "${BUILD}" "${SOURCE}" + if [[ ! -f "${PROJECT}/f256.ld" ]]; then + cp -f "${ROOT}/llvm-mos/mos-platform/f256/lib/link.ld" "${PROJECT}/f256.ld" + fi + export PATH=${ROOT}/llvm-mos/bin:${PATH} + mos-f256-clang -T ../f256.ld -Wl,-Map=${NAME}.map -o ${NAME} -I"${ROOT}" -Os -Wall -lm *.c + if [[ $? == 0 ]]; then + mv ${NAME} ${NAME}.pgz + llvm-nm ${NAME}.elf > ${NAME}.sym + llvm-objdump --syms -d --print-imm-hex ${NAME}.elf > ${NAME}.lst + python ${ROOT}/pgz-thunk.py ${NAME}.pgz + mv ${NAME}.pgz ../. + fi +popd > /dev/null diff --git a/distro/f256run.sh b/distro/f256run.sh new file mode 100755 index 0000000..57a7ce1 --- /dev/null +++ b/distro/f256run.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# +# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + + +ROOT=$(pwd) + +if [[ -z ${1} ]]; then + echo "No project folder provided." + exit 1 +fi + +PROJECT=${ROOT}/${1} +NAME=$(basename ${PROJECT}) +if [[ ! -f "${PROJECT}/${NAME}.pgz" ]]; then + echo "No PGZ found." + exit 1 +fi + +python "${ROOT}/FoenixMgr/FoenixMgr/fnxmgr.py" --boot FLASH +python "${ROOT}/FoenixMgr/FoenixMgr/fnxmgr.py" --run-pgz "${PROJECT}/${NAME}.pgz"