Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tutorial example #42

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions tutorial/CMakeLists.txt

This file was deleted.

45 changes: 45 additions & 0 deletions tutorial/bxarm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# set the minimum required version of CMake to be 3.20
cmake_minimum_required(VERSION 3.20)

# set the project name
project(Tutorial)

# add the executable target
add_executable(tutorial)

# target sources
target_sources(tutorial PRIVATE tutorial.c)

# compiler options
target_compile_options(tutorial PRIVATE --debug --endian=little --cpu=Cortex-M4 -e --fpu=VFPv4_sp -Ol)

# linker options
target_link_options(tutorial PRIVATE --config ${TOOLKIT_DIR}/arm/config/linker/ST/stm32f429xI.icf --semihosting --entry __iar_program_start --vfe --text_out locale --cpu=Cortex-M4 --fpu=VFPv4_sp)

# enable testing
enable_testing()

# add a test named `tutorialTest` for `tutorial`
add_test(NAME tutorialTest
COMMAND ${TOOLKIT_DIR}/common/bin/CSpyBat
# C-SPY drivers for the Arm simulator via command line interface
${TOOLKIT_DIR}/arm/bin/libarmPROC.so
${TOOLKIT_DIR}/arm/bin/libarmSIM2.so
--plugin=${TOOLKIT_DIR}/arm/bin/libarmLibsupportUniversal.so
--device_macro=${TOOLKIT_DIR}/arm/config/debugger/ST/STM32F4xx.dmac
# The target executable (built with debug information)
--debug_file=$<TARGET_FILE:tutorial>
# C-SPY driver options
--backend
--endian=little
--cpu=Cortex-M4
--fpu=VFPv4_SP
-p
${TOOLKIT_DIR}/arm/config/debugger/ST/STM32F429II.ddf
--semihosting
--device=STM32F429II
--multicore_nr_of_cores=1)

# set the `tutorialTest` test passing condition
set_tests_properties(tutorialTest PROPERTIES PASS_REGULAR_EXPRESSION "Hello world!")

7 changes: 4 additions & 3 deletions tutorial/bxarm.cmake → tutorial/bxarm/bxarm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

# Set CMake for cross-compiling
set(CMAKE_SYSTEM_NAME Generic)
set(TOOLKIT_DIR /opt/iarsystems/bxarm)

# Set CMake to use the IAR C/C++ Compiler from the IAR Build Tools for Arm
# Update if using a different supported target or operating system
set(CMAKE_ASM_COMPILER /opt/iarsystems/bxarm/arm/bin/iasmarm)
set(CMAKE_C_COMPILER /opt/iarsystems/bxarm/arm/bin/iccarm)
set(CMAKE_CXX_COMPILER /opt/iarsystems/bxarm/arm/bin/iccarm)
set(CMAKE_ASM_COMPILER ${TOOLKIT_DIR}/arm/bin/iasmarm)
set(CMAKE_C_COMPILER ${TOOLKIT_DIR}/arm/bin/iccarm)
set(CMAKE_CXX_COMPILER ${TOOLKIT_DIR}/arm/bin/iccarm)

# Avoids running the linker during try_compile()
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
Expand Down
File renamed without changes.
45 changes: 45 additions & 0 deletions tutorial/ewarm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# set the minimum required version of CMake to be 3.20
cmake_minimum_required(VERSION 3.20)

# set the project name
project(Tutorial)

# add the executable target
add_executable(tutorial)

# target sources
target_sources(tutorial PRIVATE tutorial.c)

# compiler options
target_compile_options(tutorial PRIVATE --debug --endian=little --cpu=Cortex-M4 -e --fpu=VFPv4_sp -Ol)

# linker options
target_link_options(tutorial PRIVATE --config ${TOOLKIT_DIR}/arm/config/linker/ST/stm32f429xI.icf --semihosting --entry __iar_program_start --vfe --text_out locale --cpu=Cortex-M4 --fpu=VFPv4_sp)

# enable testing
enable_testing()

# add a test named `tutorialTest` for `tutorial`
add_test(NAME tutorialTest
COMMAND ${TOOLKIT_DIR}/common/bin/CSpyBat.exe
# C-SPY drivers for the Arm simulator via command line interface
${TOOLKIT_DIR}/arm/bin/armPROC.dll
${TOOLKIT_DIR}/arm/bin/armSIM2.dll
--plugin=${TOOLKIT_DIR}/arm/bin/armLibsupportUniversal.dll
--device_macro=${TOOLKIT_DIR}/arm/config/debugger/ST/STM32F4xx.dmac
# The target executable (built with debug information)
--debug_file=$<TARGET_FILE:tutorial>
# C-SPY driver options
--backend
--endian=little
--cpu=Cortex-M4
--fpu=VFPv4_SP
-p
${TOOLKIT_DIR}/arm/config/debugger/ST/STM32F429II.ddf
--semihosting
--device=STM32F429II
--multicore_nr_of_cores=1)

# set the `tutorialTest` test passing condition
set_tests_properties(tutorialTest PROPERTIES PASS_REGULAR_EXPRESSION "Hello world!")

9 changes: 5 additions & 4 deletions tutorial/ewarm.cmake → tutorial/ewarm/ewarm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

# Set CMake for cross-compiling
set(CMAKE_SYSTEM_NAME Generic)
set(TOOLKIT_DIR C:/iar/ewarm-9.60.2)

# Set CMake to use the IAR C/C++ Compiler from the IAR Embedded Workbench for Arm
# Update if using a different supported target or operating system
set(CMAKE_ASM_COMPILER "C:/Program Files/IAR Systems/Embedded Workbench 9.3/arm/bin/iasmarm.exe")
set(CMAKE_C_COMPILER "C:/Program Files/IAR Systems/Embedded Workbench 9.3/arm/bin/iccarm.exe")
set(CMAKE_CXX_COMPILER "C:/Program Files/IAR Systems/Embedded Workbench 9.3/arm/bin/iccarm.exe")
set(CMAKE_ASM_COMPILER ${TOOLKIT_DIR}/arm/bin/iasmarm.exe)
set(CMAKE_C_COMPILER ${TOOLKIT_DIR}/arm/bin/iccarm.exe)
set(CMAKE_CXX_COMPILER ${TOOLKIT_DIR}/arm/bin/iccarm.exe)

# Avoids running the linker during try_compile()
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
Expand All @@ -21,6 +22,6 @@ if(CMAKE_GENERATOR MATCHES "^Ninja.*$")
find_program(CMAKE_MAKE_PROGRAM
NAMES ninja.exe
PATHS $ENV{PATH}
"C:/Program Files/IAR Systems/Embedded Workbench 9.3/common/bin"
"C:/iar/ewarm-9.60.2/common/bin"
REQUIRED)
endif()
5 changes: 5 additions & 0 deletions tutorial/ewarm/tutorial.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <stdio.h>

void main() {
printf("Hello world!");
}