Skip to content

Commit cfa6aad

Browse files
danieldegrassedecsny
authored andcommitted
mcux: scripts: pinctrl: update for v14 of the MEX utilities
Update pinctrl scripts for v14 of the MEX utilities, since v13 is now legacy. Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
1 parent e6b0d96 commit cfa6aad

File tree

7 files changed

+25
-19
lines changed

7 files changed

+25
-19
lines changed

mcux/scripts/pinctrl/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ processors
1212
## Requirements
1313

1414
All scripts here utilize files generated by with [MCUXpresso Config
15-
tools v13](https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-config-tools-pins-clocks-peripherals:MCUXpresso-Config-Tools),
16-
and version 13 data packs downloaded from
15+
tools v14](https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-config-tools-pins-clocks-peripherals:MCUXpresso-Config-Tools),
16+
and version 14 data packs downloaded from
1717
[MCUXpresso SDK builder](https://mcuxpresso.nxp.com/en/select_config_tools_data)
1818
No other version of MCUXpresso Config tools is supported.
1919
MCUXpresso config tools data sources must be provided to this tool, see below

mcux/scripts/pinctrl/gen_board_pinctrl.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,15 @@ def main():
107107
"""
108108
args = parse_args()
109109
utils = mex_utils.NxpMexUtil(args.mex_file)
110+
pins_version = utils.get_pins_version()
111+
112+
if round(pins_version) != 14:
113+
print("Warning: This tool is only verified for MEX files version 14, "
114+
"other versions may not work")
115+
110116
board_name = utils.get_board_name()
111117
processor_name = utils.get_processor_name()
112118
package_name = utils.get_package_name()
113-
pins_version = utils.get_pins_version()
114-
if not args.board_output:
115-
args.board_output = f"{board_name.lower().replace('-', '_')}-pinctrl.dtsi"
116119

117120
# Extract the Data pack to a temporary directory
118121
temp_dir = tempfile.TemporaryDirectory()
@@ -126,12 +129,13 @@ def main():
126129

127130
print(f"Found data pack version {data_version}, pins version {pins_version} "
128131
f"for processor {processor_name}")
129-
if round(data_version) != 13:
130-
print("Warning: This tool is only verified for data pack version 13, "
131-
"other versions may not work")
132-
if round(pins_version) != 13:
133-
print("Warning: This tool is only verified for MEX files version 13, "
132+
if round(data_version) != 14:
133+
print("Warning: This tool is only verified for data pack version 14, "
134134
"other versions may not work")
135+
136+
if not args.board_output:
137+
args.board_output = f"{board_name.lower().replace('-', '_')}-pinctrl.dtsi"
138+
135139
# Initialize SOC specific utility, and generate board pin control
136140
if args.copyright:
137141
# Add default copyright

mcux/scripts/pinctrl/gen_soc_headers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def main():
114114

115115
data_version = get_pack_version(temp_dir.name)
116116
print(f"Found data pack version {data_version}")
117-
if round(data_version) != 13:
117+
if round(data_version) != 14:
118118
print("Warning: This tool is only verified for data pack version 13, "
119119
"other versions may not work")
120120

mcux/scripts/pinctrl/imx/imx_cfg_utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import logging
1414

1515
# MEX file has a default namespace, map it here
16-
NAMESPACES = {'mex' : 'http://mcuxpresso.nxp.com/XSD/mex_configuration_13'}
16+
NAMESPACES = {'mex' : 'http://mcuxpresso.nxp.com/XSD/mex_configuration_14'}
1717

1818
class Peripheral:
1919
"""
@@ -1216,8 +1216,7 @@ def get_processor_name(mexfile):
12161216
processor = config_tree.getroot().find('mex:common/mex:processor',
12171217
NAMESPACES)
12181218
if processor is None:
1219-
raise RuntimeError("Cannot locate processor name in MEX file. "
1220-
"Are you using v12 of the MCUXpresso configuration tools?")
1219+
raise RuntimeError("Cannot locate processor name in MEX file.")
12211220
return processor.text
12221221
except ET.ParseError:
12231222
logging.error("Malformed XML tree %s", mexfile)

mcux/scripts/pinctrl/kinetis/kinetis_cfg_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
PIN = collections.namedtuple('PIN', ['PERIPH', 'NAME_PART', 'SIGNAL', 'PORT',
2020
'PIN', 'CH', 'MUX_FUNC'])
2121

22-
NAMESPACES = {'mex': 'http://mcuxpresso.nxp.com/XSD/mex_configuration_13'}
22+
NAMESPACES = {'mex': 'http://mcuxpresso.nxp.com/XSD/mex_configuration_14'}
2323

2424
class MUXOption:
2525
"""

mcux/scripts/pinctrl/lpc/lpc_cfg_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import os
1717
import pathlib
1818

19-
NAMESPACES = {'mex': 'http://mcuxpresso.nxp.com/XSD/mex_configuration_13'}
19+
NAMESPACES = {'mex': 'http://mcuxpresso.nxp.com/XSD/mex_configuration_14'}
2020

2121
class MUXOption:
2222
"""

mcux/scripts/pinctrl/shared/mex_utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
# MEX file has a default namespace, map it here
6-
NAMESPACES = {'mex' : 'http://mcuxpresso.nxp.com/XSD/mex_configuration_13'}
6+
NAMESPACES = {'mex' : 'http://mcuxpresso.nxp.com/XSD/mex_configuration_14'}
77

88
import xml.etree.ElementTree as ET
99
import logging
@@ -27,8 +27,11 @@ def get_pins_version(self):
2727
"""
2828
try:
2929
config_tree = ET.parse(self.mexfile)
30-
return float(config_tree.getroot().find('mex:tools/mex:pins',
31-
NAMESPACES).get('version'))
30+
pins_version = config_tree.getroot().find('mex:tools/mex:pins',
31+
NAMESPACES)
32+
if pins_version is None:
33+
return 0.0
34+
return float(pins_version.get('version'))
3235
except ET.ParseError:
3336
logging.error("Malformed XML tree %s", self.mexfile)
3437
return None

0 commit comments

Comments
 (0)