fixes DMA issue by introducing new section

This commit is contained in:
2021-06-04 12:59:12 +02:00
parent 12fb19ec7b
commit f78d0c95d3
6 changed files with 40 additions and 10 deletions

View File

@ -165,7 +165,11 @@ SECTIONS
} >RAM_D1
.dma_buffer : /* Space before ':' is critical */
{
*(.dma_buffer)
} >RAM_D2
.lwip_sec (NOLOAD) : {
. = ABSOLUTE(0x30040000);
*(.RxDecripSection)

View File

@ -1,17 +1,18 @@
#include "hardware_init.h"
#include <stm32h743xx.h>
#include <stm32h7xx_hal_rcc_ex.h>
#include <stm32h7xx_nucleo.h>
#include <app_ethernet.h>
#include "OBSWConfig.h"
#include "boardconfig.h"
#include "app_ethernet.h"
#include <common/stm32_nucleo/networking/ethernetif.h>
#include <lwip/netif.h>
#include <lwip/init.h>
#include <lwip/ip_addr.h>
#include <netif/ethernet.h>
#include <boardconfig.h>
#include "stm32h743xx.h"
#include "stm32h7xx_hal_cortex.h"
#include "stm32h7xx_hal_rcc_ex.h"
#include "stm32h7xx_nucleo.h"
#include <stdio.h>
/* Forward declarations */
@ -208,6 +209,23 @@ void MPU_Config(void)
HAL_MPU_ConfigRegion(&MPU_InitStruct);
#if STM_USE_PERIPHERAL_TX_BUFFER_MPU_PROTECTION == 1
// Protect DMA buffer for other peripherals
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0x30000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_1KB;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER1;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.SubRegionDisable = 0x00;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
#endif
/* Enable the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
}