Hallo,
ich will mich gerade ins Bootloader-Thema bei ARMs einarbeiten. Also vom
Bootloader eine Applikation flashen und diese natürlich starten.
Ich habe deshalb eine simple Anwendung erstellt, die eigentlich nichts
macht, außer sich selbst wieder starten.
Leider funktioniert nicht mal das, da ich sofort im Hard-Fault lande. Da
mein Breakpoint im ResetHandler nicht triggert, gehe ich davon aus, dass
es schon beim Aufruf in die Applikation zu springen sofort zu einem
Hard-Fault kommt.
Da sich der Code so tausendfach im Internet findet, weiß ich auch nicht
was hier falsch sein könnte.
1 | #define ApplicationAddress ((uint32_t)0x08000000)
|
2 |
|
3 | typedef void (*pFunction)(void);
|
4 |
|
5 | pFunction Jump_To_Application;
|
6 | volatile uint32_t JumpAddress;
|
7 |
|
8 | ...
|
9 |
|
10 | Printf("Starting the App...\r\n");
|
11 | DelayMs(10);
|
12 |
|
13 | JumpAddress = 0x08000000+4;
|
14 | Jump_To_Application = (pFunction)JumpAddress;
|
15 |
|
16 | // Disable all interrupts and systick
|
17 | NVIC_DisableInterrupts();
|
18 |
|
19 | /* initialize USER APP Stack Pointer */
|
20 | //__set_CONTROL(0); // Change from PSP to MSP
|
21 | __set_MSP(*(volatile uint32_t*)ApplicationAddress);
|
22 |
|
23 | Jump_To_Application();
|
mfg