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 support@ccsinfo.com

Bootloader and Interrupts

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







Bootloader and Interrupts
PostPosted: Tue Jun 29, 2004 2:04 pm     Reply with quote

Below I have pasted the two *.sta files from both my Application, and my rendition of the Bootloader. I have a question regarding the "Segment" area at the bottom of each file. They seem to be mapped correctly, and upon inspection of the *.lst files, the code looks OK. The application starts correctly, I wiggle some bits in my init routine.

What does not work is my interrupts (serial and input capture). What pit falls should I look for?

I can be emailed directly @ f_com_747@yahoo.com.

Thanks in advance.

////////////////////////////////// sta File for Bootloader ///////////////////

ROM used: 393 (10%)
4294965770 (104857563%) including unused fragments

1 Average locations per line
7 Average locations per statement

RAM used: 71 (37%) at main() level
136 (72%) worst case

Lines Stmts % Files
----- ----- --- -----
71 10 18 Z:\Embedded Code\bootloader\pic_verp9p\res_btldr.c
235 0 0 C:\Program Files\PICC\devices\16F873.h
39 0 0 Z:\Embedded Code\bootloader\pic_verp9p\bootloader.h
165 46 70 Z:\Embedded Code\bootloader\pic_verp9p\res_ldr.c
----- -----
1020 112 Total

Page ROM % RAM Functions:
---- --- --- --- ----------
0 22 6 1 @delay_ms1
0 274 70 49 real_load_program
0 43 11 6 atoi_b16
0 2 1 0 load_program
0 2 1 0 application
0 44 11 1 main
0 2 1 0 isr

Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-00005 2 0
00006-0007F 66 56
00080-00089 2 8
0008A-001FF 317 57
00200-00209 2 8
0020A-007FF 0 1526
00800-00FFF 0 2048


////////////////////////////////// sta File for Application ///////////////////
ROM used: 3100 (76%)
3072 (75%) including unused fragments

2 Average locations per line
7 Average locations per statement

RAM used: 89 (47%) at main() level
128 (67%) worst case

Lines Stmts % Files
----- ----- --- -----
853 440 100 Z:\Embedded Code\bootloader\pic_verp9p\sri_pic.c
258 0 0 C:\Program Files\PICC\devices\16F873A.h
39 0 0 Z:\Embedded Code\bootloader\pic_verp9p\bootloader.h
156 0 0 Z:\Embedded Code\bootloader\pic_verp9p\sri_pic.h
----- -----
2612 880 Total

Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 1 1 @delay_ms1
1 189 6 2 main
0 511 16 3 sys_init
1 1196 39 34 service
1 37 1 0 @goto10230
0 75 2 7 DACout
0 198 6 4 pulse_checks
0 66 2 13 @MUL3232
0 73 2 13 @DIV3232
0 26 1 1 check_for_long_pulse
1 230 7 12 temperature_check
0 51 2 5 @DIV1616
0 80 3 6 @DIVS1616
0 40 1 2 drop_out_28v
0 114 4 3 clear_faults
0 118 4 7 READ_spi_ADC
0 20 1 0 rs_232_hander

Segment Used Free
--------- ---- ----
00000-001FF 0 512
00200-00203 4 0
00204-00236 51 0
00237-007FF 1393 88
00800-00FFF 1652 396
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Jun 29, 2004 6:13 pm     Reply with quote

In the PIC16 there are two important addresses to consider: The boot vector at address 0x0000 and the interrupt vector at address 0x0008. For the PIC18 there is also the FAST interrupt vextor at 0x0018.
Your bootloader is in this same memory area as the interrupt vector so you have you to do something special for relocating the interrupt vectors for your application.

There are several possible approaches:
1) Your bootloader filters these addresses when loading a new application and relocates them to a new address. This has the advantage that your applications don't have to know anything about a possible bootloader. Disadvantage is that for easy implementatio you will have to place your bootloader in the top of the available program memory.
2) Compile your programs with the reset vectors located to other adresses. Advantage is that your bootloader doesn't have to relocate the vectors and can be placed in the bottom of the program memory with the write protect fuses available!!!. Disadvantage is that all your applications need a little bit of extra code for the interrupt relocation.

For an example on how to relocate the interrupt vectors, look at the Jolt bootloader:
http://mdubuc.freeshell.org/Jolt/

On this page, scroll down to 'How to Relocate User Code' for instructions on how to allocate memory for your bootloader and to relocate the interrupt vectors.
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