CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

What is this default interrupt handler?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dgoldman



Joined: 24 Aug 2010
Posts: 7

View user's profile Send private message

What is this default interrupt handler?
PostPosted: Tue Dec 21, 2010 9:40 am     Reply with quote

My 18F452 code has no interrupt service routines for this project. I transitioned from PCH 3.218 to 4.114. On v3, the interrupt vectors were left NOPs. In v4, I get code there (see below). The reset vector looks ok but the other stuff is new. It is a high priority ISR, yes?

It reads like an ISR to wait for the USART transmit buffer to empty before returning. The thing is that I enable no interrupts in my code. This shouldn't ever be call-able. No? Should have no effect if I don't enable interrupts. So why is the compiler adding it for me?

Anyone got a clue what this is? Having serial port issues and I suspect this is related.


Code:
Line  Address  Opcode      Label                     Disassembly             

     1   0000    EFF3                   GOTO @cinit                           
     2   0002    F02F                   NOP                                   
     3   0004    FFFF                   NOP                                   
     4   0006    FFFF                   NOP                                   
     5   0008    A89E @PUTCHARI_BIU_1   BTFSS PIR1, 0x4, ACCESS               
     6   000A    D7FE                   BRA @PUTCHARI_BIU_1                   
     7   000C    6EAD                   MOVWF TXREG, ACCESS                   
     8   000E    0C00                   RETLW 0                               
     9   0010    FFFF                   NOP                                   



Thank you!


Last edited by dgoldman on Tue Dec 21, 2010 10:08 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19512

View user's profile Send private message

PostPosted: Tue Dec 21, 2010 10:07 am     Reply with quote

The forum won't strip CR/LF, if you use the 'code' tags.

Not an interrupt handler. Just one of the standard 'service' routines.
The 08 address, is the location for a high priority handler _if priorities are enabled_, or for the low priority handler, in all other cases where interrupts are enabled. If interrupts are not used, it is just an 'ordinary' area of memory. the compiler is just using it since it is not otherwise needed.
Looks like putc.

Slightly surprised by your comment that the compiler doesn't put anything there in your older version. Have not got anything that old easily 'to hand', but tried a simple routine in 3.226, and 3.249, and both put the delay timing code starting at address 4. If you are looking in the .LST file, remember that internal code _won't_ be shown, unless you remove the 'nolist' option from the processor's .h file.

On your problems upgrading, classic difficulty is with pointers if used, since V4 switches to 'normal' C syntax, and increments a pointer by the size of the object it addresses, while V3, increments them by 1. This causes a lot of pointer code to stop working.....

Best Wishes
dgoldman



Joined: 24 Aug 2010
Posts: 7

View user's profile Send private message

Thanks
PostPosted: Tue Dec 21, 2010 10:18 am     Reply with quote

Just figured out the code quoting thing just before reading your reply. Thanks anyway. Yes, it does look like a putc() and the label would agree. Good insight. Still makes no sense why it isn't added on my old compiler.

I got this code segment by compiling and viewing program memory in MPLAB IDE. It is repeatable that v3.218 fills in the reset vector but leaves the ISR areas NOP.
Ttelmah



Joined: 11 Mar 2010
Posts: 19512

View user's profile Send private message

PostPosted: Tue Dec 21, 2010 11:12 am     Reply with quote

Have just compiled a basic program on 3.191, and 3.226 (the nearest versions I have archived to 3.218), and both are writing code over the INT areas.
The only reason they won't, is if they see an interrupt handler defined. Stick a #int_global definition in, even if no interrupts are used, and the area becomes reserved.
Code:

#include <18F452.h>
#device adc=8
#FUSES NOWDT, WDT128, HS, NOPROTECT, NOOSCSEN, NOBROWNOUT, BORV20, NOPUT, STVREN, NODEBUG, NOLVP, NOWRT, NOWRTD, NOWRTB, NOWRTC, NOCPD, NOCPB, NOEBTR, NOEBTRB
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9)


#int_global
void dummy(void) {
   delay_cycles(1);
}

void main() {

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_wdt(WDT_OFF);
   
   putc('T');

   while (TRUE);

}
//


Gives the area with NOP's.
Remove the int_global definition, and the main code starts at address 4.....

Best Wishes
dgoldman



Joined: 24 Aug 2010
Posts: 7

View user's profile Send private message

PostPosted: Tue Dec 21, 2010 3:25 pm     Reply with quote

Thanks for the insight. I got my bootloaders working (or so it seems).

The problem is that despite my #orgs in my code, the linker put the putc up near the top of memory. This is new behavior. I still don't know why it shows up there.

The solution was to assure my #org covers ALL memory I want reserved, not just the area right above where I want to go. This forces the putc() to go with the rest. Being bootloaders, the code then is in my designated areas and not overwritten by the second bootloader or the main code.

All is good in the world, it only took me a little head bashing to do the right thing.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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