cancel
Showing results for 
Search instead for 
Did you mean: 

question about segment 'vectit'

sebastian239955_stm1
Associate II
Posted on February 26, 2008 at 18:26

question about segment 'vectit'

3 REPLIES 3
sebastian239955_stm1
Associate II
Posted on February 26, 2008 at 11:20

hi everybody!

i am currently trying to translate an assembler code to c, but it doesnt work yet.

so i deleted every unnecessary part of the assembler code and looked if it still worked.

finally now i cut the code down to a few lines, containing an i2c protokoll to communicate with an tone generator and an amplifier. i understand the i2c protokoll, but what i do not understand is the following, last code part:

.dummy_rt iret ; Empty subroutine. Go back to main (iret instruction).

segment ’vectit’

DC.W not used ; FFE0-FFE1h location

DC.W not used ; FFE2-FFE3h location

.i2c_it DC.W dummy_rt ; FFE4-FFE5h location

DC.W not used ; FFE6-FFE7h location

DC.W not used ; FFE8-FFE9h location

DC.W not used ; FFEA-FFEBh location

DC.W not used ; FFEC-FFEDh location

DC.W not used ; FFEE-FFEFh location

DC.W not used ; FFF0-FFF1h location

DC.W not used ; FFF2-FFF3h location

DC.W not used ; FFF4-FFF5h location

DC.W not used ; FFF6-FFF7h location

DC.W not used ; FFF8-FFF9h location

DC.W not used ; FFFA-FFFBh location

DC.W not used ; FFFC-FFFDh location

.reset DC.W main ; FFFE-FFFEh location

haveing the last assemblercode part like this, it works and the speaker ''peeps''.

but if i delete the

''.i2c_it DC.W dummy_rt ; FFE4-FFE5h location''

line or replace it by a

''DC.W not used ; FFE4-FFE5h location'' line, my code doesen't work anymore.

can anyone tell me why this happens and in particular how i have to consider this when i translate the code to c?

thank you very much in advance

sebastian

fggnrc
Associate II
Posted on February 26, 2008 at 12:01

The vectit segment contains a table of 16 pointers and it is stored from 0xFFE0 to 0xFFFF.

If you delete an entry from the assembler code, the last pointer gets shifted down, so the reset interrupt handler (the one that ''fires'' your main) points somewhere else but your main().

To fill the table with the right interrupt handler, you have to define and initialize a static vector of sixteen pointers that is located at 0xFFE0. See your C compiler documentation for the details.

Regards

EtaPhi

sebastian239955_stm1
Associate II
Posted on February 26, 2008 at 18:26

thanks alot!

indeed, i only had 15 and not 16 pointers defined, thats why it didnt work.

i got it now and finaly my code works!

thanks again EtaPhi! have a nice evening