# This script should be located in the I2Cboot_3core directory, with
# input, interm, and output directories below it.
# Linux version

# preparation for build
rm -f interm/*.*
cd input

# generate the boot table in big endian format
../../Utilities/hex6x core0.rmd
../../Utilities/hex6x core1.rmd
../../Utilities/hex6x core2.rmd

# merge all boot tables into one big boot table
../../Utilities/mergebtbl core0.btbl core1.btbl core2.btbl simple.btbl

../../Utilities/bconvert64x -le simple.btbl simple.btbl.be
../../Utilities/b2i2c simple.btbl.be simple.btbl.i2c
../../Utilities/b2ccs simple.btbl.i2c simple.i2c.ccs

# generate the complete I2C image(I2C parameter + boot table)
../../Utilities/myparser simple.i2c.ccs i2cconfig.txt i2cromfara.ccs

# output file
mv i2cromfara.ccs ../output

# intermediate files
mv *.btbl ../interm
mv *.btbl.be ../interm
mv *.btbl.i2c ../interm
mv *.i2c.ccs ../interm

# display the output files
cd ..
ls -al output
