STM32 bootloader IRQs gehen nicht

OP #1803361
Lesenswert?

Hallo,

ich möchte gern einen Bootloader schreiben, der ein weiteres Programm 
starten kann (für den STM32F103).

Der Bootloader soll im Flash von 0x8000000 bis 0x800FFFF und das zweite 
Programm ab 0x8010000 abgespeichert sein.

1
 __asm void jump_to_application(void)
2
{
3
    ; program stack pointer of application
4
    LDR     R0, =0x8010000
5
    LDR     SP, [R0]
6

7
    ; extract entry point into application
8
    LDR     R0, =0x8010004
9
               
10
    ; jump
11
    LDR     PC, [R0]
12
}
13

14
int main(void)
15
{
16

17
  stm32_Init ();   /processor init 
18

19
  jump_to_application(); 
20

21
  while(1);
22

23
}

Zwar wird das zweite Programm ausgeführt, aber Timer / Interrupts etc. 
funktionieren nicht.

Gruß
Bernd
#1803621
Lesenswert?

Dann mußt du überprüfen, ob
a) die Vektortabelle für die Interrupts an der richtigen Stelle liegt
b) das System das auch weiß

in der ST Lib gibt es für b eine Funktion:
1
/**
2
  * @brief  Sets the vector table location and Offset.
3
  * @param  NVIC_VectTab: specifies if the vector table is in RAM or FLASH memory.
4
  *   This parameter can be one of the following values:
5
  *     @arg NVIC_VectTab_RAM
6
  *     @arg NVIC_VectTab_FLASH
7
  * @param  Offset: Vector Table base offset field. This value must be a multiple of 0x100.
8
  * @retval None
9
  */
10
void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset)
11
{ 
12
  /* Check the parameters */
13
  assert_param(IS_NVIC_VECTTAB(NVIC_VectTab));
14
  assert_param(IS_NVIC_OFFSET(Offset));  
15
   
16
  SCB->VTOR = NVIC_VectTab | (Offset & (uint32_t)0x1FFFFF80);
17
}

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren