• AVR Freaks

Helpful ReplyHot!Code size precalculator!!!

Author
EverGreen_28
Starting Member
  • Total Posts : 47
  • Reward points : 0
  • Joined: 2018/08/14 11:09:01
  • Location: Argentina
  • Status: offline
2019/12/05 15:00:56 (permalink)
0

Code size precalculator!!!

Hi guys!
 
Here another stu.pid question.
 
Any form to pre calculate the code size on XC8?
Or any plugin to calculate "on the fly" / "realtime" the code size?
 
obviously without use of "Build"/"Clean and Build"
 
I need because i working on PIC with small flash memory size's and i need to optimize the code myself in some cases and wast lot of time using "build"/"Clean and build" buttons.
 
Thx in advance!!!
#1
ric
Super Member
  • Total Posts : 28433
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: Code size precalculator!!! 2019/12/05 15:11:13 (permalink)
+1 (1)
The only way to know how big it will be is to do a build.
You don't need to do "Clean and build", just a regular build should work.
XC8 optimises across your entire project, so you must build the project for that to work.
 
What optimisation level are you currently using?
What PIC are you using? It's hard to give suggestions without seeing your programming style.
 
n.b. examining the LST file output by XC8 is a good way to find out which bits of your code are using lots of space!
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
EverGreen_28
Starting Member
  • Total Posts : 47
  • Reward points : 0
  • Joined: 2018/08/14 11:09:01
  • Location: Argentina
  • Status: offline
Re: Code size precalculator!!! 2019/12/06 11:07:42 (permalink)
0
Hi ric, thanks for your reply.
I use PRO license with 24 bit for long and "space favour" but in some cases i need to know the size of code. I never get "out of memory" but nearly, yes.

About my program style, i don't know why this. I'm autodidact and ever try to create a modular code, ever thinking on a migrable subrutine (for example: create a library for drive lcd 44780 on i2c)
Where the "LST" file is on windows OS?
Is in this file, related info for a size of specific subrutine?
#3
ric
Super Member
  • Total Posts : 28433
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: Code size precalculator!!! 2019/12/06 13:31:52 (permalink) ☄ Helpfulby EverGreen_28 2019/12/06 13:44:36
+1 (1)
EverGreen_28
About my program style, i don't know why this. I'm autodidact and ever try to create a modular code, ever thinking on a migrable subrutine (for example: create a library for drive lcd 44780 on i2c)

If you have not been looking at the LST file, you may not know what things make C code inefficient.
 

Where the "LST" file is on windows OS?

Go into your project folder with Windows Explorer, and do a search for "*.lst"
Most likely, it will be in the folder "dist\default\production"
 

Is in this file, related info for a size of specific subrutine?

It lists all the assembly language produced for all of your code, so yes, you can get this information out of it.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#4
EverGreen_28
Starting Member
  • Total Posts : 47
  • Reward points : 0
  • Joined: 2018/08/14 11:09:01
  • Location: Argentina
  • Status: offline
Re: Code size precalculator!!! 2019/12/06 13:47:08 (permalink)
0
Thx ric! Always with the people Smile: Smile
#5
Jump to:
© 2020 APG vNext Commercial Version 4.5