Skip to content

Commit 5c43240

Browse files
Hashu-17cpq
authored andcommitted
Update main.c
comments on the startup block : reset function, vector table
1 parent cda6372 commit 5c43240

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

steps/step-1-blinky/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ int main(void) {
5656
}
5757

5858
// Startup code
59-
__attribute__((naked, noreturn)) void _reset(void) {
59+
__attribute__((naked, noreturn)) void _reset(void) { //naked=don't generate prologue/epilogue //noreturn=it will never exit
6060
// memset .bss to zero, and copy .data section to RAM region
61-
extern long _sbss, _ebss, _sdata, _edata, _sidata;
61+
extern long _sbss, _ebss, _sdata, _edata, _sidata; //linker symbols declared in the .ld file
6262
for (long *dst = &_sbss; dst < &_ebss; dst++) *dst = 0;
6363
for (long *dst = &_sdata, *src = &_sidata; dst < &_edata;) *dst++ = *src++;
6464

@@ -69,5 +69,5 @@ __attribute__((naked, noreturn)) void _reset(void) {
6969
extern void _estack(void); // Defined in link.ld
7070

7171
// 16 standard and 91 STM32-specific handlers
72-
__attribute__((section(".vectors"))) void (*const tab[16 + 91])(void) = {
72+
__attribute__((section(".vectors"))) void (*const tab[16 + 91])(void) = { // defines the interrupt vector table and dumps it into .vectors via the linker script
7373
_estack, _reset};

0 commit comments

Comments
 (0)