cancel
Showing results for 
Search instead for 
Did you mean: 

IAP doesn't go to IRQ

Barbie
Associate II
Posted on April 10, 2013 at 09:50

Hello.

I make an IAP where my Boot start on 0x08000000, and my application on 0x08010000.

The Boot make the jump correctly and by using LED signals I see it start O.K. But when I get to the first IRQ request and not continue( look that it didn't map the vactor table correct).

The settimg I made:

In the icf I do :

for the interrupt vector

define symbol __ICFEDIT_intvec_start__ = 0x08010000;// start main APP on sector 4

and

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

I don't see where I have define for intvec?

For the application

define symbol __ICFEDIT_region_ROM_start__ = 0x08010000; // start main APP on sector 4

define symbol __ICFEDIT_region_ROM_end__   = 0x080FFFFF;

define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;

//define symbol __ICFEDIT_region_RAM_end__   = 0x20020000;// STM32F205ZG

define symbol __ICFEDIT_region_RAM_end__   = 0x20018000; // STM32F205ZC

In the Application I add after operate startup_stm32f2xx.s:

NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x10000); 

And that all.

1. Did I miss some setting?

2. I read somewhere taht it is not goot to operate startup_stm32f2xx.s twice (in the Boot and then the APP). But if it is right how I block it in my APP (it is get automatic by the IDE [IAR])?

Bar.

#iap-irq
9 REPLIES 9
Posted on April 10, 2013 at 12:41

I think I told you quite clearly that calling SystemInit() twice was a problem because the default code is not considering how the CPU is currently running, it assumes you're running from HSI at 16 MHz. Think of it like mashing all the gears in a car's gear box while driving 80 MPH down the motorway? It's ill considered.

Confirm that SCB->VTOR points to your new vector table, confirm the addresses of the routines in said vector table point to your service routines.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Barbie
Associate II
Posted on April 10, 2013 at 16:31

Hello.

I still didn't understand how can I omit startup_stm32f2xx.s from my project (It get automaticly) , because this is the only way I can get to SystemInit() ?

Bar.

Posted on April 10, 2013 at 16:45

It would be easier if you kept these threads as one, instead of spawning new ones.

You don't really want to omit startup_stm32f4xx.s (which could be done by simply deleting the file in the project tree), what you want to do is copy the file to your project, and either remove the call to SystemInit(), or take system_stm32f4xx.c and modify what code is in the body of SystemInit(). The startup file contains other useful structures like the vector table. I would strongly recommend that you take localized copied of startup and system source files for both your boot loader and application source trees / projects.

The code there can still change clocks, and program the vector table, but it has to do so in a way that takes into consideration the state of the system when it enters.

ST did a minimal job with the routines to switch the HSE on, and configure the PLL based on the assumption it was called at reset, and called once. You have changed this paradigm, and you must adapt the code to reflect how you're using it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Barbie
Associate II
Posted on April 10, 2013 at 21:32

Hi.

I think better and more easy to me is to modify the system_stm32f2xx.c

1.In That file write

''Then SystemInit() function is called, in ''startup_stm32f2xx.s'' file''.

But I don't see who call

''startup_stm32f2xx.s''?

2. Also in

''startup_stm32f2xx.s'' I see header

SystemInit:

Does this fill also need to be modify.Does it work together with the

SystemInit()

in system_stm32f2xx.c?

3. As I can see in

system_stm32f2xx.c

I need to close all the clock setting (because all ready done in the Boot App)

, but the part of the vector need to be modify 

 

/* Configure the Vector Table location add offset address ------------------*/

Am I right?

Thanks Bar.
Posted on April 10, 2013 at 22:03

1) The Reset_Handler on the boot loader is called when the system resets. Your boot loader then loads the SP/PC from you application image, and thus calls the Reset_Handler on the application.

2) IAR has an EXTERN SystemInit, and the LDR R0,=SystemInit; BLX R0 which calls the SystemInit() prior to calling __iar_program_start which initializes the C run time, and then jumps to your main() routine.

3) Yes, in order for the CPU to utilize your Application's vector table and interrupts, you must relocate the table SystemInit(),  SCB->VTOR =0x08010000; (aka __vector_table)

extern void * __vector_table;

SCB->VTOR = (u32)(&__vector_table);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Barbie
Associate II
Posted on April 10, 2013 at 22:42

So again to make it clear.

DO I need to make the relocate of the vector table in the end of the Boot before jump or in my main APP in the systemInit()?

And what exactly should be write there?

What is the meaning of

(aka __vector_table)

extern void * __vector_table;

SCB->VTOR = (u32)(&__vector_table);

Barbie
Associate II
Posted on April 10, 2013 at 22:47

Some more issue.

I am not quit understand the operation of the VTOR.

It point to the beginning of my code where there is written address of RAM.

Does it mean that the vector table build in the RAM and does it build during the systemInit?
Posted on April 10, 2013 at 23:55

If you want clarity might I suggest getting Joseph Yiu's book on the Cortex-M3, or perhaps a review of the TRM.

The VTOR register holds the physical address of the Vector Table, while you could copy the vectors to RAM (as done with M0 cores, absent VTOR) the simpler way is to just have the table situated in FLASH at a 512 byte boundary, and then point at it. The DCD list in startup_stm32f4xx.s is the vector table itself. It has a name, that I mentioned, and can been seen in the assembler file, and the .MAP file listing the symbols in the linked image. Please review.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on April 11, 2013 at 00:37

http://www.st.com/web/en/resource/technical/document/programming_manual/CD00228163.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..