Hi Daniel,
Thanks much for sharing a sample code. I have tested your code and it works perfectly.
However, i see that in the linker script that you have shared, i don't see a region for dtcm0 region. So i have added the following line in the code and tried to build it.
uint32_t __attribute__ ((section(".dtcm0_data"))) dtcm0_data_array[1 * 1024];
I got the following error.
c:/nxp/s32ds.3.5/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/real-ld.exe: section .dtcm0_data LMA [00405d48,00406d47] overlaps section .dtcm1_bd_data LMA [00405d48,00415d47]
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:39: Example_S32K314_DTCM1_Backdoor_RTD201_DS34_v1.elf] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.
The following are the contents of the map file.
.dtcm0_data 0x2043040c 0x1000 load address 0x00405d48
.dtcm0_data 0x2043040c 0x1000 ./src/main.o
0x2043040c dtcm0_data_array
.dtcm1_bd_data 0x21400000 0x10000 load address 0x00405d48
0x21400000 . = ALIGN (0x4)
0x21400000 __dtcm1_bd_data_start__ = .
So i have made some cosmetic changes to the linker script (which is attached here) and now i see that this seems to be working. So can you kindly help me understand the following queries.
1. I see that in the system.c file, we are setting rbar[7] and rasr[7] registers with the new DTCM1 region. But we have commented out the RAM_SHAREABLE_START here. Will this not create an issue ?
2. when i integrate this linker script into my code, i see a memory exception when i try to access this location. The following is the contents of my init_table in startup_cm7.s file. Am i missing something here ? I am using the linker script, which i have already attached now.
.section ".init_table", "a"
.long 4
.long __RAM_CACHEABLE_START
.long __ROM_CACHEABLE_START
.long __ROM_CACHEABLE_END
.long __RAM_NO_CACHEABLE_START
.long __ROM_NO_CACHEABLE_START
.long __ROM_NO_CACHEABLE_END
.long __RAM_SHAREABLE_START
.long __ROM_SHAREABLE_START
.long __ROM_SHAREABLE_END
.long __RAM_INTERRUPT_START
.long __ROM_INTERRUPT_START
.long __ROM_INTERRUPT_END
.long __RAM_DTCM0_DATA_START
.long __ROM_DTCM0_DATA_START
.long __ROM_DTCM0_DATA_END
.long __RAM_DTCM1_BD_DATA_START
.long __ROM_DTCM1_BD_DATA_START
.long __ROM_DTCM1_BD_DATA_END
3. With S32DS, how can i access the MMFSR register and other registers ? I am using a PE-Micro debugger.