@@ -61,9 +61,21 @@ def check_inherits(dict):
61
61
if ("inherits" in dict and len (dict ["inherits" ]) > 1 ):
62
62
yield "multiple inheritance is forbidden"
63
63
64
+ DEVICE_HAS_ALLOWED = ["AACI" , "ANALOGIN" , "ANALOGOUT" , "CAN" , "CLCD" ,
65
+ "ERROR_PATTERN" , "ETHERNET" , "EMAC" , "FLASH" , "I2C" ,
66
+ "I2CSLAVE" , "I2C_ASYNCH" , "INTERRUPTIN" , "LOWPOWERTIMER" ,
67
+ "PORTIN" , "PORTINOUT" , "PORTOUT" , "PWMOUT" , "RTC" , "TRNG" ,
68
+ "TSC" , "SERIAL" , "SERIAL_ASYNCH" , "SERIAL_FC" , "SLEEP" ,
69
+ "SPI" , "SPI_ASYNCH" , "SPISLAVE" , "STDIO_MESSAGES" ,
70
+ "STORAGE" , "SEMIHOST" , "LOCALFILESYSTEM" ]
71
+ def check_device_has (dict ):
72
+ for name in dict .get ("device_has" , []):
73
+ if name not in DEVICE_HAS_ALLOWED :
74
+ yield "%s is not allowed in device_has" % name
75
+
64
76
MCU_REQUIRED_KEYS = ["release_versions" , "supported_toolchains" ,
65
77
"default_lib" , "public" , "inherits" , "device_has" ]
66
- MCU_ALLOWED_KEYS = ["device_has" , " device_has_add" , "device_has_remove" , "core" ,
78
+ MCU_ALLOWED_KEYS = ["device_has_add" , "device_has_remove" , "core" ,
67
79
"extra_labels" , "features" , "features_add" ,
68
80
"features_remove" , "bootloader_supported" , "device_name" ,
69
81
"post_binary_hook" , "default_toolchain" , "config" ,
@@ -81,6 +93,7 @@ def check_mcu(mcu_json, strict=False):
81
93
errors .extend (check_extra_labels (mcu_json ))
82
94
errors .extend (check_release_version (mcu_json ))
83
95
errors .extend (check_inherits (mcu_json ))
96
+ errors .extend (check_device_has (mcu_json ))
84
97
if 'public' in mcu_json and mcu_json ['public' ]:
85
98
errors .append ("public must be false" )
86
99
return errors
0 commit comments