<commit_before>
function(add_executable ...)
	_add_executable(${ARGV}		${STM32F1_NEEDED_SYSTEM_FILES}
								${STM32F1_ACCESS_LAYER_SYSTEM_SOURCE_FILE}
								${STM32F1_DEVICE_VECTOR_TABLE_SOURCE_FILE}
								${STM32F1_SYSCALL_SOURCE_FILE}
								${STM32F1_ROOT_DIR}/hal/hal_stm32f1_clock.cpp
								${STM32F1_BOARD_SPECIFIC_FILES}
							)
endfunction()


SET(CMAKE_CROSSCOMPILING TRUE) 
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Generic)

################################################################################

set (SYSTEM_FILES_DIR "${STM32F10x_ROOT_DIR}/system_files")

################################################################################

include_directories(${CMAKE_BINARY_DIR})

include (arm-none-eabi-gcc)


################################################################################
# HAL FILES

macro (add_hal_files hal_implemented hal_type)

	if (NOT ${hal_implemented})
		message ("${hal_type} is not implemented for this architecture")
	elseif (${${hal_implemented}} STREQUAL "")
		message ("${hal_type} is not implemented for this architecture")
	else()

		set(hal_filename ${hal_type}.hpp)

		file (TO_NATIVE_PATH ${${hal_implemented}}					HAL_IMPLEMENTED_NATIVE_PATH)
		file (TO_NATIVE_PATH ${BASE_HAL_DIR}/${hal_filename}	HAL_NATIVE_PATH)

		#file (READ ${HAL_IMPLEMENTED_NATIVE_PATH} FILE_CONTENT)
		#file (WRITE ${CMAKE_BINARY_DIR}/hal/${hal_filename} "// WARNING : DO NOT EDIT THIS FILE !!!!!!!!!!!\n")
		#file (APPEND ${CMAKE_BINARY_DIR}/hal/${hal_filename} "// it was genereated by CMAKE\n")
		#file (APPEND ${CMAKE_BINARY_DIR}/hal/${hal_filename} "// if you want to modify the content, edit the file : ${HAL_IMPLEMENTED_NATIVE_PATH}\n\n")
		#file (WRITE ${CMAKE_BINARY_DIR}/hal/${hal_filename} ${FILE_CONTENT})

		configure_file(${HAL_IMPLEMENTED_NATIVE_PATH} ${CMAKE_BINARY_DIR}/hal/${hal_filename} COPYONLY)

		#message ("copy : ${HAL_IMPLEMENTED_NATIVE_PATH} to ./hal/${hal_filename}")
		#message ("append : ${HAL_NATIVE_PATH}")
		list(APPEND STM32F1_NEEDED_SYSTEM_FILES ${HAL_NATIVE_PATH})
		if (NOT (${HAL_IMPLEMENTED_NATIVE_PATH} STREQUAL ${HAL_NATIVE_PATH}))
			#message ("append : ${HAL_IMPLEMENTED_NATIVE_PATH}")
			list(APPEND STM32F1_NEEDED_SYSTEM_FILES ${HAL_IMPLEMENTED_NATIVE_PATH})
		endif()

	endif()
endmacro()

add_hal_files(HAL_IMPLEMENTED_LED		"led")
add_hal_files(HAL_IMPLEMENTED_CLOCK		"clock")
add_hal_files(HAL_IMPLEMENTED_UART		"uart")
add_hal_files(HAL_IMPLEMENTED_GPIO		"gpio")
add_hal_files(HAL_IMPLEMENTED_SPI		"spi")

################################################################################
# stm32f4 system headers
include_directories(${BASE_HAL_DIR})
include_directories(${SYSTEM_FILES_DIR})
include_directories(${STM32F1_ROOT_DIR}/system_files/STM32F10x_StdPeriph_Driver/inc/)
include_directories(${STM32F1_ROOT_DIR}/system_files)
include_directories(${STM32F1_ROOT_DIR}/../stm32fx/)

