2005-09-06 07:40 PM
2005-01-12 12:53 AM
I am trying to perform an IAP function. I am able to erase and program the micro without problem. My problem, however, is when the new code is programmed....the interrupt vectors do not line up. I am now creating a double jump table to alleviate this. I created a table at 0x1000 that contains a jump command and the interrupt addresses. It looks something like this:
#pragma section (Table1) void table1() { #asm jp _interrupt1 //fist interrupt jp _interrupt2 //second interrupt ....etc. #endasm } #pragma end The second table looks like this: void (* const _vectab[])() = { table1, table1 + 3, etc.... } When I compile this with just table1 in the second table it works. I can see that address 0x1000 is at 0xFFE0. However, when I insert the second line (table1 + 3) I get an error in the compiler: size unknown. Am I missing something here, or is this simple pointer arithmetic? Also, another note to mention, I tried typecasting the table1 + 3 and that didn't compile either. Any suggestions? TIA.2005-01-12 02:00 AM
Hi,
the HiWare Compiler removes any unused address that is not called by any part of the program. Try to add _vectab under ENTRIES to your .prm-file I post here my .prm-file (e.g. LITE29.prm) for example : -------------------------------------------------------- NAMES END SECTIONS ZRAM = READ_WRITE 0x0080 TO 0x00FF; MYSTACK = READ_WRITE 0x0180 TO 0x01FF; RAM_1 = READ_WRITE 0x0100 TO 0x017F; ROM = READ_ONLY 0xE000 TO 0xFFDF; EERCCR = READ_WRITE 0x1000 TO 0x1001; EEPROM = READ_WRITE 0x1002 TO 0x107F; IRVECTOR = READ_ONLY 0xFFE0 TO 0xFFFF; C_REGS = READ_WRITE 0x0000 TO 0x007F; PLACEMENT REG_SEG INTO C_REGS; PROJECT_CONST INTO ROM; DEFAULT_ROM, ROM_VAR, STRINGS INTO ROM; DEFAULT_RAM INTO RAM_1; RAM1 INTO RAM_1; RAM2 INTO RAM_1; BSCT INTO ZRAM; _ZEROPAGE, _OVERLAP INTO ZRAM; SSTACK INTO MYSTACK; EE_RCCR INTO EERCCR; EE_PROM INTO EEPROM; IR_VECTOR INTO IRVECTOR; END ENTRIES _vectabs _TIME END -------------------------------------------------------- Does it help ?? Regards WoRo2005-01-12 02:13 AM
Sorry, I forgot to specify...Cosmic compiler
Other details: ST72F521 InDart ST7 debugger2005-01-12 03:49 AM
2005-01-12 04:05 AM
Thanks for the response, I now understand why it won't work. I still need a solution however.
To answer your question as to why I would use this indirection table (table1), the table is not filled with constants. The table is filled with the interrupt service routine address. The compiler comes up with these addresses and I want to be sure that when I am loading new code into sectors 1 and 2 the interrupt vectors for the newly loaded software are aligned with the vectors in sector 0.2005-01-12 08:56 AM
2005-01-12 10:47 AM
Hmm, I think we are getting closer. We aren't there yet though. When I try to compile this I get the following errors:
symbol _irq_rtc not defined symbol _irq_trap not defined ...etc...etc... I don't understand how these are not defined. By the way, there is a funciton header for each that is an extern. extern void irq_trap(); extern void irq_sci(); extern void irq_rtc(); #pragma section(INT_JMP) char INT_jump_table() { #asm jp _irq_trap // PWM ART jp _irq_sci // SCI jp _irq_rtc // MCC/RTC #endasm } #pragma END char (* const _vectab[])() = { INT_jump_table, /* PWM ART */ // INT_jump_table + 3, /* IIC */ NULL, /* TRAP */ _stext, /* RESET */ }; Another question: In the vectab above ''NULL'' is defined above with the following command: #define NULL 0 If I change the initializer to anything other than 0 the program will not compile. Any idea why not? If I could get this to work I could hard code the specific address into vectab.2005-01-13 05:17 AM
Just thought I would let everyone interested know that I solved my problem. I will document it and post it later today....if anyone is interested.
[ This message was edited by: drew1296 on 13-01-2005 18:47 ]2005-09-06 07:40 PM
Hello,
can you please post your solution. I am working at the same problem Regards, Christian