SoftConsole Quick Reference


Automatically Creating a C Project in SoftConsole

To create a C project, simply click on the "Write Application Code" button in Libero, in the Design Flow pane. This will create a SoftConsole workspace in <Project Directory>/SoftConsole that is automatically populated with drivers and other useful tools., similar to the image below. They are as follows:

<Project>_app: This is where application code should be located. If you expand this folder, you'll notice a simple main.c is provided.

<Project>_hw_platform: This is where drivers and other useful platform-specific stuff are. Look through the header files in this directory, there's a lot of functionality here that will save you time. Some of the particularly notable files:

    drivers/mss_<device>: These are the drivers for the devices you added in the MSS or in the top-level canvas in Libero. Look through the headers, they're very well documented. If you can't find the driver you're looking for, you can add it by opening "View/Configure Firmware Cores", found in the Design Flow in Libero.

    hal/hal.h: Provides functions for enabling/disabling interrupts and for setting registers.

    <project>_hw_platform.h: Contains the memory map for user-specified peripherals (e.g. devices connected to the APB3).

    CMSIS: Stands for Cortex Microcontroller Software Interface Standard. It contains abstractions for processor-level functionality. This will probably not be particularly useful (the drivers and hal provide further abstraction).

        core_cm3.h:  Contains Cortex-M3 specific register definitions and intrinsics (C functions which map directly to assembly instructions).

After doing this step, continue this tutorial at "Additional Project Setup"

Manually Creating a C Project in SoftConsole

Creating a Project

Compiler, Assembler and Linker Settings

It may be necessary to change some of the default settings for the compiler, assembler or linker. The setting are accessed by selecting the project, right clicking and then selecting properties.

Under C/C++ build select settings. You will then see categories for changing Compiler, Assembler and Linker Settings.

Adding MSS Device Drivers to the Project

Libero will create device drivers for MSS components such as a UART or GPIO. You must add these drivers to your SoftConsole project manually.

Alternatively, you can drag the CMSIS and driver directories from the Libero firmware directory  into the SoftConsole Project Explorer. Drop the directories onto the directory you wish to place them in (in this case MyProject). This is much easier then using  SoftConsole Import function.

Adding Core Device Drivers to the Project

The IO capacity of the SmartFusion system is not limited to the MSS. Core library for standard IO like UARTs, SPI and  I2C can be instantiated in the FPGA by dragging core from the Libero Core Library to the SmartFusion canvas. Libero will also provide drivers for this hardware that you will need to manually import to the SoftConsole. The process is a bit different than that used to import drivers from the MSS.

NOTE: Some of the core drivers need the HAL (hardware application layer) folder generated by the MSS. This is a layer of software to standardize the interface between hardware and software drivers. For instance, the CoreUARTap needs the HAL folder. You will have to add this to your SoftConsole directory from the Libero firmware directory. As stated above, you can simply drag the folder into the SoftConsole Project Explorer. Be sure to drop it on the project directory.

Your SoftConsole project directory look something like this after adding the HAL folder.

You may find that some of the hal directory path includes are incomplete. You can manually edit them so they work, or in SoftConsole setting you can add include paths under Project-->Properties-->Setting-->C Compiler-->Directories. Click add directory (+ box) and browse to any directory path you want to include.

Linking Start Up and Default Libraries

Several default libraries and critical startup files contains the startup exception code and interrupt vector tables must be linked in with your code. By default these files should be linked, but you can check by checking the linker settings.



Additional Project Setup

Specifying Linker Load File

We need to specify if we want to load the program into volatile or non-volatile memory. The linker uses the load file for this purpose. The path to the load file is set under Project-->Properties-->C/C++ Build-->Settings-->GNU C Linker-->Miscellaneous.

Static RAM (SRAM): Copy the following line into the Miscellaneous Linker Flags Window and Apply. The static ram is volatile and has a capacity of 64K bytes for our devices.
Flash RAM:  Copy the following line into the Miscellaneous Linker Flags Window and Apply. The flash ram is non-volatile and has a capacity of 256K bytes for our device.

Enable UART for printf()

To use a standard output like printf, you must add a UART in the Libero MSS configuration tool and set a global variable in SoftConsole project.

Select the Project in the Project Explorer-->Properties.  Under C Compiler, select Symbols and add the following line.


Building a SoftConsole Project

To build all components of a project select clean under project and select build all components in the option window that will appear at the start of a clean.

Be sure that either Clean all projects is select or the project in question, Start a build immediately and Build the entire workspace is selected in the options that follow clean selection.

You can observe each source file compiling, linking and other file generation by selecting the Console Tab in the command line window below. This can be useful to trace errors.

Opening a SoftConsole Project

Open SoftConsole. under FILE, select switch Workspace. Select a recent workspace directory or browse. When browsing, you should see 2 directories under the workspace directory. SELECT the workspace directory.

Debugging in SoftConsole

Once you have succesfully built a C project you can evoke the debugger in SoftConsole to load the program to either SRAM or eNVM ram and debug with the source line level debugger. You must first configure the debugger.

Debug Configuration

You must configure the SoftConsole Debugger for a static or flash ram located program.

Static Ram Located Program

You can choose Debug and you will be prompted to launch into the Debugging perspective.

NOTE: For the debugger to load the program to the kit, a Debug directory must be available in your SoftConsole project and the location specified in the C/C++ Application window shown above while configuring. The debug directory is not created until you do a full build of your SoftConsole project. If you configure the debugger before doing a build, the C/C++ Application window will be empty. You will have to go back and manually browse for the for the project location. In this case it is specified as Debug\MyProject.

eNVM (non-volatile) Ram Located Program