STM32F429 APPOLLO V4.0.3工程执行动态模块出错,解决办法:
1、按照教程编译固件和动态模块hello
2、动态模块的线程优先级修改:原程序是
module->priority = RT_THREAD_PRIORITY_MAX - 1;
这个优先级结果是31,与IDLE线程相同了
3、MPU必须配置下,不然SDRAM无法执行代码:
static void MPU_Config(void)
{
MPU_Region_InitTypeDef MPU_InitStruct = {0};
/* Disables the MPU /
HAL_MPU_Disable();
/* Initializes and configures the Region and the memory to be protected
/
MPU_InitStruct.Enable = MPU_REGION_ENABLE; //MPU Region
MPU_InitStruct.Number = MPU_REGION_NUMBER0; //Region 0 Settings
MPU_InitStruct.BaseAddress = 0xC0000000; //MPU Region Base Address
MPU_InitStruct.Size = MPU_REGION_SIZE_16MB; //MPU Region Size
MPU_InitStruct.SubRegionDisable = 0x0; //MPU SubRegion Disable
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1; //MPU TEX field level
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS; //MPU Access Permission
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE; //MPU Instruction Access
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE; //MPU Shareability Permission
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE; //MPU Cacheable Permission
MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE; //MPU Bufferable Permission
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/ Enables the MPU */
HAL_MPU_Enable(MPU_HFNMI_PRIVDEF); //MPU Enable
}
这个函数,要在drv_common.c里尽早调用。
总结:
1、内部SRAM跑动态模块,coremark跑分450,但内存太紧张了
2、外部SDRAM打开后,F429 coremark跑分只有133分(跟F103一样),如果是-O0优化只有27分!
3、所以,如果没有缓存cache(至少M7以上),就别想动态模块了,项目的意义不大了。
原作者:chenkuanglu
|