By defining _reset_vector__ in the user application, the linker will not
link standard startup code. For example:
#include <io.h>
NAKED(_reset_vector__)
{
/* place your startup code here */
/* Make shure, the branch to main (or to your start
routine) is the last line in the function */
__asm__ __volatile__("br #main"::);
}
|
produces the following code
a.out: file format elf32-msp430
Disassembly of section .text:
0000fc00 <__zero_vector>:
fc00: 30 40 04 fc br #0xfc04
0000fc04 <_unexpected_>:
fc04: 00 13 reti
0000fc06 <_reset_vector__>:
fc06: 00 3c jmp $+2 ; abs dst addr 0xfc08
0000fc08 <main>:
fc08: 31 40 80 02 mov #640, SP ; #0x0280
fc0c: 30 40 10 fc br #0xfc10
0000fc10 <__stop_progExec__>:
fc10: 02 43 clr SR
fc12: fe 3f jmp $-2 ; abs dst addr 0xfc10
Disassembly of section .data:
Disassembly of section .vectors:
[skip]
Please note that if you declare your own startup, you must take care about
initialising the values of global variables.
Another way to define the reset routine is to use the _RESET() macro:
_RESET()
{
/* place your startup code here */
__asm__ __volatile__("br #main"::);
}
|