Installation
NOTE
If the installation instruction asks/selects whether to have the tool installation path be added to the PATH variable, please agree/select the choice. This ensures the tool can be used in any terminal in any path. After each tool installation, please verify the installation.
Basic tools
Git
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. For installation, you could visit the official Git website, download the appropriate version (suggest use the latest one) for your operating system (Windows, macOS, Linux). Then run the installer and follow the installation instructions.
User git --version
to check the version if you have a version installed.
Then configure your username and email using below commands:
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
Python
Install python 3.10
or above, please follow the guideline at Python Download.
Use python --version
to check the version if you have a version installed.
West
Please use the west version equal or greater than 1.2.0
# Note: you can add option '--default-timeout=1000' if you meet connection issue. Or you may set a different source using option '-i'.
# for example, in China you could try: pip install -U west -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -U west
Build And Configuration System
CMake
It is strongly recommended to use CMake version equal or later than 3.30.0
. You can get latest CMake distributions from the official CMake download page.
For Windows, you can directly use the .msi installer like cmake-3.31.4-windows-x86_64.msi to install.
For Linux, CMake can be installed using the system package manager or by getting binaries from the official CMake download page.
After installation, you can use cmake --version
to check the version.
Ninja
Please use the ninja version equal or later than 1.12.1
.
By default, Windows comes with the Ninja program. If the default Ninja version is too old, you can directly download the ninja binary and register the ninja executor location path into your system path variable to work.
For Linux, you can use your system package manager or you can directly download the ninja binary to work.
After installation, you can use ninja --version
to check the version.
Kconfig
MCUXpresso SDK uses Kconfig python implementation. We customize it based on our needs and integrate it into our build and configuration system. The Kconfiglib sources are placed under mcuxsdk/scripts/kconfig
folder.
Please make sure python environment is setup ready then you can use the Kconfig.
Ruby
Our build system supports IDE project generation for iar, mdk, codewarrior and xtensa to provide OOBE from build to debug. This feature is implemented with ruby. You can follow the guide ruby environment setup to setup the ruby environment. Since we provide a built-in portable ruby, it is just a simple one cmd installation.
If you only work with CLI, you can skip this step.
Toolchain
MCUXpresso SDK supports all mainstream toolchains for embedded development. You can install your used or interested toolchains following the guides.
Toolchain |
Download and Installation Guide |
Note |
---|---|---|
Armgcc |
ARMGCC is default toolchain |
|
IAR |
||
MDK |
||
Armclang |
||
Zephyr |
||
Codewarrior |
||
Xtensa |
||
NXP S32Compiler RISC-V Zen-V |
After you installed the toolchains, to make the west build recognize them, you need to register them in the system environment variables:
Toolchain |
Environment Variable |
Example |
Cmd Line Argument |
---|---|---|---|
Armgcc |
ARMGCC_DIR |
|
–toolchain armgcc |
IAR |
IAR_DIR |
|
–toolchain iar |
MDK |
MDK_DIR |
|
–toolchain mdk |
Armclang |
ARMCLANG_DIR |
|
–toolchain mdk |
Zephyr |
ZEPHYR_SDK_INSTALL_DIR |
|
–toolchain zephyr |
CodeWarrior |
CW_DIR |
|
–toolchain codewarrior |
Xtensa |
XCC_DIR |
|
–toolchain xtensa |
NXP S32Compiler RISC-V Zen-V |
RISCVLLVM_DIR |
|
–toolchain riscvllvm |
The
<toolchain>_DIR
is the root installation folder, not the binary location folder. For IAR, it is directory containing following installation folders:MDK IDE using armclang toolchain only officially supports Windows. In Linux, please directly use armclang toolchain by setting
ARMCLANG_DIR
. In Windows, since most Keil users will install MDK IDE instead of standalone armclang toolchain, theMDK_DIR
has higher priority thanARMCLANG_DIR
.For Xtensa toolchain, please set the
XTENSA_CORE
environment variable. Here’s an example list:Device Core
XTENSA_CORE
RT500 fusion1
nxp_rt500_RI23_11_newlib
RT600 hifi4
nxp_rt600_RI23_11_newlib
RT700 hifi1
rt700_hifi1_RI23_11_nlib
RT700 hifi4
t700_hifi4_RI23_11_nlib
i.MX8ULP fusion1
fusion_nxp02_dsp_prod
In Windows, the short path is used in environment variables. If any toolchain is using the long path, you can open a command window from the toolchain folder and use below command to get the short path:
for %i in (.) do echo %~fsi
Document Installation
It is only needed when you want to generate the HTML version of the document in your local environment
make
Install make for windows using choco
, other OS has make installed by default. Ensure you are running command in administrator mode.
choco install make
If you do not have choco
installed, you can install it from chocolatey
doxygen
The doxygen installation is needed if you want to try documentation generation. The versions for the doxygen tools are as below:
Doxygen version
1.8.13
Graphviz
2.43
Latexmk version
4.56
For installation, you can refer to the guideline as below, which is referenced from the Zephyr documentation generation guideline
Linux
On Ubuntu Linux:
sudo apt-get install --no-install-recommends doxygen graphviz librsvg2-bin \ texlive-latex-base texlive-latex-extra latexmk texlive-fonts-recommended imagemagick
On Fedora Linux:
sudo dnf install doxygen graphviz texlive-latex latexmk \ texlive-collection-fontsrecommended librsvg2-tools ImageMagick
On Clear Linux:
sudo swupd bundle-add texlive graphviz ImageMagick
On Arch Linux:
sudo pacman -S graphviz doxygen librsvg texlive-core texlive-bin \ texlive-latexextra texlive-fontsextra imagemagick
macOS Use
brew
andtlmgr
to install the tools:brew install doxygen graphviz mactex librsvg imagemagick
tlmgr install latexmk
tlmgr install collection-fontsrecommended
Windows Open a
cmd.exe
window as Administrator and run the following command:choco install doxygen.install graphviz strawberryperl miktex rsvg-convert imagemagick
Tool installation check
Once installed, open a terminal or command prompt and type the associated command to verify the installation.
If you see the version number, you have successfully installed the tool. Else please check whether the tool installation path be added into the PATH variable, if not, you could check the PATH variable add the tool installation path to the PATH with below commands:
Windows: Open command prompt or powershell, run below command to show the user PATH variable.
reg query HKEY_CURRENT_USER\Environment /v PATH
Assume the tool installation path is under C:\Users\xxx\AppData\Local\Programs\Git\cmd and the path is not seen in above result, you need to append the path value to the PATH variable with below command:
reg add HKEY_CURRENT_USER\Environment /v PATH /d "%PATH%;C:\Users\xxx\AppData\Local\Programs\Git\cmd"
Then close the command prompt or powershell and verify the tool command again.
Linux:
Open the
$HOME/.bashrc
file using a text editor, such asvim
.Go to the end of the file.
Add the line which append the tool installation path to PATH variable and export PATH at the end of the file. For example,
export PATH="/Directory1:$PATH"
Save and exit.
Execute the script with
source .bashrc
or reboot the system to make the changes live. To verify the changes, runecho $PATH
macOS:
Open the
$HOME/.bash_profile
file using a text editor, such asnano
.Go to the end of the file.
Add the line which append the tool installation path to PATH variable and export PATH at the end of the file. For example,
export PATH="/Directory1:$PATH"
Save and exit.
Execute the script with
source .bash_profile
or reboot the system to make the changes live. To verify the changes, runecho $PATH
Get MCUXpresso SDK Repo
To get the MCUXpresso SDK repository, use the west
tool to clone the manifest repository and checkout all the west projects.
# Initialize west with the manifest repository
west init -m https://github.com/nxp-mcuxpresso/mcuxsdk-manifests/ mcuxpresso-sdk
# Update the west projects
cd mcuxpresso-sdk
west update
# Allow the usage of west extensions provided by MCUXpresso SDK
west config commands.allow_extensions true
Install Python Dependency
To create a Python virtual environment in the west workspace core repo directory mcuxsdk, follow these steps:
Navigate to the core directory:
cd mcuxsdk
[Optional] Create and activate the virtual environment: If you don’t want to use the python virtual environment, skip this step. We strongly suggest you use venv to avoid conflicts with other projects using python.
python -m venv .venv # For Linux/MacOS source .venv/bin/activate # For Windows .\.venv\Scripts\activate # If you are using powershell and see the issue that the activate script cannot be run. # You may fix the issue by opening the powershell as administrator and run below command: powershell Set-ExecutionPolicy RemoteSigned # then run above activate command again.
Once activated, your shell will be prefixed with
(.venv)
. The virtual environment can be deactivated at any time by runningdeactivate
command.Remember to activate the virtual environment every time you start working in this directory. If you are using some modern shell like
zsh
, there are some powerful plugins to help you auto switch venv among workspaces. For example, zsh-autoswitch-virtualenv.Install the required Python packages:
# Note: you can add option '--default-timeout=1000' if you meet connection issue. Or you may set a different source using option '-i'. # for example, in China you could try: pip3 install -r mcu-sdk-3.0/scripts/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple pip install -r scripts/requirements.txt
Document Python dependencies
There are several needed python packages for documentation generation, such as Sphinx tool, which we used to do the generation process. Run below command to install those python dependencies.
cd core/docs
pip install -r requirements.txt