Linux build added.

This commit is contained in:
Scott Duensing 2024-05-01 14:02:02 -05:00
parent 45ead870a1
commit 61dc4de41c
5 changed files with 160 additions and 13 deletions

View file

@ -29,21 +29,36 @@ LOCAL1=llvm-mos-linux.tar.xz
REMOTE2=https://kangaroopunch.com/files/serve/shared/llvm-mos-f256.tar.xz REMOTE2=https://kangaroopunch.com/files/serve/shared/llvm-mos-f256.tar.xz
LOCAL2=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 if [[ -d $(basename -s .tar.xz ${LOCAL1}) ]]; then
echo "You already have an llvm-mos directory. Exiting." echo "You already have an llvm-mos directory. Exiting."
exit 1 exit 1
fi 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) CURL=$(which curl)
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
${CURL} -L ${REMOTE1} > ${LOCAL1} ${CURL} -L ${REMOTE1} > ${LOCAL1}
${CURL} -L ${REMOTE2} > ${LOCAL2} ${CURL} -L ${REMOTE2} > ${LOCAL2}
${CURL} -L ${REMOTE3} > ${LOCAL3}
else else
WGET=$(which wget) WGET=$(which wget)
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
wget ${REMOTE1} wget ${REMOTE1}
wget ${REMOTE2} wget ${REMOTE2}
wget ${REMOTE3}
else else
echo "Unable to locate curl or wget. Exiting." echo "Unable to locate curl or wget. Exiting."
exit 1 exit 1
@ -51,7 +66,42 @@ else
fi fi
tar xf ${LOCAL1} tar xf ${LOCAL1}
rm ${LOCAL1}
tar xf ${LOCAL2} tar xf ${LOCAL2}
unzip -o ${LOCAL3}
rm ${LOCAL1}
rm ${LOCAL2} 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

View file

@ -64,7 +64,7 @@ if errorlevel 1 (
) )
where /q pip.exe where /q pip.exe
if errorlevel 1 ( if errorlevel 1 (
echo Unable to find Python. Exiting. echo Unable to find pip. Exiting.
exit /B exit /B
) )
@ -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-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 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 ----------------------------------------------------------------------------- echo -----------------------------------------------------------------------------
echo Installation complete! echo Installation complete!
echo. echo.
echo Please visit https://github.com/pweingar/FoenixMgr to learn how to configure 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 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 -----------------------------------------------------------------------------
echo. echo.
pause pause

View file

@ -51,6 +51,8 @@ pushd "%PROJECT%"
cd .builddir cd .builddir
"%ROOT%\overlay.exe" 5 "%BUILD%" "%SOURCE%" "%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 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 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 if errorlevel 1 goto failed
ren %NAME% %NAME%.pgz ren %NAME% %NAME%.pgz
@ -59,4 +61,6 @@ pushd "%PROJECT%"
python.exe %ROOT%\pgz-thunk.py %NAME%.pgz python.exe %ROOT%\pgz-thunk.py %NAME%.pgz
move %NAME%.pgz ..\. > NUL move %NAME%.pgz ..\. > NUL
:failed :failed
set PATH=%OLDPATH%
set OLDPATH=
popd popd

61
distro/f256build.sh Executable file
View file

@ -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

41
distro/f256run.sh Executable file
View file

@ -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"