Bootloader für Cortex-M0+ ohne VTOR und ohne Mem-Remap?

Gast #7177112
Lesenswert?

Moin,

Ich nutze einen recht unbekannten APM32 Cortex-M0+, ohne VTOR (vector 
offset register) und ohne Mem-Remap.

Wie werden da in einem eigenen Bootloader am besten die Interrupts an 
die User-Firmware übergeben?
Meine Idee wäre ein universeller ISR Handler im Bootloader, der über 
IPSR den aktiven interrupt rausfindet und dann den entsprechenden 
ISR-Handler aus der Firmware aufruft. Gibt natürlich ziemlich overhead 
bei jedem Interrupt...
Müsste das so gehen und ist das so üblich oder gibt es eine schönere 
Methode?

Vielen Dank!
Alex
Gast #7177130
Lesenswert?

Das habe ich bereits so bei einem STM32F051K8 gemacht

Die Vektortabelle der Applikation liegt hier bei 0x08001000
1
void COMMON_IRQHandler(void)
2
{
3
    unsigned int irq_no;
4
    unsigned int * addr;
5
    void (*irq_func)(void);
6
    
7
    irq_no = __get_IPSR() & 0x3F;
8
        
9
    addr = (unsigned int *)(0x08001000 + irq_no*4);
10
    
11
    irq_func = (void (*)(void))*addr;
12
    (*irq_func)();
13
}

Die Vektortabelle des Bootloaders sieht dann so aus:
1
__vector_table
2
        DCD     sfe(CSTACK)
3
        DCD     SystemStart                    ; Reset Handler
4

5
        DCD     bl_NMI_Handler                 ; NMI Handler
6
        DCD     bl_HardFault_Handler           ; Hard Fault Handler
7
        DCD     0                              ; Reserved
8
        DCD     0                              ; Reserved
9
        DCD     0                              ; Reserved
10
        DCD     0                              ; Reserved
11
        DCD     0                              ; Reserved
12
        DCD     0                              ; Reserved
13
        DCD     0                              ; Reserved
14
        DCD     SVC_Handler                    ; SVCall Handler
15
        DCD     0                              ; Reserved
16
        DCD     0                              ; Reserved
17
        DCD     PendSV_Handler                 ; PendSV Handler
18
        DCD     COMMON_IRQHandler              ; SysTick Handler
19

20
        ; External Interrupts
21
        DCD     COMMON_IRQHandler              ; Window Watchdog
22
        DCD     COMMON_IRQHandler              ; PVD through EXTI Line detect
23
        DCD     COMMON_IRQHandler              ; RTC through EXTI Line
24
        DCD     COMMON_IRQHandler              ; FLASH
25
        DCD     COMMON_IRQHandler              ; RCC
26
        DCD     COMMON_IRQHandler              ; EXTI Line 0 and 1
27
        DCD     COMMON_IRQHandler              ; EXTI Line 2 and 3
28
        DCD     COMMON_IRQHandler              ; EXTI Line 4 to 15
29
        DCD     COMMON_IRQHandler              ; TS
30
        DCD     COMMON_IRQHandler              ; DMA1 Channel 1
31
        DCD     COMMON_IRQHandler              ; DMA1 Channel 2 and Channel 3
32
        DCD     COMMON_IRQHandler              ; DMA1 Channel 4 and Channel 5
33
        DCD     COMMON_IRQHandler              ; ADC1, COMP1 and COMP2 
34
        DCD     COMMON_IRQHandler              ; TIM1 Break, Update, Trigger and Commutation
35
        DCD     COMMON_IRQHandler              ; TIM1 Capture Compare
36
        DCD     COMMON_IRQHandler              ; TIM2
37
        DCD     COMMON_IRQHandler              ; TIM3
38
        DCD     COMMON_IRQHandler              ; TIM6 and DAC
39
        DCD     0                              ; Reserved
40
        DCD     COMMON_IRQHandler              ; TIM14
41
        DCD     COMMON_IRQHandler              ; TIM15
42
        DCD     COMMON_IRQHandler              ; TIM16
43
        DCD     COMMON_IRQHandler              ; TIM17
44
        DCD     COMMON_IRQHandler              ; I2C1
45
        DCD     COMMON_IRQHandler              ; I2C2
46
        DCD     COMMON_IRQHandler              ; SPI1
47
        DCD     COMMON_IRQHandler              ; SPI2
48
        DCD     COMMON_IRQHandler              ; USART1
49
        DCD     COMMON_IRQHandler              ; USART2
50
        DCD     0                              ; Reserved
51
        DCD     COMMON_IRQHandler              ; CEC
52
        DCD     0                              ; Reserved
Gast #7177197
Lesenswert?

> unbekannten APM32 Cortex-M0+, ohne VTOR
Die haben dann einen Bootloader im ROM und ein Firmwareblob
kuemmert sich um sowas und anderes.
Infineon hat sowas auch verbrochen. Da liegt die Vektortabelle
dann auch noch in Stein gemeisselt im ROM.

Am einfachsten und besten ist es, sowas in die Ecke zu legen
und zu warten, dass das Silizium Rost ansetzt.

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