Compare commits
No commits in common. "047b48ab1be5ce1dce8565ff1c189caee70919ed" and "506f11693adc803f47853acf5f57660ec9fb1af6" have entirely different histories.
047b48ab1b
...
506f11693a
3 changed files with 43 additions and 38 deletions
|
|
@ -21,10 +21,6 @@ endif()
|
||||||
# For being able to used LSP
|
# For being able to used LSP
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
#"-Wall":: Enable all warnings.
|
|
||||||
#"-Werror":: Treat all warnings as errors.
|
|
||||||
#"-Wpedantic":: Issue all warnings demanded by strict ISO
|
|
||||||
|
|
||||||
# Request C 17 standard features
|
# Request C 17 standard features
|
||||||
set(CMAKE_C_STANDARD 17)
|
set(CMAKE_C_STANDARD 17)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED True)
|
set(CMAKE_C_STANDARD_REQUIRED True)
|
||||||
|
|
@ -57,6 +53,7 @@ if (UNIT_TESTING)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CPPUTEST_INCLUDE_DIRS}
|
${CPPUTEST_INCLUDE_DIRS}
|
||||||
|
/usr/include/c++/11/
|
||||||
./inc
|
./inc
|
||||||
./mocks
|
./mocks
|
||||||
)
|
)
|
||||||
|
|
|
||||||
7
notes.md
7
notes.md
|
|
@ -26,10 +26,5 @@ development board.
|
||||||
- [X] Remove Unity test framework stuff.
|
- [X] Remove Unity test framework stuff.
|
||||||
- [X] Remove HAL stuff.
|
- [X] Remove HAL stuff.
|
||||||
- [X] Remove doxygen stuff from toolchain file.
|
- [X] Remove doxygen stuff from toolchain file.
|
||||||
- [X] Check through debuging flags in toolchain file.
|
- [ ] Check through debuging flags in toolchain file.
|
||||||
|
|
||||||
## Questions
|
|
||||||
|
|
||||||
- [X] What is semi-hosting in stm32 context.
|
|
||||||
- [X] What are mthumb or thumb?
|
|
||||||
- [ ]
|
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,17 @@
|
||||||
# STM32 toolchain file
|
# STM32 toolchain file
|
||||||
# ###############################
|
# ###############################
|
||||||
|
|
||||||
# ----------------------------------------
|
|
||||||
# File: stm32-toolchain.cmake
|
|
||||||
# Description: Cmake file for the stm32 controllers. It has two differnt
|
|
||||||
# types of kinds things it can output. It can output or build release binaries
|
|
||||||
# or it output debug builds.
|
|
||||||
# ----------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# Configurable Section
|
# Configurable Section
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Specify the cross-compiler
|
# Specify the cross-compiler
|
||||||
set(CROSS_TOOLCHAIN arm-none-eabi-)
|
set(CROSS_TOOLCHAIN arm-none-eabi-)
|
||||||
set(CMAKE_SYSTEM_NAME Generic)
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||||
set(DEBUG_BINARY 1)
|
set(CMAKE_CROSSCOMPILING 1)
|
||||||
set(CMAKE_SYSTEM_VERSION 1)
|
set(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -37,8 +31,6 @@ set(MCU_DIR inc/${MCU}/)
|
||||||
#set(MCU_SPEC cortex-m3)
|
#set(MCU_SPEC cortex-m3)
|
||||||
#set(MCU_SPEC cortex-m4)
|
#set(MCU_SPEC cortex-m4)
|
||||||
set(MCU_SPEC cortex-m0plus) # Might need to change?
|
set(MCU_SPEC cortex-m0plus) # Might need to change?
|
||||||
|
|
||||||
set(FLOAT_SPEC "") # Use when you have no FPU.
|
|
||||||
# set(FLOAT_SPEC "-mfloat-abi=hard -mfpu=fpv4-sp-d16")
|
# set(FLOAT_SPEC "-mfloat-abi=hard -mfpu=fpv4-sp-d16")
|
||||||
|
|
||||||
# The Startup(ASM) files
|
# The Startup(ASM) files
|
||||||
|
|
@ -128,7 +120,7 @@ set(CMAKE_CXX_FLAGS_RELEASE "-Os -flto " CACHE INTERNAL "C++ Compiler options fo
|
||||||
set(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "ASM Compiler options for release build type")
|
set(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "ASM Compiler options for release build type")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-flto " CACHE INTERNAL "Linker options for release build type")
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-flto " CACHE INTERNAL "Linker options for release build type")
|
||||||
|
|
||||||
if(DEBUG_BINARY STREQUAL "1") # -- START: Debug Binary
|
if(CMAKE_CROSSCOMPILING STREQUAL "1")
|
||||||
# Control specific options if crosscompiling
|
# Control specific options if crosscompiling
|
||||||
|
|
||||||
message(STATUS "[INFO] Cross compiling for ${MCU}")
|
message(STATUS "[INFO] Cross compiling for ${MCU}")
|
||||||
|
|
@ -143,12 +135,6 @@ if(DEBUG_BINARY STREQUAL "1") # -- START: Debug Binary
|
||||||
#-------------------
|
#-------------------
|
||||||
# General Flags for cross
|
# General Flags for cross
|
||||||
#-------------------
|
#-------------------
|
||||||
# "thumb":: Compressed instructions, 16bits. Using only ARM is an option
|
|
||||||
# as well.
|
|
||||||
# "-mcpu":: The selected and in use CPU.
|
|
||||||
# "-mthumb":: Enable the thumb(16bit) instructions.
|
|
||||||
# "-mthumb-interwork":: Support calling between ARM and Thumb instructions
|
|
||||||
# "-mabi":: Generate code for the given application binary interface.
|
|
||||||
string(APPEND OBJECT_GEN_FLAGS " \
|
string(APPEND OBJECT_GEN_FLAGS " \
|
||||||
-mcpu=${MCU_SPEC} \
|
-mcpu=${MCU_SPEC} \
|
||||||
-mthumb \
|
-mthumb \
|
||||||
|
|
@ -156,8 +142,6 @@ if(DEBUG_BINARY STREQUAL "1") # -- START: Debug Binary
|
||||||
-mabi=aapcs \
|
-mabi=aapcs \
|
||||||
${FLOAT_SPEC} \
|
${FLOAT_SPEC} \
|
||||||
")
|
")
|
||||||
# "aapcs":: Procedure Call Standard for Arm Architecture
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------
|
#-------------------
|
||||||
# CFLAGS for cross
|
# CFLAGS for cross
|
||||||
|
|
@ -194,20 +178,49 @@ if(DEBUG_BINARY STREQUAL "1") # -- START: Debug Binary
|
||||||
message(FATAL_ERROR "[ERRR] Could not find linker script ${LINKER_SCRIPT}")
|
message(FATAL_ERROR "[ERRR] Could not find linker script ${LINKER_SCRIPT}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# semihosting:: is a mechanism that enables code running on an ARM target
|
|
||||||
# to communicate and use the Input/Output facilities on a host computer
|
|
||||||
# that is running a debugger.
|
|
||||||
if("${SEMIHOSTING}" STREQUAL "1")
|
if("${SEMIHOSTING}" STREQUAL "1")
|
||||||
#"rdimon":: remote dispatch interface monitor
|
|
||||||
string(APPEND CMAKE_EXE_LINKER_FLAGS "--specs=rdimon.specs -lc -lrdimon ")
|
string(APPEND CMAKE_EXE_LINKER_FLAGS "--specs=rdimon.specs -lc -lrdimon ")
|
||||||
else()
|
else()
|
||||||
#"nosys":: systems call are stubbed out.
|
|
||||||
string(APPEND CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs ")
|
string(APPEND CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs ")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
# Actual build which will go onto the board
|
# Flags and options to set while compiling natively
|
||||||
# AKA production build.
|
message(STATUS "[INFO] Compiling natively")
|
||||||
|
|
||||||
|
#-------------------
|
||||||
|
# General Flags for native
|
||||||
|
#-------------------
|
||||||
|
string(APPEND OBJECT_GEN_FLAGS " \
|
||||||
|
--coverage \
|
||||||
|
")
|
||||||
|
|
||||||
|
#-------------------
|
||||||
|
# CFLAGS for native
|
||||||
|
#-------------------
|
||||||
|
string(APPEND CMAKE_C_FLAGS " \
|
||||||
|
${OBJECT_GEN_FLAGS} \
|
||||||
|
")
|
||||||
|
|
||||||
|
#-------------------
|
||||||
|
# ASMFLAGS for native
|
||||||
|
#-------------------
|
||||||
|
string(APPEND CMAKE_ASM_FLAGS " \
|
||||||
|
${OBJECT_GEN_FLAGS} \
|
||||||
|
")
|
||||||
|
|
||||||
|
#-------------------
|
||||||
|
# LFLAGS for native
|
||||||
|
#-------------------
|
||||||
|
string(APPEND CMAKE_EXE_LINKER_FLAGS " \
|
||||||
|
${OBJECT_GEN_FLAGS} \
|
||||||
|
")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Actual build which will go onto the board
|
||||||
|
if(TARGET_GROUP STREQUAL production)
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# @Target: ${PROJECT_NAME}.elf
|
# @Target: ${PROJECT_NAME}.elf
|
||||||
|
|
@ -268,7 +281,7 @@ else()
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Given TARGET_GROUP unknown")
|
message(FATAL_ERROR "Given TARGET_GROUP unknown")
|
||||||
endif() # -- END: DEBUG/RELEASE Binary
|
endif()
|
||||||
|
|
||||||
# Unset all cache
|
# Unset all cache
|
||||||
unset(SEMIHOSTING)
|
unset(SEMIHOSTING)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue