Open mingodad opened 6 months ago
Looking at bif.y there is several conflicts:
bif.y
bif.y: warning: 125 shift/reduce conflicts [-Wconflicts-sr] bif.y: warning: 141 reduce/reduce conflicts [-Wconflicts-rr]
The navigable railroad diagram shown bellow can help fix/debug/develop/document the grammar:
// // EBNF to be viewd at // (IPV6) https://www.bottlecaps.de/rr/ui // (IPV4) https://rr.red-dove.com/ui // // Copy and paste this at one of the urls shown above in the 'Edit Grammar' tab // then click the 'View Diagram' tab. // bif ::= group_list group_list ::= /*empty*/ | group_list bifoptions bifoptions ::= INCLUDE COLON filename bifoptions ::= WORD COLON OBRACE file_list EBRACE file_list ::= /*empty*/ | file_list file_spec | file_list other_spec | file_list image_spec | file_list metahdr_spec | file_list new_pdi_spec | file_list new_file_spec | file_list partition_spec metahdr_spec ::= METAHEADER OBRACE metahdr_attr_list EBRACE metahdr_attr_list ::= metahdr_attr | metahdr_attr COMMA metahdr_attr_list | metahdr_attr metahdr_attr_list metahdr_attr ::= /*empty*/ | ENCRYPTION EQUAL encrvalue | KEYSRC_ENCRYPTION EQUAL key_src | AES_KEY_FILE EQUAL filename | AUTHENTICATION EQUAL authvalue | PPK_FILE EQUAL filename | PSK_FILE EQUAL filename | SPK_FILE EQUAL filename | SSK_FILE EQUAL filename | SPK_SIGNATURE_FILE EQUAL filename | PRESIGN EQUAL filename | REVOKE_ID EQUAL expression | CHECKSUM EQUAL checkvalue | DPA_CM | BLOCKS EQUAL metahdr_blk | PUFHD_LOC optional_data ::= optional_data_attr | optional_data_attr SEMICOLON optional_data optional_data_attr ::= filename COMMA ID EQUAL expression | /*empty*/ metahdr_blk ::= metahdr_blk_attr | metahdr_blk_attr SEMICOLON metahdr_blk metahdr_blk_attr ::= expression | expression LPAREN expression RPAREN | expression LPAREN ASTERISK RPAREN new_pdi_spec ::= ID EQUAL expression | PARENT_ID EQUAL expression | ID_CODE EQUAL expression | EXT_ID_CODE EQUAL expression | other_file_attr EQUAL filename | KEYSRC_ENCRYPTION EQUAL key_src | PARTITION_TYPE EQUAL ptypevalue | REVOKE_ID EQUAL expression image_spec ::= image_list | image_spec image_list image_list ::= IMAGE OBRACE image_content EBRACE image_content ::= /*empty*/ | image_content image_attributes_list | image_content file_spec | image_content partition_spec image_attributes_list ::= image_attributes | image_attributes COMMA image_attributes_list | image_attributes image_attributes_list image_attributes ::= ID EQUAL expression | NAME EQUAL WORD | DELAY_HANDOFF | DELAY_LOAD | INIT | COPY EQUAL expression | PARTITION_TYPE EQUAL ptypevalue | UNIQUE_ID EQUAL expression | PARENT_UNIQUE_ID EQUAL expression | FUNCTION_ID EQUAL expression | PCR_NUMBER EQUAL expression | PCR_MEASUREMENT_INDEX EQUAL expression partition_spec ::= PARTITION partition_content | partition_content partition_content ::= /*empty*/ | partition_content file_spec | partition_content new_file_spec other_spec ::= OBRACKET KEYSRC_ENCRYPTION EBRACKET key_src other_spec ::= OBRACKET FSBL_CONFIG EBRACKET fsbl_attr_list | FSBL_CONFIG OBRACE fsbl_attr_list EBRACE | BOOT_DEVICE OBRACE sec_boot_attr_list EBRACE | OBRACKET BOOT_DEVICE EBRACKET boot_device_type | BOOT_DEVICE EQUAL boot_device_type | OBRACKET AUTH_PARAMS EBRACKET auth_parameters | OBRACKET SPLIT EBRACKET split_options | OBRACKET BOOTVECTORS EBRACKET bootvectors_list | AUTHJTAG_CONFIG OBRACE authjtag_attr_list EBRACE | OPTIONAL_DATA OBRACE optional_data EBRACE sec_boot_attr_list ::= sec_boot_attr | sec_boot_attr COMMA sec_boot_attr_list sec_boot_attr ::= boot_device_type | IMAGE_STORE | ADDRESS EQUAL expression fsbl_attr_list ::= fsbl_attr | fsbl_attr COMMA fsbl_attr_list authjtag_attr_list ::= authjtag_attr | authjtag_attr COMMA authjtag_attr_list | authjtag_attr authjtag_attr_list authjtag_attr ::= REVOKE_ID EQUAL expression | DEVICE_DNA EQUAL HEXWORD | JTAG_TIMEOUT EQUAL expression fsbl_attr ::= core | bh_rsa | auth_hash | int_hash | pufhd_loc | auth_only | opt_key | PUF4KMODE | SHUTTER EQUAL expression | dpa_cm | SMAP_WIDTH EQUAL expression | BYPASS_IDCODE_CHECK | A_HWROT | S_HWROT | PUFROSWAP EQUAL expression | DICE file_spec ::= OBRACKET attribute_list EBRACKET filename | filename new_file_spec ::= OBRACE new_attribute_list EBRACE new_attribute_list ::= attribute | new_attribute | new_attribute COMMA new_attribute_list | attribute COMMA new_attribute_list | new_attribute new_attribute_list | attribute new_attribute_list new_attribute ::= PFILE EQUAL filename | ID EQUAL expression | IMAGE_STORE EQUAL expression | PARTITION_TYPE EQUAL boolattr | PARTITION_TYPE EQUAL PMCDATA | BIF_SECTION EQUAL WORD attribute_list ::= attribute | attribute COMMA attribute_list attribute ::= boolattr | optattr | numattr | fileattr | blocksattr_list blocksattr_list ::= BLOCKS EQUAL blocksattr | AUTHBLOCKS EQUAL authblockattr blocksattr ::= blockattr | blockattr SEMICOLON blocksattr bootvectors_list ::= bootvector | bootvector COMMA bootvectors_list bootvector ::= expression authblockattr ::= expression boolattr ::= BOOTLOADER | BOOT | USER | STATIC | NOAUTOSTART | MULTIBOOT | PROTECTED | EARLY_HANDOFF | HIVEC | XIP_MODE | INIT | BOOTIMAGE | key_file | other_files | ptypevalue | LOCKSTEP trustzone_type ::= TRUSTZONE | TRUSTZONE EQUAL TRUSTZONE_TYPE blockattr ::= expression | expression LPAREN expression RPAREN | expression LPAREN ASTERISK RPAREN optattr ::= AUTHENTICATION EQUAL authvalue | ENCRYPTION EQUAL encrvalue | CHECKSUM EQUAL checkvalue | PARTITION_OWNER EQUAL pownervalue | DEST_CPU EQUAL dest_cpu_type | DEST_DEVICE EQUAL dest_device_type | EXCEPTION_LEVEL EQUAL exception_level_type | AES_KEY_FILE EQUAL filename | PPK_FILE EQUAL filename | PSK_FILE EQUAL filename | SPK_FILE EQUAL filename | SSK_FILE EQUAL filename | SPK_SELECT EQUAL spkselect | SPK_ID EQUAL expression | SPK_SIGNATURE_FILE EQUAL filename | trustzone_type | PARTITION_TYPE EQUAL ptypevalue | KEYSRC_ENCRYPTION EQUAL key_src | REVOKE_ID EQUAL expression | DPA_CM | SLR_NUM EQUAL expression | CLUSTER_NUM EQUAL expression | PUFHD_LOC | DELAY_AUTH | TCM_BOOT other_file_attr ::= INIT | key_file | BH_KEK_IV | BBRAM_KEK_IV | EFUSE_KEK_IV | EFUSE_USER_KEK0_IV | EFUSE_USER_KEK1_IV | USER_KEYS authvalue ::= NONE | AUTHVALUE encrvalue ::= NONE | ENCRVALUE checkvalue ::= NONE | CHECKSUMVALUE pownervalue ::= POWNERVALUE ptypevalue ::= PTYPEVALUE key_src ::= KEY_SRC core ::= CORE bh_rsa ::= BH_RSA dpa_cm ::= DPA_CM auth_hash ::= AUTH_HASH int_hash ::= INT_HASH pufhd_loc ::= PUFHD_LOC opt_key ::= OPT_KEY auth_only ::= AUTH_ONLY boot_device_type ::= BOOT_DEVICE_TYPE dest_cpu_type ::= DEST_CPU_TYPE dest_device_type ::= DEST_DEVICE_TYPE exception_level_type ::= EXCEPTION_LEVEL_TYPE numattr ::= ALIGNMENT EQUAL expression | OFFSET EQUAL expression | RESERVE_LEGACY EQUAL expression | RESERVE EQUAL expression | LOAD EQUAL expression | STARTUP EQUAL expression | BIGENDIAN | A32_MODE | PARTITION_NUM EQUAL expression | TCM_A_REGION EQUAL expression | TCM_B_REGION EQUAL expression | TCM_C_REGION EQUAL expression fileattr ::= PRESIGN EQUAL filename | UDF_DATA EQUAL filename key_file ::= AES_KEY_FILE | rsa_key_file | SPK_SIGNATURE_FILE | BH_SIGNATURE_FILE | HEADER_SIGNATURE_FILE | BH_KEY_FILE | PUF_HELPER_FILE | BH_KEY_IV | FAMILY_KEY rsa_key_file ::= PPK_FILE | PSK_FILE | SPK_FILE | SSK_FILE other_files ::= PMUFW_IMAGE | PMCDATA | UDF_BH auth_parameters ::= PPK_SELECT EQUAL expression | SPK_SELECT EQUAL spkselect | SPK_ID EQUAL expression | HEADER_AUTH | auth_parameters SEMICOLON auth_parameters spkselect ::= SPKSELECT split_options ::= SPLIT_MODE EQUAL splitmode | SPLIT_FMT EQUAL splitfmt | split_options COMMA split_options splitmode ::= SPLITMODE splitfmt ::= MCS | BIN filename ::= FILENAME | QFILENAME number ::= HEXVALUE | DECVALUE | LPAREN expression RPAREN unary_expression ::= number | PLUS unary_expression | NEGATION unary_expression multiplicative_expression ::= unary_expression | multiplicative_expression MULT unary_expression | multiplicative_expression DIVIDE unary_expression | multiplicative_expression MODULO unary_expression additive_expression ::= multiplicative_expression | additive_expression PLUS multiplicative_expression | additive_expression MINUS multiplicative_expression shift_expression ::= additive_expression | shift_expression LSHIFT additive_expression | shift_expression RSHIFT additive_expression and_expression ::= shift_expression | and_expression AND shift_expression xor_expression ::= and_expression | xor_expression XOR and_expression expression ::= xor_expression | expression OR xor_expression //Tokens BOOTLOADER ::= "bootloader" PRESIGN ::= "presign" UDF_DATA ::= "udf_data" XIP_MODE ::= "xip_mode" BOOT ::= "boot" USER ::= "user" STATIC ::= "static" NOAUTOSTART ::= "noautostart" MULTIBOOT ::= "multiboot" PROTECTED ::= "protected" ALIGNMENT ::= "alignment" EARLY_HANDOFF ::= "early_handoff" DELAY_HANDOFF ::= "delay_handoff" DELAY_LOAD ::= "delay_load" DELAY_AUTH ::= "delay_auth" HIVEC ::= "hivec" BLOCKS ::= "blocks" AUTHBLOCKS ::= "authblocks" BIGENDIAN ::= "big_endian" A32_MODE ::= "aarch32_mode" PARTITION ::= "partition" IMAGE ::= "image" METAHEADER ::= "metaheader" BIF_SECTION ::= "section" LOCKSTEP ::= "lockstep" INCLUDE ::= "include" TCM_BOOT ::= "tcmboot" OPTIONAL_DATA ::= "optionaldata" OFFSET ::= "offset" RESERVE_LEGACY ::= "reserve_legacy" RESERVE ::= "reserve" LOAD ::= "load" COPY ::= "copy" STARTUP ::= "startup" PARTITION_NUM ::= "pid" INIT ::= "init" UDF_BH ::= "udf_bh" AES_KEY_FILE ::= "aeskeyfile" PPK_FILE ::= "ppkfile" PSK_FILE ::= "pskfile" SPK_FILE ::= "spkfile" SSK_FILE ::= "sskfile" SPK_SIGNATURE_FILE ::= "spksignature" BH_SIGNATURE_FILE ::= "bhsignature" HEADER_SIGNATURE_FILE ::= "headersignature" BOOTVECTORS ::= "bootvectors" BOOTIMAGE ::= "bootimage" PARENT_ID ::= "parent_id" ID_CODE ::= "id_code" EXT_ID_CODE ::= "extended_id_code" ID ::= "id" NAME ::= "name" PFILE ::= "file" BH_KEY_FILE ::= "bh_keyfile" PUF_HELPER_FILE ::= "puf_file" PMUFW_IMAGE ::= "pmufw_image" PMCDATA ::= "pmcdata" BH_KEY_IV ::= "bh_key_iv" UNIQUE_ID ::= "uid" PARENT_UNIQUE_ID ::= "parent_uid" FUNCTION_ID ::= "function_id" PCR_NUMBER ::= "pcr" PCR_MEASUREMENT_INDEX ::= "pcr_mindex" IMAGE_STORE ::= "imagestore" TCM_A_REGION ::= "tcm_a_region" TCM_B_REGION ::= "tcm_b_region" TCM_C_REGION ::= "tcm_c_region" BBRAM_KEK_IV ::= "bbram_kek_iv" BH_KEK_IV ::= "bh_kek_iv" EFUSE_KEK_IV ::= "efuse_kek_iv" EFUSE_USER_KEK0_IV ::= "efuse_user_kek0_iv" EFUSE_USER_KEK1_IV ::= "efuse_user_kek1_iv" USER_KEYS ::= "userkeys" FAMILY_KEY ::= "familykey" ENCRYPTION ::= "encryption" NONE ::= "none" ENCRVALUE ::= "aes" AUTHENTICATION ::= "authentication" AUTHVALUE ::= "rsa" AUTHVALUE ::= "ecdsa" AUTHVALUE ::= "ecdsa-p384" AUTHVALUE ::= "ecdsa-p521" CHECKSUM ::= "checksum" CHECKSUMVALUE ::= "md5" CHECKSUMVALUE ::= "sha2" CHECKSUMVALUE ::= "sha3" PARTITION_OWNER ::= "partition_owner" PARTITION_OWNER ::= "owner" POWNERVALUE ::= "fsbl" POWNERVALUE ::= "uboot" POWNERVALUE ::= "pmc" POWNERVALUE ::= "non-pmc" POWNERVALUE ::= "plm" POWNERVALUE ::= "non-plm" PARTITION_TYPE ::= "partition_type" PARTITION_TYPE ::= "type" PTYPEVALUE ::= "cdo" PTYPEVALUE ::= "raw" PTYPEVALUE ::= "cfi" PTYPEVALUE ::= "cfi-gsc" PTYPEVALUE ::= "slr-boot" PTYPEVALUE ::= "slr-config" PTYPEVALUE ::= "slr-slave" PTYPEVALUE ::= "slr-slave-boot" PTYPEVALUE ::= "slr-slave-config" PTYPEVALUE ::= "elf" KEYSRC_ENCRYPTION ::= "keysrc_encryption" KEYSRC_ENCRYPTION ::= "keysrc" KEY_SRC ::= "efuse" KEY_SRC ::= "bbram" KEY_SRC ::= "efuse_red_key" KEY_SRC ::= "efuse_blk_key" KEY_SRC ::= "efuse_gry_key" KEY_SRC ::= "bbram_red_key" KEY_SRC ::= "bbram_blk_key" KEY_SRC ::= "bbram_gry_key" KEY_SRC ::= "bh_gry_key" KEY_SRC ::= "bh_blk_key" KEY_SRC ::= "user_key0" KEY_SRC ::= "user_key1" KEY_SRC ::= "user_key2" KEY_SRC ::= "user_key3" KEY_SRC ::= "user_key4" KEY_SRC ::= "user_key5" KEY_SRC ::= "user_key6" KEY_SRC ::= "user_key7" KEY_SRC ::= "efuse_user_key0" KEY_SRC ::= "efuse_user_blk_key0" KEY_SRC ::= "efuse_user_gry_key0" KEY_SRC ::= "efuse_user_key1" KEY_SRC ::= "efuse_user_blk_key1" KEY_SRC ::= "efuse_user_gry_key1" KEY_SRC ::= "kup_key" FSBL_CONFIG ::= "fsbl_config" FSBL_CONFIG ::= "boot_config" FSBL_CONFIG ::= "image_config" CORE ::= "r5_single" CORE ::= "a53_x32" CORE ::= "a5x_x32" CORE ::= "a53_x64" CORE ::= "a5x_x64" CORE ::= "r5_dual" BH_RSA ::= "bh_auth_enable" AUTH_HASH ::= "auth_sha2_enable" INT_HASH ::= "INT_HASH" PUFHD_LOC ::= "pufhd_bh" AUTH_ONLY ::= "auth_only" OPT_KEY ::= "opt_key" PUF4KMODE ::= "puf4kmode" SHUTTER ::= "shutter" PUFROSWAP ::= "puf_ro_swap" DPA_CM ::= "dpacm_enable" DICE ::= "dice_enable" SMAP_WIDTH ::= "smap_width" BYPASS_IDCODE_CHECK ::= "bypass_idcode_check" A_HWROT ::= "a_hwrot" S_HWROT ::= "s_hwrot" BOOT_DEVICE ::= "boot_device" ADDRESS ::= "address" BOOT_DEVICE_TYPE ::= "qspi32" BOOT_DEVICE_TYPE ::= "qspi24" BOOT_DEVICE_TYPE ::= "nand" BOOT_DEVICE_TYPE ::= "sd0" BOOT_DEVICE_TYPE ::= "sd1" BOOT_DEVICE_TYPE ::= "sd-ls" BOOT_DEVICE_TYPE ::= "mmc" BOOT_DEVICE_TYPE ::= "usb" BOOT_DEVICE_TYPE ::= "ethernet" BOOT_DEVICE_TYPE ::= "pcie" BOOT_DEVICE_TYPE ::= "sata" BOOT_DEVICE_TYPE ::= "ospi" BOOT_DEVICE_TYPE ::= "smap" BOOT_DEVICE_TYPE ::= "sbi" BOOT_DEVICE_TYPE ::= "sd0-raw" BOOT_DEVICE_TYPE ::= "sd1-raw" BOOT_DEVICE_TYPE ::= "sd-ls-raw" BOOT_DEVICE_TYPE ::= "mmc-raw" BOOT_DEVICE_TYPE ::= "mmc0" BOOT_DEVICE_TYPE ::= "mmc0-raw" DEST_CPU ::= "destination_cpu" DEST_CPU ::= "core" DEST_CPU_TYPE ::= "a53-0" DEST_CPU_TYPE ::= "a72-0" DEST_CPU_TYPE ::= "a78-0" DEST_CPU_TYPE ::= "a5x-0" DEST_CPU_TYPE ::= "a53-1" DEST_CPU_TYPE ::= "a72-1" DEST_CPU_TYPE ::= "a78-1" DEST_CPU_TYPE ::= "a5x-1" DEST_CPU_TYPE ::= "a53-2" DEST_CPU_TYPE ::= "a78-2" DEST_CPU_TYPE ::= "a5x-2" DEST_CPU_TYPE ::= "a53-3" DEST_CPU_TYPE ::= "a78-3" DEST_CPU_TYPE ::= "a5x-3" DEST_CPU_TYPE ::= "r5-0" DEST_CPU_TYPE ::= "r52-0" DEST_CPU_TYPE ::= "r5-1" DEST_CPU_TYPE ::= "r52-1" DEST_CPU_TYPE ::= "r5-lockstep" DEST_CPU_TYPE ::= "pmu" DEST_CPU_TYPE ::= "psm" DEST_CPU_TYPE ::= "aie" CLUSTER_NUM ::= "cluster" DEST_DEVICE ::= "destination_device" DEST_DEVICE_TYPE ::= "ps" DEST_DEVICE_TYPE ::= "pl" DEST_DEVICE_TYPE ::= "pmufw" DEST_DEVICE_TYPE ::= "xip" EXCEPTION_LEVEL ::= "exception_level" EXCEPTION_LEVEL_TYPE ::= "el-0" EXCEPTION_LEVEL_TYPE ::= "el-1" EXCEPTION_LEVEL_TYPE ::= "el-2" EXCEPTION_LEVEL_TYPE ::= "el-3" TRUSTZONE ::= "trustzone" TRUSTZONE_TYPE ::= "secure" TRUSTZONE_TYPE ::= "nonsecure" SLR_NUM ::= "slr" AUTH_PARAMS ::= "auth_params" PPK_SELECT ::= "ppk_select" SPK_SELECT ::= "spk_select" SPKSELECT ::= "spk-efuse" SPKSELECT ::= "user-efuse" SPK_ID ::= "spk_id" HEADER_AUTH ::= "header_auth" REVOKE_ID ::= "revoke_id" SPLIT ::= "split" SPLIT_MODE ::= "mode" SPLITMODE ::= "slaveboot" SPLITMODE ::= "normal" SPLIT_FMT ::= "fmt" MCS ::= "mcs" BIN ::= "bin" AUTHJTAG_CONFIG ::= "authjtag_config" DEVICE_DNA ::= "device_dna" JTAG_TIMEOUT ::= "jtag_timeout" COLON ::= ":" SEMICOLON ::= ";" EQUAL ::= "=" COMMA ::= "," OBRACKET ::= "[" EBRACKET ::= "]" OBRACE ::= "{" EBRACE ::= "}" LPAREN ::= "(" RPAREN ::= ")" ASTERISK ::= "*" PLUS ::= "+" MINUS ::= "-" LSHIFT ::= "<<" RSHIFT ::= ">>" MULT ::= "*" DIVIDE ::= "/" MODULO ::= "%" NEGATION ::= "~" AND ::= "&" OR ::= "|" XOR ::= "^"
Looking at
bif.y
there is several conflicts:The navigable railroad diagram shown bellow can help fix/debug/develop/document the grammar: