Menu

#1710 sdcc is placing __interrupt function on wrong adress

closed-invalid
5
2013-05-25
2010-11-22
No

Dear Sir or Madame

which sdcc
/usr/local/bin/sdcc
sdcc -v
SDCC : mcs51/gbz80/z80/ds390/pic16/pic14/TININative/ds400/hc08 3.0.1 #6064 (Nov 22 2010) (Linux)

gplink -v
gplink-0.13.7 beta

I have number of .C files targeting the PIC cpu 18f2520, the compilation goes well but the linking is failing with error message
"multiple sections using address 0"

The linker fails because it tries to place both the "ivec_0x0_isr " method and the "crt0i" on address 0x00000
according to the data blade of the PIC 18F2520 it is the reset vector (crt0i) that should be placed on address 0x0000
and the interrupt vector on 0x000008 (and in case high/low is used 0x000018 is low priority)

My interrupt vector is declared like this
void isr(void) __interrupt (0)

this become this in the .lst file
00256 ;--------------------------------------------------------
00257 ; interrupt vector
00258 ;--------------------------------------------------------
00259
00260 ;--------------------------------------------------------
00261 ; global & static initialisations
00262 ;--------------------------------------------------------
00263 ; ; Starting pCode block for absolute section
00264 ; ;-----------------------------------------
00265 S_weatherlog_ivec_0x0_isr code 0X000000
0000 00266 ivec_0x0_isr:
0000 EF00 F000 00267 GOTO _isr

the source file is compiled with
sdcc -mpic16 -p18f2520 -V --debug --use-non-free -I/home/stefan/Project/Embedded/Pic/18F2520/WeatherLog/ -c weatherlog.c --opt-code-speed --optimize-cmp --optimize-df

The project is linked with
sdcc -mpic16 -p18f2520 -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

Regards

Discussion

  • Raphael Neider

    Raphael Neider - 2010-11-22

    > My interrupt vector is declared like this
    > void isr(void) __interrupt (0)

    ... and if you had used

    void isr(void) __interrupt(1)

    instead, all would be well. __interrupt(0) is used to denote the "RESET" handler, __interrupt(1) denotes the "common" / high priority interrupt handler, and __interrupt(2) denotes the low priority interrupt handler (SDCC Manual 4.6.15).

    Best regards

    Raphael

     
  • Raphael Neider

    Raphael Neider - 2010-11-22
    • milestone: --> non_bugs
    • status: open --> closed-invalid
     
  • Stefan Olsson

    Stefan Olsson - 2010-11-22

    Dear Raphael

    I see, seems that I have an old manual, sorry for that, will get the latest one

    Regards

     
  • Raphael Neider

    Raphael Neider - 2012-02-12
    • assigned_to: nobody --> tecodev
     

Log in to post a comment.