Hi gcc_support_team.
Problem:
compiler produces the "RESET_VECTOR" routine when it shouldn't.
I just updated to the prebuilt __Rev20070216__ mspgcc compiler,
was previously using the mspgcc-20050614.
system = Win-XP
The new version produces a <_reset_vector__> routine when my program has a
"void naked(_reset_vector__)" section. The older version did not do this.
(the older version also did not require the 'void' part of the statement).
The problem is rectified when I use the _RESET() option.
You probably already know about this.
regards Fred Villella
some information that will be needed,
msp430-gcc --v
Reading specs from /cygdrive/c/mspgcc/bin/../lib/gcc-lib/msp430/3.2.3/specs
Configured with: ./configure --target=msp430
--prefix=/cygdrive/c/Local/liechtic/mspgcc/sf/packaging/build/installed
--enable-languages=c,c++
Thread model: single
gcc version 3.2.3
//commands to compile my program..
msp430-gcc -g -Os -Wall test.c -mmcu=msp430x135 -mendup-at=main -o test.elf
msp430-objdump -DS test.elf > test.lst
msp430-objcopy --keep-symbols test.elf -O srec test.elf test.d43
//output, using _RESET()..
Disassembly of section .text:
_RESET()
{
// place your startup code here
// _SP = 0x400; //initialize stack, NB not required as gcc does this
for you
asm("mov #0x200,r15"); //start of ram
asm("mov r15,r14"); //end of ram = start + 0x200
asm("clr r13");
asm("loop:");
asm("mov r13,6(r15)"); //skip rtc_mem space at location 0x200
asm("incd r15");
asm("decd r14");
asm("jnz loop");
// Make sure, the branch to main is the last line in the function
asm("br #main"); //__asm__ __volatile__("br #main"::);
}
produces this :>
*******************************************
0000c000 <__ctors_end>:
c000: 30 40 04 c0 br #0xc004 ;
0000c004 <_unexpected_>:
c004: 00 13 reti
....
...
..
_RESET()
{
// place your startup code here
// _SP = 0x400; //initialize stack, NB not required as gcc does this
for you
asm("mov #0x200,r15"); //start of ram
ed44: 3f 40 00 02 mov #512, r15 ;#0x0200
asm("mov r15,r14"); //end of ram = start + 0x200
ed48: 0e 4f mov r15, r14 ;
asm("clr r13");
ed4a: 0d 43 clr r13 ;
0000ed4c <loop>:
asm("loop:");
asm("mov r13,6(r15)"); //skip rtc_mem space at location 0x200
ed4c: 8f 4d 06 00 mov r13, 6(r15) ;
asm("incd r15");
ed50: 2f 53 incd r15 ;
asm("decd r14");
ed52: 2e 83 decd r14 ;
asm("jnz loop");
ed54: fb 23 jnz $-8 ;abs 0xed4c
// Make sure, the branch to main is the last line in the function
asm("br #main"); //__asm__ __volatile__("br #main"::);
ed56: 30 40 dc e9 br #0xe9dc ;
*******************************************
//and when I use this command...
void naked(_reset_vector__)
{
// place your startup code here
// _SP = 0x400; //initialize stack, NB not required as gcc does this
for you
asm("mov #0x200,r15"); //start of ram
asm("mov r15,r14"); //end of ram = start + 0x200
asm("clr r13");
asm("loop:");
asm("mov r13,6(r15)"); //skip rtc_mem space at location 0x200
asm("incd r15");
asm("decd r14");
asm("jnz loop");
// Make sure, the branch to main is the last line in the function
asm("br #main"); //__asm__ __volatile__("br #main"::);
}
*******************************************
// produces this....
Disassembly of section .text:
0000c000 <_reset_vector__>:
c000: b2 40 80 5a mov #23168, &0x0120 ;#0x5a80
c004: 20 01
c006: 3f 40 0a f6 mov #-2550, r15 ;#0xf60a
c00a: 3e 40 00 02 mov #512, r14 ;#0x0200
c00e: 3d 40 00 02 mov #512, r13 ;#0x0200
c012: 0d 9e cmp r14, r13 ;
c014: 05 24 jz $+12 ;abs 0xc020
c016: fe 4f 00 00 mov.b @r15+, 0(r14) ;
c01a: 1e 53 inc r14 ;
c01c: 0e 9d cmp r13, r14 ;
c01e: fb 2b jnc $-8 ;abs 0xc016
c020: 3f 40 00 02 mov #512, r15 ;#0x0200
c024: 3d 40 d1 02 mov #721, r13 ;#0x02d1
c028: 0d 9f cmp r15, r13 ;
c02a: 05 24 jz $+12 ;abs 0xc036
c02c: cf 43 00 00 mov.b #0, 0(r15) ;r3 As==00
c030: 1f 53 inc r15 ;
c032: 0f 9d cmp r13, r15 ;
c034: fb 2b jnc $-8 ;abs 0xc02c
c036: 30 40 16 ea br #0xea16 ;
0000c03a <__ctors_end>:
c03a: 30 40 3e c0 br #0xc03e ;
0000c03e <_unexpected_>:
c03e: 00 13 reti
....
..
..
void naked(_reset_vector__)
{
// place your startup code here
// _SP = 0x400; //initialize stack, NB not required as gcc does this
for you
asm("mov #0x200,r15"); //start of ram
ed7e: 3f 40 00 02 mov #512, r15 ;#0x0200
asm("mov r15,r14"); //end of ram = start + 0x200
ed82: 0e 4f mov r15, r14 ;
asm("clr r13");
ed84: 0d 43 clr r13 ;
0000ed86 <loop>:
asm("loop:");
asm("mov r13,6(r15)"); //skip rtc_mem space at location 0x200
ed86: 8f 4d 06 00 mov r13, 6(r15) ;
asm("incd r15");
ed8a: 2f 53 incd r15 ;
asm("decd r14");
ed8c: 2e 83 decd r14 ;
asm("jnz loop");
ed8e: fb 23 jnz $-8 ;abs 0xed86
// Make sure, the branch to main is the last line in the function
asm("br #main"); //__asm__ __volatile__("br #main"::);
ed90: 30 40 16 ea br #0xea16 ;
}
ed94: 30 41 ret
*******************************************
--
Fred Villella
Dallas Delta Corporation - Engineering Department
Telephone 03 9387 7388
Facsimile 03 9387 3128
Email [email protected]
******IMPORTANT INFORMATION******
The Dallas Delta Corporation takes care to provide accurate and timely advice
in all electronic communications, however due to human nature, omissions and
errors may have been made. If you plan to rely on this advice, please make
contact with the author and ensure this email addresses all of your personal
criteria; we specifically disclaim any liability arising from the use of this
email without such contact. The information contained herein may also be
privileged and subject to confidentiality and copyright agreements; if you are
not in the recipients list, please obtain advice from Dallas Delta on +61 3
9387 7388 as disclosure of this email is illegal and breaks privilege.
******VIRUS SCANNING NOTICE******
The Dallas Delta Corporation Pty Ltd makes no guarantee that this communication
is free of viruses or code that may potentially be harmful to the recipients
computer equipment. Before opening any communications the recipient should
satisfy themselves that all appropriate scans have been completed.