Hi again,
one year later I am resuming the task of compiling and running parts of the code of my thesis on ARM-M platforms. I've downloaded the toolchain (GNU Arm Embedded Toolchain v2020) from ARM website and created a Cmakelists for a simple test project using the aforementioned toolchain. In order to create the project for Visual Studio 2019 in my repository, I am launching Cmake with the command "cmake .. -DCMAKE_TOOLCHAIN_FILE=Teensy.cmake" on Windows10. However, Cmake assigned as C/C++ compilers the Visual Studio ones.
I have several questions:
- is it possible to compile the project on Windows using Visual Studio or I have to change IDE or OS?
- I don't know if Cmake doesn't find the Toolchain in the path or it is necessary to be more explicit in the Cmakelists to assign the ARM compilers.
- Is there a template to create the project using Cmake? If not, may you point out where there are mistakes in my files?
- I attached Teensy.cmake, Cmakelists and the main program.
Thank you so much
Borja
Here Teensy.cmake:
Code:
# Type of processor
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
# Where the target environment is
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/arm-none-eabi)
# Specify the cross compiler
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_OBJCOPY arm-none-eabi-objcopy)
set(CMAKE_SIZE arm-none-eabi-size)
set(CMAKE_C_COMPILER_ID GNU)
set(CMAKE_CXX_COMPILER_ID GNU)
set(CMAKE_C_COMPILER_FORCED TRUE)
set(CMAKE_CXX_COMPILER_FORCED TRUE)
Here Cmakelists:
Code:
cmake_minimum_required(VERSION 2.8)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/Teensy.cmake")
set(PROJECT_NAME Teensy)
project(${PROJECT_NAME})
set (${PROJECT_NAME}_FILES
${${PROJECT_NAME}_SOURCE_DIR}/src/main.cpp
)
add_executable (${PROJECT_NAME} ${${PROJECT_NAME}_FILES})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src)
Here the main program:
Code:
int main(void)
{
// Main loop
while(1)
{
}
}