Skip to content

Commit

Permalink
Add H7RS subfamily support (#288)
Browse files Browse the repository at this point in the history
Add H7RS family and allow it's support
  • Loading branch information
xanthio authored Aug 13, 2024
1 parent 684774a commit 145b34a
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 18 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/create-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,5 @@ jobs:
- name: Create matrix
id: create-matrix
run: |
files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr '[:lower:]' '[:upper:]'" \; | sort)
deletes="COMMON DEVICES LINKER_LD"
for del in $deletes; do
files=(${files[@]/$del})
done
echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${files[@]})}" >> $GITHUB_OUTPUT
families=$(sed -nr "s@stm32_util_create_family_targets\((\w+)+(\s\w+)?\)@\1@p" cmake/stm32/* | tr -d '\r' | sort | uniq)
echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${families[@]})}" >> $GITHUB_OUTPUT
29 changes: 19 additions & 10 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,31 @@ jobs:
with:
repository: STMicroelectronics/stm32${{ matrix.family }}xx_hal_driver

- name: Update Cube with latest version
- name: Prepare Env variables
id: find-family-src-file
run: |
family_src_file=${GITHUB_WORKSPACE}/cmake/stm32/$(echo "${{ matrix.family }}" | tr '[:upper:]' '[:lower:]').cmake
sed -ri 's@(set\(CUBE_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-cube.outputs.TAG }}\4@g' $family_src_file
family_src_file=${GITHUB_WORKSPACE}/$(grep -lr -e "stm32_util_create_family_targets(${{ matrix.family }}" cmake/stm32/)
echo "FAMILY_SRC_FILE=${family_src_file}" >> $GITHUB_OUTPUT
- name: Update Cube with latest version
env:
FAMILY_SRC_FILE: ${{ steps.find-family-src-file.outputs.FAMILY_SRC_FILE }}
run:
sed -ri 's@(set\(CUBE_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-cube.outputs.TAG }}\4@g' ${FAMILY_SRC_FILE}

- name: Update CMSIS with latest version
if: ${{ steps.get-latest-cmsis.outputs.TAG }}
run: |
family_src_file=${GITHUB_WORKSPACE}/cmake/stm32/$(echo "${{ matrix.family }}" | tr '[:upper:]' '[:lower:]').cmake
sed -ri 's@(set\(CMSIS_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-cmsis.outputs.TAG }}\4@g' $family_src_file
env:
FAMILY_SRC_FILE: ${{ steps.find-family-src-file.outputs.FAMILY_SRC_FILE }}
run:
sed -ri 's@(set\(CMSIS_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-cmsis.outputs.TAG }}\4@g' ${FAMILY_SRC_FILE}

- name: Update HAL with latest version
if: ${{ steps.get-latest-hal.outputs.TAG }}
run: |
family_src_file=${GITHUB_WORKSPACE}/cmake/stm32/$(echo "${{ matrix.family }}" | tr '[:upper:]' '[:lower:]').cmake
sed -ri 's@(set\(HAL_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-hal.outputs.TAG }}\4@g' $family_src_file
env:
FAMILY_SRC_FILE: ${{ steps.find-family-src-file.outputs.FAMILY_SRC_FILE }}
run:
sed -ri 's@(set\(HAL_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-hal.outputs.TAG }}\4@g' ${FAMILY_SRC_FILE}

- name: Generate token
uses: tibdex/github-app-token@v2
Expand Down Expand Up @@ -123,7 +132,7 @@ jobs:
id: prepare-env
run: |
FAMILY_L=$(echo "${{ matrix.family }}" | tr '[:upper:]' '[:lower:]')
family_src_file=${GITHUB_WORKSPACE}/cmake/stm32/${FAMILY_L}.cmake
family_src_file=${GITHUB_WORKSPACE}/$(grep -lr -e "stm32_util_create_family_targets(${{ matrix.family }}" cmake/stm32/)
{
echo "FAMILY_L=${FAMILY_L}"
echo "FAMILY_SRC_FILE=${family_src_file}"
Expand Down
5 changes: 5 additions & 0 deletions cmake/stm32/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ function(stm32_extract_info identifier)

# message(STATUS "Parsed ${identifier} and got F ${FAMILY} S ${SUB_FAMILY} P ${PIN_COUNT} R ${FLASH_SIZE} C ${CORE}")

string(TOLOWER ${FAMILY} FAMILY_L)
if(COMMAND "stm32${FAMILY_L}_get_actual_family")
cmake_language(CALL stm32${FAMILY_L}_get_actual_family ${FAMILY}${SUB_FAMILY} FAMILY)
endif()

if (INFO_FAMILY AND FAMILY)
set(${INFO_FAMILY} ${FAMILY} PARENT_SCOPE)
endif()
Expand Down
64 changes: 63 additions & 1 deletion cmake/stm32/h7.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ set(STM32_H7_CCRAM_SIZES
0K 0K 0K 0K 0K 0K
)

set(STM32_H7RS_TYPES
H7R3xx H7S3xx
H7R7xx H7S7xx
)
set(STM32_H7RS_TYPE_MATCH
"H7R3.." "H7S3.."
"H7R7.." "H7S7.."
)
set(STM32_H7RS_RAM_SIZES
620K 620K
620K 620K
)
set(STM32_H7RS_CCRAM_SIZES
0K 0K
0K 0K
)

set(STM32_H7_DUAL_CORE
H745xx H755xx H747xx H757xx
)
Expand Down Expand Up @@ -53,6 +70,22 @@ target_compile_definitions(STM32::H7::M4 INTERFACE
-DCORE_CM4
)

stm32_util_create_family_targets(H7RS)

target_compile_options(STM32::H7RS INTERFACE
-mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard
)

target_link_options(STM32::H7RS INTERFACE
-mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard
)

function(stm32h7_get_actual_family DEVICE FAMILY)
if(${DEVICE} MATCHES "(STM32)?H7(R|S).*")
set(FAMILY H7RS PARENT_SCOPE)
endif()
endfunction()

function(stm32h7_get_memory_info DEVICE TYPE CORE FLASH FLASH_ORIGIN RAM RAM_ORIGIN TWO_FLASH_BANKS)
if(${TYPE} IN_LIST STM32_H7_DUAL_CORE)
set(${TWO_FLASH_BANKS} TRUE PARENT_SCOPE)
Expand Down Expand Up @@ -218,15 +251,44 @@ set(STM32_H7_DEVICES
)
list(APPEND STM32_ALL_DEVICES STM32_H7_DEVICES)

set(STM32_H7RS_DEVICES
H7R3A8
H7R3I8
H7R3L8
H7R3R8
H7R3V8
H7R3Z8
H7R7A8
H7R7I8
H7R7L8
H7R7Z8
H7S3A8
H7S3I8
H7S3L8
H7S3R8
H7S3V8
H7S3Z8
H7S7A8
H7S7I8
H7S7L8
H7S7Z8
)
list(APPEND STM32_ALL_DEVICES STM32_H7_DEVICES)

list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME
STM32H7_M4
STM32H7_M7
STM32H7RS
)

list(APPEND STM32_FETCH_FAMILIES H7)
list(APPEND STM32_FETCH_FAMILIES H7 H7RS)

# SERIE SS1951

set(CUBE_H7_VERSION v1.11.2)
set(CMSIS_H7_VERSION v1.10.4)
set(HAL_H7_VERSION v1.11.3)

set(CUBE_H7RS_VERSION v1.1.0)
set(CMSIS_H7RS_VERSION v1.1.0)
set(HAL_H7RS_VERSION v1.1.0)
2 changes: 1 addition & 1 deletion cmake/stm32/mp2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ set(STM32_MP2_DEVICES
MP257D
MP257F
)
list(APPEND STM32_ALL_DEVICES STM32MP2_DEVICES MP257C)
list(APPEND STM32_ALL_DEVICES STM32MP2_DEVICES)

list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME
STM32MP2_M33
Expand Down

0 comments on commit 145b34a

Please sign in to comment.