Embedded Systems Development Guidelines for S32K3 ITCM and DTCM in Automotive Applications
Learn how to optimize memory usage in automotive applications using the S32K3 series microcontrollers. The guidelines cover placing functions into ITCM, storing data into DTCM, defining memory sections, and integrating with ARM EABI GNU tools. Follow step-by-step instructions for section placement in linker files, defining start and end addresses, and incorporating attributes for efficient data copying. Use the provided images to visualize the process.
Download Presentation
![](/assets/img/so-down.gif)
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
S32K3 ITCM AND DTCM AUTOMOTIVE APPLICATIONS TEAM Created: Last Update: Nov 2021 Nov 2021 EXTERNAL USE
Agenda Place functions into ITCM Place data into DTCM Place ARM EABI GNU related sections 1 EXTERNAL USE
PLACE FUNCTIONS INTO ITCM 2 EXTERNAL USE
Step1: add ITCM section in linker file (after section .shareable_bss) This section s start and end address in ROM/RAM should also be defined __itcm0_code_rom = __shareable_data_rom_end; .itcm0_code : AT(__itcm0_code_rom) { . = ALIGN(4); __itcm0_code_start__ = .; KEEP(*(.itcm0_code)) . = ALIGN(4); __itcm0_code_end__ = .; } > int_itcm __itcm0_code_rom_end = __itcm0_code_rom + (__itcm0_code_end__ - __itcm0_code_start__); 3 EXTERNAL USE
Step2: define ITCM section start and end address for ROM/RAM in linker file This will be used in init_table for data copying __RAM_ITCM0_CODE_START = __itcm0_code_start__; __ROM_ITCM0_CODE_START = __itcm0_code_rom; __ROM_ITCM0_CODE_END = __itcm0_code_rom_end; 4 EXTERNAL USE
Step3: Add the ITCM start and end address into init_table for data copying. This table is defined in startup_cm7.s This file is located at C:\NXP\SW32K3_RTD_4.4_1.0.0\eclipse\plugin s\Platform_TS_T40D34M10I0R0\startup\src\m7\ gcc for MCAL users. This file is located at Project_Settings/Startup_Code/startup_cm7.s for S32DS RTD users. .section ".init_table", "a" .long 6 .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_ITCM0_CODE_START .long __ROM_ITCM0_CODE_START .long __ROM_ITCM0_CODE_END .long __RAM_DTCM0_DATA_START .long __ROM_DTCM0_DATA_START .long __ROM_DTCM0_DATA_END 5 EXTERNAL USE
Step4: Add __attribute__ ((section(".itcm0_code"))) in the function declaration and definition (namely in both .h and .c files) void __attribute__ ((section(".itcm0_code"))) testFuncItcm(uint32_t nGpioChannel){ return; } 6 EXTERNAL USE
PLACE DATA INTO DTCM 7 EXTERNAL USE
Step1: add DTCM section in linker file (after section .shareable_bss) This section s start and end address in ROM/RAM should also be defined __dtcm0_data_rom = __itcm0_code_rom_end; .dtcm0_data : AT(__dtcm0_data_rom) { . = ALIGN(4); __dtcm0_data_start__ = .; KEEP(*(.dtcm0_data)) . = ALIGN(4); __dtcm0_data_end__ = .; } > int_dtcm __dtcm0_data_rom_end = __dtcm0_data_rom + (__dtcm0_data_end__ - __dtcm0_data_start__); 8 EXTERNAL USE
Step2: define DTCM section start and end address for ROM/RAM in linker file This will be used in init_table for data copying __RAM_DTCM0_DATA_START = __dtcm0_data_start__; __ROM_DTCM0_DATA_START = __dtcm0_data_rom; __ROM_DTCM0_DATA_END = __dtcm0_data_rom_end; 9 EXTERNAL USE
Step3: Add the DTCM start and end address into init_table for data copying. This table is defined in startup_cm7.s .section ".init_table", "a" .long 6 .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_ITCM0_CODE_START .long __ROM_ITCM0_CODE_START .long __ROM_ITCM0_CODE_END .long __RAM_DTCM0_DATA_START .long __ROM_DTCM0_DATA_START .long __ROM_DTCM0_DATA_END 10 EXTERNAL USE
Step4: Add __attribute__ ((section(".dtcm0_data")))in the variables declaration and definition (namely in both .h and .c file) uint32_t __attribute__ ((section(".dtcm0_data"))) myDtcm0Data[1024] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; 11 EXTERNAL USE
Tips ARM EABI GNU related sections overlay with TCM/data section RTD linker file does not include ARM EABI GNU reserved sections placement, user should add them and place them into Flash to avoid TCM(itcm/dtcm) or data section placement conflicts(overlap) .ARM.exidx : { } > int_flash *(.ARM.exidx*) *(.gnu.linkonce.armexidx.*) *(.glue*) *(.vfp11*) *(.v4*) *(.iplt*) *(.rel*) 12 EXTERNAL USE