Skip to content

Commit

Permalink
generate CMake source package of HAL on release
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-hillmann committed Aug 12, 2022
1 parent f8bda02 commit 800ce59
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release
permissions:
contents: write

on:
release:
types: [published]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Create build environment
run: cmake -E make_directory build
- name: Configure
working-directory: build/
run: cmake $GITHUB_WORKSPACE
- name: Package source code
working-directory: build/
run: cmake --build . --target stm32f7xx-hal_package

- name: Add packaged source code to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/stm32f7xx-hal-src.zip
tag: ${{ github.ref }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ignore
/build
55 changes: 55 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#******************************************************************************
# Copyright 2020 Embedded Office GmbH & Co. KG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#******************************************************************************

#---
# Preamble
#
cmake_minimum_required(VERSION 3.20) # buildPresets is introduced in 3.20
project(stm32f7xx-hal)

#---
# Target exported by this project as 'stm32f7xx-hal'
#
# You must configure the HAL with some cached variables in your project:
# - STM_HAL_CONF_DIR : [path] directory which holds the configuration: stm32f7xx_hal_conf.h
# - STM_HAL_DEVICE : [string] select a supported compiler definition (e.g. 'STM32F76XX')
# - STM_USE_HAL_DRIVER : [boolean] true = set compiler definition 'USE_HAL_DRIVER'
# - STM_USE_FULL_LL_DRIVER : [boolean] true = set compiler definition 'USE_FULL_LL_DRIVER'
# - STM_USE_FULL_ASSERT : [bbolean] true = set compiler definition 'USE_FULL_ASSERT'
add_subdirectory(Drivers)

#---
# This is needed only if we are the top level project
#
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)

# Setup target which creates a source package for efficient usage with Cmake CPM/FetchContent
set(package_files
Drivers/CMSIS/Device
Drivers/CMSIS/Include
Drivers/STM32F7xx_HAL_Driver
Drivers/CMakeLists.txt
CMakeLists.txt
LICENSE.md
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-src.zip
COMMAND ${CMAKE_COMMAND} -E tar c ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-src.zip --format=zip -- ${package_files}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${package_files}
)
add_custom_target(${PROJECT_NAME}_package DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-src.zip)

endif()
130 changes: 130 additions & 0 deletions Drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#******************************************************************************
# Copyright 2020 Embedded Office GmbH & Co. KG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#******************************************************************************

add_library(stm32f7xx-hal)

target_sources(stm32f7xx-hal
PRIVATE
STM32F7xx_HAL_Driver/Src/Legacy/stm32f7xx_hal_can.c
STM32F7xx_HAL_Driver/Src/Legacy/stm32f7xx_hal_eth.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_adc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_adc_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_can.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cec.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_crc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_crc_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cryp.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cryp_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dac.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dac_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dcmi.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dcmi_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dfsdm.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma2d.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dsi.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_eth.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_hash.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_hash_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_hcd.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2s.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_irda.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_iwdg.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_jpeg.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_lptim.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_ltdc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_ltdc_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_mdios.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_mmc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_nand.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_nor.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pcd.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pcd_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_qspi.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rng.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rtc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rtc_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sai.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sai_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sd.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sdram.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_smartcard.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_smartcard_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_smbus.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_spdifrx.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_spi.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_spi_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sram.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_usart.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_wwdg.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_adc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_crc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_dac.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_dma.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_dma2d.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_exti.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_fmc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_gpio.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_i2c.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_lptim.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_pwr.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_rcc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_rng.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_rtc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_sdmmc.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_spi.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_tim.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_usart.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_usb.c
STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_utils.c
)

target_include_directories(stm32f7xx-hal
PUBLIC
CMSIS/Include
CMSIS/Device/ST/STM32F7xx/Include
STM32F7xx_HAL_Driver/Inc
STM32F7xx_HAL_Driver/Inc/Legacy
${STM_HAL_CONF_DIR}
)

if (${STM_USE_HAL_DRIVER})
target_compile_definitions(stm32f7xx-hal PUBLIC USE_HAL_DRIVER)
endif()
if (${STM_USE_FULL_LL_DRIVER})
target_compile_definitions(stm32f7xx-hal PUBLIC USE_FULL_LL_DRIVER)
endif()
if (${STM_USE_FULL_ASSERT})
target_compile_definitions(stm32f7xx-hal PUBLIC USE_FULL_ASSERT)
endif()
target_compile_definitions(stm32f7xx-hal PUBLIC ${STM_HAL_DEVICE})

0 comments on commit 800ce59

Please sign in to comment.