blob: 8c280de3426f914e20338223ef9fc143d5570daa [file] [log] [blame]
yang.li5bef2f62022-01-11 14:08:06 +08001# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
2
3# SPDX-License-Identifier: MIT
4
Xiaohu.Huangbe565062021-10-15 17:29:19 +08005set(common_flags "")
Xiaohu.Huangbe565062021-10-15 17:29:19 +08006set(c_flags "")
7
8set(linker_flags "-Wl,--print-memory-usage,-Map=${TARGET_NAME}.map,--gc-sections")
9
10if(CONFIG_LIBC_STD)
Xiaohu.Huang89a650b2021-12-31 17:31:55 +080011set(linker_flags "${linker_flags},--wrap=_malloc_r,--wrap=_free_r,--wrap=_realloc_r,--wrap=_calloc_r")
Xiaohu.Huangbe565062021-10-15 17:29:19 +080012endif()
13
Kelvin Zhang83cb3da2022-03-21 16:33:27 +080014set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -g -ffunction-sections -fdata-sections -fno-common -fgnu89-inline -march=rv32imc -mabi=ilp32")
Xiaohu.Huangbe565062021-10-15 17:29:19 +080015set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --specs=nano.specs --specs=nosys.specs")
Kelvin Zhang83cb3da2022-03-21 16:33:27 +080016set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -g -ffunction-sections -fdata-sections -fno-common -fno-builtin -fgnu89-inline -march=rv32imc -mabi=ilp32 -nostdlib")
Xiaohu.Huangbe565062021-10-15 17:29:19 +080017set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --specs=nano.specs --specs=nosys.specs")
Kelvin Zhang83cb3da2022-03-21 16:33:27 +080018set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -O2 -g -ffunction-sections -fdata-sections -fno-common -fgnu89-inline -march=rv32imc -mabi=ilp32 -D__ASM")
Xiaohu.Huangbe565062021-10-15 17:29:19 +080019set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} --specs=nano.specs --specs=nosys.specs")