drivers: hwinfo stm32h5 device must disable icache to access UID_BASE
Reading the UID_BASE_ADDRESS requires disabling the icache of the stm32h5x mcu. Else a bus fault error occurs reading Address: 0x8fff800-0x8fff808 Enable afterwards. Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
429be3608c
commit
8d5ff8cb68
1 changed files with 11 additions and 0 deletions
|
|
@ -7,6 +7,9 @@
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include <stm32_ll_utils.h>
|
#include <stm32_ll_utils.h>
|
||||||
#include <stm32_ll_rcc.h>
|
#include <stm32_ll_rcc.h>
|
||||||
|
#if defined(CONFIG_SOC_SERIES_STM32H5X)
|
||||||
|
#include <stm32_ll_icache.h>
|
||||||
|
#endif /* CONFIG_SOC_SERIES_STM32H5X */
|
||||||
#include <zephyr/drivers/hwinfo.h>
|
#include <zephyr/drivers/hwinfo.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <zephyr/sys/byteorder.h>
|
#include <zephyr/sys/byteorder.h>
|
||||||
|
|
@ -19,10 +22,18 @@ ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
|
||||||
{
|
{
|
||||||
struct stm32_uid dev_id;
|
struct stm32_uid dev_id;
|
||||||
|
|
||||||
|
#if defined(CONFIG_SOC_SERIES_STM32H5X)
|
||||||
|
LL_ICACHE_Disable();
|
||||||
|
#endif /* CONFIG_SOC_SERIES_STM32H5X */
|
||||||
|
|
||||||
dev_id.id[0] = sys_cpu_to_be32(LL_GetUID_Word2());
|
dev_id.id[0] = sys_cpu_to_be32(LL_GetUID_Word2());
|
||||||
dev_id.id[1] = sys_cpu_to_be32(LL_GetUID_Word1());
|
dev_id.id[1] = sys_cpu_to_be32(LL_GetUID_Word1());
|
||||||
dev_id.id[2] = sys_cpu_to_be32(LL_GetUID_Word0());
|
dev_id.id[2] = sys_cpu_to_be32(LL_GetUID_Word0());
|
||||||
|
|
||||||
|
#if defined(CONFIG_SOC_SERIES_STM32H5X)
|
||||||
|
LL_ICACHE_Enable();
|
||||||
|
#endif /* CONFIG_SOC_SERIES_STM32H5X */
|
||||||
|
|
||||||
if (length > sizeof(dev_id.id)) {
|
if (length > sizeof(dev_id.id)) {
|
||||||
length = sizeof(dev_id.id);
|
length = sizeof(dev_id.id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue