Compare commits
11 commits
629a634a3e
...
21bf0729e0
Author | SHA1 | Date | |
---|---|---|---|
|
21bf0729e0 | ||
|
e6f0a5aa38 | ||
|
d23191a956 | ||
|
dc1899e1e4 | ||
|
5051388a6b | ||
|
005f278742 | ||
|
919cf61eec | ||
|
0357b82201 | ||
|
b93acdb9a2 | ||
|
beff37f324 | ||
|
272eed6304 |
6 changed files with 96 additions and 30 deletions
|
@ -53,6 +53,7 @@ set(CMAKE_SIZE ${TRIPPLE}-size)
|
|||
#riscv-none-embed-size --format=berkeley "CH32V203K8T6.elf"
|
||||
|
||||
# Define compile options
|
||||
# Should check to see if parts are all compiled using same options
|
||||
set(CMAKE_C_FLAGS "-march=${MARCH} -mabi=${MABI} -msmall-data-limit=8\
|
||||
-msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections\
|
||||
-fdata-section -fno-common -Wunused -Wuninitialized -g\
|
||||
|
@ -60,8 +61,7 @@ set(CMAKE_C_FLAGS "-march=${MARCH} -mabi=${MABI} -msmall-data-limit=8\
|
|||
--specs=nano.sepcs --specs=nosys.specs
|
||||
")
|
||||
set(CMAKE_CXX_FLAGS "-march=${MARCH}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-mmcu=${AVR_MCU}")
|
||||
|
||||
#set(CMAKE_EXE_LINKER_FLAGS_INIT "-mmcu=${AVR_MCU}")
|
||||
|
||||
# Define the archiver and other tools
|
||||
set(CMAKE_AR ${TRIPPLE}-gcc-ar)
|
||||
|
|
|
@ -1,10 +1,42 @@
|
|||
# LOCATION: projectroot/src
|
||||
add_executable(main
|
||||
main.c
|
||||
ch32v20x_it.c
|
||||
)
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(peripheral)
|
||||
add_subdirectory(system)
|
||||
add_subdirectory(startup)
|
||||
|
||||
add_library(isr SHARED
|
||||
ch32v20x_it.c
|
||||
)
|
||||
|
||||
add_executable(main
|
||||
main.c
|
||||
ch32v20x_it.c
|
||||
)
|
||||
|
||||
target_link_libraries(main
|
||||
core_riscv
|
||||
system_ch32v20x
|
||||
debug
|
||||
ch32v20x_adc
|
||||
ch32v20x_can
|
||||
ch32v20x_dbgmcu
|
||||
ch32v20x_exti
|
||||
ch32v20x_gpio
|
||||
ch32v20x_i2c
|
||||
ch32v20x_misc
|
||||
ch32v20x_pwr
|
||||
ch32v20x_rtc
|
||||
ch32v20x_tim
|
||||
ch32v20x_usb
|
||||
ch32v20x_bkp
|
||||
ch32v20x_crc
|
||||
ch32v20x_dma
|
||||
ch32v20x_flash
|
||||
ch32v20x_iwdg
|
||||
ch32v20x_opa
|
||||
ch32v20x_rcc
|
||||
ch32v20x_spi
|
||||
ch32v20x_usart
|
||||
ch32v20x_wwdg
|
||||
)
|
||||
|
|
8
src/core/CMakeLists.txt
Normal file
8
src/core/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
# LOCATION: projectroot/src/core
|
||||
|
||||
#Example/template lines.
|
||||
add_library(core_riscv SHARED
|
||||
core_riscv.c
|
||||
)
|
||||
|
||||
target_include_directories(core_riscv PUBLIC ./inc)
|
8
src/debug/CMakeLists.txt
Normal file
8
src/debug/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
# LOCATION: projectroot/src/debug
|
||||
|
||||
add_library(debug SHARED
|
||||
debug.c
|
||||
)
|
||||
|
||||
target_include_directories(debug PUBLIC ./)
|
||||
|
|
@ -12,116 +12,128 @@
|
|||
add_library(ch32v20x_adc SHARED
|
||||
src/ch32v20x_adc.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_adc PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_xxx SHARED
|
||||
src/ch32v20x_xxx.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_xxx PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_can SHARED
|
||||
src/ch32v20x_can.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_can PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_dbgmcu SHARED
|
||||
src/ch32v20x_dbgmcu.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_dbgmcu PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_exti SHARED
|
||||
src/ch32v20x_exti.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_exti PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_gpio SHARED
|
||||
src/ch32v20x_gpio.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_gpio PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_i2c SHARED
|
||||
src/ch32v20x_i2c.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_i2c PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_misc SHARED
|
||||
src/ch32v20x_misc.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_misc PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_pwr SHARED
|
||||
src/ch32v20x_pwr.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_pwr PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_rtc SHARED
|
||||
src/ch32v20x_rtc.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_rtc PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_tim SHARED
|
||||
src/ch32v20x_tim.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_tim PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_usb SHARED
|
||||
src/ch32v20x_usb.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_usb PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_bkp SHARED
|
||||
src/ch32v20x_bkp.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_bkp PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_crc SHARED
|
||||
src/ch32v20x_crc.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_crc PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_dma SHARED
|
||||
src/ch32v20x_dma.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_dma PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_flash SHARED
|
||||
src/ch32v20x_flash.c
|
||||
)
|
||||
|
||||
target_include_directories(ch32v20x_flash PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x SHARED
|
||||
src/ch32v20x.c
|
||||
add_library(ch32v20x_iwdg SHARED
|
||||
src/ch32v20x_iwdg.c
|
||||
)
|
||||
target_include_directories(ch32v20x_iwdg PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_opa SHARED
|
||||
src/ch32v20x_opa.c
|
||||
)
|
||||
target_include_directories(ch32v20x_opa PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_rcc SHARED
|
||||
src/ch32v20x_rcc.c
|
||||
)
|
||||
target_include_directories(ch32v20x_rcc PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_spi SHARED
|
||||
src/ch32v20x_spi.c
|
||||
)
|
||||
target_include_directories(ch32v20x_spi PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_usart SHARED
|
||||
src/ch32v20x_usart.c
|
||||
)
|
||||
target_include_directories(ch32v20x_usart PUBLIC ./inc)
|
||||
|
||||
|
||||
add_library(ch32v20x_wwdg SHARED
|
||||
src/ch32v20x_wwdg.c
|
||||
)
|
||||
target_include_directories(ch32v20x_wwdg PUBLIC ./inc)
|
||||
|
||||
|
||||
# This one doesn't have source code.
|
||||
#target_include_directories(ch32v20x PUBLIC ./inc)
|
||||
|
|
6
src/system/CMakeLists.txt
Normal file
6
src/system/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
# LOCATION: projectroot/src/system
|
||||
|
||||
add_library(system_ch32v20x SHARED
|
||||
system_ch32v20x.c
|
||||
)
|
||||
target_include_directories(system_ch32v20x PUBLIC ./inc)
|
Loading…
Add table
Reference in a new issue