Nios® V Processor Software Developer Handbook

ID 743810
Date 7/08/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

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(
)

…