EmbDev.net

Forum: µC & Digital Electronics MSP430: custom interrupt vector table


von Philipp W. (ikarus177)


Rate this post
useful
not useful
Hello everyone,

I'm currently working on a bootloader (written in C) for a 
MSP430F168-device. The bootloader should be placed in the two uppermost 
segments of the flash memory (where also the interrupt vector table is 
located). As the values stored in this table can therefore no longer be 
changed, they should simply point to another "table" in a segment that 
is not occupied by the BSL and can therefore be changed by the 
bootloader.

I'm using Eclipse together with MSPGCC4 on Ubuntu 10.04.

My first approach to change the IVT was to add an assembler-file to my 
project, containing the new values for this segment (.vectors is the 
segment the IVT is stored in):
1
.section .vectors
2
InterruptVectors:
3
.word 0xFBE0
4
.word 0xFBE2
5
.word 0xFBE4
6
.word 0xFBE6
7
.word 0xFBE8
8
.word 0xFBEA
9
.word 0xFBEC
10
.word 0xFBEE
11
.word 0xFBF0
12
.word 0xFBF2
13
.word 0xFBF4
14
.word 0xFBF6
15
.word 0xFBF8
16
.word 0xFBFA
17
.word 0xFBFC
18
.word 0xFBFE

To make this have effect, I deactivated the use of the standard 
startup-files by passing the -nostartfiles argument to the 
compiler/linker.

When I look in the contents of the IVT by using
1
msp430-objdump -Dj .vectors BSL.elf
 I get the following (looks OK for me):
1
BSL.elf:     file format elf32-msp430
2
3
Disassembly of section .vectors:
4
5
0000ffe0 <InterruptVectors>:
6
    ffe0:  e0 fb         interrupt service routine at 0xfbe0
7
    ffe2:  e2 fb         interrupt service routine at 0xfbe2
8
    ffe4:  e4 fb         interrupt service routine at 0xfbe4
9
    ffe6:  e6 fb         interrupt service routine at 0xfbe6
10
    ffe8:  e8 fb         interrupt service routine at 0xfbe8
11
    ffea:  ea fb         interrupt service routine at 0xfbea
12
    ffec:  ec fb         interrupt service routine at 0xfbec
13
    ffee:  ee fb         interrupt service routine at 0xfbee
14
    fff0:  f0 fb         interrupt service routine at 0xfbf0
15
    fff2:  f2 fb         interrupt service routine at 0xfbf2
16
    fff4:  f4 fb         interrupt service routine at 0xfbf4
17
    fff6:  f6 fb         interrupt service routine at 0xfbf6
18
    fff8:  f8 fb         interrupt service routine at 0xfbf8
19
    fffa:  fa fb         interrupt service routine at 0xfbfa
20
    fffc:  fc fb         interrupt service routine at 0xfbfc
21
    fffe:  fe fb         interrupt service routine at 0xfbfe

But when I now convert the created *.elf-file to *.hex for flashing 
using
1
msp430-objcopy -O ihex -j .vectors BSL.elf out.hex
 (this should just put the contents of the IVT in the hex-file), I get
1
:0400000300004000B9
2
:00000001FF

For me, it looks like the IVT doesn't get copied to the hex-file. Is 
this right?

Do you know any other approach how to change the IVT to support my 
problem?

Best regards,
ikarus177

EDIT: I just tried to add the "a" attribute to the .section directive in 
my assembler file. Now the IVT contents are also visible in the 
hex-file:
1
:10FFE000E0FBE2FBE4FBE6FBE8FBEAFBECFBEEFB01
2
:10FFF000F0FBF2FBF4FBF6FBF8FBFAFBFCFB0090DA
3
:040000030000900069
4
:00000001FF

Can anybody explain this?

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.