This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Relocating the vector table

The board I'm using is the phyCORE-167HSE with ST10F269 processor
intern:
256kB flash,;
8 + 2kB GP-RAM
2kB IRAM;

Extern:
1MB flash on /CS0:
512kB RAM on /CS1
4kB UARTon /CS2
512kB RAM at /CS3
4kB Ethernet on /CS4

Software:
uVision3 V3.02
FlashTools 3 Version 0.96


Memory configuration in uVision3
RAM 0x1000-0x1FFF (4kB(min size),UART)
ROM 0x100000-0x1FFFFF (1MB, Flash)
RAM 0x200000-0x27FFFF (512kB, RAM)

I'd like to start executing code from external ROM at 0x100000 (=mirror), so section 0 remains free for PEC-transfers to a n external UART, see memory map
(b.t.w. this is possible right??? the ST user manual says on page 36:
"For PEC data transfers the external memory in segment 0 can be accessed independent of the contents
of the DPP registers via the PEC source and destination pointers.")


I changed the invec table to this location in the L166 MISC tab. (like suggested in this post: http://www.keil.com/forum/docs/thread1060.asp)

When I ran the simulator, there was no JMPS at address0.

I tried inserting it with the inline assembly feature, but opon the first interrupt, the code jumps to the interrupt vector table starting at 0x00 (which I thought was moved by the setting in L166 MISC tab)...

After searching I came upon this article:
http://www.keil.com/support/docs/1075.htm
In it, an invec-redirection table is suggested located at 0x0, which "reroutes" interrupts to the specified address with JMPSs.

I inserted this asm file(modified with a JMPS 0x100000 at location 0) and linked the whole bunch.

$segmented

; this example shows how to redirect interrupt vectors to
; address 28000H.  Interrupt Vector redirection is typically required
; when you devide an user program into two parts:  BOOT part and
; application part.  This assembly module needs to be added to the BOOT
; part that is located in segment 0 of the 166 program space.
;
; The application part needs to be linkedwith the L166 VECTAB directive.
; In this example you need to specify VECTAB(0x28000) to generate the interrupt
; vector table at address 0x28000.

VEC_SEG  EQU 10H
VEC_OFF  EQU 0H

; The RESET vector is used by the boot application
VECT_TAB SECTION CODE AT 0
VEC_PROC PROC
  JMPS 10H,0000H
  JMPS VEC_SEG,VEC_OFF+004H
  JMPS VEC_SEG,VEC_OFF+008H
	etc...
  JMPS VEC_SEG,VEC_OFF+1F8H
  JMPS VEC_SEG,VEC_OFF+1FCH
VEC_PROC ENDP
VECT_TAB ENDS

  end

This ran fine in the simulator. If I try to program it with flashtools though flashtools gives the message "specified area is not blank.". My guess is the inserted asm-code conflicts with the position of the original invec table.

If anybody is still with me, could he/she explain what I'm doing wrong? I'm lost...

Regards,

-Dirk

  • Hi Dirk,

    I am not familiar with the phyCORE-167HSE board, but I'll try to answer.
    First of all, in order to start program execution from external ROM, you have to make sure that the EA pin (external access) is held low during reset. There must be a jumper on the board for that. I'm sure you've taken care of it.
    Secondly, I am not sure why you want to redirect interrupts. Why not just map external flash starting at address 0? There will be no need for interrupt vector table relocation then. Of course, some of the external flash will not be accessible due to external UART and on-chip RAM and SFRs. But that's only a few kilobytes of ROM. In exchange you get reduced complexity. You will need to use the RESERVE linker directive to make sure the linker doesn't touch the UART address space.
    If you insist on having external ROM starting at address 0x100000, there is no need for interrupt vector table redirection either, if I am not mistaken. The reason for that is that in the memory map that you provided, nothing is mapped at address 0. This means that external ROM will be accessed at address 0 since it's connected to CS0 (see Address Window Arbitration in the microcontroller manual.) Just place the interrupt vector table at address 0x100000, and it will emerge at address 0 as well. The simulator does not simulate mirroring, so it is not surprising that your test failed in the simulator.

    Good luck,
    - mike