@@ -260,7 +260,7 @@ def check_duplicate_markers(test_mode=False):
260260 return errors
261261
262262
263- def target_has_arduino_form_factor (target_name ):
263+ def target_has_form_factor (target_name , form_factor ):
264264 """Check if the target has the Arduino form factor."""
265265 mbed_os_root = pathlib .Path (__file__ ).absolute ().parents [3 ]
266266
@@ -272,7 +272,7 @@ def target_has_arduino_form_factor(target_name):
272272 if target_name in target_data :
273273 if "supported_form_factors" in target_data [target_name ]:
274274 form_factors = target_data [target_name ]["supported_form_factors" ]
275- if "ARDUINO_UNO" in form_factors :
275+ if form_factor in form_factors :
276276 return True
277277
278278 return False
@@ -464,6 +464,13 @@ def legacy_uart_check(pin_name_dict):
464464 return invalid_items
465465
466466
467+ def legacy_arduino_uno_check (arduino_form_factor ):
468+ invalid_items = []
469+ if arduino_form_factor == True :
470+ message = "ARDUINO form factor is deprecated, should be replaced by ARDUINO_UNO"
471+ invalid_items .append ({"key" : "" , "val" : "" , "message" : message })
472+ return invalid_items
473+
467474def print_summary (report ):
468475 targets = set ([case ["platform_name" ] for case in report ])
469476
@@ -690,6 +697,12 @@ def has_passed_all_test_cases(report):
690697 "case_function" : legacy_uart_check ,
691698 "case_input" : "content" ,
692699 },
700+ {
701+ "suite_name" : "generic" ,
702+ "case_name" : "arduino_formfactor" ,
703+ "case_function" : legacy_arduino_uno_check ,
704+ "case_input" : "arduino_form_factor" ,
705+ },
693706 {
694707 "suite_name" : "arduino_uno" ,
695708 "case_name" : "duplicate" ,
@@ -740,21 +753,27 @@ def validate_pin_names(args):
740753
741754 pin_name_dict = pin_name_to_dict (pin_name_content )
742755
743- arduino_support = target_has_arduino_form_factor (target )
756+ arduino_uno_support = target_has_form_factor (target , "ARDUINO_UNO" )
757+
758+ arduino_support = target_has_form_factor (target , "ARDUINO" )
744759
745760 for case in test_cases :
746761 if suites :
747762 if case ["suite_name" ] not in suites :
748763 continue
749764 else :
750- if not arduino_support and case ["suite_name" ] == "arduino_uno" :
765+ if not arduino_uno_support and case ["suite_name" ] == "arduino_uno" :
766+ continue
767+ if not arduino_uno_support and not arduino_support and case ["case_name" ] == "arduino_formfactor" :
751768 continue
752769
770+
753771 if case ["case_input" ] == "dict" :
754772 case_input = pin_name_dict
755773 elif case ["case_input" ] == "content" :
756774 case_input = pin_name_content
757-
775+ elif case ["case_input" ] == "arduino_form_factor" :
776+ case_input = arduino_support
758777 case_output = case ["case_function" ](case_input )
759778
760779 case_result = "FAILED" if case_output else "PASSED"
0 commit comments