Skip to content

Latest commit

 

History

History
216 lines (114 loc) · 7.7 KB

using_eclipse.rst

File metadata and controls

216 lines (114 loc) · 7.7 KB

Using Eclipse With QORC SDK

The recommended Eclipse for QORC SDK is Eclipse IDE for Embedded C/C++ Developers.

The IDE is available for download from : https://projects.eclipse.org/projects/iot.embed-cdt/downloads

The current tested version with QORC SDK is Eclipse IDE for Embedded C/C++ Developers 2020-09.

This Eclipse IDE is a continuation of the GNU MCU Eclipse project (https://gnu-mcu-eclipse.github.io/) and is now an Eclipse Incubation Project, and is recommended over the older GNU MCU for new installations.

This guide assumes that all the pre-requisites for the QORC SDK applications are already installed and you are able to build the applications using make from the command line.

It is recommended to keep a separate workspace for the QORC SDK applications, but it is not mandatory.

All QORC SDK applications have Makefile support, and the application_dir/GCC_Project/ contains the necessary Makefiles.

To convert this to an Eclipse Project, the following steps can be followed:

  1. Create a directory eclipse_make_project in the application's GCC_Project dir.

  2. Create a file eclipse_custom_build_command.sh in the application's GCC_Project dir.

    Copy the below content into the file :

    #!/usr/bin/env bash
    
    cd $1
    echo $INSTALL_DIR
    export PATH="$INSTALL_DIR/quicklogic-arch-defs/bin:$INSTALL_DIR/quicklogic-arch-defs/bin/python:$PATH"
    source "$INSTALL_DIR/conda/etc/profile.d/conda.sh"
    conda activate
    make $2
    

    Save the file, and mark it executable with chmod +x eclipse_custom_build_command.sh

  3. Open Eclipse and Select Preferred Workspace.

  4. Select File -> New -> Project

    From the New Project dialog box,

    Select Makefile project with existing code under C++ and click Next.

  5. Specify the Project Name ("Use Your Preferred Name") in the Project Name text box.

    Specify the path to eclipse_make_project that was created in Step [1] in the Existing Code Location text box

    Keep both C and C++ checked in Languages

    Select ARM Cross GCC in the Toolchain for Indexer Settings options

    Click Finish

  6. Add files and folder to the Eclipse Virtual Filesystem

    Select the following directories in the File Explorer from the QORC SDK repo directory:

    • BSP
    • HAL
    • FreeRTOS
    • Libraries
    • Tasks

    Drag the selected directories and drop them onto the newly created project in Eclipse IDE

    Once dropped, a File and Folder Operation dialog pops up.

    Choose Link to files and recreate folder structure with virtual folders option.

    Ensure that the option Check the Create link locations relative to PROJECT_LOC is checked.

    Click OK.

    Any other QORC SDK directories can be added to the eclipse project in the same way.

  7. Create Virtual Folder named "App".

    Ensure that the newly create project is selected in Eclipse IDE

    Select File -> New -> Folder

    Specify folder name as App

    Click the Advanced tab and ensure to select the option Folder is not located in the file system (Virtual Folder)

    Click Finish

    Select the following directories in the File Explorer from the application directory:

    • GCC_Project
    • src
    • inc

    Drag the selected directories and drop them onto the newly App Virtual Folder in Eclipse IDE

Now, the project structure is ready.

  1. Ensure that the newly create project is selected in Eclipse IDE

  2. Select Project -> Properties

    1. Select C/C++ Build from the left pane

      Select the Builder Settings tab

      Deselect Use default build command

      Enter the following in the Build command text box:

      ${workspace_loc:/${ProjName}}/../eclipse_custom_build_command.sh ${workspace_loc:/${ProjName}}/../
      
    2. Select sub option Settings under C/C++ Build

      Select Toolchains tab and pull-down Name option and select GNU Tools for ARM Embedded Processors (arm-none-eabi-gcc)

    3. Select sub option Environment under C/C++ Build

      Click option Add, input Name as INSTALL_DIR and Value as "Path to the FPGA Toolchain Installation Directory" (same as in regular setup)

      Click option Add, input Name as PATH and Value as "Path to the ARM GCC Toolchain Directory":"$INSTALL_DIR/install/bin:$INSTALL_DIR/install/bin/python:$PATH

    Click Apply and Close the Project Properties

  3. Right-Click on the project in Project Explorer, select Clean Project

    You should be able to see the project cleaned successfully.

    The CDT Build Console output should look to be the same as what you would see while executing make clean from the command line.

  4. Right-Click on the project in Project Explorer, select Build Project

    You should be able to see the project build successfully.

    The CDT Build Console output should look to be the same as what you would see while executing make from the command line.

  5. Select the bin directory in the File Explorer from the application's GCC_Project/output/ directory.

    Drag the selected directory and drop it onto the App/GCC_Project/output/ Virtual Folder in Eclipse IDE

    This is required for setting up the Debug Configuration in the next section.

  1. Install the Segger J-Link Software Package for Ubuntu:

    Recommended to use the tgz archive (J-Link Software and Documentation pack for Linux, TGZ archive, 32 or 64 bit according to host architecture) from :

    https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack
    

    Tested with v6.92 at the time of writing this guide.

    Extract the archive to any preferred location.

  2. Ensure the project is selected in Eclipse IDE Project Explorer

    Select Run -> Debug Configurations

  3. Select GDB SEGGER J-Link Debugging, and then click on New launch configuration (the top left most icon with only a "+" in the corner)

  4. On the Main tab :

    • Select the Project (It should show the project you created)

    • Specify the C/C++ Application as App/GCC_Project/output/bin/"application_name".elf (Ideally, this should have been automatically selected by Eclipse)

      Click on Search Project and select the correct elf file.

  5. On the Debugger tab :

    • Set the Executable path to point to the JLinkGDBServerCLExe file in the Segger J-Link Installation above.
    • Set the Device name to Cortex-M4
  6. On the Startup tab :

    • set Initial Reset and Halt type to 0
    • Check the RAM application (reload after reach reset/restart) option
    • Uncheck the Pre-run/Restart reset option
  7. Click on Debug button

    The debug session should start launching (Answer Yes if Eclipse asks to switch to Debug Perspective)

    You should be able to see the code loaded and debugger halted on int main()

coming soon!