Part Number: AM62A7
Q: The default memory map for AM62A does not work for my application. How do I modify the RAM / DDR memory map to suit my module size and application?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: AM62A7
Q: The default memory map for AM62A does not work for my application. How do I modify the RAM / DDR memory map to suit my module size and application?
I see this question fairly often for developers working towards their production application. Let me start with the fundamentals of this task
/usr/lib/firmware/`, requires sections for code, data for normal core operation. This will setup other regions used by TIOVX and TI Deep Learning/usr/lib/`, and contains configuration of the various shared DDR regions for used TIOVX. This library provides TIOVX to LinuxThe below does not include code/data for remote core firmwares or fundamental IPC regions.
| Region Name | Start Address | Size | Usage |
|---|---|---|---|
| APP_LOG_MEM | 0xA1000000 | 256.00 KB | Memory for remote core logging |
| TIOVX_OBJ_DESC_MEM | 0xA1040000 | 15.75 MB | Memory for TI OpenVX shared memory. MUST be non-cached or cache-coherent |
| APP_FILEIO_MEM | 0xA2000000 | 4.00 MB | Memory for remote core file operations |
| TIOVX_LOG_RT_MEM | 0xA2400000 | 12.00 MB | Memory for TI OpenVX shared memory for Run-time logging. MUST be non-cached or cache-coherent |
| DDR_SHARED_MEM | 0xA3000000 | 176.00 MB | Memory for shared memory buffers in DDR |
| DDR_MCU_R5F_LOCAL_HEAP | 0xAE000000 | 16.00 MB | DDR for MCU R5F for local heap |
| DDR_DM_R5F_LOCAL_HEAP | 0xAF000000 | 16.00 MB | DDR for DM R5F for local heap |
| DDR_C7X_1_LOCAL_HEAP_NON_CACHEABLE | 0xB0000000 | 16.00 MB | DDR for c7x_1 for non cacheable local heap |
| DDR_C7X_1_SCRATCH_NON_CACHEABLE | 0xB1000000 | 16.00 MB | DDR for c7x_1 for non cacheable scratch Memory |
| DDR_C7X_1_LOCAL_HEAP | 0xB2000000 | 112.00 MB | DDR for c7x_1 for local heap |
| DDR_C7X_1_SCRATCH | 0xB9000000 | 112.00 MB | DDR for c7x_1 for Scratch Memory |
cat /sys/kernel/debug/dma_buf/bufinfo` (shows instantaneous usage)`/opt/vision_apps/vx_app_heap_stats.out`/opt/vision_apps/vx_app_heap_stats.out`/opt/vision_apps/vx_app_heap_stats.out`psdk_rtos/docs inside to set this upvision_apps/platform/am62a/rtos/` in the firmware-builderboard-support/ti-linux-kernel-X.XX.XX+git-ti/arch/arm64/boot/dts/ti` directoryexport ORG_DTS_PATH=${LINUX_INSTALL_PATH}/board-support/ti-linux-kernel-6.12.34+git-ti/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
export EDGEAI_DTS_PATH=${LINUX_INSTALL_PATH}/board-support/ti-linux-kernel-6.12.34+git-ti/arch/arm64/boot/dts/ti/k3-am62a7-sk-edgeai.dtso
vision_apps/platform/am62a/rtos/gen_linker_mem_map.py` to change memory regions.ddr_shared_mem` section (around line 213):# Original ddr_shared_mem_addr = tiovx_log_rt_mem_addr + tiovx_log_rt_mem_size; ddr_shared_mem_size = 172*MB; # Modified (increase to 256 MB) ddr_shared_mem_addr = tiovx_log_rt_mem_addr + tiovx_log_rt_mem_size; ddr_shared_mem_size = 256*MB;
ddr_c7x_1_scratch` section:# Original ddr_c7x_1_scratch_addr = ddr_c7x_1_local_heap_addr + ddr_c7x_1_local_heap_size; ddr_c7x_1_scratch_size = 128*MB; # Modified (reduce to 64 MB) ddr_c7x_1_scratch_addr = ddr_c7x_1_local_heap_addr + ddr_c7x_1_local_heap_size; ddr_c7x_1_scratch_size = 64*MB;
cd vision_apps/platform/am62a/rtos/ python3 gen_linker_mem_map.py
app_mem_map.h`)k3-am62a7-sk.dts and k3-am62a7-sk-edgeai.dtso, respectively. Otherwise, the script will print updated regions, and it is the user's responsibility to modify the DTS file themselves.vision_apps/platform/am62a/rtos/` (linker files)
c7x_1` directory (and `generated` sub-directory) for C7 NPUmcu1_0` directory (and `generated` sub-directory) for DM R5 running VPAC/ISPsdk` and `firmware` make targets to rebuild these files. board_support/u-boot-buid/r5/tiboot3.bin`/usr/lib/firmware/` on rootfs/usr/lib/` on the rootfs partition# Copy from staging area to the SD card make linux_fs_install_sd # If this gives permissions errors, use sudo -E make linux_fs_install_sd
sdk_builder/tools_path`. Permissions on the SD card and other files may require SUDO rights to write updated files, so it may be necessary in your system to run this with elevated privileges. Make sure to set environment variables like `SOC=am62a` or use `sudo -E` to inherit the environment from the calling script/terminal. dtbs'). This involves the `make linux-dtbs` make target from the top-level SDK makefile. The built .DTB, DTBO files will be in the linux kernel tree under `arch/arm64/boot/dtb/ti`. The resulting .DTB and .DTBO must be placed into the /boot/dtb directory of the rootfs partition.ddr_dm_r5f_viss_config_heap_addr = <calculated>; ddr_dm_r5f_viss_config_heap_size = <size>*MB;
gen_linker_mem_map.py` to include VISS_CONFIG_HEAP regionAnd let me include further information for checking your work, debugging, and common issues:
cat /sys/kernel/debug/dma_buf/bufinfo # Shows each allocated buffer with size
free -h cat /proc/meminfo
/opt/vision_apps/vx_app_heap_stats.out
./bin/Release/edgeai-tiovx-apps-main configs/linux/object_detection.yaml
DDR_SHARED_MEM: Alloc's: 47 alloc's of 48344052 bytes DDR_SHARED_MEM: Free's : 47 free's of 48344052 bytes DDR_SHARED_MEM: Open's : 0 allocs of 0 bytes
vision_apps/platform/am62a/rtos/system_memory_map.html`, which tells each region, the address range, and overall size. This is worth verifying against alignment and sizing requirements, and should be provided in any support ticket on the matter. /opt/edgeai-gst-apps` and `/opt/edgeai-tiovx-apps` include config-file-based applications. Using small applications like image_classification.yaml is a good verification that the new memory map was applied correctlydocs/user_guide/getting_started_am62a.rst`vision_apps/platform/am62a/rtos/gen_linker_mem_map.py`