Page 1 of 1

Interrupt Vector Offset

Posted: Mon Jan 30, 2012 11:45 pm
by rallysjd
Hi Giovanni,
We have 2.3.4 running on PiXCL Decaf-1 and Decaf-2 (STM32F103VE) boards, loaded at the std 0x800 0000.
We have also developed a USB Device Firmware Update (DFU) utility that sits at 0x800 0000 - 800 2FFF. Our test code (some LCD and graphics primitives) that's built to load at 0x800 3000 runs fine. We adjust the linker script to be
MEMORY
{
flash : org = 0x08003000, len = 512k - 0x3000
ram : org = 0x20000000, len = 64k
}
and issue a vector table remap command
(NVIC_SetVectorTable(NVIC_VectTab_FLASH, InterruptVectorAddress)
as the first line of main().

When our DFU code only runs, the boards appear as a USB DFU Device, and we can load the test binary (a .BIN converted to .DFU). When the combined flash load is booted, the core DFU code checks for a flag at 0x800 3000 and if found jumps there and starts execution, and the USB DFU Device mode never appears.

We did the same build exercise with 2.3.4, but there's two problems. The DFU mode never gets unset, and 2.3.4 tries to start and then jams: the usual LEDs light up but don't blink, no USART output, suggesting that the blinker thread has run through once.

We see the vector.c file that includes the vector table, so it seems that we have missed something that relocates the vectors. Suggestions?

In the Makefile, I see "# Enable this if you really want to use the STM FWLib."
Can you clarify why we would or would not use the FWLib?
regards

Re: Interrupt Vector Offset

Posted: Tue Jan 31, 2012 9:17 am
by Giovanni
Hi,

During the kernel initialization (chSysInit()) the kernel reinitializes the vectors table base address based on the cortex-specific setting CORTEX_VTOR_INIT which is set at 0x00000000 by default. If you want the kernel to use a vector table at another address just change that setting, you dont need to set the address yourself.

About the FWLib, in general you don't need it unless you want to use something not already present in the ChibiOS HAL. I don't recommend its use anyway, in general it is a huge blob of code that offers little to none abstraction over the hardware. A typical use case is when you have to integrate code that use the FWLib.

Giovanni