|
|
View previous topic :: View next topic |
Author |
Message |
sham
Joined: 18 Apr 2006 Posts: 9
|
Interrupt not working in the user code but it working in the |
Posted: Tue Apr 18, 2006 8:15 pm |
|
|
Hi
I tried to get more info about interrupt which, can be used in boot code as well the user code. I am using SPI interrupt in the boot code to download new user code and it working fine. Once finish downloading it jump to user code. but the interrupt not working then. If any one has done simmilar coding please help me out.
Regards
Shamine |
|
|
sham
Joined: 18 Apr 2006 Posts: 9
|
|
Posted: Wed Apr 19, 2006 8:44 am |
|
|
Hi All
No one to help me!. Sme one can help me. Please I need help.
regards
sham |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Wed Apr 19, 2006 10:19 am |
|
|
It is improbable that somebody helps you. Being this one a forum of Language C
and PIC microcontroller, the best way is to post a short code that demonstrates
the problem and not to comment a history.
Humberto |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
Re: Interrupt not working in the user code but it working in |
Posted: Wed Apr 19, 2006 8:35 pm |
|
|
sham wrote: | I tried to get more info about interrupt which, can be used in boot code as well the user code. I am using SPI interrupt in the boot code to download new user code and it working fine. Once finish downloading it jump to user code. but the interrupt not working then. If any one has done simmilar coding please help me out.
|
The easiest solution to the problem is not to use interrupts in the bootloader. A bootloader usually does not require an interrupt handler as it has nothing else to do other than bootload code into FLASH and it can have interrupts enabled while programming the FLASH anyway. In this approach you would poll for SPI events. I have previoulsy implemented an SPPI bootloader and I did not use interrupts.
The second approach is that the bootloader interrupt handler has to determine if the PIC is in bootloader mode. If not in bootloader mode it then vectors to the address in the users vectors. This requires that you intercept and relocate the users interrupt vector as they are being downloaded. The problem with this approach is that the user code may not use any interrupts in which case there are no vectors present just code. You can work around this by ensuring the user code does not sit on top of the interrupt vector space but this means your bootloader is no longer transparent to the user code.
There a two different flavours of bootloader, those located in low memory which require the user code to reserve space for the loader and therefore are not transparent. In the other approach the bootloader is located in high memory. In these cases the application program should be compiled to not load over this code but in normal operation this is not usually a problem becasue by default the coompilers consume code from low memory upwards and high memory is usually untouched. I have used high memory bootloader for years and have to date been virtually 100% successful in running third party code that was compiled without reserving memory for the high memory bootloader. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
sham
Joined: 18 Apr 2006 Posts: 9
|
|
Posted: Tue Apr 25, 2006 11:47 pm |
|
|
Thanks for the answer, But I need to download app code via the SPI port. So I need to use interrupt. Here is my some code of my work...
Hopefully someone can help me now.
My header file used in App as in Boot code.
***************************
#define LOADER_END 0x12FF
#define LOADER_SIZE 0x4FF
#define INTERRUPT_VECTOR 0x868
#define NEW_PROG_LOADED 0X0020 //If this is 1 then new code is loaded
#ifndef _bootloader
#define _bootloader
#build(reset=LOADER_END+2, interrupt=LOADER_END+8)
#org 0, LOADER_END {}
#endif
*****************************
My boot code .....
*****************
#include <18F8520.h>
#device ICD=TRUE
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=11059200)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS, STREAM=COM_A)
#define _bootloader
#NOLIST
#include <input.c>
#include <stdlib.h>
#LIST
#include <C:\PIC\boot\bootloader.h>
int save_w;
#locate save_w=0x80
int save_status;
#locate save_status=0xFF
int save_pclath;
#locate save_pclath=0xFF
int save_FSR ;
#locate save_FSR=0xFF
#byte STATUS = 0xFD8
#byte PCLATH= 0xFFA
#bit zero_flag = status.2
#bit sspif =0XF9E.3 //PIR1 // SSP interrupt falg bit
#bit sspie =0XF9D.3 //PIE1 // SSP interrupt enable bit
// SPI MSG Defines
#define _SPI_MSG_WAKEUP_ 0x5A
#define _SPI_MSG_POLL_ 0x11
#define _SPI_MSG_ENQ_ 0x05
#define _SPI_MSG_MESSAGE_ 0x0E
#define _SPI_MSG_IDLE_ 0x16
#define _SPI_MSG_FILL_ 0x33
#define _SPI_MSG_ACK_ 0x06
#define _SPI_MSG_NACK_ 0x15
// Stage of the SPI MSG
#define _SPI_IDLE 0
#define _SPI_START_RECEIVE_MSG_LEN 1
#define _SPI_RECEIVE_MSG 2
#define _SPI_START_SEND 3
#define _SPI_START_SENDING 4
#define _SPI_WAIT_ACK 5
// SPI - Registers
#bit SSOV1 = 0xFC6.6
#bit SSORR = 0xFC6.7
#byte SSPBUF = 0xFC9
#define APP_CODE_WRITE_FAILED 1
#define APP_CODE_WRITE_LAST_BLOCK 2
#define APP_CODE_WRITE_BLOCK_OK 3
// Details of the Ltu_ext...
#define MAX_RELEASE_NAME_LENGTH 32
char release_name[MAX_RELEASE_NAME_LENGTH] = {0}; /* From Header */
// PIC SPI Stages
int8 _spi_stage;
//Send/Receive define
int1 _send_msg_flag = 0; // set if PIC have msg to send
int8 send_buff[140] = {0};
int *send_msg_ptr;
int8 send_msg_len;
int8 _wait_timer_flag; // PIC will wait for ack/nack from othet unit for 4 times..
int1 busy_msg_flag = 0;
int8 _msg_len=0;
char _checksum =0;
char *rec_msg_pointer;
char _recv_msg_buff [140] = {0};
#define RECV_MSG_HEADER_SIZE 8
#define BLOCK_SIZE 128
int16 block_no = 0;
int download_status =0;
int32 data_offset = 0;
int _reset_flag =2;
//RESPONSE_STATUS msg_response;
#define LOADER_ADDR (LOADER_END-LOADER_SIZE);
int code_area; // 1 = Boot area, 2= app area.
// SEND MSG INFO
int msg_type;
int msg_unit_type;
//***************************************
//0x08 ---- 0x1C
//***************************************
#ORG default
#int_global
void isr() {
#asm
goto INTERRUPT_VECTOR
nop
nop
nop
nop
nop
nop
goto INTERRUPT_VECTOR+0x17
#endasm
}
#org LOADER_END+2,LOADER_END+20
void application(void) {
#asm
goto LOADER_END
#endasm
}
//#org 0xF24,0xF86
int atoi_b16(char *s) { // Convert two hex characters to a int8
int MSN, LSN;
// NOTE: This function processes both uppercase and lowercase strings
MSN = (s[0] - '0'); // Assume numeric and subtract text 0 which is ASCII 30
if (s[0] >= 'A') { // The character is actually alphabetic,...
MSN = MSN - 7; // ...adjust for the 7 character gap in the ASCII table
}
LSN = (s[1] - '0'); // Assume numeric and subtract text 0 which is ASCII 30
if (s[1] >= 'A') { // The character is actually alphabetic,...
LSN = LSN - 7; // ...adjust for the 7 character gap in the ASCII table
}
// Shift the MSN into position (zero fill), strip lowercase bit and...
return ((MSN << 4) | (LSN & 0x0F)); // ...merge it with the LSN after the lowercase bit is stripped
}
// ************** Serial MSG get Process here ***********************
// ******************************************************************
#ORG 0xb44, 0x1122 //52
void download_app_code() {
int8 cnt, record_type, checksum;
int fst_l_addr, snd_l_addr =0,data_start;
int16 l_addr,h_addr=0;
int32 addr;
#if getenv("FLASH_ERASE_SIZE")>2
int32 next_addr;
#endif
int8 dataidx, i, data[32], receive_buff_len =0;
char start_of_record =0;
int record_len = 0;
int cnt_at_start = 0;
int cnt_at_end =0;
int receive_cs = 0;
int last_cnt_cs=0;
int testcs =0;
int32 local_loader;
local_loader = LOADER_ADDR;
// First 7 data in the MSG_buff is MSG header
receive_buff_len = _recv_msg_buff[0]- RECV_MSG_HEADER_SIZE;
for (cnt=6; cnt<receive_buff_len;) {
fprintf(COM_A,"%X",_recv_msg_buff[cnt]);
cnt++;
}
if (block_no == 1) {
// Get the Release name and version no
cnt=70; // Release name start @0x3E
for (i = 0; i < 32; i++ ) {
release_name[i] = _recv_msg_buff[cnt];
cnt++;
}
data_offset = (data_offset + receive_buff_len + 1); //??????????????????
download_status = APP_CODE_WRITE_BLOCK_OK;
return;
}
// Download App code. Always start fron 2nd block
for (cnt=8; cnt<receive_buff_len;) { // 8 = msg_start = RECV_MSG_HEADER_SIZE;
start_of_record = _recv_msg_buff[cnt];
// Only process data blocks that start with ':'
if (start_of_record != 0x3A) {
cnt++;
} else {
cnt_at_start = cnt; // Record Start No
//*********************************************************************************
record_len =atoi_b16(&_recv_msg_buff[cnt+1]); // Get the number of bytes from the buffer
l_addr =make16((atoi_b16 (&_recv_msg_buff[cnt+3])), (atoi_b16 (&_recv_msg_buff[cnt+5])));
addr = make32(h_addr,l_addr); // We got the address now.
record_type = atoi_b16(&_recv_msg_buff[cnt+7]); // Get the typr of the MSG (record type)
//***********************************************************************************
// Lets do the checksum here before doing major stuff
checksum = 0;
for(i=cnt_at_start+1; i<cnt_at_end;)
{
if (_recv_msg_buff[i+2] !=0x0D) {
testcs=atoi_b16 (&_recv_msg_buff[i]);
checksum += testcs;
i+=2;
} else{
checksum = 0xFF - checksum + 1;
receive_cs = atoi_b16 (&_recv_msg_buff[i]);
if (checksum != receive_cs) {
download_status == APP_CODE_WRITE_FAILED;
fprintf(COM_A, "\n\rWrong CS C%X R%X\n\r", checksum,receive_cs);
_reset_flag =1; // since checksum is wrong NO reset.
write_eeprom(NEW_PROG_LOADED, 0); //No new code loaded
return;
} else {
fprintf(COM_A, "\n\rOK CS ");
}
break;
}
}
for (i = cnt; i < receive_buff_len; i++ ) {
if (_recv_msg_buff[i] != 0x0D){
if (receive_buff_len <= i+1) {// line end in the next block so send last END
data_offset += cnt_at_start-12 ;
download_status = APP_CODE_WRITE_BLOCK_OK;
return;
}
} else {
cnt_at_end =i; //got the end of line //setflag for found end of line
break;
}
}
//******************************************************************************
// record_type = 1 = (End Data record in the hex file) Start analysing the Data
//******************************************************************************
if (record_type == 1) {
// OUTPUT_LOW (PIN_J5); // no download
download_status = APP_CODE_WRITE_LAST_BLOCK;
// write_eeprom(NEW_PROG_LOADED, 1);
//fprintf(COM_A, "\n\rEnd of file\n\r");
_reset_flag =1; // since we finish downloading let reset.
#if defined(__PCM__)
} else if ((addr < local_loader|| addr > LOADER_END) && addr < 0x2000){
#elif defined(__PCH__)
} else if ((addr <local_loader || addr > LOADER_END) && addr < 0x300000){
#endif
//****************************************************************************
// line_type = 0 = (Data record in the hex file)
//****************************************************************************
if (record_type == 0) {
// Loops through all of the data and stores it in data
// The last 2 bytes are the check sum, hence Perline_len-3
data_start =cnt+9;
for (i = data_start,dataidx=0; i < cnt_at_end-3; i += 2) {
data[dataidx++]=atoi_b16 (&_recv_msg_buff[i]);
}
#if getenv("FLASH_ERASE_SIZE")>2
#if defined(__PCM__)
if ((addr!=next_addr)&&(addr&(getenv("FLASH_ERASE_SIZE")-1)!=0))
#else
if ((addr!=next_addr)&&(addr&(getenv("FLASH_ERASE_SIZE")/2-1)!=0))
#endif
erase_program_eeprom(addr);
next_addr = addr + 1;
#endif
write_program_memory(addr, data, record_len);
fprintf(COM_A, "\n\rWriting *_*\n\r");
download_status = APP_CODE_WRITE_BLOCK_OK;
}
else if (record_type == 4) {
fst_l_addr=atoi_b16(&_recv_msg_buff[cnt+9]);
snd_l_addr =atoi_b16(&_recv_msg_buff[cnt+11]);
h_addr = make16(fst_l_addr,snd_l_addr);
}
}
cnt = (cnt_at_end-3);
}
}
data_offset = (data_offset + receive_buff_len + 1);
if ((receive_buff_len + 1) != BLOCK_SIZE ) {
download_status = APP_CODE_WRITE_LAST_BLOCK;
write_eeprom(NEW_PROG_LOADED,1);
fprintf(COM_A, "\n\rLast Block *_*");
} else {
download_status = APP_CODE_WRITE_BLOCK_OK;
}
}
//******************************
// 0x648 --------------- 0x648+2FA =942 INTERRUPT_VECTOR+0x2FA
#org INTERRUPT_VECTOR , INTERRUPT_VECTOR+0x1FA
void intcode(void) {
int rec_msg = 0;
#asm
//store current state of processor
MOVWF save_w
SWAPF STATUS,W
BCF STATUS,5
BCF STATUS,6
MOVWF save_status
SWAPF PCLATH,W
MOVWF save_pclath
#endasm
if (sspif) {
rec_msg = spi_read(); // Unload the SPI MSG
SSOV1 = 0; // Clear Overflow bit
SSORR = 0; // Clear Write Collision Error
if (busy_msg_flag == 1) {
SSPBUF = _SPI_MSG_NACK_; // PIC is busy
return;
}
// NOTE: ///********************
/// get and send code goes here. This function is working ok...
/// copy write reason I can't post this code.
//**************8
#asm
MOVF save_pclath,w
MOVWF PCLATH
MOVF save_status,W
MOVWF STATUS
SWAPF save_w,F
SWAPF save_w,W
BCF sspif
retfie
#endasm
}
}
// ************************************************************************
// ---------- When MSG received from othe unit start processin the MSGs here ---
// ************************************************************************
#org 0x592,0x6FF
void spihandle() {
int recv_msg_type;
recv_msg_type = _recv_msg_buff[1]; // 2nd byte in the message is MSG type
msg_unit_type = _recv_msg_buff[2];
switch (recv_msg_type)
{
case _UNIT_DOWNLOAD_IMG_REQUEST_:
data_offset = 0;
block_no = 0;
send_blk_request();
break;
case _UNIT_DOWNLOAD_BLK_RESPONSE_:
block_no++;
download_app_code();
if ( download_status == APP_CODE_WRITE_BLOCK_OK ) {
send_blk_request_to_ other unit();
} else if ( download_status == APP_CODE_WRITE_FAILED ) { // Failed writing the app
msg_response = _IMG_INTEGRITY_ERROR_ ;
msg_type = _UNIT_DOWNLOAD_IMG_RESPONSE_ ;
send_img_response();
} else if (download_status == APP_CODE_WRITE_LAST_BLOCK ){ // Last blk received
msg_type = _UNIT_DOWNLOAD_IMG_RESPONSE_ ;
msg_response = _IMG_NO_ERROR_ ;
// fprintf(COM_A, "\n\r Tlast!\n\r");
send_img_response_to_ other unit();
OUTPUT_LOW (PIN_J5);
}
break;
}
}
//****************************************************************
// Main Start here.
//****************************************************************
#org 0x98,0x590 // It was 0x7F but I changed to DF
void main(void) {
int download_mode;
OUTPUT_HIGH (PIN_H7); // No reset
download_mode = read_eeprom(NEW_PROG_LOADED);
setup_adc_ports(NO_ANALOGS);
set_tris_C ( 0x9D ); // Bit 0 is input - RS232- Rx
set_tris_B ( 0x03 ); // 1=InPut , 0=OutPut
// Setup SPI
setup_spi(SPI_SLAVE|SPI_XMIT_L_TO_H|SPI_H_TO_L);
delay_ms(2);
OUTPUT_HIGH (PIN_G4); // Indicate that I have SPI
fprintf(COM_A, "\n\r we are in Boot area!\n\r");
busy_msg_flag = 0; // When MSG Received the this flag get set
_send_msg_flag = 0; // When MSG need to be send then this flag get set
_spi_stage = _SPI_IDLE; // Init spi stage to idle _serial_stage = 0;
if (download_mode == 1) { //new app code is lodeed.
OUTPUT_LOW (PIN_J5); // no download
disable_interrupts(global);
disable_interrupts(int_ssp);
OUTPUT_LOW (PIN_H7); // reset
application();
}else {
OUTPUT_HIGH (PIN_J5); // download
}
// code_area = 1; // YES we are in boot area.
_send_msg_flag = 0;
send_msg_len = 0;
data_offset = 0; // Init the offset - This is used for ..
enable_interrupts(int_ssp); // Enable the interrupt for SPI
enable_interrupts(global);
while(1)
{
if (busy_msg_flag == 1) {
disable_interrupts(global);
spihandle();
busy_msg_flag = 0;
memset (_recv_msg_buff, 0, sizeof(_recv_msg_buff));
enable_interrupts(int_ssp); // Enable the interrupt for SPI
enable_interrupts(global);
}
if (_send_msg_flag == 0 ) {
if (_reset_flag == 0){
delay_ms(2);
disable_interrupts(global);
write_eeprom(NEW_PROG_LOADED,1);
_reset_flag =2;
fprintf(COM_A, "\n\r Yes Finish Last block!");
delay_ms(10);
reset_cpu();
}
}
}
}
******************
---> Above boot code work fine interrupt work ok as well once I jump to App code area interrupt don't work...
//******************************
//Here is app code
// ******************************
#include <18F8520.h>
#device ICD=TRUE
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=11059200)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS, STREAM=COM_A)
#NOLIST
#include <input.c>
#include <stdlib.h>
#LIST
#include <C:\PIC\app\bootloader.h>
int save_w;
#locate save_w=0x80
int save_status;
#locate save_status=0xFF
int save_pclath;
#locate save_pclath=0xFF
int save_FSR ;
#locate save_FSR=0xFF
#byte STATUS = 0xFD8
#byte PCLATH= 0xFFA
#bit zero_flag = status.2
#bit sspif =0XF9E.3 //PIR1 // SSP interrupt falg bit
#bit sspie =0XF9D.3 //PIE1 // SSP interrupt enable bit
// SPI MSG Defines
#define _SPI_MSG_WAKEUP_ 0x5A
#define _SPI_MSG_POLL_ 0x11
#define _SPI_MSG_ENQ_ 0x05
#define _SPI_MSG_MESSAGE_ 0x0E
#define _SPI_MSG_IDLE_ 0x16
#define _SPI_MSG_FILL_ 0x33
#define _SPI_MSG_ACK_ 0x06
#define _SPI_MSG_NACK_ 0x15
// Stage of the SPI MSG
#define _SPI_IDLE 0
#define _SPI_START_RECEIVE_MSG_LEN 1
#define _SPI_RECEIVE_MSG 2
#define _SPI_START_SEND 3
#define _SPI_START_SENDING 4
#define _SPI_WAIT_ACK 5
// SPI - Registers
#bit SSOV1 = 0xFC6.6
#bit SSORR = 0xFC6.7
#byte SSPBUF = 0xFC9
// PIC SPI Stages
int8 _spi_stage;
//Send/Receive define
int1 _send_msg_flag = 0; // set if PIC have msg to send
int8 send_buff[140] = {0};
int *send_msg_ptr;
int8 send_msg_len;
int8 _wait_timer_flag; // PIC will wait for ack/nack from othe unit for 4 times..
int1 busy_msg_flag = 0;
int8 _msg_len=0;
char _checksum =0;
char *rec_msg_pointer;
char _recv_msg_buff [140] = {0};
//***************************************
//0x1307
//***************************************
#ORG default
#int_global
void isr() {
fprintf(COM_A,"\r\n app int");
#asm
goto 0x1800
nop
nop
nop
nop
nop
nop
goto 0x1827
#endasm
}
//******************************
// 0x1800 --- 0x1800+2FA
#org 0x1800 , 0x19fa
void intcode(void) {
int rec_msg = 0;
#asm
//store current state of processor
MOVWF save_w
SWAPF STATUS,W
BCF STATUS,5
BCF STATUS,6
MOVWF save_status
SWAPF PCLATH,W
MOVWF save_pclath
#endasm
if (sspif) {
rec_msg = spi_read(); // Unload the SPI MSG
SSOV1 = 0; // Clear Overflow bit
SSORR = 0; // Clear Write Collision Error
if (busy_msg_flag == 1) {
SSPBUF = _SPI_MSG_NACK_; // PIC is busy
return;
}
// NOTE: ///********************
/// get and send code goes here. This function is working ok...
/// copy write reason I can't post this code.
//**************8
#asm
MOVF save_pclath,w
MOVWF PCLATH
MOVF save_status,W
MOVWF STATUS
SWAPF save_w,F
SWAPF save_w,W
BCF sspif
retfie
#endasm
}
}
void main(void) {
// int rec_msg = 0;
// int i = 0;
setup_adc_ports(NO_ANALOGS);
OUTPUT_HIGH (PIN_H7); // No reset
set_tris_C ( 0x9D ); // Bit 0 is input - RS232- Rx
set_tris_B ( 0x03 );
// Setup SPI
setup_spi(SPI_SLAVE|SPI_XMIT_L_TO_H|SPI_H_TO_L);
delay_ms(2);
OUTPUT_HIGH (PIN_G4); // Indicate that I have SPI
fprintf(COM_A,"\r\n Writen by Sham \r\n");
busy_msg_flag = 0; // When MSG Received the this flag get set
_send_msg_flag = 0; // When MSG need to be send then this flag get set
_spi_stage = _SPI_IDLE; // Init spi stage to idle _serial_stage = 0;
_send_msg_flag = 0;
send_msg_len = 0;
enable_interrupts(int_ssp); // Enable the interrupt for SPI
enable_interrupts(global);
OUTPUT_LOW (PIN_J5); // no download
delay_ms(2);
fprintf(COM_A,"\r\n Firmware writen by SM Ver Test \r\n");
delay_ms(2);
while(1)
{
if (busy_msg_flag == 1) {
fprintf(COM_A,"\r\n SPI Tesing \r\n");
}
}
} |
|
|
sham
Joined: 18 Apr 2006 Posts: 9
|
I have added my code but no help. |
Posted: Fri Apr 28, 2006 8:58 am |
|
|
There is no one who used the interrupt in app code and boot code.
I only 2 wks to do this. Otherwise this project will drop. Please someone???
Regards
Shamine |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Fri Apr 28, 2006 9:03 am |
|
|
No one wants to waste time trying to read your code because you did not post it using the code button so it is almost like gibberish. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
sham
Joined: 18 Apr 2006 Posts: 9
|
I have added my code but no help. ---- code button ? |
Posted: Fri Apr 28, 2006 9:32 am |
|
|
Hi
I am soory I don't know anything about code button ? What should I do??
shamine |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
Re: I have added my code but no help. ---- code button ? |
Posted: Fri Apr 28, 2006 9:49 am |
|
|
sham wrote: | Hi
I am soory I don't know anything about code button ? What should I do??
shamine |
Go back to the entry where you posted the code and select the edit button to edit your posting. At the start of the actual code type [_code] (leave out the _ character). At the end of your code put [/_code] (leave out the _ character).
When posting your code in the first place you should have selected the CODE button on the menu and press the code button again at the end of your code section. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
sham
Joined: 18 Apr 2006 Posts: 9
|
I have added my code but no help. |
Posted: Fri Apr 28, 2006 10:33 am |
|
|
Hi Asmallri
have you done boot loader with interrupt.. once you jump to app code, there also interrupt need to be use. (only SPI).
can you help me here
thanks you
Shamine |
|
|
sham
Joined: 18 Apr 2006 Posts: 9
|
help needed in boot loader |
Posted: Fri Apr 28, 2006 11:48 am |
|
|
Please some one help me here..... |
|
|
dmendesf
Joined: 31 Dec 2005 Posts: 32
|
|
Posted: Fri Apr 28, 2006 9:23 pm |
|
|
Basically your error is that you have 2 interrupt entry points.. one at the bootloader and one in your application. But only the bootloader is located at the correct offset. The other one is never called, so it never works. You must create a variable to determine if the bootloader or the applicatio is running and make your interrupt entry point at the bootloader check this variable: if itīs inside the bootloader, run your normal code... if itīs the application running, jump to the application interrupt entry poin.t |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sun Apr 30, 2006 4:23 pm |
|
|
Dmendesf is correct. Please check my new post to the thread http://www.ccsinfo.com/forum/viewtopic.php?p=62993.
Also, I spot lots of #org statements in your code. This isn't wrong, but unnescessary. Just specify a start- and end address for a group of functions and than have the compiler figure out how to place them in this area.
And I agree with Andrew, I don't want to read your code as it is because it is very difficult to read in it's current format. Please return to your code posting and edit it by posting the program using the 'Code' button. Doing so will preserve the formatting of your program, also see point 5 in http://www.ccsinfo.com/forum/viewtopic.php?t=26245.
The easier you make it for other people to read your code, the more, better and quicker responses you will get. |
|
|
sham
Joined: 18 Apr 2006 Posts: 9
|
SOLVED - Now interrupt works in boot smd app code as well |
Posted: Mon May 08, 2006 11:08 pm |
|
|
Thanks ckielstra
It working.. Your idea really worked. Thank you very much.
Sham |
|
|
|
|
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
|