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
- This demo creates a comprehensive set of tasks and tests that demonstrate:
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¶
- Build your FPGA project and U-Boot.
- Find the
pll_config.h
file generated by the bsp-editor. In the Critical Link reference FPGA project, it is located atsoftware/preloader/generated/pll_config.h
relative to the top-level build directory where the Makefile is.
Build Steps¶
- Check out the
multiplatform
branch of the FreeRTOS source:git clone https://support.criticallink.com/git/freertos-socfpga.git -b multiplatform
- Change into the FreeRTOS source directory:
cd freertos-socfpga
- Replace the default FreeRTOS
pll_config.h
file with the one found above:cp <prerequisite pll_config.h> Altera_Code/SoCSupport/include/
The defaultpll_config.h
is configured for the 5CSX-H6-42A using the reference FPGA project. - 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
- 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
- The supported SOM variants are:
- 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 newpll_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
- If switching from one SOM variant to another in the same build tree, it's recommended to run
- The final FreeRTOS binaries are located in the current directory.
Running the Demos¶
- 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
- 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
- Power on the board and stop in U-Boot by pressing any key at the countdown.
- Probe the SD card and load the FPGA:
mmc rescan; run mmcloadfpga; run fpgaload
- Load the desired demo executable:
fatload mmc 0:1 0xA000 /rtosblinkdemo.elf
orfatload mmc 0:1 0xA000 /rtosfulldemo.elf
- Start the demo:
bootelf 0xA000
Go to top