bootloader needs more universal way to create 'boot' flashable image
bombasticbob opened this issue · 5 comments
currently the 'boot' flash image must be made to start at offset 0, rather than 'whatever it normally is', in order to flash the boot section. This must also be done with an external programmer. It is a bit of a problem in that the output from the compiler starts the address at whatever the boot address normally is. Since NVRAM is contiguous like that, it's necessary to alter the '.hex' file accordingly.
The existing bootloader for the 64d4 simply edits the file and removes the starting offset. Conveniently the 16-bit address will begin at 0.
For the 32d4, 32e5, etc and others, it's not so simple. The offset for a 32k NVRAM will be 8000H. Currently there is a simple program associated with the 32e5 that does this editing correctly (it has not yet been checked in). A more universal program could edit any hex file properly, removing the starting offset, and changing the 16-bit start address to '0000H'. Since this program is currently built by 'Makefile' as a utility when you build the flash image, it can still be customized as needed for each CPU type's requirements as a non-universal utility.
however, a universal utility would be more robust and flexible.
it's worth pointing out that avrstudio will flash the entire image, not just the 'boot' sector, using the unmodified hex file output by the compiler. The problem may have to do with how avrdude handles it, and not how the device responds to an attempt to flash all of NVRAM. That being the case, the 'universal' utility could accomodate this and generate both image AND boot files from whatever is provided to it.
Hi Bob..
I have been following all your postings an d I get an e-mail for each of them.
This is more complicated then I first thought and I am drinking through the proverbial “fire hose” trying to come up-to-speed on Github, Atmel Studio 6.2, and the internals of the Arduino IDE.
I have read through all of the Xmega128-a1u datasheet and Manual and compared it to the 2560 and the Arduino Mega2560 board.
The x128 development board is now working with the Atmel Studio (able to modify and download code).
Would you be open for a phone call to help me come up to speed faster on the build process you are using and syncing with github?
If so.. You name the day and time..
It seems that you are using GCC under Linux directly instead of the Atmel Studio for Windows.
Should I setup a Linux VM for the Xmega work? Any recommendations on which distro and version?
Also, I did not see any invitation to the github repo from you.
Later.. Mike..
From: Bob Frazier [mailto:notifications@github.com]
Sent: Saturday, October 11, 2014 4:13 AM
To: XMegaForArduino/arduino
Subject: Re: [arduino] bootloader needs more universal way to create 'boot' flashable image (#6)
it's worth pointing out that avrstudio will flash the entire image, not just the 'boot' sector, using the unmodified hex file output by the compiler. The problem may have to do with how avrdude handles it, and not how the device responds to an attempt to flash all of NVRAM. That being the case, the 'universal' utility could accomodate this and generate both image AND boot files from whatever is provided to it.
—
Reply to this email directly or view it on GitHub #6 (comment) . https://github.com/notifications/beacon/9028226__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyODYzNzk1MSwiZGF0YSI6eyJpZCI6NDU1MDkyMzh9fQ==--a5468febc699741ba613e963369aed4e4dc8c730.gif
ah, excellent, you're able to post issues. I wasn't sure it would work without being a member. This is actually a good thing because then any registered user can participate.
For the 128A1 you should be able to use the windows arduino IDE, with the exception of building a bootloader [which may only work properly in linux or BSD or on a mac]. But if you have cygwin installed, it may work as long as you have the right compilers and tools in your path. Setting this up may be complicated, though. It's easier to use a unix-like OS.
Putting linux in a VM is a good idea as long as you can map the serial port or USB port. I would recommend the latest Ubuntu or Debian, or Mint [your preference]. I would prefer 'Mint' though I haven't done a package for the 64d4 compiler updates. you won't need them for the A1. Mint lets you install 'Mate' desktop out of the box, and Cinammon is lightweight and very windows-like.
I fixed the invite, by the way. you should get the e-mail now.
FYI I use FreeBSD for most of my development, and Linux (in a VM) for customer-related development. The VM lets me back it up easily. I use VirtualBox for the VM environment [it runs on anything, pretty much].
The bootloaders/xmega directory now contains the 'universal' bootloader. It supports both 'arduino' and 'wiring' protocols. by default, the wiring protocol is used when the flash image is >64k, and arduino when it is <= 64k. the wiring protocol still needs further testing, but appears (so far) to work as expected.
The xmega128a1 sub-directory has been converted to use the new protocol.
the avrdude.conf file still needs to be modified to support 'wiring' for several processors. An updated patch file will need to be created to complete the necessary support. 'wiring' protocol needs several new entries (see the entry for the mega2560 for an example) to support stk500v2 requirements. They are not that difficult to make, but their absence prevents the protocol from working. Unfortunately there are existing sections (not just new ones that I add) for several xmega processors without these entries in them. So if the avrdude.conf file is "too different" the patch file won't work properly. It may be necessary to use another method to patch it (or multiple patch files) if the changes are too significant.
universal bootloader checked in, enabled for 64d4 and 128a1[u] targets.