Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polar SoC VSCode Template Project

Dev container for building and debugging Microchip PolarFire SoC (MPFS) bare-metal projects in VS Code. Drop in any existing SoftConsole project and get clangd, GDB hardware debugging via OpenOCD + FlashPro6, Renode emulation, and Libero SoC FPGA design, all without installing the RISC-V toolchain on the host.

Replaces the SoftConsole (Eclipse) workflow while keeping full compatibility with it.

Built on SoftConsole-Docker and Libero-Docker.

Prerequisites

  • Docker
  • VS Code with the Dev Containers extension
  • Microchip license files at ~/Microchip/license/ on the host
  • Libero vault at ~/Microchip/vault/ on the host
  • For hardware debug: FlashPro6 via USB with a udev rule (MODE="0666")

Getting started

  1. Clone this repo (or use it as a GitHub template).
  2. Drop your SoftConsole project folder into the repo root (should contain .cproject and .project files)
  3. Open in VS Code, reopen in the dev container when prompted.
  4. Ctrl+Shift+B to build. Pick a config when asked (LIM-Debug, LIM-Release, etc).
  5. Run "Generate compile_commands.json" task once so clangd picks up your includes.
  6. F5 to debug.

The build system finds your project by looking for .project.

Tasks

F1 > "Tasks: Run Task":

  • Build -- compile the selected config (Ctrl+Shift+B)
  • Clean -- clean the selected config
  • Rebuild (Clean + Build) -- clean then build
  • Generate compile_commands.json -- build with bear to capture compile commands for clangd
  • Launch OpenOCD Server -- start OpenOCD for hardware debug (handles USB/hidraw setup)
  • Kill OpenOCD Server -- stop OpenOCD
  • Launch Renode Server -- start Renode emulator on port 3333
  • Kill Renode Server -- stop Renode
  • Create SoftConsole Workspace -- import project into a local Eclipse workspace for SoftConsole
  • Build via SoftConsole (Headless) -- build using Eclipse CDT headless builder
  • Launch SoftConsole -- open SoftConsole GUI (auto-creates workspace first)
  • Launch Libero -- open Libero SoC for FPGA design (needs X11)

After building, build/latest.elf is a symlink to whichever ELF was last built. All debug configs point at this.

Debugging

F5 opens the debug config picker. Options:

  • OpenOCD: Debug All Harts (Hardware) -- reset, load, break at e51
  • OpenOCD: Attach All Harts (Hardware) -- attach without reset/load
  • OpenOCD: Debug Hart 0 (E51) -- single hart
  • OpenOCD: Debug Hart 1 (U54_1) -- single hart
  • Renode: Debug All Harts (Emulation) -- no hardware needed

OpenOCD configs automatically start/stop the server. FlashPro6 must be connected and USB passed through to the container.

clangd

Uses clangd, not Microsoft C/C++ IntelliSense. Run "Generate compile_commands.json" after your first build or after switching configs.

.clangd at the repo root strips GCC flags that clang doesn't understand.

SoftConsole

The project stays compatible with SoftConsole. "Launch SoftConsole" creates the workspace and opens the GUI. "Build via SoftConsole (Headless)" builds without the GUI.

The softconsole-workspace/ directory is ignored by git.

Hidden files

Eclipse project files (.project, .cproject, .settings/, *.launch) are hidden from the VS Code explorer. They're still on disk. To unhide, edit files.exclude in .vscode/settings.json.

File layout

.clangd                       # strips GCC flags clang doesn't understand
.devcontainer/                # container definition (Dockerfile, devcontainer.json)
.vscode/
  build.sh                    # build wrapper (auto-detects project dir)
  setup_eclipse_workspace.sh  # creates softconsole-workspace/, imports project
  start_openocd.sh            # starts OpenOCD, fixes hidraw device nodes
  tasks.json                  # all build/debug/tool tasks
  launch.json                 # GDB debug configurations
  settings.json               # editor, clangd, file visibility
<your-project>/               # SoftConsole project (.project, .cproject, src/, ...)

TODO

  • Fix Renode emulation (mono not installed in container)
  • Add Launch MSS convenience task

About

VSCode dev container for Microchip PolarFire SoC bare-metal development in VS Code. SoftConsole toolchain, Libero, OpenOCD, clangd.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Contributors

Languages