Forum Discussion
Altera_Forum
Honored Contributor
20 years agowho can help me save my memory?
hello!
I explant my uclinux system form arm(Samsung 4510) to nios2, I need build ppp with serial port, so we need pppd, now I have a terrible problem,I find the pppd consume neraly 1.2M sdram. I can't abide it, beacause only 300kb memory is needed in the arm system. I indeed the source is same in the two plats. who can help me? Thank you for all response!18 Replies
- Altera_Forum
Honored Contributor
Did your arm have shared obj? The current nios2 did not support shared obj yet.
Another question, how do you take the size of the exec obj? - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by hippo@Mar 8 2006, 09:15 AM did your arm have shared obj? the current nios2 did not support shared obj yet.another question, how do you take the size of the exec obj?
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=13221)
--- quote end ---
--- Quote End --- Hi,hippo! Thanks for your repsonds, there are no mmu in the both flatforms arm and nios2, I only use the lib uClibc, I am a begginer, so I don't know share obj clearly. I get the memory size of the pppd exec through catting the /proc/meminfo content. I think the free memory's difference between before and after the pppd run is the memory size of pppd used.In addition, I find 1.2M excess memory is impropriated at the begging of ppp building.In other word, the pppd process need almost 2.4Mb memory when they attempt building ppp link with remote. After the ppp link is successful build, the excess 1.2Mb memory will be free can you tell another better mothod to caculater the memory size of the exec obj clearly? Thanks a lot.
- Altera_Forum
Honored Contributor
Did you count in buffer/cache for free memory?
Use "free" command is easier than "cat /proc/meminfo", you should include buffer/cache for free memory. - Altera_Forum
Honored Contributor
Hi, hippo.
thank you for your help.I find the size of cache and the buffer isn't change,the only difference of the memory info before and after pppd run is freemem.the result is same by "cat /proc/meminfo" and using free command. in addition, I find all the application use more memory than arm. I am looking forward to you reply, thank you very much - Altera_Forum
Honored Contributor
Hi smalllight,
Let try find out what's the diff in exec, please use xxxxx-flthdr to each of them. - Altera_Forum
Honored Contributor
<div class='quotetop'>QUOTE </div>
--- Quote Start --- let try find out what's the diff in exec, please use xxxxx-flthdr to each of them.[/b] --- Quote End --- What dose "xxxxx-flthdr" meaning? Could you figure out in detail? Thank u in advance. BTW, what do those flags meanings? 1. elf2flt -s 16000 / elf2flt -s 8192 2. gcc -Wl (Does -W have anymore flags? ) or , pls show us how to find more information about hwo to use gcc ? - Altera_Forum
Honored Contributor
<div class='quotetop'>QUOTE </div>
--- Quote Start --- What dose "xxxxx-flthdr" meaning? Could you figure out in detail?[/b] --- Quote End --- the exec format in uclinux is "binary flat" or "flt" in short. I need to know the headers of the exec, eg pppd, in both platform. For nios2, xxxx is nios2-linux-uclibc-flthdr (or nios2-elf-flthdr) For arm, it may be arm-elf-flthdr ? <div class='quotetop'>QUOTE </div> --- Quote Start --- 1. elf2flt -s 16000 / elf2flt -s 8192[/b] --- Quote End ---
ornios2-linux-uclibc-elf2flt
will show the usage. -s set stack size <div class='quotetop'>QUOTE </div> --- Quote Start --- 2. gcc -Wl (Does -W have anymore flags? ) or , pls show us how to find more information about hwo to use gcc ?[/b] --- Quote End --- Those flags are used pass options to linker. altera/kits/nios2/documents/gnu-tools gcc.gnu.orgnios2-elf-elf2flt - Altera_Forum
Honored Contributor
Hello, Hippo!
I use the XXXX-flthdr in both of the platforms,the display is as follow: <div class='quotetop'>QUOTE </div> --- Quote Start --- In nios2 platform:[/b] --- Quote End --- [nios2linux@localhost pppd]$ nios2-elf-flthdr pppd pppd Magic: bFLT Rev: 4 Build Date: Mon Mar 6 17:02:53 2006 Entry: 0x44 Data Start: 0x23c30 Data End: 0x2adf8 BSS End: 0x46d4c Stack Size: 0x1000 Reloc Start: 0x2adf8 Reloc Count: 0x1130 Flags: 0x1 ( Load-to-Ram ) <div class='quotetop'>QUOTE </div> --- Quote Start --- In arm platform:[/b] --- Quote End --- [root@localhost pppd]# arm-elf-flthdr pppd pppd Magic: bFLT Rev: 4 Build Date: Tue Jul 20 16:25:09 2004 Entry: 0x50 Data Start: 0x24c60 Data End: 0x2b820 BSS End: 0x359e0 Stack Size: 0x2000 Reloc Start: 0x2b820 Reloc Count: 0xa2e Flags: 0x1 ( Load-to-Ram ) what do you find? Thanks. - Altera_Forum
Honored Contributor
I didi find problems in the flts. Let's look at detail of memory usage.
Try "cat /proc/(pid of pppd)/maps" for both paltform. - Altera_Forum
Honored Contributor
"cat maps" print nothing,the directory /proc/(pppd pid) is as following:
# cat maps# ls -l -r--r--r-- 1 root 0 0 Mar 13 10:13 mounts lrwxrwxrwx 1 root 0 0 Mar 13 10:13 exels: ls:./exe: No such file or directory lrwxrwxrwx 1 root 0 0 Mar 13 10:13 root -> / lrwxrwxrwx 1 root 0 0 Mar 13 10:13 cwd -> / -rw------- 1 root 0 0 Mar 13 10:13 mem -r--r--r-- 1 root 0 0 Mar 13 10:13 maps -r--r--r-- 1 root 0 0 Mar 13 10:13 statm -r--r--r-- 1 root 0 0 Mar 13 10:13 stat -r--r--r-- 1 root 0 0 Mar 13 10:13 cmdline -r--r--r-- 1 root 0 0 Mar 13 10:13 status -r-------- 1 root 0 0 Mar 13 10:13 environ dr-x------ 2 root 0 0 Mar 13 10:13 fdarm platform:
# cat maps# ls -l -r-------- 1 root root 0 Nov 30 00:01 auxv -r--r--r-- 1 root root 0 Nov 30 00:00 cmdline lrwxrwxrwx 1 root root 0 Nov 30 00:01 cwd -> / -r-------- 1 root root 0 Nov 30 00:01 environ lrwxrwxrwx 1 root root 0 Nov 30 00:01 exels: ./exe: No such f le or directory dr-x------ 2 root root 0 Nov 30 00:01 fd -r--r--r-- 1 root root 0 Nov 30 00:01 maps -rw------- 1 root root 0 Nov 30 00:01 mem -r--r--r-- 1 root root 0 Nov 30 00:01 mounts -rw-r--r-- 1 root root 0 Nov 30 00:01 oom_adj -r--r--r-- 1 root root 0 Nov 30 00:01 oom_score lrwxrwxrwx 1 root root 0 Nov 30 00:01 root -> / -r--r--r-- 1 root root 0 Nov 30 00:00 stat -r--r--r-- 1 root root 0 Nov 30 00:01 statm -r--r--r-- 1 root root 0 Nov 30 00:01 status dr-xr-xr-x 3 root root 0 Nov 30 00:01 tasknios2 flatform: