Menu

#1716 PIC16: Assembler forget .line in the .lst file

open
nobody
PIC16
5
2014-08-15
2010-11-26
No

Dear sir or Madame

I think there is an error in how the compiler produce the .lst file when compiling a c file

# ----------------------- Environment information

which sdcc
/usr/local/bin/sdcc

gpasm -v
gpasm-0.13.7 beta

which gpasm
/usr/local/bin/gpasm

gplink -v
gplink-0.13.7 beta

which gplink
/usr/local/bin/gplink

sdcc -mpic16 -p18f442 -V --debug --use-non-free -I/home/stefan/Project/Embedded/Pic/18F2520/WeatherLog/ -c I2CSWDriver.c --opt-code-speed --optimize-cmp --optimize-df --nooverlay

sdcc -mpic16 -p18f442 -V --debug -Wl-c -Wl-m -I/home/stefan/Project/Embedded/Pic/18F2520/WeatherLog/ -oWeatherlog.hex BMP085.o DS1307.o I2CSWDriver.o OneWire.o SystemClock.o weatherlog.o --use-non-free --opt-code-speed --optimize-cmp --optimize-df --nooverlay

# ----------------------- Problem
The compiler misses a .line for the first statement in the .lst file
(The following happens regardless if I add __reentrant or change flags to the compiler/linker.)

# ----------------------- Source code

The function is declared like this
extern void I2CSWDriver_Init(unsigned char aMaster, I2CSWDriverSpeed_t aSpeed) __reentrant;

The function is defined like this
void I2CSWDriver_Init( unsigned char aMaster, I2CSWDriverSpeed_t aSpeed) __reentrant
{
//
myMaster = aMaster;
//
// Setup ports
//
// Drive CLK high
I2CSWDCLKPortBit = 1;
// Set up CLK as output
I2CSWDCLKTrisBit = 0;

The variable myMaster is declared like this

static unsigned char myMaster;

# ----------------------- The output in the corresponding .lst file look like this

00230 ;--------------------------------------------------------
00231 ; global & static initialisations
00232 ;--------------------------------------------------------
00233 ; I code from now on!
00234 ; ; Starting pCode block
00235 S_I2CSWDriver__I2CSWDriver_Init code
0000 00236 _I2CSWDriver_Init:
00237 .line 436; I2CSWDriver.c void I2CSWDriver_Init( unsigned char aMaster, I2CSWDriverSpeed_t aSpeed) __reentrant
0000 CFD9 FFE5 00238 MOVFF FSR2L, POSTDEC1
0004 CFE1 FFD9 00239 MOVFF FSR1L, FSR2L
0008 C000 FFE5 00240 MOVFF r0x00, POSTDEC1
000C 0E02 00241 MOVLW 0x02
000E CFDB F000 00242 MOVFF PLUSW2, _myMaster
0012 0E03 00243 MOVLW 0x03
0014 CFDB F000 00244 MOVFF PLUSW2, r0x00
00245 .line 444; I2CSWDriver.c I2CSWDCLKPortBit = 1;
0018 8600 00246 BSF _PORTCbits, 3
00247 .line 446; I2CSWDriver.c I2CSWDCLKTrisBit = 0;
001A 9600 00248 BCF _TRISCbits, 3

# ----------------------- Assumed error
the .line is missing for the statement "myMaster = aMaster;" in this example there should be a line
.line 439; I2CSWDriver.c myMaster = aMaster;

Regards Stefan

Discussion

  • Philipp Klaus Krause

    • labels: 101552 --> pic16 target
     
  • Maarten Brock

    Maarten Brock - 2011-09-15
    • summary: Assembler forgett .line in the .lst file --> PIC16: Assembler forget .line in the .lst file
     
  • Philipp Klaus Krause

    • Category: --> PIC16
     

Log in to post a comment.

MongoDB Logo MongoDB