Project

General

Profile

Building the FreeRTOS Demo Project for MitySOM-5CSx

Repository: https://support.criticallink.com/git/freertos-socfpga.git

FreeRTOS homepage: https://www.freertos.org/

The following build steps were tested on Ubuntu 18.04 with Quartus/SoCEDS 18.1. The toolchain used was Mentor Graphics Sourcery CodeBench Lite 2016.11-88, based on GCC 6.2.0.

Demo Binaries

The MitySOM-5CSx FreeRTOS demo project creates two separate demo applications:
  • rtosblinkdemo.elf
    • This demo creates two tasks and one queue. One task sends the value 100 to the queue once every second. The other task waits until it sees the value 100 in the queue and then toggles a GPIO and prints a message to the console.
  • rtosfulldemo.elf
    • This demo creates a comprehensive set of tasks and tests that demonstrate:
      • The FreeRTOS+CLI command line interface
      • Software timers
      • Queues
      • Semaphores
      • Mutexes
      • Event Groups

A 'check' RTOS task is also created. The check task periodically queries the other demo tasks to ensure they are functioning as intended. The check task also toggles a GPIO to give an indication of the system status. If the GPIO toggles every 3 seconds then the check task has not discovered any problems with the executing demo. If the LED toggles every 200 milliseconds then the check task has discovered a problem in at least one task. An error message is also printed to the console if the check task discovers a problem.

Both demo applications use GPIO1[21], which is routed to the green LED D403 on the Development Kit baseboard.

Prerequisites

  1. Build your FPGA project and U-Boot.
  2. Find the pll_config.h file generated by the bsp-editor. In the Critical Link reference FPGA project, it is located at software/preloader/generated/pll_config.h relative to the top-level build directory where the Makefile is.

Build Steps

  1. Check out the multiplatform branch of the FreeRTOS source:
    git clone https://support.criticallink.com/git/freertos-socfpga.git -b multiplatform
    
  2. Change into the FreeRTOS source directory:
    cd freertos-socfpga
    
  3. Replace the default FreeRTOS pll_config.h file with the one found above:
    cp <prerequisite pll_config.h> Altera_Code/SoCSupport/include/
    

    The default pll_config.h is configured for the 5CSX-H6-42A using the reference FPGA project.
  4. Execute the Intel Embedded Command Shell (substitute /opt/intelFPGA/18.1/ if your install path is different):
    /opt/intelFPGA/18.1/embedded/embedded_command_shell.sh
    
  5. Configure autotools for your SOM variant, e.g.:
    SOM_MODEL=5csx-h6-42a ./autogen.sh
    
    • The supported SOM variants are:
      • 5CSX-H6-53B
      • 5CSX-H6-42A
      • 5CSX-H6-4YA
      • 5CSX-H5-4YA
      • 5CSE-H4-3YA
      • 5CSE-H4-8YA
      • 5CSE-L2-3Y8
  6. Build the project:
    make
    
    • If switching from one SOM variant to another in the same build tree, it's recommended to run make clean before building for the new variant. Be sure to switch in the new pll_config.h as well.
    • The following linker warning is expected and can safely be ignored (the exact path to libcs3unhosted.a may vary):
      /opt/intelFPGA/18.1/embedded/host_tools/mentor/gnu/arm/baremetal/bin/../lib/gcc/arm-altera-eabi/6.2.0/../../../../arm-altera-eabi/lib/cortex-a9/libcs3unhosted.a(unhosted-_kill.o): warning: IO function '_kill' used
      
  7. The final FreeRTOS binaries are located in the current directory.

Running the Demos

  1. Make an SD card that includes the demo executables.
    • Subsequent steps here will assume the demo executables are located on the SD card's FAT partition. They may be copied there manually by mounting the SD card on a PC, or they may be included at creation time by using the following arguments to make_sd.sh in addition to the ones recommended in the link above:
      -f rtosblinkdemo.elf -f rtosfulldemo.elf
      
  2. Power on the board and stop in U-Boot by pressing any key at the countdown.
  3. Probe the SD card and load the FPGA:
    mmc rescan; run mmcloadfpga; run fpgaload
    
  4. Load the desired demo executable:
    fatload mmc 0:1 0xA000 /rtosblinkdemo.elf
    

    or
    fatload mmc 0:1 0xA000 /rtosfulldemo.elf
    
  5. Start the demo:
    bootelf 0xA000
    

Go to top
Add picture from clipboard (Maximum size: 1 GB)