From 4c17b0443c90ff11516d8f7b30da7ae4c3ef8d14 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Mon, 20 Jun 2022 21:05:41 +1000 Subject: [PATCH] Drop stubs --- source/CMake/gd32vf1.cmake | 2 +- source/CMakeLists.txt | 2 +- source/Core/BSP/Pine64/CMakeLists.txt | 26 +++++-------------- .../SoC/gd32vf103/Common/Source/Stubs/close.c | 4 --- .../SoC/gd32vf103/Common/Source/Stubs/fstat.c | 6 ----- .../Common/Source/Stubs/gettimeofday.c | 13 ---------- .../gd32vf103/Common/Source/Stubs/isatty.c | 11 -------- .../SoC/gd32vf103/Common/Source/Stubs/lseek.c | 6 ----- .../SoC/gd32vf103/Common/Source/Stubs/read.c | 9 ------- .../SoC/gd32vf103/Common/Source/Stubs/sbrk.c | 18 ------------- .../SoC/gd32vf103/Common/Source/Stubs/stub.h | 2 -- 11 files changed, 9 insertions(+), 90 deletions(-) delete mode 100644 source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/close.c delete mode 100644 source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/fstat.c delete mode 100644 source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/gettimeofday.c delete mode 100644 source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/isatty.c delete mode 100644 source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/lseek.c delete mode 100644 source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/read.c delete mode 100644 source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/sbrk.c delete mode 100644 source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/stub.h diff --git a/source/CMake/gd32vf1.cmake b/source/CMake/gd32vf1.cmake index 78ba05f6..dcfda8e7 100644 --- a/source/CMake/gd32vf1.cmake +++ b/source/CMake/gd32vf1.cmake @@ -1,6 +1,6 @@ # core flags -set(CORE_FLAGS "-march=rv32imac -mabi=ilp32 -mcmodel=medlow -fno-builtin -nostartfiles" CACHE INTERNAL "CPU flags") +set(CORE_FLAGS "-march=rv32imac -mabi=ilp32 -mcmodel=medany -fsigned-char -fno-builtin -nostartfiles" CACHE INTERNAL "CPU flags") add_definitions(${CORE_FLAGS}) # link with linker file target_link_libraries(${elf_file} PUBLIC -T ${CMAKE_CURRENT_SOURCE_DIR}/linkers/gd32vf103.ld) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index fe519bca..180f0a5c 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.23) set(application_name "${MODEL}_${LANG}") set(elf_file ${application_name}.elf) set(bin_file ${application_name}.bin) diff --git a/source/Core/BSP/Pine64/CMakeLists.txt b/source/Core/BSP/Pine64/CMakeLists.txt index 2a05c432..3920d110 100644 --- a/source/Core/BSP/Pine64/CMakeLists.txt +++ b/source/Core/BSP/Pine64/CMakeLists.txt @@ -10,10 +10,8 @@ set(sources # Vendor Code ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/OS/FreeRTOS/Source/portable/GCC/portasm.S ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/OS/FreeRTOS/Source/portable/GCC/port.c - ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/gd32vf103_soc.c ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/system_gd32vf103.c - ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_adc.c ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_bkp.c ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_crc.c @@ -35,41 +33,31 @@ ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103 ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_usart.c ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_wwdgt.c ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/n200_func.c - ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/GCC/intexc_gd32vf103.S ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/GCC/startup_gd32vf103.S -${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/ -${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/close.c -${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/fstat.c -${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/gettimeofday.c -${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/isatty.c -${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/lseek.c -${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/read.c -${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/sbrk.c - BSP.cpp + BSP.cpp Debug.cpp - I2C_Wrapper.cpp + I2C_Wrapper.cpp postRTOS.cpp preRTOS.cpp flash.c fusb_user.cpp - ThermoModel.cpp - IRQ.cpp + ThermoModel.cpp + IRQ.cpp Setup.cpp Power.cpp - QC_GPIO.cpp - + QC_GPIO.cpp ) add_library(BSPImplementation ${sources}) -target_include_directories(BSPImplementation PUBLIC . ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/NMSIS/Core/Include ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/OS/FreeRTOS/Source/portable/GCC ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Include ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/ ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/) +target_include_directories(BSPImplementation PUBLIC . ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/NMSIS/Core/Include ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/OS/FreeRTOS/Source/portable/GCC ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Include ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/ ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/) target_compile_definitions (BSPImplementation PUBLIC -DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP -DUSE_RTOS_SYSTICK -DVECT_TAB_OFFSET=0U) target_link_libraries(BSPImplementation PRIVATE brieflz BSP threads drivers mainSource) -# target_link_libraries(${elf_file} PUBLIC -Wl,--defsym=__FLASH_SIZE__=128k -Wl,--defsym=__BOOTLDR_SIZE__=0) +target_link_libraries(${elf_file} PUBLIC -Wl,--defsym=__FLASH_SIZE__=128k -Wl,--defsym=__BOOTLDR_SIZE__=0) set(DEVICE_DFU_ADDRESS 0x08000000) set(DEVICE_DFU_VID_PID 0x28E9:0x0189) \ No newline at end of file diff --git a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/close.c b/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/close.c deleted file mode 100644 index 3bcb4918..00000000 --- a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/close.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "stub.h" -#include - -int _close(int fd) { return _stub(EBADF); } diff --git a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/fstat.c b/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/fstat.c deleted file mode 100644 index f1649b2f..00000000 --- a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/fstat.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "stub.h" -#include -#include -#include - -int _fstat(int fd, struct stat *st) { return _stub(EBADF); } diff --git a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/gettimeofday.c b/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/gettimeofday.c deleted file mode 100644 index 507ca8c3..00000000 --- a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/gettimeofday.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "nuclei_sdk_soc.h" -#include -#include - -int _gettimeofday(struct timeval *tp, void *tzp) { - uint64_t cycles; - - cycles = __get_rv_cycle(); - - tp->tv_sec = cycles / SystemCoreClock; - tp->tv_usec = (cycles % SystemCoreClock) * 1000000 / SystemCoreClock; - return 0; -} diff --git a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/isatty.c b/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/isatty.c deleted file mode 100644 index ac581a54..00000000 --- a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/isatty.c +++ /dev/null @@ -1,11 +0,0 @@ -/* See LICENSE of license details. */ - -#include - -int _isatty(int fd) { - if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { - return 1; - } - - return 0; -} diff --git a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/lseek.c b/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/lseek.c deleted file mode 100644 index ac07a720..00000000 --- a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/lseek.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "stub.h" -#include -#include -#include - -off_t _lseek(int fd, off_t ptr, int dir) { return _stub(EBADF); } diff --git a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/read.c b/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/read.c deleted file mode 100644 index 85b12773..00000000 --- a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/read.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "gd32vf103_usart.h" -#include -#include -#include -#include - -// #define UART_AUTO_ECHO - -ssize_t _read(int fd, void *ptr, size_t len) { return -1; } diff --git a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/sbrk.c b/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/sbrk.c deleted file mode 100644 index a11450d2..00000000 --- a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/sbrk.c +++ /dev/null @@ -1,18 +0,0 @@ -/* See LICENSE of license details. */ - -#include -#include -#include - -void *_sbrk(ptrdiff_t incr) { - extern char _end[]; - extern char _heap_end[]; - static char *curbrk = _end; - - if ((curbrk + incr < _end) || (curbrk + incr > _heap_end)) { - return NULL - 1; - } - - curbrk += incr; - return curbrk - incr; -} diff --git a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/stub.h b/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/stub.h deleted file mode 100644 index 9e1840c0..00000000 --- a/source/Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Source/Stubs/stub.h +++ /dev/null @@ -1,2 +0,0 @@ - -static inline int _stub(int err) { return -1; }