-- Well known name table entries. -- Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold -- -- GHDL is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free -- Software Foundation; either version 2, or (at your option) any later -- version. -- -- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- -- You should have received a copy of the GNU General Public License -- along with GCC; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Name_Table; with Tokens; use Tokens; package body Std_Names is procedure Std_Names_Initialize is function GI (S : String) return Name_Id renames Name_Table.Get_Identifier; -- function GI (S : String) return Name_Id is -- begin -- Ada.Text_IO.Put_Line ("add " & S); -- return Name_Table.Get_Identifier (S); -- end GI; begin Name_Table.Initialize; -- Create keywords. for I in Tok_Mod .. Tok_Protected loop if GI (Image (I)) /= Name_First_Keyword + Token_Type'Pos (I) - Token_Type'Pos (Tok_First_Keyword) then raise Program_Error; end if; end loop; -- Create operators. if GI ("=") /= Name_Op_Equality or GI ("/=") /= Name_Op_Inequality or GI ("<") /= Name_Op_Less or GI ("<=") /= Name_Op_Less_Equal or GI (">") /= Name_Op_Greater or GI (">=") /= Name_Op_Greater_Equal or GI ("+") /= Name_Op_Plus or GI ("-") /= Name_Op_Minus or GI ("*") /= Name_Op_Mul or GI ("/") /= Name_Op_Div or GI ("**") /= Name_Op_Exp or GI ("&") /= Name_Op_Concatenation then raise Program_Error; end if; -- Create Attributes. if GI ("base") /= Name_Base or GI ("left") /= Name_Left or GI ("right") /= Name_Right or GI ("high") /= Name_High or GI ("low") /= Name_Low or GI ("pos") /= Name_Pos or GI ("val") /= Name_Val or GI ("succ") /= Name_Succ or GI ("pred") /= Name_Pred or GI ("leftof") /= Name_Leftof or GI ("rightof") /= Name_Rightof or GI ("reverse_range") /= Name_Reverse_Range or GI ("length") /= Name_Length or GI ("delayed") /= Name_Delayed or GI ("stable") /= Name_Stable or GI ("quiet") /= Name_Quiet or GI ("transaction") /= Name_Transaction or GI ("event") /= Name_Event or GI ("active") /= Name_Active or GI ("last_event") /= Name_Last_Event or GI ("last_active") /= Name_Last_Active or GI ("last_value") /= Name_Last_Value or GI ("behavior") /= Name_Behavior or GI ("structure") /= Name_Structure or GI ("ascending") /= Name_Ascending or GI ("image") /= Name_Image or GI ("value") /= Name_Value or GI ("driving") /= Name_Driving or GI ("driving_value") /= Name_Driving_Value or GI ("simple_name") /= Name_Simple_Name or GI ("instance_name") /= Name_Instance_Name or GI ("path_name") /= Name_Path_Name then raise Program_Error; end if; -- Create standard. if GI ("std") /= Name_Std or GI ("standard") /= Name_Standard or GI ("boolean") /= Name_Boolean or GI ("false") /= Name_False or GI ("true") /= Name_True or GI ("bit") /= Name_Bit or GI ("character") /= Name_Character or GI ("severity_level") /= Name_Severity_Level or GI ("note") /= Name_Note or GI ("warning") /= Name_Warning or GI ("error") /= Name_Error or GI ("failure") /= Name_Failure or GI ("UNIVERSAL_INTEGER") /= Name_Universal_Integer or GI ("UNIVERSAL_REAL") /= Name_Universal_Real or GI ("CONVERTIBLE_INTEGER") /= Name_Convertible_Integer or GI ("CONVERTIBLE_REAL") /= Name_Convertible_Real or GI ("integer") /= Name_Integer or GI ("real") /= Name_Real or GI ("time") /= Name_Time or GI ("fs") /= Name_Fs or GI ("ps") /= Name_Ps or GI ("ns") /= Name_Ns or GI ("us") /= Name_Us or GI ("ms") /= Name_Ms or GI ("sec") /= Name_Sec or GI ("min") /= Name_Min or GI ("hr") /= Name_Hr or GI ("delay_length") /= Name_Delay_Length or GI ("now") /= Name_Now or GI ("natural") /= Name_Natural or GI ("positive") /= Name_Positive or GI ("string") /= Name_String or GI ("bit_vector") /= Name_Bit_Vector or GI ("file_open_kind") /= Name_File_Open_Kind or GI ("read_mode") /= Name_Read_Mode or GI ("write_mode") /= Name_Write_Mode or GI ("append_mode") /= Name_Append_Mode or GI ("file_open_status") /= Name_File_Open_Status or GI ("open_ok") /= Name_Open_Ok or GI ("status_error") /= Name_Status_Error or GI ("name_error") /= Name_Name_Error or GI ("mode_error") /= Name_Mode_Error or GI ("foreign") /= Name_Foreign then raise Program_Error; end if; if GI ("nul") /= Name_Nul or GI ("soh") /= Name_Soh or GI ("stx") /= Name_Stx or GI ("etx") /= Name_Etx or GI ("eot") /= Name_Eot or GI ("enq") /= Name_Enq or GI ("ack") /= Name_Ack or GI ("bel") /= Name_Bel or GI ("bs") /= Name_Bs or GI ("ht") /= Name_Ht or GI ("lf") /= Name_Lf or GI ("vt") /= Name_Vt or GI ("ff") /= Name_Ff or GI ("cr") /= Name_Cr or GI ("so") /= Name_So or GI ("si") /= Name_Si or GI ("dle") /= Name_Dle or GI ("dc1") /= Name_Dc1 or GI ("dc2") /= Name_Dc2 or GI ("dc3") /= Name_Dc3 or GI ("dc4") /= Name_Dc4 or GI ("nak") /= Name_Nak or GI ("syn") /= Name_Syn or GI ("etb") /= Name_Etb or GI ("can") /= Name_Can or GI ("em") /= Name_Em or GI ("sub") /= Name_Sub or GI ("esc") /= Name_Esc or GI ("fsp") /= Name_Fsp or GI ("gsp") /= Name_Gsp or GI ("rsp") /= Name_Rsp or GI ("usp") /= Name_Usp or GI ("del") /= Name_Del then raise Program_Error; end if; if GI ("c128") /= Name_C128 or GI ("c129") /= Name_C129 or GI ("c130") /= Name_C130 or GI ("c131") /= Name_C131 or GI ("c132") /= Name_C132 or GI ("c133") /= Name_C133 or GI ("c134") /= Name_C134 or GI ("c135") /= Name_C135 or GI ("c136") /= Name_C136 or GI ("c137") /= Name_C137 or GI ("c138") /= Name_C138 or GI ("c139") /= Name_C139 or GI ("c140") /= Name_C140 or GI ("c141") /= Name_C141 or GI ("c142") /= Name_C142 or GI ("c143") /= Name_C143 or GI ("c144") /= Name_C144 or GI ("c145") /= Name_C145 or GI ("c146") /= Name_C146 or GI ("c147") /= Name_C147 or GI ("c148") /= Name_C148 or GI ("c149") /= Name_C149 or GI ("c150") /= Name_C150 or GI ("c151") /= Name_C151 or GI ("c152") /= Name_C152 or GI ("c153") /= Name_C153 or GI ("c154") /= Name_C154 or GI ("c155") /= Name_C155 or GI ("c156") /= Name_C156 or GI ("c157") /= Name_C157 or GI ("c158") /= Name_C158 or GI ("c159") /= Name_C159 then raise Program_Error; end if; -- Create misc. if GI ("guard") /= Name_Guard or GI ("deallocate") /= Name_Deallocate or GI ("file_open") /= Name_File_Open or GI ("file_close") /= Name_File_Close or GI ("read") /= Name_Read or GI ("write") /= Name_Write or GI ("endfile") /= Name_Endfile or GI ("p") /= Name_P or GI ("f") /= Name_F or GI ("external_name") /= Name_External_Name or GI ("open_kind") /= Name_Open_Kind or GI ("status") /= Name_Status or GI ("first") /= Name_First or GI ("last") /= Name_Last or GI ("textio") /= Name_Textio or GI ("work") /= Name_Work or GI ("text") /= Name_Text or GI ("untruncated_text_read") /= Name_Untruncated_Text_Read then raise Program_Error; end if; if GI ("ieee") /= Name_Ieee or GI ("std_logic_1164") /= Name_Std_Logic_1164 or GI ("std_ulogic") /= Name_Std_Ulogic or GI ("std_ulogic_vector") /= Name_Std_Ulogic_Vector or GI ("std_logic") /= Name_Std_Logic or GI ("std_logic_vector") /= Name_Std_L
import os
import glob
import sys
import subprocess
import time
SUCCEEDED = "\033[32msucceeded\033[0m"
FAILED = "\033[31mfailed\033[0m"
SKIPPED = "\033[33mskipped\033[0m"
success_count = 0
fail_count = 0
skip_count = 0
exit_status = 0
total_time = time.monotonic()
build_format = '| {:29} | {:30} | {:18} | {:7} | {:6} | {:6} |'
build_separator = '-' * 106
def filter_with_input(mylist):
if len(sys.argv) > 1:
input_args = list(set(mylist).intersection(sys.argv))
if len(input_args) > 0:
mylist[:] = input_args
# If examples are not specified in arguments, build all
all_examples = []
for entry in os.scandir("examples/device"):
if entry.is_dir():
all_examples.append("device/" + entry.name)
for entry in os.scandir("examples/host"):
if entry.is_dir():
all_examples.append("host/" + entry.name)
filter_with_input(all_examples)
all_examples.sort()
# If family are not specified in arguments, build all
all_families = []
for entry in os.scandir("hw/bsp"):
if entry.is_dir() and os.path.isdir(entry.path + "/boards") and entry.name != "esp32s2" and entry.name != "esp32s3":
all_families.append(entry.name)
filter_with_input(all_families)
all_families.sort()
def build_family(example, family):
all_boards = []
for entry in os.scandir("hw/bsp/{}/boards".format(family)):
if entry.is_dir():
all_boards.append(entry.name)
filter_with_input(all_boards)
all_boards.sort()
for board in all_boards:
build_board(example, board)
def build_board(example, board):
global success_count, fail_count, skip_count, exit_status
start_time = time.monotonic()
flash_size = "-"
sram_size = "-"
# Check if board is skipped
if skip_example(example, board):
success = SKIPPED
skip_count += 1
print(build_format.format(example, board, success, '-', flash_size, sram_size))
else:
#subprocess.run("make -C examples/{} BOARD={} clean".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
build_result = subprocess.run("make -j -C examples/{} BOARD={} all".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if build_result.returncode == 0:
success = SUCCEEDED
success_count += 1
(flash_size, sram_size) = build_size(example, board)
subprocess.run("make -j -C examples/{} BOARD={} copy-artifact".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
exit_status = build_result.returncode
success = FAILED
fail_count += 1
build_duration = time.monotonic() - start_time
print(build_format.format(example, board, success, "{:.2f}s".format(build_duration), flash_size, sram_size))
if build_result.returncode != 0:
print(build_result.stdout.decode("utf-8"))
def build_size(example, board):
#elf_file = 'examples/device/{}/_build/{}/{}-firmware.elf'.format(example, board, board)
elf_file = 'examples/{}/_build/{}/*.elf'.format(example, board)
size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8")
size_list = size_output.split('\n')[1].split('\t')
flash_size = int(size_list[0])
sram_size = int(size_list[1]) + int(size_list[2])
return (flash_size, sram_size)
def skip_example(example, board):
ex_dir = 'examples/' + example
# family CMake
board_mk = 'hw/bsp/{}/family.cmake'.format(family)
# family.mk
if not os.path.exists(board_mk):
board_mk = 'hw/bsp/{}/family.mk'.format(family)
with open(board_mk) as mk:
mk_contents = mk.read()
# Skip all OPT_MCU_NONE these are WIP port
if 'CFG_TUSB_MCU=OPT_MCU_NONE' in mk_contents:
return 1
# Skip if CFG_TUSB_MCU in board.mk to match skip file
for skip_file in glob.iglob(ex_dir + '/.skip.MCU_*'):
mcu_cflag = 'CFG_TUSB_MCU=OPT_' + os.path.basename(skip_file).split('.')[2]
if mcu_cflag in mk_contents:
return 1
# Build only list, if exists only these MCU are built
only_list = list(glob.iglob(ex_dir + '/.only.MCU_*'))
if len(only_list) > 0:
for only_file in only_list:
mcu_cflag = 'CFG_TUSB_MCU=OPT_' + os.path.basename(only_file).split('.')[2]
if mcu_cflag in mk_contents:
return 0
return 1
return 0
print(build_separator)
print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM'))
for example in all_examples:
print(build_separator)
for family in all_families:
build_family(example, family)
total_time = time.monotonic() - total_time
print(build_separator)
print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(success_count, SUCCEEDED, fail_count, FAILED, skip_count, SKIPPED, total_time))
print(build_separator)
sys.exit(exit_status)