--some updates

This commit is contained in:
Mysteo
2023-07-14 19:21:22 +03:00
parent 5c26bb8dff
commit 5f7dcde4af
21 changed files with 22075 additions and 406 deletions

View File

@@ -1,4 +1,26 @@
cmake_minimum_required(VERSION 3.23)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER arm-none-eabi-gcc)
set(CMAKE_AR arm-none-eabi-ar)
set(CMAKE_OBJCOPY arm-none-eabi-objcopy)
set(CMAKE_OBJDUMP arm-none-eabi-objdump)
set(SIZE arm-none-eabi-size)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
if (BOOT)
project(reader-boot C CXX ASM)
else()
project(reader-main-prog C CXX ASM)
endif()
set(CORTEX-M 0)
set(COMPILE_OPTIONS -mcpu=cortex-m${CORTEX-M} -mthumb -mthumb-interwork -ffunction-sections -fdata-sections -fno-common -fmessage-length=0 $<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/STM32G070CBTX_FLASH.ld)
set(LINK_OPTIONS -Wl,-gc-sections,--print-memory-usage,-Map=${PROJECT_BINARY_DIR}/${PROJECT_NAME}.map -mcpu=cortex-m${CORTEX-M} -mthumb -mthumb-interwork -T ${LINKER_SCRIPT} -specs=nano.specs -specs=nosys.specs)
if(GTEST)
@@ -37,18 +59,7 @@ else()
endif()
math(EXPR LEN_ADDRESS "${FLASH_MAIN_ADDRESS} + ${LEN_OFFSET}" OUTPUT_FORMAT HEXADECIMAL)
add_compile_definitions("PAGE_SIZE=0x0800")
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER arm-none-eabi-gcc)
set(CMAKE_AR arm-none-eabi-ar)
set(CMAKE_OBJCOPY arm-none-eabi-objcopy)
set(CMAKE_OBJDUMP arm-none-eabi-objdump)
set(SIZE arm-none-eabi-size)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
add_compile_options(-mcpu=cortex-m0 -mthumb -mthumb-interwork )
add_compile_options(-ffunction-sections -fdata-sections -fno-common -fmessage-length=0)
#PAGE SIZE FOR F0 Series with 256KB Flash 0x0800 For 128Kb Flash 0x0400
# uncomment to mitigate c++17 absolute addresses warnings
@@ -85,9 +96,6 @@ else()
add_compile_definitions("BOOT_FLASH_VECTOR_TABLE_CS_OFFSET=${LEN_OFFSET}" "LEN_ADDRESS=${LEN_ADDRESS}")
add_definitions(-DDEBUG -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -DSTM32G070xx)
project(reader-boot C CXX ASM)
add_compile_options(-mcpu=cortex-m0 -mthumb -mthumb-interwork)
add_compile_options(-ffunction-sections -fdata-sections -fno-common -fmessage-length=0)
include_directories(Boot/Core/Inc Drivers/STM32G0xx_HAL_Driver/Inc Drivers/STM32G0xx_HAL_Driver/Inc/Legacy Drivers/CMSIS/Device/ST/STM32G0xx/Include Drivers/CMSIS/Include Boot/App)
include_directories(Boot/loader)
@@ -97,12 +105,9 @@ else()
list(FILTER SOURCES EXCLUDE REGEX "IAR\\/.*.[c|h]$")
list(FILTER SOURCES EXCLUDE REGEX "Keil\\/.*.[c|h]$")
set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/Boot/STM32G070CBTX_FLASH.ld)
add_link_options(-Wl,-gc-sections,--print-memory-usage,-Map=${PROJECT_BINARY_DIR}/${PROJECT_NAME}.map)
add_link_options(-mcpu=cortex-m0 -mthumb -mthumb-interwork)
add_link_options(-T ${LINKER_SCRIPT})
add_executable(${PROJECT_NAME}.elf ${SOURCES} )
target_compile_options(${PROJECT_NAME}.elf PUBLIC ${COMPILE_OPTIONS})
target_link_options(${PROJECT_NAME}.elf PUBLIC ${LINK_OPTIONS})
set(HEX_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.hex)
set(BIN_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.bin)
add_custom_command(TARGET ${PROJECT_NAME}.elf PRE_BUILD
@@ -116,7 +121,6 @@ else()
else()
project(reader-main-prog C CXX ASM)
include_directories(Core/Inc Drivers/STM32G0xx_HAL_Driver/Inc Drivers/STM32G0xx_HAL_Driver/Inc/Legacy Drivers/CMSIS/Device/ST/STM32G0xx/Include Drivers/CMSIS/Include Core/Interfaces Core/Interfaces/Templates App)
@@ -127,12 +131,9 @@ else()
set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32G070CBTX_FLASH.ld)
add_link_options(-Wl,-gc-sections,--print-memory-usage,-Map=${PROJECT_BINARY_DIR}/${PROJECT_NAME}.map)
add_link_options(-mcpu=cortex-m0 -mthumb -mthumb-interwork )
add_link_options(-T ${LINKER_SCRIPT})
add_executable(${PROJECT_NAME}.elf ${SOURCES} ${LINKER_SCRIPT})
target_compile_options(${PROJECT_NAME}.elf PUBLIC ${COMPILE_OPTIONS})
target_link_options(${PROJECT_NAME}.elf PUBLIC ${LINK_OPTIONS})
set(HEX_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.hex)
set(BIN_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.bin)
set(HEX_FILE_SRECORD_WITH_LEN_AND_CRC ${PROJECT_BINARY_DIR}/${PROJECT_NAME}_SRECORD.hex)