Dear All,
I am using MIMXRT1050-EVK and would like to configure DTCM for 512 Kb at the first place of my software, I did the following :
___writeMemory32(0x400AC040, 0x80000000); //IOMUXC_GPR_GPR16
___writeMemory32(0x400AC044, 0xAAAAAAAA);
but I get hardfault on the second line, any advise about this ?
I call these 2 lines just after clock init.
Regards
David
Best practice is to configure FlexRAM in Reset_Handler as below:
__iomux_gpr16_adr EQU 0x400AC040
__iomux_gpr17_adr EQU 0x400AC044
__flexram_bank_cfg EQU 0xAAAAAAAA
Reset_Hanlder
CPSID I ;关闭全局中断
LDR R0,=__iomux_gpr17_adr
MOV32 R1,__flexram_bank_cfg
STR R1,[R0]
LDR R0,=__iomux_gpr16_adr
LDR R1,[R0]
ORR R1,R1,#4
STR R1,[R0]
Note that you need to configure IOMUXC_GPR_GPR17 before IOMUXC_GPR_GPR16, and why you configure IOMUXC_GPR_GPR16 as 0x80000000? it should be 0x00200007.
___writeMemory32(0x400AC044, 0xAAAAAAAA);//IOMUXC_GPR_GPR17
___writeMemory32(0x400AC040, 0x00200007); //IOMUXC_GPR_GPR16
As RT1050 only contains 512KB FlexRAM, not other dedicated OCRAM, so your application .data/.bss sections have to be resided in FlexRAM region.
In this case, you need to put FlexRAM configuration code before .data/.bss init process of your application, or there will be hardfault. because .data/.bss will be damaged after FlexRAM configuration.
Hi David
for configuration examples one can look at sect.2.1.1.2. Runtime
configuration AN12077 Using the i.MX RT FlexRAM
https://www.nxp.com/docs/en/application-note/AN12077.pdf
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------