Added scripts to build/use a local copy of sdcc version 4.2.0.

This commit is contained in:
Skip Hansen
2023-11-03 16:21:02 -07:00
parent 246b234b22
commit a24bccd1af
6 changed files with 116 additions and 1 deletions

2
.gitignore vendored
View File

@@ -23,3 +23,5 @@
*.bin
*.lk
*.o
sdcc/sdcc

View File

@@ -61,7 +61,7 @@ After programming the ESP32, make sure to also program the filesystem. This will
## Hints and excuses:
- There is no warranty whatsoever. Nothing. Not implied or otherwise suggested. This code isn't fit for anything. Please don't use this code to do nasty things.
- Do a ```make clean``` between building for different boards. It really helps!
- This repo builds on SDCC 4.2.0 for Linux. Different SDCC versions can behave VERY differently.
- This repo builds on SDCC 4.2.0 for Linux. Different SDCC versions can behave VERY differently. Source sdcc/setup.sh to setup build a local copy and use it for compiling.
- We are happy and honored to see your pull requests! But please, no code/indent style changes :)
## Credits

34
sdcc/README.md Executable file

File diff suppressed because one or more lines are too long

34
sdcc/build_sdcc.sh Executable file
View File

@@ -0,0 +1,34 @@
#/bin/sh
# build local version of sdcc 4.2.0 from source
SDCC_VER=4.2.0
if [ ! -e sdcc ]; then
git clone https://github.com/swegener/sdcc.git
if [ $? -ne 0 ]; then
echo "Couldn't clone https://github.com/swegener/sdcc.git"
exit 1
fi
fi
cd sdcc
git tag 4.2.0 56dc646f8ba6d37c039c5e0c3e60b1340da65b9f
git checkout ${SDCC_VER}
if [ $? -ne 0 ]; then
echo "Couldn't checkout ${SDCC_VER} source from git"
exit 1
fi
./configure --prefix=`pwd`/${SDCC_VER} --disable-z80-port --disable-z180-port --disable-r2k-port --disable-r2ka-port --disable-r3ka-port --disable-sm83-port --disable-tlcs90-port --disable-ez80_z80-port --disable-z80n-port --disable-ds390-port --disable-ds400-port --disable-pic14-port --disable-pic16-port --disable-hc08-port --disable-s08-port --disable-stm8-port --disable-pdk13-port --disable-pdk14-port --disable-pdk15-port --disable-pdk16-port --disable-mos6502-port --disable-mos65c02-port 2>&1 | tee build.log
make -j8 2>&1 | tee -a build.log
if [ $? -ne 0 ]; then
echo "sdcc make failed see ./sdcc/build.log for details"
exit 1
fi
make -j8 install 2>&1 | tee -a build.log
if [ $? -ne 0 ]; then
echo "sdcc make install failed see ./sdcc/build.log for details"
exit 1
fi

26
sdcc/setup.sh Executable file
View File

@@ -0,0 +1,26 @@
#/bin/sh
# set environment variables to use locally built sdcc version 4.2.0
#set -x
SDCC_VER=4.2.0
if [ "${BASH_SOURCE[0]}" -ef "$0" ]; then
echo "This script must be SOURCED, not run directly (source $0)."
exit 1
fi
SDCC_DIR=`dirname ${BASH_SOURCE[0]}`
if [ ! -e ${SDCC_DIR}/sdcc/${SDCC_VER} ]; then
(cd ${SDCC_DIR};./build_sdcc.sh)
fi
export CC=sdcc
SDCC_PATH=${SDCC_DIR}/sdcc/${SDCC_VER}/bin
echo $PATH | grep ${SDCC_PATH} > /dev/null
if [ $? -ne 0 ]; then
export SDCC_PATH_SAVE=$PATH
export PATH=${SDCC_PATH}:$PATH
echo "Added ${SDCC_PATH} to PATH"
fi

19
sdcc/unset.sh Executable file
View File

@@ -0,0 +1,19 @@
#/bin/sh
# set environment variables to use locally built sdcc version 4.2.0
#set -x
SDCC_VER=4.2.0
if [ "${BASH_SOURCE[0]}" -ef "$0" ]; then
echo "This script must be SOURCED, not run directly (source $0)."
exit 1
fi
SDCC_DIR=`dirname ${BASH_SOURCE[0]}`
SDCC_PATH=${SDCC_DIR}/sdcc/${SDCC_VER}/bin
echo $PATH | grep ${SDCC_PATH} > /dev/null
if [ ! "${SDCC_PATH_SAVE}x" = "x" ]; then
export PATH=${SDCC_PATH_SAVE}
export SDCC_PATH_SAVE=
export CC=
fi