PolarFire® SoC Applications - SoftConsole Integration
Here, we will create a simple SoftConsole project for Serial Peripheral Interface (SPI) communication. This guide demonstrates how to pass through SoftConsole Flow for the PolarFire® System on Chip (SoC) Discovery Kit, but you will understand how to pass flow for any PolarFire SoC.
Introduction to SoftConsole
SoftConsole is Microchip’s free Eclipse®-based integrated development environment (IDE) designed for developing, debugging, and deploying embedded software applications on Microchip’s Field-Programmable Gate Array (FPGA) and microcontroller platforms. It supports C and C++ programming, offers seamless integration with hardware debugging tools, and provides project templates and libraries to accelerate development. SoftConsole is widely used for RISC-V® and Arm®-based designs, enabling efficient firmware development and hardware-software co-design in embedded systems.
Content
SoftConsole Integration
Launch SoftConsole
Run SoftConsole
After SoftConsole installation, the SoftConsole icon is automatically added to your desktop. Double-click the icon to launch SoftConsole.

Otherwise, you should launch SoftConsole manually from its installation path. By default, SoftConsole is in the path:
C:\Microchip\SoftConsole-{SOFTCONSOLE_VERSION}\
From the path shown above, in your file explorer, launch the softconsole.cmd program. Once you launch the MSS Configurator, you will see the window shown in the accompanying image. Run SoftConsole as the administrator to see the Select a directory as workspace window.

Specify the folder as the workspace path where you want to initialize the SoftConsole workspace, then click Launch.
Import Blank Project
Downloading Blank Project
Download the blank project from the PolarFire SoC GitHub® repository. Extract the ZIP file and make sure this path exists:
C:/.../{GIT_REPO}/applications/mpfs-blank-baremetal
Importing Project Into Workspace
To import the project, navigate to File > Import, select the Existing Projects into workspace option and click Next >.

You will see the following window. Here, in Select root directory, specify the C:/.../{GIT_REPO}/applications/mpfs-blank-baremetal path and select the mpfs-blank-baremetal project. Make sure Copy projects into workspace is checked and click Finish.

Close the Welcome tab to continue.

Project Hierarchy
Application-Specific Part
In the project/src/application, we have five .c files, each for its own hart (RISC-V core).

All codes in this section are related to the first U54 hart, whose C code is in the u54_1.c file. To edit them, double-click on the file and it will open in the editor part of SoftConsole.
Drivers-Specific Part
In the platform/drivers/mss/ path, we have subfolders, each corresponding to a specific folder for a driver.

As shown in the diagram, all peripheral drivers are available, but only mss_mmuart is currently active. Later, in the "Enable Libraries" section, we will enable the mss_spi driver to allow SPI functionality.
XML File Import
Copying XML File Into Project
To import an XML file, expand the src/boards/{YOUR_BOARD_NAME}/fpga_design/design_description path. You will see the MPFS_DISCOVERY_KIT_MSS.xml file. Replace this file with the XML file generated by MSS Configurator.

We need to delete the default MSS XML file and paste the new one into the design_description folder. Copy the {MSS_GEN_FOLDER}/DemoProject_mss_cfg.xml file into design_description folder.

You should have this.
Setting Build
Selecting Build Configuration
Now open the build dropdown and select the eNVM-Scratchpad-Release-DiscoveryKit option.

Program Options and Configurations Capable List
The build options came in two parts:
<Build-Config><Board Name>
- Boot mode 0 is capable with the Lim-debug build for your board.
- Boot Mode 1 is capable with the eNVM-Scratchpad-Build for your board.
Enable Libraries
Open Library Configurations
Open the MSS libraries folder located in <Your Project>/src/platform/drivers/mss/ path and right-click on the mss_spi folder, then open the Properties.

Now you should see this window.

Include Driver to Build

Open C/C++ Build.
Uncheck Exclude resource from build.
Click on Apply and Close.
Application Development
Source Codes
Copy the following code to src/applications/hart1/u54_1.c.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "mpfs_hal/mss_hal.h"
#include "drivers/mss/mss_spi/mss_spi.h"
void delay(uint8_t seconds){
for (uint64_t i = 0; i < (seconds * 129000000U); ++i) {
__asm__("sll x0, x0, x0"); // Dummy instruction for delay
}
}
static void mss_spi_overflow_handler(uint8_t mss_spi_core){}
void u54_1(void)
{
(void)mss_config_clk_rst(MSS_PERIPH_SPI0,
(uint8_t) MPFS_HAL_FIRST_HART,
PERIPHERAL_ON);
PLIC_init();
__enable_irq();
PLIC_SetPriority(SPI0_PLIC, 2u);
PLIC_EnableIRQ(SPI0_PLIC);
MSS_SPI_init(&g_mss_spi0_lo);
MSS_SPI_configure_master_mode(&g_mss_spi0_lo,
MSS_SPI_SLAVE_0,
MSS_SPI_MODE0,
256u,
MSS_SPI_BLOCK_TRANSFER_FRAME_SIZE,
mss_spi_overflow_handler);
uint8_t tx_buffer[] = {0b1};
uint8_t rx_buffer[] = {0};
while(1U){
MSS_SPI_set_slave_select(&g_mss_spi0_lo, MSS_SPI_SLAVE_0);
MSS_SPI_transfer_block(&g_mss_spi0_lo, tx_buffer, 1, rx_buffer, 0);
MSS_SPI_clear_slave_select(&g_mss_spi0_lo, MSS_SPI_SLAVE_0);
delay(1);
}
}
- Line 1-3 - Include standard and SPI-related headers for hardware access.
- Line 5-9 - Define a delay function using a dummy instruction loop.
- Line 11 - Empty SPI overflow handler placeholder.
- Line 15-17 - Start hart function and enable SPI0 clock.
- Line 19-22 - Initialize interrupts and configure SPI0 interrupt priority.
- Line 24-31 - Initialize SPI0 in master mode with settings and overflow handler.
- Line 33-34 - Set up transmit and receive buffers.
- Line 35-40 - Loop: send data via SPI, deselect slave, delay 1 second.
Save it by pressing Ctrl + S.
Building
Choosing Project to Build
To build source files, go to the Project Explorer tab and select the project.

Building
Right-click on the project name and select Build Project.

Checking Logs
After successfully building, you should see this.

Deploy
Deploying the Project
To deploy the application to the SoC, open the programming menu and select the option that matches your build configuration. In our case, it is PolarFire-SoC-Discovery-kit-program non-secure boot mode 1.

Open the program options drop-down and select the PolarFire-SoC-Discovery-kit-program non-secure boot mode 1 option.
Checking Logs
After successfully deployment process you should see this in your log tab.

Capture Signals
Now, if you connect a logic analyzer to the mikroBUS™ socket SPI pins, you should be able to capture these signals.
