This is a first implementation of a "full" timing system, with proper handling for cases wher the ignition charge time overlaps with the compression pulse, the spark has a more complex state machine system with the option to defer charge from the intake pulse to the compression pulse, and further defferal of the spark release schedule to the ISR that triggers when the output compare triggers for the charge Preliminary error counters have been put in place, they still require handling error conditions that would force a soft shutdown on the ignition IC. Alongside this the code still needs to be verified so that all non critical errors (ie missed charge schedules) reset the state machine and increment a global spark miss counter to avoid having these errors breaking the state machine as they can easily be recovered from Cases where the coil would already be charging and an error occurs require as stated above a full recovery procedure with soft shutdown of the ignition IC and a clean cycle of the state machine to ensure a full recovery
96 lines
2.1 KiB
CMake
96 lines
2.1 KiB
CMake
cmake_minimum_required(VERSION 3.22)
|
|
|
|
#
|
|
# This file is generated only once,
|
|
# and is not re-generated if converter is called multiple times.
|
|
#
|
|
# User is free to modify the file as much as necessary
|
|
#
|
|
|
|
# Setup compiler settings
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
set(CMAKE_C_EXTENSIONS ON)
|
|
|
|
# Define the build type
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
endif()
|
|
|
|
message("Build type: " ${CMAKE_BUILD_TYPE})
|
|
|
|
# Enable compile command to ease indexing with e.g. clangd
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
|
|
|
# Compiler options
|
|
set(STM32_MCU_FLAGS "-mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard " )
|
|
|
|
#Linker options
|
|
set(STM32_LINKER_SCRIPT stm32h747xx_flash_CM7.ld)
|
|
set(STM32_LINKER_OPTION )
|
|
|
|
# Set the project name
|
|
set(CMAKE_PROJECT_NAME STM32_CM7)
|
|
project(${CMAKE_PROJECT_NAME})
|
|
|
|
# Create an executable object type
|
|
add_executable(${CMAKE_PROJECT_NAME})
|
|
|
|
# Include mx-generated
|
|
include("mx-generated.cmake")
|
|
|
|
|
|
# In order to use CMake for cross-compiling
|
|
set(CMAKE_CXX_COMPILER_FORCED "true")
|
|
|
|
# Add project symbols (macros)
|
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
|
|
# Add user defined symbols
|
|
)
|
|
|
|
# Enable CMake support for ASM and C languages
|
|
enable_language(C ASM)
|
|
|
|
# Add include paths
|
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
|
|
# Add user defined include paths
|
|
)
|
|
|
|
# Add sources to executable
|
|
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
|
|
# Add user sources here
|
|
Core/Src/ring_buffer.c
|
|
Core/Src/SEGGER_RTT.c
|
|
Core/Src/SEGGER_RTT_printf.c
|
|
Core/Src/tasks/crank.c
|
|
Core/Src/tasks/cam.c
|
|
Core/Src/timer_utils.c
|
|
)
|
|
|
|
# Link directories setup
|
|
target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE
|
|
# Add user defined library search paths
|
|
)
|
|
|
|
# Add linked libraries
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
|
|
# Add user defined libraries
|
|
)
|
|
|
|
# Remove wrong libob.a library dependency when using cpp files
|
|
list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_LIBRARIES ob)
|
|
|
|
# Validate that STM32CubeMX code is compatible with C standard
|
|
if((CMAKE_C_STANDARD EQUAL 90) OR (CMAKE_C_STANDARD EQUAL 99))
|
|
message(ERROR "Generated code requires C11 or higher")
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|