Step 4 : Compile Free-RTOS ============================ .. tab-set:: .. tab-item:: Compile Free-RTOS * In this program, you are going to learn .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * How to ? .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :ref:`Compile Free-RTOS ` .. _freertos_qemu_rpi3b_step4_0: .. tab-set:: .. tab-item:: Compile Free-RTOS * Download the following patch and place it in the parent directory of FreeRTOS-raspi3: :download:`add_patch_to_FreeRTOS-raspi3.patch <./add_patch_to_FreeRTOS-raspi3.patch>` * Apply the changes using the above patch to the FreeRTOS-raspi3 directory using below command: .. code-block :: c $ patch --directory=FreeRTOS-raspi3/ --strip=1 < add_patch_to_FreeRTOS-raspi3.patch * The output of above command should look something like this: .. code-block :: c patching file Demo/FreeRTOSConfig.h patching file Demo/main.c patching file Demo/uart.c patching file Drivers/serial/serial.c patching file Drivers/serial/serial.h patching file Drivers/serial/uart.c patching file Drivers/serial/UARTCommandConsole.c patching file Drivers/serial/uart_string.c patching file Drivers/serial/uart_string.h patching file FreeRTOS/Source/tasks.c patching file FreeRTOS_Plus_Cli/FreeRTOS_CLI.c patching file FreeRTOS_Plus_Cli/FreeRTOS_CLI.h patching file FreeRTOS_Plus_Cli/Sample-CLI-commands.c patching file .git/config patching file .git/description patching file .git/HEAD patching file .git/hooks/applypatch-msg.sample patching file .git/hooks/commit-msg.sample patching file .git/hooks/fsmonitor-watchman.sample patching file .git/hooks/post-update.sample patching file .git/hooks/pre-applypatch.sample patching file .git/hooks/pre-commit.sample patching file .git/hooks/pre-merge-commit.sample patching file .git/hooks/prepare-commit-msg.sample patching file .git/hooks/pre-push.sample patching file .git/hooks/pre-rebase.sample patching file .git/hooks/pre-receive.sample patching file .git/hooks/push-to-checkout.sample patching file .git/hooks/update.sample patching file .git/info/exclude patching file .git/logs/HEAD patching file .git/logs/refs/heads/master patching file .git/logs/refs/remotes/origin/HEAD patching file .git/packed-refs patching file .git/refs/heads/master patching file .git/refs/remotes/origin/HEAD patching file Makefile * Once the patching is done, move to the FreeRTOS-raspi3 directory .. code-block :: c $ cd FreeRTOS-raspi3 * Run make command to compile the FreeRTOS source code. .. code-block :: c FreeRTOS-raspi3$ make mkdir build aarch64-none-elf-as -mcpu=cortex-a53 -c -o build/startup.o Demo/startup.S aarch64-none-elf-as -mcpu=cortex-a53 -c -o build/FreeRTOS_asm_vector.o Demo/FreeRTOS_asm_vector.S aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/FreeRTOS_tick_config.o Demo/FreeRTOS_tick_config.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/uart_string.o Drivers/serial/uart_string.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/uart.o Drivers/serial/uart.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/Sample-CLI-commands.o FreeRTOS_Plus_Cli/Sample-CLI-commands.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/UARTCommandConsole.o Drivers/serial/UARTCommandConsole.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/FreeRTOS_CLI.o FreeRTOS_Plus_Cli/FreeRTOS_CLI.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/serial.o Drivers/serial/serial.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/main.o Demo/main.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/port.o FreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3/port.c aarch64-none-elf-as -mcpu=cortex-a53 -c -o build/portASM.o FreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3/portASM.S aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/list.o FreeRTOS/Source/list.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/tasks.o FreeRTOS/Source/tasks.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/queue.o FreeRTOS/Source/queue.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/timers.o FreeRTOS/Source/timers.c aarch64-none-elf-gcc -mcpu=cortex-a53 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -IFreeRTOS/Source/include -IFreeRTOS/Source/portable/GCC/ARM_CA53_64_RaspberryPi3 -IDemo -IFreeRTOS_Plus_Cli -IDrivers/serial -c -o build/heap_1.o FreeRTOS/Source/portable/MemMang/heap_1.c aarch64-none-elf-gcc -Wl,--build-id=none -std=gnu11 -T raspberrypi3.ld -o kernel8.elf -ffreestanding -O2 -nostdlib build/startup.o build/FreeRTOS_asm_vector.o build/FreeRTOS_tick_config.o build/uart_string.o build/uart.o build/Sample-CLI-commands.o build/UARTCommandConsole.o build/FreeRTOS_CLI.o build/serial.o build/main.o build/port.o build/portASM.o build/list.o build/tasks.o build/queue.o build/timers.o build/heap_1.o aarch64-none-elf-objdump -D kernel8.elf > kernel8.list * Once the build is done the kernel8.elf file will be generated. Verify it by running below command: .. code-block:: c FreeRTOS-raspi3$ ls -l total 316 drwxrwxr-x 2 test test 4096 May 20 17:33 build drwxrwxr-x 2 test test 4096 May 20 17:33 Demo drwxrwxr-x 3 test test 4096 May 20 17:33 Drivers drwxrwxr-x 3 test test 4096 May 20 16:30 FreeRTOS drwxrwxr-x 2 test test 4096 May 20 17:33 FreeRTOS_Plus_Cli -rwxrwxr-x 1 test test 107464 May 20 17:33 kernel8.elf -rw-rw-r-- 1 test test 235605 May 20 17:33 kernel8.list drwxrwxr-x 2 test test 4096 May 20 16:30 License -rw-rw-r-- 1 test test 2228 May 20 17:33 Makefile -rw-rw-r-- 1 test test 611 May 20 16:30 raspberrypi3.ld -rw-rw-r-- 1 test test 409 May 20 16:30 README.md