diff --git a/.cproject b/.cproject deleted file mode 100644 index 998f557..0000000 --- a/.cproject +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index aa9c4c2..0000000 --- a/.project +++ /dev/null @@ -1,66 +0,0 @@ - - - - CH32V203C8T6 - - - - - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - - clean,full,incremental, - - - - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - - full,incremental, - - - - - - - - - - org.eclipse.cdt.core.cnature - - org.eclipse.cdt.managedbuilder.core.managedBuildNature - - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - - - - - - - 1595986042669 - - - - 22 - - - - org.eclipse.ui.ide.multiFilter - - 1.0-name-matches-false-false-*.wvproj - - - - - - - - diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml deleted file mode 100644 index 29f8233..0000000 --- a/.settings/language.settings.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.template b/.template deleted file mode 100644 index 74fd4a8..0000000 --- a/.template +++ /dev/null @@ -1,16 +0,0 @@ -Mcu Type=CH32V20x -Address=0x08000000 -Target Path=obj/CH32V203C8T6.hex -Erase All=true -Program=true -Verify=true -Reset=true - -Vendor=WCH -Link=WCH-Link -Toolchain=RISC-V -Series=CH32V203 -Description=Website: http://www.wch.cn/products/CH32V203.html?\nROM(byte): 64K, SRAM(byte): 20K, CHIP PINS: 48, GPIO PORTS: 37.\nWCH CH32V2 series of mainstream MCUs covers the needs of a large variety of applications in the industrial,medical and consumer markets. High performance with first-class peripherals and low-power,low-voltage operation is paired with a high level of integration at accessible prices with a simple architecture and easy-to-use tools. - -PeripheralVersion=1.6 -MCU=CH32V203C8T6 diff --git a/CH32V203C8T6.launch b/CH32V203C8T6.launch deleted file mode 100644 index f6f87f4..0000000 --- a/CH32V203C8T6.launch +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CH32V203C8T6.wvproj b/CH32V203C8T6.wvproj deleted file mode 100644 index 4ad1180..0000000 Binary files a/CH32V203C8T6.wvproj and /dev/null differ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2f5c156 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.10) +project(bacstat) + +# set(CMAKE_VERBOSE_MAKEFILE ON) +set(CMAKE_C_COMPILER riscv-none-embed-gcc) +set(CMAKE_CXX_COMPILER riscv-none-embed-gcc) +set(CMAKE_OBJCOPY riscv-none-embed-objcopy) +set(CMAKE_SIZE riscv-none-embed-size) + +set_property(SOURCE Startup/startup_ch32v20x_D6.S PROPERTY LANGUAGE C) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +include_directories(Debug) +include_directories(Core) +include_directories(User) +include_directories(Peripheral/inc) + +add_definitions(-finline-functions-called-once -g) + +add_definitions(-Wall -march=rv32ec -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") + +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.hex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMAND ${CMAKE_OBJCOPY} + ARGS -O ihex ${CMAKE_PROJECT_NAME}.elf ${CMAKE_PROJECT_NAME}.hex) +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.siz + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMAND ${CMAKE_SIZE} + ARGS --format=berkeley ${CMAKE_PROJECT_NAME}.elf) + + add_executable(${CMAKE_PROJECT_NAME}.elf ${SOURCES}) +target_link_options(${CMAKE_PROJECT_NAME}.elf PRIVATE -T ${CMAKE_SOURCE_DIR}/Ld/Link.ld -Os -march=rv32ec -mabi=ilp32e -nostartfiles -Xlinker -gc-sections -static --specs=nano.specs --specs=nosys.specs)