-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could you ask for inclusion of this bootloader in official Boards Manager? #1
Comments
Very good idea! I would love to see this. Are you willing to do it? |
Oooh, sorry, I haven't such technical skills. But I know this other project https://github.com/NicoHood/HoodLoader2 which has achieved this (it's a custom bootloader designed to be loaded in UNO's Atmega16U2 to convert it into a Leonardo-like board). Its author is @NicoHood |
An example can be found here: @per1234 helped me with the packaging of the files: You can ask him for help too i guess. |
Actually this is the specification for adding Boards Manager support: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.6.x-package_index.json-format-specification This may also provide some useful information on potential locations for the necessary files: http://playground.arduino.cc/Main/BoardsManagerSupport I have helped add Boards Manager installation support to 8 projects now and am willing to provide assistance for this one also. The bootloader files and boards.txt for all boards that you want to support will need to be made and tested before doing the Boards Manager work. |
Oh hi @per1234 you helped me here maniacbug/mighty-1284p#14 I don't really understand the process of adding boards. Adding a board would more be like for example adding 1284p support like in Ok, now for Bootloaders I assume we need a seperate Board for every Bootloader? Or can we have multiple Bootloaders for a given board? I have only limited knowledge of Arduino packaging ... if you coulld tell me what exactly you need, it would be easier for me. I guess we will need a hex file for every board.
+FUSES Keep in mind that we need 4k and after the bootloader is installed flashing via Serial does not work anymore. (We still have 500 bytes left so serial support should be quite feasible however...) |
It's just adding a new entry to the Tools > Board menu in the Arduino IDE. That could mean adding support for a new MCU as the Mighty 1284P project did. A different configuration of hardware already supported by the Arduino IDE. Or a different bootloader such as your project. I have even used it to add a new programmer to the Tools > Programmers menu. Boards Manager makes it easy for people to install hardware files to the Arduino IDE and keep them updated simply by adding a URL to File > Preferences > Additional Boards Manager URLs. Arduino IDE 1.6.6 has added a notification when a new version of any package installed with Boards Manager is available so the users will be able to immediately update with just a click.
You can have multiple bootloader for each board but there are some limitations. Each selection in the Tools > Board menu can have other custom menus. So for example the Board entry could be ATmega328P and then there could be a custom menu for So at a minimum we need a 16MHz bootloader file for each MCU that will be supported. If you want to have LED and UART options then there would need to be 4 bootloader files for each MCU to support all possible combinations of the 2 options. If you want to offer 20MHz clock option then that would require another bootloader(or 4) for each MCU. I'm willing to make the bootloaders but I may not be able to test all options so I might need help there. Other than that you will need to decide:
So let me know if you have any questions. Once you have made the decision of how you want this implemented I'm happy to take over and submit pull requests or just provide assistance. I'm also willing to be in charge of adding new versions to the JSON file as they are released. Just let me know what you want me to do. |
I think it is too complicated to provide options for LED (needs configuration of two pins) and UART (needs the divider for the baud rate). I pretty much would like to let you decide on all the other details. Avr_boot is not really "my work". I only adapted existing ideas to get my project up and running. I dont need credits and am happy already, if others can save some time. So please fork and I am happy to pull all your requests. If you wish branches we can have branches. So just go ahead and use everything. If you want my help, tell me, what I should do. |
I'd like to add support for:
And clock options:
Do you think the avr_boot will work for all of those without modification? It sounds like you would like this functionality to be as low-maintenance as possible on your part so I think I will just put all the Boards Manager files in the gh-pages branch. That way you will only need to accept one pull request for each release.. So go ahead and create the gh-pages branch when you get a chance as I can't do that via pull request. |
I know of no reason why it shouldn work. Perfekt. gh-pages branch is set up! |
I'm going to add instructions for installation and use with the Arduino IDE. Do you want me to add these to the README.md in the master branch or should I put it in the gh-pages branch? |
What do you think about having the instructions on the gh-pages branch and I will add a prominent Link in top of my README.md ? |
I'm making the bootloader files and I ran into a couple of snags. The first is that the bootloader sizes are larger for me than you state in the documentation. Here's the avr-size output:
So ATmega1284P and ATmega328P are still fine but the ATmega32U4 is too big to fit in the max section of 4096 bytes. I'm using make.exe from WinAVR-20100110 which is the most recent version I have found and everything else from the Arduino 1.6.6 installation. This is with USE_LED = 0 and USE_UART = 0. My makefile is here: https://github.com/per1234/avr_boot/blob/dev/Makefile I had to add some stuff to make it work with the Windows paths. So worst case scenario I just won't add ATmega32U4 but it's strange to me that the size is so different. The second issue I'm running into is when I try to make the ATmega2560 bootloader files I get some errors:
Any ideas? |
WinAVR is just OLD. Use a recent avr-gcc and the size will be probably a lot smaller. Edit: just downloaded the default master package and hit make without modifications. Got the following error:
|
@NicoHood I'm only using make.exe from WinAVR. I installed avr-gcc 5.1.0 from that link and the sizes are the same as before and the same error on the ATmega2560 compile. I also tried using the make.exe from Arduino IDE 1.0.6 which I believe is the last one that came with that file and I get the same results on both issues. |
I just compiled it as I am used to do it on linux debian (had to do sudo apt-get install avr-libc gcc-avr ) I cloned your fork and I got the same error! I saw that make clean is not deleting *.o in pff and uart dirs (wrong usage of rm -rf) As I deleted them manually I get the same error as well. I will look into it this evening ... |
ok - I don't know why we have issues compiling it... I made some changes
@NicoHood the error only indicates, that the build is too large |
Ok, I have realized my attempt at a makefile is causing problems so I've gone back to as close to the original as will work with windows. All except the ATmega32U4 is working for me now with the new version of avr_boot. @zevero have you tried the making it for ATmega32U4?
I get:
Sizes are now:
1284p:
2560:
That's right they are all larger with the newer version of avr-gcc |
As a quickfix, you can just comment out uart.c in Makefile line 12. On atmega32u4 Serial is on 1 instead of 0 in uart.c from line 7 to 17 But maybe you know some switch, that I can just can leave out uart.c in Makefile line 12 if USE_UART = 0 ? |
If I do:
It works but for some reason if I do:
It doesn't work. Do you think the first one is a good solution to the issue? |
it works without the # Comment
I pushed a new commit |
Does asmfunc.S have to be modified for each different MCU? It looks like it's only set up for ATmega1284P right now. |
oh you are right!
it does not work with strings... do you have an idea? Can we use some standard ATMEGA_1284p ? Else I would convert the MCU_TARGET to a number and we need to use the number in the Makefile? |
You can do:
|
Thanks! |
Progress report: I've added support for using the SD on the Ethernet Shield and Arduino Ethernet(which uses pin 4 for CS instead of SS as on the SD Shield). Pin 4 is different depending on which ATmega1284P board is being used which I have also accounted for. I just need to test a bunch of different board configurations now and then I'll submit the pull request for that change to |
Everything is working well for me except for ATmega2560. @zevero if you have one would you please try it out and see if it works for you? My boards.txt file, etc. is here: https://github.com/per1234/avr_boot/tree/boards-manager-install. The CS pin situation with the SD shields is really a mess: I'm wondering if using a pin other than SS for SD CS will cause reliability problems. Does SS still need to be set in the bootloader code so the MCU won't go into slave mode? I haven't had any problems in my testing. What do you think? |
I am impressed and looking forward to pull! I happen to have a MEGA2560 board and I can test it ... what doesnt work for you? Unfortunately I do not have answers to the other questions. I have only experience with Atmega328p, Atmega644 and Atmega1284p. And I always used standard pins for sd cards. |
With the ATmega2560 the bootloader compiles fine. Burn Bootloader is successful. But the code from the SD card never runs. I haven't been able to make USE_UART or USE_LED work properly with ATmega328P which works fine without those options enabled. When I enable either of those options AVR_BOOT is shown in the serial monitor or the LEDs blink but the file on the SD card is never uploaded so they aren't providing me any useful diagnostics as to why the ATmega2560 isn't working. I think bootloaders have to handle ATmega2560 differently because of the larger memory size. |
I should add that I am using your makefile with only the optiboot build environment code added, SD CS connected to SS, and your current asmfunc.S when troubleshooting to eliminate as many possible complications as I can. |
hm ... debug options are not working on Atmega328p? Atmega2560 has 256 kbytes and Atmega1284p 128kB there should not be any difference ... (only when passing 64kBytes we need to take the far pgm_space variants) |
I managed to get the ATmega2560 to load a program from the SD card but it's far from ideal. I discovered the program will run under these circumstances:
After the program has been loaded from the SD no other programs will load from the SD card until the bootloader is burned again. If I change any of the above conditions it doesn't work. With all of these conditions it works consistently. I have no idea what this means, it's a bit more advanced than my current skill level. Worst case scenario I can just not add support for ATmega2560 as all the other MCUs work fine in all my tests without having to jump through any of these hoops. |
I think, its better to postpone support for ATmega2560. Momentarily my schedules are too tight for me to contribute. Perhaps later or maybe somebody will help us. |
Ok, understood. @q2dg can you test avr_boot with ATmega2560 and see if it works for you? |
Oooh, sorry! I haven't any board of this kind :-/ |
I'll go ahead with just the other 3 MCUs then. |
Thumbs up! |
I noticed that F_CPU is only used for the dly_100us function so I tested all supported configurations with F_CPU=20000000 with no problems. This will cause the delay to be longer than expected for clock speeds less than 20MHz(especially 8MHz) but even with a 64KB program at 8MHz I don't find a measurable difference in the time it takes for the program to load from the SD card. Using a single F_CPU setting for all boards will make the avr_boot section of the Board menu much smaller which is a real advantage for people who have lots of 3rd party boards installed as well as making the boards.txt file simpler and therefor less prone to errors. So unless anyone has a compelling reason not to do this I will use F_CPU=20000000 for all clock speeds of the avr_boot boards installed via Boards Manager. |
What a coincidence! Today I wondered, that my 16 Mhz Bootloader works with an 8Mhz Board without issues ;) |
Well I don't understand fully the inner working of this bootloader but F_CPU is used only in this line of asmfunc.S: |
ok. I add a comment in makefile! Thanks for your hint! It makes my situation easier as well! |
I released avr_boot to be v1.1.0 just now. Is that ok for you? |
Thanks, my PR is coming soon. |
@zevero should I move the information on adding ATmega2560 support to a new issue and then we can close this issue? Maybe you could add a "help wanted" tag to it and hopefully some bootloader wizard will come along to figure it out. @q2dg the Boards Manager URL for avr_boot is: https://zevero.github.io/avr_boot/package_zevero_avr_boot_index.json please let me know if you find any problems or have any suggestions. If you find others who need help with adding Boards Manager support to their projects feel free to give me a mention and I'll see what I can do. |
@q2dg I forgot to mention if you're using Arduino IDE 1.6.6 then you may need to open Boards Manager twice after adding the Boards Manager URL before the avr_boot entry will show because of this issue: arduino/Arduino#3795. |
Updated Readme with a link to Boards Manager installation instructions. I thank you so much for all the time and effort that you put into my little project! |
You're welcome. I hope it is slightly improved and more accessible as a result. If you want me to continue to update the installation files on each release I'm happy to do so. |
Yes please. It is a pleasure working with you! |
Ok will do. I'm following this repository so I should be automatically notified of any new release but feel free to give me a mention here if I miss one. |
@per1234 It's perfect!! Thanks a lot!!! Only a silly thing: in Readme instructions it is said: "...and then reopen it before the Ariadne Bootloader entry will appear." Copy/paste is the new evil :-) |
Glad to hear and thanks for spotting the typo. I'll fix that. |
This would give a lot more of visibility to your fantastic project and, moreover, it should make installation of avr_boot a lot easier...as only selecting the target "board" in the menu, the menu option "Burn bootloader" should do the rest.
See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
Thanks
The text was updated successfully, but these errors were encountered: