|
|
View previous topic :: View next topic |
Author |
Message |
allenhuffman
Joined: 17 Jun 2019 Posts: 552 Location: Des Moines, Iowa, USA
|
Identifying variables used by a library function. |
Posted: Fri Aug 30, 2019 10:58 am |
|
|
Before I do this manually, does anyone know if there is an easy way to identify any global/static functions used by a library call? For example:
To work around an issue we have encountered, I need to identify any variables being brought in by a library function so I can inspect the symbol table and see if any are int8s, and if they share memory with other variables.
Thanks... (I plan to manually use test code and just bring in a call, one by one, and look at the symbol table.) _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Aug 30, 2019 11:54 am |
|
|
Compile a program. Look at the .SYM file. Notice compiler-generated
variables:
Quote: | 017 @INTERRUPT_AREA
018 @INTERRUPT_AREA
019 @I2C_STATE
01A ssp_isr.temp
F55 CCP_5
F55 CCP_5_LOW
F56 |
Also put the .LST file in Symbolic mode and see it:
Quote: | .................... #int_ssp
.................... void ssp_isr(void)
.................... {
.................... int8 temp;
....................
.................... temp = i2c_isr_state();
000AE: BTFSC SSP1STAT.ADDRESS
000B0: BRA 00B8
000B2: CLRF @I2C_STATE
000B4: BTFSC SSP1STAT.WRITE
000B6: BSF @I2C_STATE.7
000B8: MOVF @I2C_STATE,W
000BA: INCF @I2C_STATE,F
000BC: MOVWF temp
....................
000BE: BCF PIR1.SSP1IF
000C0: GOTO 0060
.................... } |
Test program:
Code: | #include <18F46K22.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOPBADEN
#use delay(clock=4M)
#use i2c(Slave, I2C1)
#int_ssp
void ssp_isr(void)
{
int8 temp;
temp = i2c_isr_state();
}
//======================================
void main()
{
while(TRUE);
} |
|
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 552 Location: Des Moines, Iowa, USA
|
|
Posted: Fri Aug 30, 2019 1:51 pm |
|
|
PCM programmer wrote: | Compile a program. Look at the .SYM file. Notice compiler-generated
variables: |
Thanks! Yep. That is my "manual" approach. I have been sticking in every library call I find in our ISRs in and looking at the results. So far, so good.
An OS company I worked for used to provide stub files for our libraries, allowing symbol table lookup and such without giving out the source code. I don't think that is very common, though. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Sun Sep 01, 2019 11:55 am |
|
|
Remember also that 90% of the values will actually just be held in
the scratch area, rather than in specific variables. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|