This library is based on the SiFive Freedom Device Tree Tools library, but has been modified to be work with the IAR toolchain. Check the SiFive repository for the original library documentation.
The IAR flavoured Freedom Device Tree Tools library is provided as-is, and there is no guarantee of its status and that it will be maintained.
Downloading and building the SiFive Metal libraries currently requires Linux and a few packages like g++, make, libfdt etc.
Under Windows you can install the Ubuntu WSL (Windows Subsystem for Linux) in order to make and create the SiFive Metal library in a way that is usable for the EWRISCV (IAR Embedded Workbench for RISC-V).
Before we can make the SiFive Metal libraries we need to make sure we have installed the required packages. In the Linux terminal window, run the following command to fetch and update the required packages:
$ sudo apt install -y g++ make device-tree-compiler libfdt-dev
This library should be used to generate bare metal device files which is needed in order to use the IAR version of the Freedom Metal library.
Make sure you are located in the iar-freedom-devicetree-tools directory and use autoconf to setup the configuration:
$ ./configure
And simply use make to build the tools with g++:
$ make
This takes a few minutes but when finished, the tools are ready to be used.
To simplify the file generating process, IAR are providing a simple bash script that do most of the steps automatically. The script can be found at /scripts/metalify.sh and will need the path to this library, a path to the IAR Freedom Metal library and a path to the device tree specific files that you aim to build for (the SiFive Freedom E SDK contain theese kind of files):
$ ./scripts/metalify.sh -d /SiFive/fredom-e-sdk/bsp/freedom-e310-arty -t /SiFive/iar-freedom-devictree-tools -m /SiFive/iar-freedom-metal
Check the script to get a better understanding of what is going on, but in short:
-
Generate DTB files from the DTS files (generally in the freedom-e-sdk repository for the device you are building for).
-
Generate the device header files from the DTB files
-
Create and move the generated headers to the iar-freedom-metal repository.
If everything is going as intended, the new generated files should now populate the IAR Freedom Metal repo in the following fashion:
iar-freedom-metal
└── metal
├── machine
│ ├── inline.h
| └── platform.h
└── machine.h