Closed GoogleCodeExporter closed 9 years ago
With gcc 4.3.2:
/* Forever loop */
for (;;) {
/* get character from UART */
ch = getch();
7e60: a2 d0 rcall .+324 ; 0x7fa6 <getch>
if(ch == STK_GET_PARAMETER) {
7e62: 81 34 cpi r24, 0x41 ; 65
7e64: 61 f4 brne .+24 ; 0x7e7e <main+0x7e>
unsigned char which = getch();
7e66: 9f d0 rcall .+318 ; 0x7fa6 <getch>
7e68: 08 2f mov r16, r24
verifySpace();
7e6a: af d0 rcall .+350 ; 0x7fca <verifySpace>
if (which == 0x82) {
7e6c: 02 38 cpi r16, 0x82 ; 130
7e6e: 11 f0 breq .+4 ; 0x7e74 <main+0x74>
/*
* Send optiboot version as "minor SW version"
*/
putch(OPTIBOOT_MINVER);
} else if (which == 0x81) {
7e70: 01 38 cpi r16, 0x81 ; 129
7e72: 11 f4 brne .+4 ; 0x7e78 <main+0x78>
putch(OPTIBOOT_MAJVER);
7e74: 84 e0 ldi r24, 0x04 ; 4
7e76: 01 c0 rjmp .+2 ; 0x7e7a <main+0x7a>
} else {
/*
* GET PARAMETER returns a generic 0x03 reply for
* other parameters - enough to keep Avrdude happy
*/
putch(0x03);
7e78: 83 e0 ldi r24, 0x03 ; 3
7e7a: 8d d0 rcall .+282 ; 0x7f96 <putch>
7e7c: 89 c0 rjmp .+274 ; 0x7f90 <main+0x190>
}
Original comment by wes...@gmail.com
on 24 Jan 2012 at 4:58
With gcc 4.5.3. Note: TWO calls to putch():
/* Forever loop */
for (;;) {
/* get character from UART */
ch = getch();
7e60: ad d0 rcall .+346 ; 0x7fbc <getch>
if(ch == STK_GET_PARAMETER) {
7e62: 81 34 cpi r24, 0x41 ; 65
7e64: 89 f4 brne .+34 ; 0x7e88 <main+0x88>
unsigned char which = getch();
7e66: aa d0 rcall .+340 ; 0x7fbc <getch>
verifySpace();
7e68: 89 83 std Y+1, r24 ; 0x01
7e6a: ba d0 rcall .+372 ; 0x7fe0 <verifySpace>
if (which == 0x82) {
7e6c: 89 81 ldd r24, Y+1 ; 0x01
7e6e: 82 38 cpi r24, 0x82 ; 130
7e70: 19 f4 brne .+6 ; 0x7e78 <main+0x78>
/*
* Send optiboot version as "minor SW version"
*/
putch(OPTIBOOT_MINVER);
7e72: 84 e0 ldi r24, 0x04 ; 4
7e74: 9c d0 rcall .+312 ; 0x7fae <putch>
7e76: 98 c0 rjmp .+304 ; 0x7fa8 <main+0x1a8>
} else if (which == 0x81) {
7e78: 81 38 cpi r24, 0x81 ; 129
7e7a: 19 f4 brne .+6 ; 0x7e82 <main+0x82>
putch(OPTIBOOT_MAJVER);
7e7c: 84 e0 ldi r24, 0x04 ; 4
7e7e: 97 d0 rcall .+302 ; 0x7fae <putch>
7e80: 93 c0 rjmp .+294 ; 0x7fa8 <main+0x1a8>
} else {
/*
* GET PARAMETER returns a generic 0x03 reply for
* other parameters - enough to keep Avrdude happy
*/
putch(0x03);
7e82: 83 e0 ldi r24, 0x03 ; 3
7e84: 94 d0 rcall .+296 ; 0x7fae <putch>
7e86: 90 c0 rjmp .+288 ; 0x7fa8 <main+0x1a8>
}
}
Original comment by wes...@gmail.com
on 24 Jan 2012 at 5:00
Fixed by using attribute "OS_main" instead of "naked" for main()
http://code.google.com/p/optiboot/source/detail?r=3aaa971abb56d72e34e49ec7373303
57c465a797
Original comment by wes...@gmail.com
on 28 Jan 2012 at 4:52
Original issue reported on code.google.com by
wes...@gmail.com
on 24 Jan 2012 at 4:57