0
0
Embedded Cprogramming~10 mins

Startup sequence and reset vector in Embedded C - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the reset vector function name correctly.

Embedded C
void [1](void) {
    // Reset handler code
}
Drag options to blanks, or click blank then click option'
AReset_Handler
Binit
Cstart
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using main as the reset vector function name.
Using generic names like start or init.
2fill in blank
medium

Complete the code to declare the vector table with the reset vector at the correct position.

Embedded C
void (* const vector_table[])(void) __attribute__((section(".isr_vector"))) = {
    (void (*)(void))[1], // Initial stack pointer
    Reset_Handler,               // Reset vector
    NMI_Handler,                 // NMI handler
};
Drag options to blanks, or click blank then click option'
A0x08000000
B0x20002000
C0x20000000
D0x20001000
Attempts:
3 left
💡 Hint
Common Mistakes
Using the reset vector address instead of the stack pointer.
Using flash memory address for the stack pointer.
3fill in blank
hard

Fix the error in the reset handler function prototype to match the expected signature.

Embedded C
void [1](void) {
    // Reset handler implementation
}
Drag options to blanks, or click blank then click option'
AReset_Handler
Breset_handler
DReset_Handler(void)
Attempts:
3 left
💡 Hint
Common Mistakes
Adding parameters to the reset handler function.
Using lowercase function names that do not match the vector table.
4fill in blank
hard

Fill both blanks to correctly initialize the vector table with stack pointer and reset handler.

Embedded C
void (* const vector_table[])(void) __attribute__((section(".isr_vector"))) = {
    (void (*)(void))[1], // Initial stack pointer
    [2],                 // Reset vector
};
Drag options to blanks, or click blank then click option'
A0x20001000
BReset_Handler
C0x08000000
DNMI_Handler
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the stack pointer and reset handler entries.
Using incorrect addresses or handler names.
5fill in blank
hard

Fill all three blanks to complete the startup code that sets the vector table base address and calls the reset handler.

Embedded C
extern void [1](void);

int main(void) {
    SCB->VTOR = (uint32_t)[2]; // Set vector table base address
    [3]();                    // Call reset handler
    while(1) {}
}
Drag options to blanks, or click blank then click option'
AReset_Handler
Bvector_table
DSystemInit
Attempts:
3 left
💡 Hint
Common Mistakes
Calling the wrong function instead of the reset handler.
Not setting the vector table base address correctly.