################################################################################
# stm32f4 system sources
set(STM32F1xx_StdPeriph_Driver		${STM32F1_ROOT_DIR}/system_files/STM32F10x_StdPeriph_Driver)
set(STM32F1_MISC_SOURCE				misc)
set(STM32F1_ADC_SOURCE				stm32f10x_adc)
set(STM32F1_BKP_SOURCE				stm32f10x_bkp)
set(STM32F1_CAN_SOURCE				stm32f10x_can)
set(STM32F1_CEC_SOURCE				stm32f10x_cec)<commit_msg>Add a warning header to the temporary generated file<commit_after>
function(add_executable ...)
	_add_executable(${ARGV}		${STM32F1_NEEDED_SYSTEM_FILES}
								${STM32F1_ACCESS_LAYER_SYSTEM_SOURCE_FILE}
								${STM32F1_DEVICE_VECTOR_TABLE_SOURCE_FILE}
								${STM32F1_SYSCALL_SOURCE_FILE}
								${STM32F1_ROOT_DIR}/hal/hal_stm32f1_clock.cpp
								${STM32F1_BOARD_SPECIFIC_FILES}
							)
endfunction()


SET(CMAKE_CROSSCOMPILING TRUE) 
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Generic)

################################################################################

set (SYSTEM_FILES_DIR "${STM32F10x_ROOT_DIR}/system_files")

################################################################################

include_directories(${CMAKE_BINARY_DIR})

include (arm-none-eabi-gcc)


################################################################################
# HAL FILES

macro (add_hal_files hal_implemented hal_type)

	if (NOT ${hal_implemented})
		message ("${hal_type} is not implemented for this architecture")
	elseif (${${hal_implemented}} STREQUAL "")
		message ("${hal_type} is not implemented for this architecture")
	else()

		set(hal_filename ${hal_type}.hpp)

		file (TO_NATIVE_PATH ${${hal_implemented}}				HAL_IMPLEMENTED_NATIVE_PATH)
		file (TO_NATIVE_PATH ${BASE_HAL_DIR}/${hal_filename}	HAL_NATIVE_PATH)

		file (READ ${HAL_IMPLEMENTED_NATIVE_PATH} FILE_CONTENT)
		file (WRITE ${CMAKE_BINARY_DIR}/hal/${hal_filename} "
/****************************************************************************
** Hal file for ${hal_type}
**
** This file was genereted by the toolchain
**
** The original file is located here : \"${HAL_IMPLEMENTED_NATIVE_PATH}\"
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
")
		file (APPEND ${CMAKE_BINARY_DIR}/hal/${hal_filename} "${FILE_CONTENT}")

		
		list(APPEND STM32F1_NEEDED_SYSTEM_FILES ${HAL_NATIVE_PATH})
		if (NOT (${HAL_IMPLEMENTED_NATIVE_PATH} STREQUAL ${HAL_NATIVE_PATH}))
			#message ("append : ${HAL_IMPLEMENTED_NATIVE_PATH}")
			list(APPEND STM32F1_NEEDED_SYSTEM_FILES ${HAL_IMPLEMENTED_NATIVE_PATH})
		endif()

	endif()
endmacro()

add_hal_files(HAL_IMPLEMENTED_LED		"led")
add_hal_files(HAL_IMPLEMENTED_CLOCK		"clock")
add_hal_files(HAL_IMPLEMENTED_UART		"uart")
add_hal_files(HAL_IMPLEMENTED_GPIO		"gpio")
add_hal_files(HAL_IMPLEMENTED_SPI		"spi")

################################################################################
# stm32f4 system headers
include_directories(${BASE_HAL_DIR})
include_directories(${SYSTEM_FILES_DIR})
include_directories(${STM32F1_ROOT_DIR}/system_files/STM32F10x_StdPeriph_Driver/inc/)
include_directories(${STM32F1_ROOT_DIR}/system_files)
include_directories(${STM32F1_ROOT_DIR}/../stm32fx/)

################################################################################
# stm32f4 system sources
set(STM32F1xx_StdPeriph_Driver		${STM32F1_ROOT_DIR}/system_files/STM32F10x_StdPeriph_Driver)
set(STM32F1_MISC_SOURCE				misc)
set(STM32F1_ADC_SOURCE				stm32f10x_adc)
set(STM32F1_BKP_SOURCE				stm32f10x_bkp)
set(STM32F1_CAN_SOURCE				stm32f10x_can)
set(STM32F1_CEC_SOURCE				stm32f10x_cec)
{'fraction_non_alphanumeric': 0.24329296336041698, 'fraction_numerical': 0.0285144871991415, 'mean_word_length': 8.086350974930362, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '247609', 'n_tokens_mistral': 2552, 'n_tokens_neox': 2249, 'n_words': 329}