Commented out some stuff and removed uneeded lines.
This commit is contained in:
parent
5a8f27912c
commit
b7debf7eee
1 changed files with 24 additions and 16 deletions
|
@ -33,8 +33,7 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc)
|
set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc)
|
||||||
set(CMAKE_CXX_COMPILER riscv32-unknown-elf-g++)
|
set(CMAKE_CXX_COMPILER riscv32-unknown-elf-g++)
|
||||||
set(CMAKE_FIND_ROOT_PATH /usr/local/riscv/)
|
set(CMAKE_FIND_ROOT_PATH /usr/local/riscv/)
|
||||||
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${NEWLIB}")
|
|
||||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=${NEWLIB}")
|
|
||||||
# Without these two lines it freaks out.
|
# Without these two lines it freaks out.
|
||||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT GNU)
|
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT GNU)
|
||||||
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT GNU)
|
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT GNU)
|
||||||
|
@ -44,6 +43,8 @@ elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
set(NEWLIB /opt/riscv/riscv32-unknown-elf/include)
|
set(NEWLIB /opt/riscv/riscv32-unknown-elf/include)
|
||||||
set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc)
|
set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc)
|
||||||
set(CMAKE_CXX_COMPILER riscv32-unknown-elf-g++)
|
set(CMAKE_CXX_COMPILER riscv32-unknown-elf-g++)
|
||||||
|
|
||||||
|
# Without these two lines it freaks out.
|
||||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT GNU)
|
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT GNU)
|
||||||
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT GNU)
|
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT GNU)
|
||||||
else()
|
else()
|
||||||
|
@ -67,14 +68,10 @@ endif()
|
||||||
# `/inc/funconfig.h` file.
|
# `/inc/funconfig.h` file.
|
||||||
|
|
||||||
# Specify the exact Chip
|
# Specify the exact Chip
|
||||||
#set(MCU CH32V003J4M6)
|
|
||||||
#set(MCU CH32V003A4M6)
|
|
||||||
#set(MCU CH32V003F4P6)
|
|
||||||
#set(MCU CH32V003F4U6)
|
|
||||||
set(MCU CH32V003)
|
set(MCU CH32V003)
|
||||||
|
|
||||||
#Define it for the preprocessor as well.
|
#Define it for the preprocessor as well.
|
||||||
add_compile_definitions(${MCU})
|
add_compile_definitions(${MCU}=1)
|
||||||
|
|
||||||
#add_definitions(-D${MCU})
|
#add_definitions(-D${MCU})
|
||||||
|
|
||||||
|
@ -113,9 +110,7 @@ set(C_FLAGS_ARCH "\
|
||||||
#-------------------
|
#-------------------
|
||||||
|
|
||||||
# I'm appending to the existing cflags from the cmake file in the root dir.
|
# I'm appending to the existing cflags from the cmake file in the root dir.
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_ARCH} ${OBJECT_GEN_FLAGS}")
|
||||||
${C_FLAGS_ARCH} \
|
|
||||||
${OBJECT_GEN_FLAGS}")
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------
|
#-------------------
|
||||||
|
@ -128,7 +123,8 @@ ${OBJECT_GEN_FLAGS}")
|
||||||
#-------------------
|
#-------------------
|
||||||
|
|
||||||
#set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_SCRIPT})
|
#set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_SCRIPT})
|
||||||
set(LINKER_SCRIPT "./src/ch32v003.ld")
|
#set(LINKER_SCRIPT "./src/ch32v003.ld")
|
||||||
|
set(LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/src/linker_script.ld")
|
||||||
|
|
||||||
#set(LD_FLAGS "-lgcc")
|
#set(LD_FLAGS "-lgcc")
|
||||||
set(LD_FLAGS " \
|
set(LD_FLAGS " \
|
||||||
|
@ -136,8 +132,21 @@ set(LD_FLAGS " \
|
||||||
-Wl,-Map=${PROJECT_NAME}.map \
|
-Wl,-Map=${PROJECT_NAME}.map \
|
||||||
-lgcc \
|
-lgcc \
|
||||||
-T ${LINKER_SCRIPT} \
|
-T ${LINKER_SCRIPT} \
|
||||||
-Wl,--gc-sections")
|
-Wl,--gc-sections"
|
||||||
|
)
|
||||||
|
|
||||||
|
#Allowing this line causes it to attempt compiler tests and if
|
||||||
|
# tosses errors.
|
||||||
|
|
||||||
|
#set(CMAKE_EXE_LINKER_FLAGS_INIT "${LD_FLAGS}")
|
||||||
|
|
||||||
|
|
||||||
|
#target_link_options(my_project PRIVATE -static -nostartfiles -T linker_script.ld)
|
||||||
|
#set(CMAKE_EXE_LINKER_FLAGS_INIT "${LD_FLAGS}")
|
||||||
|
#set(LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/src/linker_script.ld")
|
||||||
|
|
||||||
|
#set(LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/linker_script.ld")
|
||||||
|
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T ${LINKER_SCRIPT}")
|
||||||
|
|
||||||
|
|
||||||
#-------------------
|
#-------------------
|
||||||
|
@ -149,8 +158,7 @@ message(STATUS "CMAKE_INCLUDE_PATH: ${CMAKE_INCLUDE_PATH}")
|
||||||
message(STATUS "CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
|
message(STATUS "CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Unset all cache
|
# Unset all cache
|
||||||
unset(SEMIHOSTING)
|
#unset(SEMIHOSTING)
|
||||||
unset(CMAKE_TOOLCHAIN_FILE)
|
#unset(CMAKE_TOOLCHAIN_FILE)
|
||||||
unset(CMAKE_BUILD_TYPE)
|
#unset(CMAKE_BUILD_TYPE)
|
||||||
|
|
Loading…
Add table
Reference in a new issue