Streamlined shell script (rc eval)

master
kaqu 2 years ago
parent 82f396bb8e
commit d6c55c076b
  1. 55
      software/ramcreate.sh

@ -55,46 +55,59 @@ INCLUDES="-I$SOC_DIRECTORY/software/include/base -I$SOC_DIRECTORY/software/inclu
COMMONFLAGS="-O0 $CPUFLAGS -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $INCLUDES"
CFLAGS="-fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes"
LDFLAGS="-nostdlib -nodefaultlibs -L$BUILDINC_DIRECTORY"
echo "--"
echo "calling gcc with: -c $COMMONFLAGS $CFLAGS -Wa,-fPIC for $1 & $2"
#$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc -O0 -S -nostdinc $COMMONFLAGS $INCLUDES -Wa,-fPIC source/$1.c
echo "Compiling ..."
$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc -c $COMMONFLAGS $CFLAGS -Wa,-fPIC source/$2.c -o build/$2.o
if [ $? -ne 0 ];
then
echo "*** gcc for $2.c failed!"
exit $?
fi
$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc -c $COMMONFLAGS $CFLAGS -Wa,-fPIC source/$1.c -o build/$1.o
if [ $? -ne 0 ];
then
echo "*** gcc for $1.c failed!"
exit $?
fi
$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc -c $COMMONFLAGS $CFLAGS -Wa,-fPIC source/my_vsnprintf.c -o build/my_vsnprintf.o
#$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc -c $COMMONFLAGS $CFLAGS -Wa,-fPIC source/my_printf.c -o build/my_printf.o
echo "--"
echo "calling ld for RAM bank #$3 with: $LDFLAGS $OBJECTS build/$2.o build/$1.o build/my_vsnprintf.o lib/rv32ilibm.a lib/rv32ilibgcc.a -o build/$1.bin"
# /home/kln/fpga/litex/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/riscv64-unknown-elf/lib/rv32i/ilp32 <-- libs
# /home/kln/fpga/litex/litex-boards/litex_boards/targets/build/colorlight_5a_75b/software/libbase <-- board specific
#$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-ld $LDFLAGS -T linker/ram$3.ld -N $CRT0 $OBJECTS $LXR build/$2.o build/$1.o lib/rv32ilibgcc.a -o build/$1.elf
if [ $? -ne 0 ];
then
echo "*** gcc for my_vsnprintf.c failed!"
exit $?
fi
echo "Linking ..."
$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-ld $LDFLAGS -T linker/ram$3.ld -N $CRT0 $OBJECTS $LXR build/$2.o build/$1.o build/my_vsnprintf.o lib/rv32ilibm.a lib/rv32ilibgcc.a -o build/$1.elf
#$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-ld $LDFLAGS -T linker/ram$3.ld -N $CRT0 $OBJECTS $LXR build/$2.o build/$1.o build/my_printf.o lib/rv32ilibm.a lib/rv32ilibgcc.a -o build/$1.elf
echo "--"
echo "creating raw binary from elf-file"
if [ $? -ne 0 ];
then
echo "*** Link/Loader for build/$1.elf failed!"
exit $?
fi
if [ "$3" = "1" ]; then
echo "for bank #1"
echo "-> bank #1"
$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/riscv64-unknown-elf/bin/objcopy -O binary -S --image-base 0x40000000 build/$1.elf build/$1.bin
else
echo "for bank #2"
echo "-> bank #2"
$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/riscv64-unknown-elf/bin/objcopy -O binary -S --image-base 0x40200000 build/$1.elf build/$1.bin
fi
#echo "--"
#echo "creating disassembly dump build/$1.dis"
#$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-objdump -D -b binary build/$1.bin -m riscv >build/$1.dis
echo "--"
echo "Creating flashable image"
echo "Creating flashable image ..."
python3 -m litex.soc.software.mkmscimg build/$1.bin --little --fbi --output build/$1.img
#<<<--- TEST ONLY!
#cp build/$1.bin build/$1.img
echo "--"
echo "loading build/$1.bin to RAM base via wishbone-tool"
echo "Loading build/$1.bin to RAM bank #$3 via wishbone-tool (make sure, other terminal has stopped!)"
if [ "$3" = "1" ]; then
echo "for bank #1"
$MY_LOCAL_FOMU_PATH/fomu-toolchain-linux_x86_64-v1.5.6/bin/wishbone-tool --ethernet-host 192.168.1.20 --server load-file --csr-csv ../build/csr.csv --load-address 0x40000000 --load-name build/$1.bin
else
echo "for bank #2"
$MY_LOCAL_FOMU_PATH/fomu-toolchain-linux_x86_64-v1.5.6/bin/wishbone-tool --ethernet-host 192.168.1.20 --server load-file --csr-csv ../build/csr.csv --load-address 0x40200000 --load-name build/$1.bin
fi
if [ $? -ne 0 ];
then
echo "*** wishbone-tool load failed!"
exit $?
fi
#echo "--"
#echo "Connecting to remote terminal w/ wishbone-tool (press ESC to terminate ...)"
#$MY_LOCAL_FOMU_PATH/fomu-toolchain-linux_x86_64-v1.5.6/bin/wishbone-tool --ethernet-host 192.168.1.20 --server terminal --csr-csv ../build/csr.csv

Loading…
Cancel
Save