-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework MPU config for unaligned access to external memory
- Add MPU config to ORGPAL3 and ORGPALX to allow unaligned access to external memory. - Remove MPU config for non cached memory in ChibiOS mcu config for ORGPAL3 and ORGPALX. Now are in Target_ConfigNonCacheableMemory(). - Rework call to MPU config in ORGPAL3 and ORGPALX. - Migrate ST_STM32F769I_DISCOVERY MPU config to use ST HAL API.
- Loading branch information
1 parent
9498e56
commit ec25d8a
Showing
11 changed files
with
172 additions
and
82 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,40 @@ | ||
// | ||
// Copyright (c) .NET Foundation and Contributors | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#include <ch.h> | ||
#include <hal.h> | ||
#include <stm32_registry.h> | ||
#include <hal_nf_community.h> | ||
|
||
extern void Target_ExternalMemoryConfigMPU(); | ||
|
||
void Target_ConfigNonCacheableMemory() | ||
{ | ||
// region | ||
MPU->RNR = ((uint32_t)MPU_REGION_1); | ||
|
||
// base address | ||
MPU->RBAR = ((uint32_t)0x20000000U); | ||
|
||
// size and other configs | ||
MPU->RASR = | ||
((uint32_t)MPU_RASR_ATTR_AP_RW_RW | MPU_RASR_ATTR_NON_CACHEABLE | MPU_RASR_ATTR_S | MPU_RASR_SIZE_128K | | ||
MPU_RASR_ENABLE); | ||
} | ||
|
||
void Target_ConfigMPU() | ||
{ | ||
// disable MPU | ||
HAL_MPU_Disable(); | ||
|
||
// config MPU for external memory | ||
Target_ExternalMemoryConfigMPU(); | ||
|
||
// config MPU for non cacheable memory | ||
Target_ConfigNonCacheableMemory(); | ||
|
||
// enable MPU | ||
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); | ||
} |
This file contains 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 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 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 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 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,40 @@ | ||
// | ||
// Copyright (c) .NET Foundation and Contributors | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#include <ch.h> | ||
#include <hal.h> | ||
#include <stm32_registry.h> | ||
#include <hal_nf_community.h> | ||
|
||
extern void Target_ExternalMemoryConfigMPU(); | ||
|
||
void Target_ConfigNonCacheableMemory() | ||
{ | ||
// region | ||
MPU->RNR = ((uint32_t)MPU_REGION_1); | ||
|
||
// base address | ||
MPU->RBAR = ((uint32_t)0x20000000U); | ||
|
||
// size and other configs | ||
MPU->RASR = | ||
((uint32_t)MPU_RASR_ATTR_AP_RW_RW | MPU_RASR_ATTR_NON_CACHEABLE | MPU_RASR_ATTR_S | MPU_RASR_SIZE_128K | | ||
MPU_RASR_ENABLE); | ||
} | ||
|
||
void Target_ConfigMPU() | ||
{ | ||
// disable MPU | ||
HAL_MPU_Disable(); | ||
|
||
// config MPU for external memory | ||
Target_ExternalMemoryConfigMPU(); | ||
|
||
// config MPU for non cacheable memory | ||
Target_ConfigNonCacheableMemory(); | ||
|
||
// enable MPU | ||
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); | ||
} |
This file contains 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