Nios® V Processor Software Developer Handbook

ID 743810
Date 10/12/2024
Public
Document Table of Contents

7.11.1.1. Apply Different Compiler Flags in BSP and APP

The toolchain.cmake file lists the compiler switches set in the BSP Editor. Both BSP and APP CMakeLists.txt includes the toolchain.cmake for their respective software compilation. Thus, Ashling* RiscFree* IDE for Intel FPGAs implements the same compiler switches for both BSP and APP projects.

To apply different compiler flags for APP project, overwrite the compiler switches in the APP CMakeLists.txt. The following example shows the overwriting lines:

Overwrite Compiler Switches in APP CMakeLists.txt

cmake_minimum_required(VERSION 3.14)
add_subdirectory(../bsp bsp)
include(../bsp/toolchain.cmake)

# Add/Overwrite compile options in toolchain.cmake
add_compile_option(
    -O0
)

# Add/Overwrite link options in toolchain.cmake
add_link_options(
)

# Add/Overwrite compile definitions in toolchain.cmake
add_compile_definitions(
)

# Remove compile definitions set in toolchain.cmake 
remove_definitions(
)

…