# MCUXpresso Pin Control Generation Scripts These scripts aid in the generation of pin control data NXP platforms. The scripts currently support most i.MX RT processors, and some LPC and Kinetis processors | Script | Functionality | | -------------------------- | ------------------------------------------- | | `gen_board_pinctrl.py` | Generates pin control dtsi files for boards | | `gen_soc_headers.py` | Generates pin control dtsi files defining SOC pinmux settings | ## Requirements All scripts here utilize files generated by with [MCUXpresso Config tools v14](https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-config-tools-pins-clocks-peripherals:MCUXpresso-Config-Tools), and version 14 data packs downloaded from [MCUXpresso SDK builder](https://mcuxpresso.nxp.com/en/select_config_tools_data) No other version of MCUXpresso Config tools is supported. MCUXpresso config tools data sources must be provided to this tool, see below for documentation on how to download data sources. ## Supported SOCs The following SOC lines are supported: - i.MX RT10xx series - i.MX RT11xx series - i.MX RT7xx series - i.MX RT6xx series - i.MX RT5xx series - Kinetis K8x, K6x, K2x series - LPC55(S)xx series - MCXN9xx series Other SOCs may function with this tooling, but are not explicitly supported. See [unsupported SOCs](#unsupported-socs) for more information. ## Data Packs Data packs for processors can be downloaded from [NXP's MCUXpresso SDK builder](https://mcuxpresso.nxp.com/en/select-config-tools-data). Select the "offline data" section under "MCUXpresso Config Tools" in the sidebar, and locate your processor to download the relevant data pack. Make sure you select version 13. The scripts will use this archive directly, and it does not need to be extracted. ## Board Pin Control Generation To generate pin control files for a board, first generate a board settings file, (also known as a MEX file) for the specific board. Populate board level functional groups with pin control groups. Then, run the following command: ``` python gen_board_pinctrl.py ${path_to_mex_file} ${path_to_data_pack} ``` Replacing `${path_to_data_pack}` and `${path_to_mex_file}` with the paths to your MCUXpresso config tools data source, and board settings file respectively. ### Examples The following command will generate board pin control data for the RT1060 EVK, based on an RT1060 EVK mex file created with MCUXpresso config tools: ``` python gen_board_pinctrl.py mimxrt1060_evk.mex MIMXRT1062xxxxA_ConfigTools_data.zip ``` The user can also output the pin control files to a custom path: ``` python gen_board_pinctrl.py mimxrt1060_evk.mex MIMXRT1062xxxxA_ConfigTools_data-v13.zip \ --board-output ~/zephyrproject/zephyr/boards/arm/mimxrt1060_evk/mimxrt1060_evk-pinctrl.dtsi ``` ## SOC Pin Control Definition Generation To generate pin control definitions for a new SOC not presently supported by Zephyr, download the relevant data pack for your SOC, and run the following script: ``` python gen_soc_headers.py ${path_to_data_pack} ``` Replacing `${path_to_data_pack}` with the path to your MCUXpresso config tools data pack. ### Examples The following command will generate SOC pin control data for the RT1062xxxxA: ``` python gen_soc_headers.py MIMXRT1062xxxxA_ConfigTools_data.zip ``` The user can also specify a directory to output all SOC pin control data files into: ``` python gen_soc_headers.py MIMXRT1062xxxxA_ConfigTools_data-v13.zip \ --soc-output ~/zephyrproject/modules/hal/nxp/dts/nxp/nxp_imx/rt/ ``` ## Unsupported SOCs This tooling may support more NXP SOCs than those explicitly supported above. The tooling is aware of three families of pin controllers: | Family | Description | | --------- | --------------------------------------------------------------- | | IOMUX | i.MX heritage, present on some i.MX SOCs as well as i.MX RT1xxx | | IOCON | LPC heritage, present on LPC SOCs and some i.MX RT | | PORT | Kinetis heritage, present on most Kinetis SOCs | If your SOC is not explicitly supported, you can run the tooling with the `--controller` option in order to attempt to generate pin control data: ``` python gen_board_pinctrl.py LPCXpresso54114.mex LPC54114J256_ConfigTools_data.zip \ --controller IOCON ```