-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Guillaumebeuzeboc/test/arm
Test/arm
- Loading branch information
Showing
3 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
if (NOT DEFINED ENV{CUBE}) | ||
message(FATAL_ERROR "CUBE environment variable was not defined!") | ||
endif() | ||
|
||
set(CUBE_HOME "$ENV{CUBE}" CACHE INTERNAL "Copied from environment variable") | ||
|
||
SET (CUBE_ROOT "${CUBE_HOME}/Repository/STM32Cube_FW_L4_V1.14.0") | ||
|
||
SET (LINKER_SCRIPT "${CUBE_ROOT}/Projects/NUCLEO-L476RG/Templates/SW4STM32/STM32L476RG_NUCLEO/STM32L476RGTx_FLASH.ld") | ||
|
||
SET (CMAKE_SYSTEM_NAME Generic) | ||
SET (CMAKE_SYSTEM_PROCESSOR arm) | ||
|
||
|
||
SET(CMAKE_CXX_FLAGS "-mcpu=cortex-m4 -std=c++11 -fno-rtti -fno-exceptions -Wall -fdata-sections -ffunction-sections -MD -Wall" CACHE INTERNAL "cxx compiler flags") | ||
|
||
SET (CMAKE_EXE_LINKER_FLAGS "-T ${LINKER_SCRIPT} -specs=nosys.specs -Wl,--gc-sections" CACHE INTERNAL "exe link flags") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,58 @@ | ||
#!/bin/bash | ||
set -e | ||
DIR=$(dirname ${0}) | ||
SL_PATH=$( dirname $(realpath ${0}) ) | ||
|
||
USAGE="$(basename "$0"): Haricot build system | ||
where: | ||
clean -- clean build & install directory | ||
-s|--stm32 toolchain -- Cross-compile using the provided toolchain ex: stm32l4 | ||
-h|--help -- print this" | ||
|
||
function clean_directories { | ||
echo "Deleting install directory and build directory content" | ||
rm -Rf ${DIR}/install | ||
rm -Rf ${DIR}/build/* | ||
echo "Cleaned" | ||
} | ||
|
||
function stm32_compiler { | ||
CMAKE_COMPILER_ARGS="-DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_CXX_COMPILER=arm-none-eabi-g++" | ||
CMAKE_COMPILER_ARGS="${CMAKE_COMPILER_ARGS} -DCMAKE_C_COMPILER=arm-none-eabi-gcc " | ||
} | ||
|
||
function stm32_toolchain { | ||
CMAKE_TOOLCHAIN_ARGS="-DCMAKE_TOOLCHAIN_FILE=${SL_PATH}/cmake/stm32/${STM32_TO_USE}.cmake" | ||
} | ||
|
||
USE_STM32=false | ||
CMAKE_COMPILER_ARGS="" | ||
CMAKE_TOOLCHAIN_ARGS="" | ||
STM32_TO_USE="" | ||
while [[ $# -gt 0 ]] | ||
do | ||
case "$1" in | ||
-s|--stm32) | ||
USE_STM32=true | ||
STM32_TO_USE=$2 | ||
stm32_compiler | ||
stm32_toolchain | ||
shift | ||
shift | ||
;; | ||
clean) | ||
clean_directories | ||
exit 1 | ||
;; | ||
-h|--help) | ||
echo "$USAGE" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
cd ${DIR}/build | ||
cmake -GNinja .. | ||
cmake ${CMAKE_COMPILER_ARGS} ${CMAKE_TOOLCHAIN_ARGS} -GNinja .. | ||
ninja | ||
cd - |