EmbDev.net

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


Author: Philipp W. (ikarus177)
Posted on:

Rate this post
0 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):
.section .vectors
InterruptVectors:
.word 0xFBE0
.word 0xFBE2
.word 0xFBE4
.word 0xFBE6
.word 0xFBE8
.word 0xFBEA
.word 0xFBEC
.word 0xFBEE
.word 0xFBF0
.word 0xFBF2
.word 0xFBF4
.word 0xFBF6
.word 0xFBF8
.word 0xFBFA
.word 0xFBFC
.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
msp430-objdump -Dj .vectors BSL.elf
 I get the following (looks OK for me):
BSL.elf:     file format elf32-msp430

Disassembly of section .vectors:

0000ffe0 <InterruptVectors>:
    ffe0:  e0 fb         interrupt service routine at 0xfbe0
    ffe2:  e2 fb         interrupt service routine at 0xfbe2
    ffe4:  e4 fb         interrupt service routine at 0xfbe4
    ffe6:  e6 fb         interrupt service routine at 0xfbe6
    ffe8:  e8 fb         interrupt service routine at 0xfbe8
    ffea:  ea fb         interrupt service routine at 0xfbea
    ffec:  ec fb         interrupt service routine at 0xfbec
    ffee:  ee fb         interrupt service routine at 0xfbee
    fff0:  f0 fb         interrupt service routine at 0xfbf0
    fff2:  f2 fb         interrupt service routine at 0xfbf2
    fff4:  f4 fb         interrupt service routine at 0xfbf4
    fff6:  f6 fb         interrupt service routine at 0xfbf6
    fff8:  f8 fb         interrupt service routine at 0xfbf8
    fffa:  fa fb         interrupt service routine at 0xfbfa
    fffc:  fc fb         interrupt service routine at 0xfbfc
    fffe:  fe fb         interrupt service routine at 0xfbfe

But when I now convert the created *.elf-file to *.hex for flashing 
using
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
:0400000300004000B9
: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:
:10FFE000E0FBE2FBE4FBE6FBE8FBEAFBECFBEEFB01
:10FFF000F0FBF2FBF4FBF6FBF8FBFAFBFCFB0090DA
:040000030000900069
:00000001FF

Can anybody explain this?

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.