1111import os
1212import pathlib
1313import logging
14+ import __main__
1415
1516# MEX file has a default namespace, map it here
1617NAMESPACES = {'mex' : 'http://mcuxpresso.nxp.com/XSD/mex_configuration_14' }
@@ -586,7 +587,8 @@ def __init__(self, function, signal_map, rt):
586587 description = function .find ('mex:description' , NAMESPACES )
587588 pins = function .find ('mex:pins' , NAMESPACES )
588589 if description is not None and description .text is not None :
589- self ._description = description .text
590+ # Replace <br> html tag with newline
591+ self ._description = description .text .replace ("<br/>" , "\n " )
590592 else :
591593 self ._description = ""
592594 # Build dictionary mapping pin properties to pins. This allows us to
@@ -752,8 +754,12 @@ def _props_to_dts(self, props, defaults):
752754 zephyr_props = []
753755 prop_mapping = {
754756 'MHZ_50' : '50-mhz' ,
757+ 'MHZ_100_01' : '100-mhz' ,
758+ # On some iMX RT10xx SOCs, 150 MHz is mapped to this value. However,
759+ # this is not consistent for all iMX RT10xx supported by
760+ # config tools. Therefore, we just force both MHZ_100_01 and
761+ # MHZ_100 to 100-mhz.
755762 'MHZ_100' : '100-mhz' ,
756- 'MHZ_150' : '150-mhz' ,
757763 'MHZ_200' : '200-mhz' ,
758764 'R0' : 'r0' ,
759765 'R0_2' : 'r0-2' ,
@@ -922,7 +928,7 @@ def write_gpio_mux(self, outputfile):
922928 with open (outputfile , "w" , encoding = 'utf8' ) as gpio_dsti :
923929 # Write header
924930 gpio_dsti .write (f"/*\n "
925- f" * File created by { os .path .basename (__file__ )} \n "
931+ f" * File created by { os .path .basename (__main__ . __file__ )} \n "
926932 " * not intended for direct usage. Hand edit these DTS\n "
927933 " * nodes as needed to integrate them into Zephyr.\n "
928934 " */\n \n " )
@@ -996,7 +1002,7 @@ def write_pinctrl_defs(self, outputfile):
9961002 header = (f"/*\n "
9971003 f" * { self ._copyright } \n "
9981004 f" *\n "
999- f" * Note: File generated by { os .path .basename (__file__ )} \n "
1005+ f" * Note: File generated by { os .path .basename (__main__ . __file__ )} \n "
10001006 f" * from configuration data for { self ._soc_sku } \n "
10011007 " */\n \n " )
10021008 soc_dtsi .write (header )
@@ -1058,7 +1064,7 @@ def write_pinctrl_groups(self, mexfile, outputfile):
10581064 header = (f"/*\n "
10591065 f" * { self ._copyright } \n "
10601066 f" *\n "
1061- f" * Note: File generated by { os .path .basename (__file__ )} \n "
1067+ f" * Note: File generated by { os .path .basename (__main__ . __file__ )} \n "
10621068 f" * from { os .path .basename (mexfile )} \n "
10631069 " */\n \n " )
10641070 with open (outputfile , "w" , encoding = "utf8" ) as dts_file :
@@ -1070,12 +1076,19 @@ def write_pinctrl_groups(self, mexfile, outputfile):
10701076 dts_file .write ("#include <nxp/nxp_imx/"
10711077 f"{ self .get_part_num ().lower ()} -pinctrl.dtsi>\n \n " )
10721078 dts_file .write ("&pinctrl {\n " )
1073- for pin_group in sorted ( pin_groups .values () ):
1079+ for pin_group in pin_groups .values ():
10741080 pin_props = pin_group .get_pin_props ()
10751081 description = pin_group .get_description ()
10761082 # if a description is present, write it
10771083 if description != "" :
1078- dts_file .write (f"\t /* { description } */\n " )
1084+ description_lines = description .split ("\n " )
1085+ if len (description_lines ) == 1 :
1086+ dts_file .write (f"\t /* { description } */\n " )
1087+ else :
1088+ dts_file .write ("\t /*\n " )
1089+ for line in description_lines :
1090+ dts_file .write (f"\t * { line } \n " )
1091+ dts_file .write ("\t */\n " )
10791092 # Write pin group name
10801093 name = pin_group .get_name ().lower ()
10811094 dts_file .write (f"\t { name } : { name } {{\n " )
0 commit comments