From 4f44d2893a506ee3924785c91a5f8983c013150c Mon Sep 17 00:00:00 2001 From: WestfW Date: Fri, 10 Jun 2011 16:17:13 -0700 Subject: This is a relatively significant edit that brings the Arduino copy of optiboot up-to-date with the optiboot source repository as of Jun-2011 (the last changes made in the optiboot repository were in Oct-2010) This adds support for several plaforms, fixes the "30k bug", and refactors the source to have separate stk500.h, boot.h, and pin_defs.h These are the arduino opticode issues fixed: http://code.google.com/p/arduino/issues/detail?id=380 optiboot has problems upload sketches bigger than 30 KB http://code.google.com/p/arduino/issues/detail?id=556 update optiboot to the point of the latest optiboot project sources. These are issues that had been solved in the optiboot source aready: http://code.google.com/p/arduino/issues/detail?id=364 optiboot leaves timer1 configured when starting app, breaks PWM on pin 9 and 10. (fixed with a workaround in arduino core.) aka http://code.google.com/p/optiboot/source/detail?r=c778fbe72df6ac13ef730c25283358c3c970f73e Support for ATmega8 and mega88. Fix fuse settings for mega168 _ISP targets Additional new platforms (mega, sanguino) http://code.google.com/p/optiboot/issues/detail?id=26 Set R1 to 0 (already in arduino code) http://code.google.com/p/optiboot/issues/detail?id=36&can=1 Fails to build correctly for mega88 After this commit, the only differences between the Arduino optiboot.c and the optiboot repository optiboot.c are cosmetic. --- bootloaders/optiboot/optiboot_atmega328.hex | 59 +++++++++++++++-------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'bootloaders/optiboot/optiboot_atmega328.hex') diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index e8aa31c..72108ee 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -1,33 +1,34 @@ -:107E0000112485E08093810082E08093C00088E1A6 -:107E10008093C10086E08093C20080E18093C4001B -:107E200084B714BE81FFD0D08DE0C8D0259A86E0FB +:107E0000112484B714BE81FFE6D085E08093810001 +:107E100082E08093C00088E18093C10086E0809377 +:107E2000C20080E18093C4008EE0CFD0259A86E026 :107E300020E33CEF91E0309385002093840096BBD3 :107E4000B09BFECF1D9AA8958150A9F7DD24D3944D -:107E5000A5E0EA2EF1E1FF2EA4D0813421F481E0E7 -:107E6000BED083E024C0823411F484E103C08534A1 -:107E700019F485E0B4D08AC08535A1F492D0082FDA -:107E800010E010930102009300028BD090E0982F35 -:107E90008827802B912B880F991F90930102809344 -:107EA000000273C0863529F484E099D080E071D057 -:107EB0006DC0843609F043C07CD0E0910002F0919F -:107EC000010283E080935700E895C0E0D1E069D0DB -:107ED0008993809102028150809302028823B9F72E -:107EE00078D007B600FCFDCF40910002509101020E -:107EF000A0E0B1E02C9130E011968C91119790E0C8 -:107F0000982F8827822B932B1296FA010C01D0927E -:107F10005700E89511244E5F5F4FF1E0A038BF078E -:107F200049F7E0910002F0910102E0925700E895D4 -:107F300007B600FCFDCFF0925700E89527C08437C4 -:107F4000B9F437D046D0E0910002F09101023196A9 -:107F5000F0930102E09300023197E4918E2F19D043 -:107F600080910202815080930202882361F70EC043 -:107F7000853739F42ED08EE10CD085E90AD08FE018 -:107F800096CF813511F488E019D023D080E101D05B -:107F900063CF982F8091C00085FFFCCF9093C600DF -:107FA0000895A8958091C00087FFFCCF8091C600FE -:107FB0000895F7DFF6DF80930202F3CFE0E6F0E00A -:107FC00098E190838083089580E0F8DFEE27FF2713 -:107FD0000994E7DF803209F0F7DF84E1DACF1F93FD -:0E7FE000182FDFDF1150E9F7F4DF1F9108952D +:107E5000A5E0EA2EF1E1FF2EABD0813421F481E0E0 +:107E6000C5D083E020C0823411F484E103C085349E +:107E700019F485E0BBD091C0853581F499D0082FE5 +:107E800010E096D090E0982F8827802B912B880FB8 +:107E9000991F90930102809300027EC0863529F4D9 +:107EA00084E0A4D080E07CD078C0843609F04EC055 +:107EB00087D0E0910002F091010280E7E030F807FE +:107EC00018F483E087BFE895C0E0D1E071D08993D2 +:107ED000809102028150809302028823B9F7E091D9 +:107EE0000002F091010280E7E030F80718F083E02B +:107EF00087BFE89575D007B600FCFDCF4091000222 +:107F000050910102A0E0B1E02C9130E011968C91EB +:107F1000119790E0982F8827822B932B1296FA01C5 +:107F20000C01D7BEE89511244E5F5F4FF1E0A038F9 +:107F3000BF0751F7E0910002F0910102E7BEE8951A +:107F400007B600FCFDCFF7BEE89527C08437B9F42B +:107F500037D046D0E0910002F09101023196F093C3 +:107F60000102E09300023197E4918E2F19D08091A5 +:107F70000202815080930202882361F70EC0853788 +:107F800039F42ED08EE10CD085E90AD08FE08BCF6A +:107F9000813511F488E019D023D080E101D05CCF85 +:107FA000982F8091C00085FFFCCF9093C600089564 +:107FB000A8958091C00087FFFCCF8091C6000895EE +:107FC000F7DFF6DF80930202F3CFE0E6F0E098E11E +:107FD00090838083089580E0F8DFEE27FF270994DF +:107FE000E7DF803209F0F7DF84E1DACF1F93182F43 +:0C7FF000DFDF1150E9F7F4DF1F91089566 :0400000300007E007B :00000001FF -- cgit v1.2.3-18-g5258 From 2a83ee55b38c81df04d7d3b83d6bf68ed72936e4 Mon Sep 17 00:00:00 2001 From: WestfW Date: Fri, 10 Jun 2011 17:47:47 -0700 Subject: Add a version number to the optiboot source and binary. http://code.google.com/p/arduino/issues/detail?id=554 end of flash memory where they can be read (at least in theory) by device programmers, hex-file examination, or application programs. This is done by putting the version number in a separate section (".version"), and using linker/objcopy magic to locate that section as appropriate for the target chip. (See http://lists.gnu.org/archive/html/avr-gcc-list/2011-02/msg00016.html for some discussion on the details.) Start the version at 4.1 (the last "packaged" version of optiboot was called version 3, so the "top of source" would be 4.0, and adding the version number makes 4.1) Refactor LDSECTION in the Makefile to LDSECTIONS so that multiple section start addresses can be defined. Change the _isp makefile definitions to make the bootloader section readable (but not writable) by the application section. (This would need to be done elsewhere as well to handle all bootloader programming techniques. Notably Arduino's boards.txt Note that this change does not change the "code" portion of optiboot at all. The only diffs in the .hex files are the added version word at the end of flash memory. --- bootloaders/optiboot/optiboot_atmega328.hex | 1 + 1 file changed, 1 insertion(+) (limited to 'bootloaders/optiboot/optiboot_atmega328.hex') diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index 72108ee..7286e0d 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -30,5 +30,6 @@ :107FD00090838083089580E0F8DFEE27FF270994DF :107FE000E7DF803209F0F7DF84E1DACF1F93182F43 :0C7FF000DFDF1150E9F7F4DF1F91089566 +:027FFE0001047C :0400000300007E007B :00000001FF -- cgit v1.2.3-18-g5258 From a78553bd13fb9cbb03b574b363c8f68a7289dc11 Mon Sep 17 00:00:00 2001 From: WestfW Date: Fri, 10 Jun 2011 23:02:25 -0700 Subject: Shrink code by using registers for variables "length" and "address" http://code.google.com/p/optiboot/issues/detail?id=33 Fix high-value watchdog timeouts on ATmega8 http://code.google.com/p/optiboot/issues/detail?id=38 Change "start app on bad commands" code to start the app via the watchdog timer, so that the app is always started with the chip in fully reset state. http://code.google.com/p/optiboot/issues/detail?id=37 --- bootloaders/optiboot/optiboot_atmega328.hex | 58 ++++++++++++++--------------- 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'bootloaders/optiboot/optiboot_atmega328.hex') diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index 7286e0d..11819d6 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -1,35 +1,33 @@ -:107E0000112484B714BE81FFE6D085E08093810001 +:107E0000112484B714BE81FFE3D085E08093810004 :107E100082E08093C00088E18093C10086E0809377 -:107E2000C20080E18093C4008EE0CFD0259A86E026 +:107E2000C20080E18093C4008EE0BCD0259A86E039 :107E300020E33CEF91E0309385002093840096BBD3 -:107E4000B09BFECF1D9AA8958150A9F7DD24D3944D -:107E5000A5E0EA2EF1E1FF2EABD0813421F481E0E0 -:107E6000C5D083E020C0823411F484E103C085349E -:107E700019F485E0BBD091C0853581F499D0082FE5 -:107E800010E096D090E0982F8827802B912B880FB8 -:107E9000991F90930102809300027EC0863529F4D9 -:107EA00084E0A4D080E07CD078C0843609F04EC055 -:107EB00087D0E0910002F091010280E7E030F807FE -:107EC00018F483E087BFE895C0E0D1E071D08993D2 -:107ED000809102028150809302028823B9F7E091D9 -:107EE0000002F091010280E7E030F80718F083E02B -:107EF00087BFE89575D007B600FCFDCF4091000222 -:107F000050910102A0E0B1E02C9130E011968C91EB -:107F1000119790E0982F8827822B932B1296FA01C5 -:107F20000C01D7BEE89511244E5F5F4FF1E0A038F9 -:107F3000BF0751F7E0910002F0910102E7BEE8951A -:107F400007B600FCFDCFF7BEE89527C08437B9F42B -:107F500037D046D0E0910002F09101023196F093C3 -:107F60000102E09300023197E4918E2F19D08091A5 -:107F70000202815080930202882361F70EC0853788 -:107F800039F42ED08EE10CD085E90AD08FE08BCF6A -:107F9000813511F488E019D023D080E101D05CCF85 -:107FA000982F8091C00085FFFCCF9093C600089564 -:107FB000A8958091C00087FFFCCF8091C6000895EE -:107FC000F7DFF6DF80930202F3CFE0E6F0E098E11E -:107FD00090838083089580E0F8DFEE27FF270994DF -:107FE000E7DF803209F0F7DF84E1DACF1F93182F43 -:0C7FF000DFDF1150E9F7F4DF1F91089566 +:107E4000B09BFECF1D9AA8958150A9F799249394D1 +:107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E +:107E6000AFD083E01FC0823411F484E103C08534B5 +:107E700019F485E0A5D083C0853579F48BD0E82E40 +:107E8000FF2488D0082F10E0102F00270E291F296B +:107E9000000F111F8DD0680172C0863529F484E06F +:107EA0008FD080E06FD06BC0843609F042C072D0B2 +:107EB00071D0082F6FD080E0C81680E7D80620F474 +:107EC00083E0F60187BFE895C0E0D1E063D08993F5 +:107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 +:107EE000F60187BFE89564D007B600FCFDCFA60178 +:107EF000A0E0B1E02C9130E011968C91119790E0C8 +:107F0000982F8827822B932B1296FA010C0197BE8B +:107F1000E89511244E5F5F4FF1E0A038BF0751F79D +:107F2000F601A7BEE89507B600FCFDCFB7BEE89501 +:107F300026C08437B1F42ED02DD0F82E2BD038D0D7 +:107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 +:107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 +:107F60000EC0853739F424D08EE10CD085E90AD0D3 +:107F70008FE098CF813511F488E014D019D080E1DA +:107F800001D06ACF982F8091C00085FFFCCF9093DD +:107F9000C6000895A8958091C00087FFFCCF80910E +:107FA000C6000895E0E6F0E098E1908380830895AC +:107FB000F1DF803219F088E0F5DFFFCF84E1E2CF16 +:107FC0001F93182FE7DF1150E9F7F2DF1F91089593 +:0A7FD00080E0E8DFEE27FF270994A8 :027FFE0001047C :0400000300007E007B :00000001FF -- cgit v1.2.3-18-g5258 From 738e5ca709769e6b42d0ae93285435aeaa459a56 Mon Sep 17 00:00:00 2001 From: WestfW Date: Sat, 11 Jun 2011 03:15:33 -0700 Subject: Fix errors in LDSECTIONS refactoring (found during atmega8 testing.) --- bootloaders/optiboot/optiboot_atmega328.hex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bootloaders/optiboot/optiboot_atmega328.hex') diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index 11819d6..10dcd6c 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -28,6 +28,6 @@ :107FB000F1DF803219F088E0F5DFFFCF84E1E2CF16 :107FC0001F93182FE7DF1150E9F7F2DF1F91089593 :0A7FD00080E0E8DFEE27FF270994A8 -:027FFE0001047C +:027FFE0002047B :0400000300007E007B :00000001FF -- cgit v1.2.3-18-g5258 From a0d00b4d86cfbd5cb508eda69997175fab39e725 Mon Sep 17 00:00:00 2001 From: WestfW Date: Mon, 13 Jun 2011 19:07:07 -0700 Subject: http://code.google.com/p/arduino/issues/detail?id=368 Optiboot does not support ArduinoasISP programmer. When avrdude runs and talks to an arduino running ArduinoISP, it needs the optiboot (entered due to auto-reset) to abort and start the ArduinoISP "application" when it sees communications at the wrong serial speed. Unfortunately, optiboot treats all unrecognized command characters as "no-ops" and responds/loops for more commands, leading to a nice loop that never gets to the sketch. This patch causes characters received with Framing errors (the most likely error for speed mis-matches) to NOT reset the watchdog timer (normally done in getch()), which will cause the application to start if it continues for "a while." (tested. Works! Running ArduinoISP at speeds as high as 57600 still causes the bootloader to start the sketch (although it fails later on for other reasons.)) --- bootloaders/optiboot/optiboot_atmega328.hex | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'bootloaders/optiboot/optiboot_atmega328.hex') diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index 10dcd6c..f147e81 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -1,33 +1,34 @@ -:107E0000112484B714BE81FFE3D085E08093810004 +:107E0000112484B714BE81FFE7D085E08093810000 :107E100082E08093C00088E18093C10086E0809377 -:107E2000C20080E18093C4008EE0BCD0259A86E039 +:107E2000C20080E18093C4008EE0C0D0259A86E035 :107E300020E33CEF91E0309385002093840096BBD3 :107E4000B09BFECF1D9AA8958150A9F799249394D1 :107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E -:107E6000AFD083E01FC0823411F484E103C08534B5 -:107E700019F485E0A5D083C0853579F48BD0E82E40 +:107E6000B3D083E01FC0823411F484E103C08534B1 +:107E700019F485E0A9D083C0853579F48BD0E82E3C :107E8000FF2488D0082F10E0102F00270E291F296B -:107E9000000F111F8DD0680172C0863529F484E06F -:107EA0008FD080E06FD06BC0843609F042C072D0B2 +:107E9000000F111F91D0680172C0863529F484E06B +:107EA00093D080E06FD06BC0843609F042C072D0AE :107EB00071D0082F6FD080E0C81680E7D80620F474 :107EC00083E0F60187BFE895C0E0D1E063D08993F5 :107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 -:107EE000F60187BFE89564D007B600FCFDCFA60178 +:107EE000F60187BFE89568D007B600FCFDCFA60174 :107EF000A0E0B1E02C9130E011968C91119790E0C8 :107F0000982F8827822B932B1296FA010C0197BE8B :107F1000E89511244E5F5F4FF1E0A038BF0751F79D :107F2000F601A7BEE89507B600FCFDCFB7BEE89501 -:107F300026C08437B1F42ED02DD0F82E2BD038D0D7 +:107F300026C08437B1F42ED02DD0F82E2BD03CD0D3 :107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 :107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 -:107F60000EC0853739F424D08EE10CD085E90AD0D3 -:107F70008FE098CF813511F488E014D019D080E1DA +:107F60000EC0853739F428D08EE10CD085E90AD0CF +:107F70008FE098CF813511F488E018D01DD080E1D2 :107F800001D06ACF982F8091C00085FFFCCF9093DD -:107F9000C6000895A8958091C00087FFFCCF80910E -:107FA000C6000895E0E6F0E098E1908380830895AC -:107FB000F1DF803219F088E0F5DFFFCF84E1E2CF16 -:107FC0001F93182FE7DF1150E9F7F2DF1F91089593 -:0A7FD00080E0E8DFEE27FF270994A8 -:027FFE0002047B +:107F9000C60008958091C00087FFFCCF8091C0008B +:107FA00084FD01C0A8958091C6000895E0E6F0E048 +:107FB00098E1908380830895EDDF803219F088E0A6 +:107FC000F5DFFFCF84E1DECF1F93182FE3DF1150E1 +:107FD000E9F7F2DF1F91089580E0E8DFEE27FF2741 +:027FE000099402 +:027FFE0003047A :0400000300007E007B :00000001FF -- cgit v1.2.3-18-g5258 From 1f01799bbfd17eb04ec6322a123d6d26b21b09a0 Mon Sep 17 00:00:00 2001 From: WestfW Date: Tue, 14 Jun 2011 10:24:27 -0700 Subject: Allow the READ PARAMETER command to return our version number. (significant size impact: 14 bytes!) Initialized "address" to eliminate compiler warning (4 bytes!) Add "atmega168" as a more accurate target name than "diecimila" (keep diecimila as well for backward compatibility) Reduce the .hex and .lst targets that are stored in source control to the three basics: atmega8, atmega168, atmega328. The other targets remain in the makefile and makeall, but will need to be built from source if wanted. Which should be less of a problem now that the source is buildable without installing crosspack. --- bootloaders/optiboot/optiboot_atmega328.hex | 61 +++++++++++++++-------------- 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'bootloaders/optiboot/optiboot_atmega328.hex') diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index f147e81..a219f08 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -1,34 +1,35 @@ -:107E0000112484B714BE81FFE7D085E08093810000 +:107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 -:107E2000C20080E18093C4008EE0C0D0259A86E035 +:107E2000C20080E18093C4008EE0C9D0259A86E02C :107E300020E33CEF91E0309385002093840096BBD3 -:107E4000B09BFECF1D9AA8958150A9F799249394D1 -:107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E -:107E6000B3D083E01FC0823411F484E103C08534B1 -:107E700019F485E0A9D083C0853579F48BD0E82E3C -:107E8000FF2488D0082F10E0102F00270E291F296B -:107E9000000F111F91D0680172C0863529F484E06B -:107EA00093D080E06FD06BC0843609F042C072D0AE -:107EB00071D0082F6FD080E0C81680E7D80620F474 -:107EC00083E0F60187BFE895C0E0D1E063D08993F5 -:107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 -:107EE000F60187BFE89568D007B600FCFDCFA60174 -:107EF000A0E0B1E02C9130E011968C91119790E0C8 -:107F0000982F8827822B932B1296FA010C0197BE8B -:107F1000E89511244E5F5F4FF1E0A038BF0751F79D -:107F2000F601A7BEE89507B600FCFDCFB7BEE89501 -:107F300026C08437B1F42ED02DD0F82E2BD03CD0D3 -:107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 -:107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 -:107F60000EC0853739F428D08EE10CD085E90AD0CF -:107F70008FE098CF813511F488E018D01DD080E1D2 -:107F800001D06ACF982F8091C00085FFFCCF9093DD -:107F9000C60008958091C00087FFFCCF8091C0008B -:107FA00084FD01C0A8958091C6000895E0E6F0E048 -:107FB00098E1908380830895EDDF803219F088E0A6 -:107FC000F5DFFFCF84E1DECF1F93182FE3DF1150E1 -:107FD000E9F7F2DF1F91089580E0E8DFEE27FF2741 -:027FE000099402 -:027FFE0003047A +:107E4000B09BFECF1D9AA8958150A9F7CC24DD24C4 +:107E500088248394B5E0AB2EA1E19A2EF3E0BF2EE7 +:107E6000A2D0813461F49FD0082FAFD0023811F036 +:107E7000013811F484E001C083E08DD089C08234E0 +:107E800011F484E103C0853419F485E0A6D080C0E4 +:107E9000853579F488D0E82EFF2485D0082F10E0AE +:107EA000102F00270E291F29000F111F8ED06801E7 +:107EB0006FC0863521F484E090D080E0DECF843638 +:107EC00009F040C070D06FD0082F6DD080E0C81688 +:107ED00080E7D80618F4F601B7BEE895C0E0D1E017 +:107EE00062D089930C17E1F7F0E0CF16F0E7DF06D8 +:107EF00018F0F601B7BEE89568D007B600FCFDCFD4 +:107F0000A601A0E0B1E02C9130E011968C91119780 +:107F100090E0982F8827822B932B1296FA010C0160 +:107F200087BEE89511244E5F5F4FF1E0A038BF0790 +:107F300051F7F601A7BEE89507B600FCFDCF97BE46 +:107F4000E89526C08437B1F42ED02DD0F82E2BD052 +:107F50003CD0F601EF2C8F010F5F1F4F84911BD097 +:107F6000EA94F801C1F70894C11CD11CFA94CF0C13 +:107F7000D11C0EC0853739F428D08EE10CD085E9AC +:107F80000AD08FE07ACF813511F488E018D01DD067 +:107F900080E101D065CF982F8091C00085FFFCCF94 +:107FA0009093C60008958091C00087FFFCCF809118 +:107FB000C00084FD01C0A8958091C6000895E0E648 +:107FC000F0E098E1908380830895EDDF803219F02E +:107FD00088E0F5DFFFCF84E1DECF1F93182FE3DFCA +:107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6 +:047FF000FF270994CA +:027FFE00040479 :0400000300007E007B :00000001FF -- cgit v1.2.3-18-g5258