Updated CMakeLists to use vanilla GCC
Use this compiler https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack
This commit is contained in:
parent
267aa0534d
commit
ba886be444
1 changed files with 9 additions and 7 deletions
|
@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.10)
|
||||||
project(main)
|
project(main)
|
||||||
|
|
||||||
# set(CMAKE_VERBOSE_MAKEFILE ON)
|
# set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
set(CMAKE_C_COMPILER riscv-none-embed-gcc)
|
set(CMAKE_C_COMPILER riscv-none-elf-gcc)
|
||||||
set(CMAKE_CXX_COMPILER riscv-none-embed-gcc)
|
set(CMAKE_CXX_COMPILER riscv-none-elf-gcc)
|
||||||
set(CMAKE_OBJCOPY riscv-none-embed-objcopy)
|
set(CMAKE_OBJCOPY riscv-none-elf-objcopy)
|
||||||
set(CMAKE_SIZE riscv-none-embed-size)
|
set(CMAKE_SIZE riscv-none-elf-size)
|
||||||
|
|
||||||
set_property(SOURCE Startup/startup_ch32v00x.S PROPERTY LANGUAGE C)
|
set_property(SOURCE Startup/startup_ch32v00x.S PROPERTY LANGUAGE C)
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ include_directories(Debug)
|
||||||
include_directories(Core)
|
include_directories(Core)
|
||||||
include_directories(User)
|
include_directories(User)
|
||||||
include_directories(Peripheral/inc)
|
include_directories(Peripheral/inc)
|
||||||
add_definitions(-march=rv32ec -mabi=ilp32e -msmall-data-limit=0 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common)
|
|
||||||
|
add_definitions(-march=rv32ec_zicsr -mabi=ilp32e -msmall-data-limit=0 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common)
|
||||||
|
|
||||||
file(GLOB SOURCES "Debug/*.c" "Core/*.c" "User/*.c" "Peripheral/src/*.c" "Startup/*.S")
|
file(GLOB SOURCES "Debug/*.c" "Core/*.c" "User/*.c" "Peripheral/src/*.c" "Startup/*.S")
|
||||||
|
|
||||||
|
@ -31,5 +32,6 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.siz
|
||||||
COMMAND ${CMAKE_SIZE}
|
COMMAND ${CMAKE_SIZE}
|
||||||
ARGS --format=berkeley ${CMAKE_PROJECT_NAME}.elf)
|
ARGS --format=berkeley ${CMAKE_PROJECT_NAME}.elf)
|
||||||
|
|
||||||
add_executable(${CMAKE_PROJECT_NAME}.elf ${SOURCES} ${CMAKE_PROJECT_NAME}.hex ${CMAKE_PROJECT_NAME}.siz)
|
add_executable(${CMAKE_PROJECT_NAME}.elf ${SOURCES})
|
||||||
target_link_options(${CMAKE_PROJECT_NAME}.elf PRIVATE -T ${CMAKE_SOURCE_DIR}/Ld/Link.ld -march=rv32ec -mabi=ilp32e -nostartfiles -Xlinker -gc-sections --specs=nano.specs --specs=nosys.specs)
|
|
||||||
|
target_link_options(${CMAKE_PROJECT_NAME}.elf PRIVATE -T ${CMAKE_SOURCE_DIR}/Ld/Link.ld -march=rv32ec_zicsr -mabi=ilp32e -nostartfiles -Xlinker -gc-sections --specs=nano.specs --specs=nosys.specs -mcmodel=medany)
|
||||||
|
|
Loading…
Reference in a new issue