|
|
|
![]() |
|
|||||||
|
||||||||
Hi There!
I've written a little perl script to extract some useful information from the .map file. The script tells you how much space in flash is used by each function in your code. The size is in bytes followed by the percentage of the total 32k available. The list is ordered with the biggest ...
Hi There!
I've written a little perl script to extract some useful information from the .map file. The script tells you how much space in flash is used by each function in your code. The size is in bytes followed by the percentage of the total 32k available. The list is ordered with the biggest functions first.
Instructions:
1. Get perl. If you're using Windows, you can download perl from:
http://www.activestate.com/Products/ActivePerl/
2. Make a .map file. From MPLAB select Project->Build Options->Project.
Under the "MPLINK Linker" tab, check the box labled "Generate map file"
This will create a new .map file every time you compile your code.
3. Compile your code. Sorry the script won't work unless you can compile and link successfully.
4. Copy the script file "codesize.pl" to your FrcCode directory and run it like so:
perl codesize.pl
5. Enjoy!
If you've renamed your project for some reason, the .map file can also be specified as a parameter like so:
perl codesize.pl AwsomeCodeProject.map
BONUS!!!!!!!!
You can also import your results into Microsoft Excel with the bonus -csv switch. Use it like so:
perl codesize.pl -csv > NiftySpreadsheet.csv
Questions, comments or compliments? Let me know:
tedhansen@team1216.com
1134594805codesize.zip
23-12-2005 00:05
prograidHi, I'm having a few problems with this script.
When I tried using the script the first two lines were as follows.
Unused Memory 28651 bytes 93.3% vfprintf() 3062 bytes 10.0% vfprintf.c
25-12-2005 23:19
kc8nod|
Originally Posted by prograid
I have a feeling that my code is actually larger than the maximum possible size and somehow this is affecting the result.
|
27-12-2005 19:52
prograidThanks for replying.
By the way, I don't think this should make a difference but the script is being run as a post-build command from within eclipse.
The mapfile is in the attachment in the FRCMapfile.zip archive because the forum does not allow text file attachments of greater than 100kb.
Thanks.
03-01-2006 11:03
kc8nod|
Originally Posted by prograid
...the script is being run as a post-build command from within eclipse.
|
Program Memory Usage
Start End
--------- ---------
0x000800 0x000814
0x000818 0x0063a0
0x300000 0x30000d
23468 out of 33816 program addresses used, program memory utilization is 69%
03-01-2006 11:20
kc8nodBTW, here's the proper output from the .map file you posted.
06-01-2006 19:50
prograid|
Originally Posted by kc8nod
Sorry for the slow response, I've been offline last week.
I'm guessing that you are doing something clever with your linker script and that is confusing the codsize script. Are you even using the linker script? I can only imagine what hacks you have had to perpetrate to make mcc18 work under Eclipse. |
perl "..codesize.pl" "FRCMapfile.map"