Note: We recommend using NVM for installing and managing NodeJS on your machine.
-
Windows
Ensure that you are running commands in an elevated terminal. Furthermore, ensure that there are no spaces in the installation folder for nvm. A failure to do this will result in an error in the nvm use command.
- Download and install the latest version of
nvm
from https://github.com/coreybutler/nvm-windows/releases.
- Download and install the latest version of
-
Linux and macOS
Follow the instructions found here: https://github.com/nvm-sh/nvm#installing-and-updating
The following section details how you build, run, and debug your checked out copy of this VS Code extension.
We recommend using NVM to install and manage NodeJS on your machine.
-
Install NVM
-
Windows
- NOTE: Do not include spaces in the installation folder for nvm as this will result in an error with the nvm use command. Run commands in an elevated terminal.
- Download and install nvm from https://github.com/coreybutler/nvm-windows/releases/download/1.1.7/nvm-setup.zip.
-
Linux and macOS
- Run the curl command.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
-
-
Install NodeJS.
nvm install 18.15
nvm use 18.15
-
Install the dependencies.
- Install Yarn package manager globally.
npm install -g yarn
- Install tools for building .vsix extension files.
npm install -g @vscode/vsce
yarn install
You may get errors stating "There appears to be trouble with your network connection. Retrying..." If the number of packages increases every time you run the command, continue running it until it passes.
- Install Yarn package manager globally.
-
Build local dependencies.
yarn ws:ide build-local-deps
-
Build the VS Code extension for local deployment.
yarn ws:ide build:extension
-
Install the VS Code SDK for toolchains and debug.
Details can be found in the User documentation.
Recommended VS Code extensions:
- Prettier - Code formatter (extension id: esbenp.prettier-vscode)
To debug the CFS IDE extension, select Run IDE Extension from the VS Code launch.
- Build the VSIX file
yarn ws:ide package
. - Select Extensions in the VS Code activity bar.
- Click the Views and More Actions menu (...) and select Install from VSIX.
- Select your cfs-ide<version>.vsix file, and click install.
For more information about the project, see the User documentation.
The project uses yarn as a package manager, and yarn workspace as monorepo manager. The monorepo is formed by the following top level directories:
.
├── packages # Host the main packages of this repo
| |── cfs-lib # Reusable utilities for CFS components
| |── cli # CodeFusion Studio CLI source files
| |── cli-plugins # CodeFusion Studio CLI additional plugins
| |── elf-parser # A parser for ELF Files
| |── ide # Build and Debug applications for Analog Devices targets
| |── react-library # Custom React components for CFS
└── package.json # Declares global dependencies and global scripts.
The project is configured to access all main scripts used by all workspaces from the root of the repo.
After installation, you will get prompted to install some VS Code extensions. Its important to install these extensions in case you are planning to contribute to the code base as they will keep the code consistent with the project's code style.
To start the UI development environment, you can use vscode's "Run and Debug" (Ctrl + Shift + D). From the dropdown, you can select "Run IDE Extension". This will launch a dedicated instance of vscode with the UI extension pre-installed in it.
You can debug the ELF parser with debug option "Run ELF file viewer".
A symlink to the CLI package needs to be created globally by yarn. This is done by running the following command from the root:
cd packages/cli
yarn link
yarn build
yarn cfsutil --help
This should display the help menu of the CLI with the available commands.
The following plugins are provided as extensions to the CLI:
- add-soc Example plugin that demonstrates adding additional SoC data models to the CLI
- add-codegen Example plugin that demonstrates adding additional code generation engines to the CLI
You can add new dependencies to a specific workspace (for example the main UI app) from the root directory, by using the identifier of the workspace. For example, to add a new dev dependency to the UI App, you can run:
yarn ws:app add my-dependency
The workspace identifiers are shorthands declared in the root package.json file.
Command | Package |
---|---|
ws:ide |
/packages/ide |
ws:cli |
/packages/cfsutil |
ws:lib |
/packages/cfs-lib |
ws:react-lib |
/packages/react-library |
ws:add-engine |
/packages/cli-plugin/add-codegen |
ws:add-soc |
/packages/cli-plugin/add-soc |
You can generate a production build that can be installed locally in any instance of vscode by running the following command from the root:
yarn ws:ide package
This will generate a cfs-ide-*.vsix
file in the build directory of the ui package (packages/ide/
).
You can manually install the extension through the vscode extensions menu by selecting the Install from VSIX...
option and navigating to the path where the package was generated, or you can run the following command:
code --install-extension packages/ide/*.vsix
Additionally, a packaged extension is generated with every pull request and uploaded to github artifacts. A link is provided as a comment in each pull request where you can download a zip file containing the extension.
To ensure the UI extension functions correctly, it is crucial to configure the path to the CLI in VSCode settings, because the UI extension depends on the CLI to be installed. Follow the next steps to set up the CLI path, making sure you are using the latest version of the CLI to have access to all recent features and fixes.
Start by building the CLI to get the latest version. In your terminal run the following command:
yarn ws:cli build
- macOS: Use the shortcut ⌘, or navigate through Code > Preferences > Settings.
- Windows/Linux: navigate through File > Preferences > Settings or Manage > Settings.
Within the Settings interface, use the search bar to find 'Pinconfig'. Under the section labeled Pinconfig > Cfsutil: Path, input the path to where your CLI is located. Be sure to replace YOUR_PATH_TO_THE_REPO with the actual path to your repository:
- macOS/Linux:
YOUR_PATH_TO_THE_REPO/packages/cli/bin/run.js
- Windows:
YOUR_PATH_TO_THE_REPO/packages/cli/bin/run.cmd
Note: Ensure the path is correct to avoid any issues with the CLI integration in VSCode.
Our documentation is authored in Markdown using MkDocs to publish the resulting HTML.
MkDocs requires that Python version 3.10 or greater be installed on your development machine.
To install MkDocs and related dependencies:
# create a virtual environment
$ python -m venv .venv
# activate the virtual environment
$ source ./venv/bin/activate
# install dependencies
$ pip install -r docs/requirements.txt
Once installed, you can run MkDocs and view the documentation in your browser:
$ mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
INFO - Documentation built in 0.41 seconds
INFO - [15:24:48] Watching paths for changes: 'docs', 'mkdocs.yml'
INFO - [15:24:48] Serving on http://127.0.0.1:8000/
- Markdown files and images should be kebab-cased (not camelCased or snake_cased)
- All end-user documentation should be placed in the appropriate spot within the
/docs
directory - Place image files in a subdirectory named
images
next to the markdown file(s) it is used in - Prefer ATX-style headings (
#
,##
, ...) over setext-style headings (---, ===, ...) - Prefer fenced code blocks over indented code blocks and always set a language identifier when possible.
We use markdownlint to ensure consistent adherence to our prefered markdown styles. To run the linter, ensure that you've followed the NodeJS setup instructions at the top of this file and run yarn lint:docs
from the root folder to ensure that your markdown docs are clean before committing changes. Currently, only markdown files in the top-level /docs
folder are checked.
If you're editing documentation in VS Code, we recommend installing the markdownlint and .editorconfig extentions.
When adding a new page you'll want to also be sure to add it to the table of contents by adding an entry in the nav
section of mkdocs.yml
. See Documentation Layout in the mkdocs manual for additional information.
nav:
- Section:
...
# the key is the name of the page as it will appear in the ToC
# the value is the relative link to the md page
- My new page: folder/my-new-page.md
...
If you are adding a new folder to the structure then you should also create a landing page called index.md
for that page with, at minimum, links to the child pages. To add a nav
entry to the ToC that points to your new index.md
simply specify the path to the md file with no key as the first entry beneath the new section name. See Section index pages in the mkdocs-material manual.
nav:
- A new section:
- new-section/index.md