SSD_Flash & DDR Reference
1. Flash Partition¶
1.1. Partition Config¶
-
Compile phase
After compilation,
partition_layout.txt
will be generated in the directory where the image is generated, and you can see the partition layout of the image. -
kernel phase
After the kernel is running, you can view it by
cat /proc/mtd
. -
boot phase
In uboot console, you can view it by
mtdpart
.
1.2. Partition Modification¶
-
Find the corresponding partition config file used by the project
Find the partition config specified by IMAGE_CONFIG, and take
spinand.ubifs.partition.dualenv.dispcam.config
as an example (directory: project\image\configs\p3\spinand.ubifs.partition.dualenv.dispcam.config ) -
Open the partition config, take the kernel partition as an example, modify the value specified by *$(PATSIZE)
Note: Due to the physical characteristics of flash, a block is the unit of erasing, and the partition config should be aligned according to the block size (nand flash partition is aligned according to 128K, nor flash is aligned according to 64K)
2. DDR Memory¶
-
The composition of memory
DDR total memory = linux memory + part of kernel reserved memory (including MMA)
-
Memory checking
-
check linux memory
In order to accurately check the memory MemFree, it is recommended to execute
echo 3 >/proc/sys/vm/drop_caches
first, and then executecat /proc/meminfo
.MemTotal is the total memory of linux, MemFree is free memory.
-
Check MMA memory
length is the total size of the allocated MMA, which is 0x1e00000 Byte
MMA remaining memory: chunk_mgr_avail = 0x132d000 Byte = 30M
-
-
Configure MMA memory
-
Open the config in project(Configs/defconfigs/dispcam_p3_spinand.glibc-9.1.0-s01a.64.qfn128.demo_camera_defconfig)
Find CONFIG_KERNEL_BOOT_ENV, modify the sz corresponding to mma_heap_name0 (sz=0x1E00000 that is 30M MMA)
-
Modify the bootargs parameters on the board in the boot console during debugging, then restart after execute saveenv to take effect.
-
-
How to judge whether MMA/Linux is sufficient
-
There are information such as MmaAlloc fail in the log, MMA memory may not be enough, execute echo 3 before the problem occurs > /proc/mi_moudles/mi_sys/debug_level to increase the debug level of sys, and the serial port will print MMA debug information after a problem occurs
-
Linux memory is not enough, OOM will be generated, some applications will be killed, and the log will generate backtrace information
-
-
How to debug after encountering memory-related problems in actual program operation?
By adjusting the memory size of MMA to balance the available memory of MMA and Linux, you can confirm by following the steps below.
-
Check whether there is a leak problem, if the available memory continues to decrease, please solve it first;
-
Whether there is an Out of Memory problem, if there is, the memory is insufficient, if MMA has surplus, you can reduce the memory allocation of MMA to increase it to Linux memory;
-
Whether there is MMA apply error such as MmaAlloc fail, if there is, the memory size of MMA in this usage scenario is insufficient, if linux has surplus, you can reduce the memory allocation of linux to increase it to MMA memory;
-
There is no memory leak, Linux and MMA memory balance each other, but the memory is still insufficient. Please cut the function or replace the DDR with larger memory
-