rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
hw_layer
ports
stm32
stm32h7
mpu_util.cpp
Go to the documentation of this file.
1
/**
2
* @file mpu_util.cpp
3
*
4
* @date Feb 26, 2021
5
* @author Matthew Kennedy, (c) 2021
6
*/
7
8
#include "
pch.h
"
9
10
#include "
flash_int.h
"
11
12
bool
mcuCanFlashWhileRunning
() {
13
#ifdef STM32H723xx
14
return
false
;
15
#else
16
return
true
;
17
#endif
18
}
19
20
size_t
flashSectorSize
(
flashsector_t
/* sector */
) {
21
// All sectors on H7 are 128k
22
return
128 * 1024;
23
}
24
25
static_assert
(
sizeof
(
persistent_config_container_s
) <= 128 * 1024,
"Settings does not fit into flash sector"
);
26
27
uintptr_t
getFlashAddrFirstCopy
() {
28
#ifdef STM32H723xx
29
return
0x080E0000;
30
#else
31
return
0x08100000;
32
#endif
33
}
34
35
uintptr_t
getFlashAddrSecondCopy
() {
36
#ifdef STM32H723xx
37
return
0;
38
#else
39
// Second copy is one sector past the first
40
return
getFlashAddrFirstCopy
() + 128 * 1024;
41
#endif
42
}
mcuCanFlashWhileRunning
bool mcuCanFlashWhileRunning()
Definition
mpu_util.cpp:10
getFlashAddrSecondCopy
uintptr_t getFlashAddrSecondCopy()
Definition
mpu_util.cpp:252
getFlashAddrFirstCopy
uintptr_t getFlashAddrFirstCopy()
Definition
mpu_util.cpp:248
flashSectorSize
size_t flashSectorSize(flashsector_t sector)
Get the size of sector.
Definition
mpu_util.cpp:237
flash_int.h
flashsector_t
uint8_t flashsector_t
Index of a sector.
Definition
flash_int.h:93
pch.h
persistent_config_container_s
Definition
persistent_configuration.h:14
Generated on Sat Oct 18 2025 00:09:11 for rusEFI by
1.9.8