Commit 94fa262c authored by Tiago Jorge's avatar Tiago Jorge
Browse files

Brave synthesis in dedicated function. Add Bambu invocation as well just before.

parent 4f174661
......@@ -2589,7 +2589,77 @@ def ApplyPatchForDeploymentViewNeededByOcarinaForNewEllidissTools(depl_aadlFile)
if not any('Taste::version' in x for x in open(depl_aadlFile).readlines()):
mysystem('TASTE-DV --convert-deployment-view "%s"' % depl_aadlFile)
def BraveSynthesisAndHeaderFileGen(bNoBitfile):
if bNoBitfile == False:
bitFileOffset = 0;
savedDir = os.getcwd()
bitFilesHeader = open("auto-src/bravebitfiles.h", "w")
bitFilesHeader.write('''
struct config_bitfile {
char *config;
int offset;
int size;
};
struct config_bitfile bitfiles[] = {''');
for braveMakefile in os.popen("find . -path *VHDL-DESIGN/design/Makefile*"):
os.chdir(os.path.dirname(braveMakefile))
os.environ["NANOXPLORE_BYPASS"] = "x86_64_UBUNTU_16"
with os.popen("make") as pipe:
status = pipe.read().strip()
if "Generating bistream of project succeed" not in status:
bitFilesHeader.close()
panic('Bitfile synthesis failed in "%s"' % os.getcwd())
btfileSize = os.path.getsize('bitfile-swapped.nxb')
os.chdir('../..')
fBlockName = os.path.basename(os.getcwd())[4:]
os.chdir('../../' + fBlockName)
with os.popen("cat mini_cv.aadl | grep -o -P '(?<=FPGA_Configurations => \").*(?=\";)'") as pipe:
configs = pipe.read().strip().split(',')
for config in configs:
bitFilesHeader.write('''
"%s", %s, %s,''' % (config, bitFileOffset, bitFileOffset + btfileSize))
bitFileOffset = bitFileOffset + btfileSize
os.chdir(savedDir)
bitFilesHeader.write('''
"0",0,0
};''')
bitFilesHeader.close()
os.chdir(savedDir)
def CallBambuForBrave(bNoBitfile):
if bNoBitfile == False:
bambuDir = 'Bambu'
successMsg = " " #TODO define
savedDir = os.getcwd()
for bambuFile in os.popen("find . -path *GlueAndBuild/glue*_bambu.c"):
os.chdir(os.path.dirname(bambuFile))
fBlockName = os.path.basename(os.getcwd())[4:]
ifName = os.path.basename(bambuFile)[:-9]
if os.path.exists(bambuDir):
shutil.rmtree(bambuDir)
os.makedirs(bambuDir)
os.chdir(bambuDir)
bambu_cmd = 'bambu ' \
'--compiler=I386_CLANG4 ' \
'-O3 ' + '../' + os.path.basename(bambuFile)[:-1] + ' '\
'-I../../../auto-src/ ' \
'-I../../../' + fBlockName + '/' + fBlockName + '/ ' \
'-DSTATIC="" ' \
'../../../' + fBlockName + '/' + fBlockName + '/' + ifName + '.c ' \
'--top-fname=bambu_' + ifName + ' ' \
'--generate-interface=INFER ' \
'-v4 ' \
'--do-not-expose-globals ' \
'-wH ' \
'--panda-parameter=none-ptrdefault=1 '
with os.popen(bambu_cmd) as pipe:
status = pipe.read().strip()
if successMsg not in status:
panic('Bambu failed in "%s"' % os.getcwd())
os.chdir(savedDir)
os.chdir(savedDir)
def main():
FixEnvVars()
cmdLineInformation = ParseCommandLineArgs()
......@@ -2686,42 +2756,8 @@ def main():
pythonSubsystems = DetectPythonSubsystems()
if bNoBitfile == False:
bitFileOffset = 0;
savedDir = os.getcwd()
bitFilesHeader = open("auto-src/bravebitfiles.h", "w")
bitFilesHeader.write('''
struct config_bitfile {
char *config;
int offset;
int size;
};
struct config_bitfile bitfiles[] = {''');
for braveMakefile in os.popen("find . -path *VHDL-DESIGN/design/Makefile*"):
os.chdir(os.path.dirname(braveMakefile))
os.environ["NANOXPLORE_BYPASS"] = "x86_64_UBUNTU_16"
with os.popen("make") as pipe:
status = pipe.read().strip()
if "Generating bistream of project succeed" not in status:
bitFilesHeader.close()
panic('Bitfile synthesis failed in "%s"' % os.getcwd())
btfileSize = os.path.getsize('bitfile-swapped.nxb')
os.chdir('../..')
fBlockName = os.path.basename(os.getcwd())[4:]
os.chdir('../../' + fBlockName)
with os.popen("cat mini_cv.aadl | grep -o -P '(?<=FPGA_Configurations => \").*(?=\";)'") as pipe:
configs = pipe.read().strip().split(',')
for config in configs:
bitFilesHeader.write('''
"%s", %s, %s,''' % (config, bitFileOffset, bitFileOffset + btfileSize))
bitFileOffset = bitFileOffset + btfileSize
os.chdir(savedDir)
bitFilesHeader.write('''
"0",0,0
};''')
bitFilesHeader.close()
os.chdir(savedDir)
CallBambuForBrave(bNoBitfile)
BraveSynthesisAndHeaderFileGen(bNoBitfile)
BuildSCADEsystems(scadeSubsystems, CDirectories, cflagsSoFar)
BuildSimulinkSystems(simulinkSubsystems, CDirectories, cflagsSoFar, bUseSimulinkMakefiles)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment