forked from ARMmbed/mbed-os
-
Notifications
You must be signed in to change notification settings - Fork 26
Enable ICACHE, TRNG and WATCHDOG for STM32H5 #465
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
Merged
multiplemonomials
merged 4 commits into
mbed-ce:master
from
wdx04:stm32h5-icache-trng-wdg-lpticker
Jun 18, 2025
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1eaecd3
enable ICACHE, LPTICKER, TRNG and WATCHDOG for STM32H5
wdx04 b19a330
added Cache_Init() weak function for STM32 targets and provide a defa…
wdx04 44e5b27
revert the changes in system_clock.c of STM32H5
wdx04 1839d2a
revert adding LP ticker
wdx04 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* mbed Microcontroller Library | ||
| * SPDX-License-Identifier: BSD-3-Clause | ||
| ****************************************************************************** | ||
| * | ||
| * Copyright (c) 2015-2021 STMicroelectronics. | ||
| * All rights reserved. | ||
| * | ||
| * This software component is licensed by ST under BSD 3-Clause license, | ||
| * the "License"; You may not use this file except in compliance with the | ||
| * License. You may obtain a copy of the License at: | ||
| * opensource.org/licenses/BSD-3-Clause | ||
| * | ||
| ****************************************************************************** | ||
| */ | ||
| #include "stm32h5xx.h" | ||
| #include "mbed_error.h" | ||
|
|
||
| /** | ||
| * @brief Enable ICACHE and define a MPU region to avoid HardFaults when accessing OTP and RO regions | ||
| * @param None | ||
| * @retval None | ||
| */ | ||
|
|
||
| void Cache_Init() | ||
| { | ||
| MPU_Attributes_InitTypeDef attr; | ||
| MPU_Region_InitTypeDef region; | ||
|
|
||
| /* Disable MPU before perloading and config update */ | ||
| HAL_MPU_Disable(); | ||
|
|
||
| /* Configurate 0x00000000-0x08FFF7FF as Read Only, Executable and Cacheable */ | ||
| region.Enable = MPU_REGION_ENABLE; | ||
| region.Number = MPU_REGION_NUMBER0; | ||
| region.AttributesIndex = MPU_ATTRIBUTES_NUMBER0; | ||
| region.BaseAddress = 0x00000000; | ||
| region.LimitAddress = 0x08FFF7FF; | ||
| region.AccessPermission = MPU_REGION_ALL_RO; | ||
| region.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE; | ||
| region.IsShareable = MPU_ACCESS_NOT_SHAREABLE; | ||
| HAL_MPU_ConfigRegion(®ion); | ||
|
|
||
| /* Define cacheable memory via MPU */ | ||
| attr.Number = MPU_ATTRIBUTES_NUMBER5; | ||
| attr.Attributes = INNER_OUTER(MPU_NOT_CACHEABLE); | ||
| HAL_MPU_ConfigMemoryAttributes(&attr); | ||
|
|
||
| /* Configurate 0x08FFF800-0X0FFFFFFF as Read Only, Not Executable and Non-cacheable */ | ||
| region.Enable = MPU_REGION_ENABLE; | ||
| region.Number = MPU_REGION_NUMBER5; | ||
| region.AttributesIndex = MPU_ATTRIBUTES_NUMBER5; | ||
| region.BaseAddress = 0x08FFF800; | ||
| region.LimitAddress = MBED_CONF_TARGET_MPU_ROM_END; | ||
| region.AccessPermission = MPU_REGION_ALL_RO; | ||
| region.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE; | ||
| region.IsShareable = MPU_ACCESS_NOT_SHAREABLE; | ||
| HAL_MPU_ConfigRegion(®ion); | ||
|
|
||
| /* Enable the MPU */ | ||
| HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); | ||
|
|
||
| /* Enable ICACHE */ | ||
| HAL_ICACHE_Enable(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* mbed Microcontroller Library | ||
| * SPDX-License-Identifier: BSD-3-Clause | ||
| ****************************************************************************** | ||
| * | ||
| * Copyright (c) 2015-2021 STMicroelectronics. | ||
| * All rights reserved. | ||
| * | ||
| * This software component is licensed by ST under BSD 3-Clause license, | ||
| * the "License"; You may not use this file except in compliance with the | ||
| * License. You may obtain a copy of the License at: | ||
| * opensource.org/licenses/BSD-3-Clause | ||
| * | ||
| ****************************************************************************** | ||
| */ | ||
| #include "stm32u5xx.h" | ||
| #include "mbed_error.h" | ||
|
|
||
| /** | ||
| * @brief Enable ICACHE | ||
| * @param None | ||
| * @retval None | ||
| */ | ||
|
|
||
| void Cache_Init() | ||
| { | ||
| HAL_ICACHE_ConfigAssociativityMode(ICACHE_1WAY); | ||
| HAL_ICACHE_Enable(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.