code size


Closed Thread
Results 1 to 7 of 7

Thread: code size

  1. #1

    Default code size

    hello again,

    I want to find out how get the size of the compiled code of my program. where can i check that with pbp. i know its something simple and ive searched but can't find it. thank you.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You have a lot of options.

    If you're using MCS as the editor the bottom screen shows the compiled file size.

    If you use MPASM as the assembler you can open the .LST file and look at the bottom.

    Program Memory Words Used: 63
    Program Memory Words Free: 8129

    With PM as the assembler you can look at the bottom of the .LST file;

    + 003C- 0063 @@0000 sleep
    + 003D- 018A clrf PCLATH
    + 003E- 283C goto @@0000

    Or you could use Darrels' GetAddress macro to find & display the size something like this;
    Code:
    @ device  pic16F877, xt_osc, wdt_off, lvp_off, protect_off
    
    DEFINE OSC 4
    DEFINE LOADER_USED 1
    
    RetAddr VAR WORD
    
    asm
    GetAddress macro Label, Wout
        CHK?RP Wout
        movlw low Label          ; get low byte
        movwf Wout
        movlw High Label         ; get high byte
        movwf Wout + 1
        endm
    endasm
        
    loop:
        @ GetAddress _Over, _RetAddr
        HSEROUT [HEX4 RetAddr,13,10]       
        High 0          ' Turn on LED connected to PORTB.0
        Pause 500       ' Delay for .5 seconds
        Low 0           ' Turn off LED connected to PORTB.0
        Pause 500       ' Delay for .5 seconds
    
        Goto loop       ' Go back to loop and blink LED forever
        
    Over:
    Or you could just open & examine the compiled .HEX file with your device programmer.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3


    Did you find this post helpful? Yes | No

    Default

    i'm using mpasm assembler and i could find the size of the code at the very bottom. thank you again.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Goto the directory that you saved your project in. That is where you will find the *.LST file Bruce told you about. If your program is called blinky, you will look for blinky.LST.
    Dave
    Always wear safety glasses while programming.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    when mpasm compiles my code using PicBasic Pro, does the entire PBPPIC14.lib file get compiled also, or is it only the specific functions that i'm using such as ADCIN, or SEROUT, etc.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Only sections of the library that are required get compiled.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I don't know what your needs are, but I have had two instances where I needed to
    automatically watch the code size:

    1. I use MCLOADER, which occupies some of the chip's upper memory.
    I need to make sure my compiled code does not "run into" the bottom of MCLoader.

    2. I sometimes want to know if my code is small enough to fit into a smaller, cheaper chip.

    The technique I use is to add a few statements at the end of my programs -


    ASM
    ORG 0x1fcee <=== Put the address you don't want to over-run here.
    nop
    ENDASM


    If the code is too big and over-runs the ORG address, MPASM will flag an error.
    Charles Linquist

Similar Threads

  1. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. Apparent code size problem
    By eetech in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 30th July 2007, 15:51
  5. pic18F code size problem???
    By dogi in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th March 2005, 21:52

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts