The network installer lets you install Ubuntu over a network. Because it does not meet the minimum requirements for the live CD/DVD, or because the computer. To talk to it, you can use Atmel's closed-source 'flip' and 'batchisp3' tools, which are awful, or the free. Dfu-programmer is an open-source program to talk to the USB DFU boot loader. It is included in Debian and Ubuntu, for which the installation step is (as root). Tar xfz mizar32-firmware-*.tgz cd mizar32-firmware-*.
This is a brief outline of the steps taken to get sample code from the Atmel ASF for the “SAME70 Xplained Pro” built and flashed to the board from Ubuntu 14.04. Much of this guide is built around insights from http://jjmilburn.github.io/2014/09/18/Atmel-SAMD20-EclipseCDT/
Prerequisite Hardware
Software Installation
- Eclipse CDT this is an Eclipse IDE tailored to C/C++ development. This guide was written for Eclipse Kepler, install this first.
- GNU Tools for Embedded Processors this is a toolchain that has worked on Cortex M0/M0+ processors. This guide is tested using version 2014-q2.
- Atmel makes the “Atmel Software Framework”, available which provides plenty of actual code to begin working on the SAME70 board. Download this file; its large (200MB). This guide was written for version 3.19.0 (“xdk-asf-3.19.0”).
- OpenOCD 0.10.0 is used to actually connect to the board.
Execute the following:
Now, make sure that your sources.list file contains ‘deb-src’ entries. If it doesn’t, copy the existing ‘deb’ entries for Ubuntu repositories, and create an identical line for each of them, with ‘deb’ replaced by ‘deb-src’. For example, here is my sources.list file:
Now, obtain the OpenOCD source code, and build it:
Download openocd from Sourceforge and extract it.
The output at this point (after ./configure) should look like the following image. Specifically, note that CMSIS-DAP support is present:
Then run:
At this point, you can try to launch OpenOCD to ensure that the install completed succesfully. If an error along the lines of “error while loading shared libraries: libhidapi-hidraw.so.0” occurs, just run the following and retry:
Now, copy the udev rules for OpenOCD to the appropriate location, so that the atmel_same70_xplained board is properly identified when plugged into USB:
Now, if you plug in “atmel_same70_xplained” via USB, and run the following command:
The following (or similar) output should result:
This indicates that OpenOCD is successfully connected to the board; more specifically, to the debugger chip located on the backside of the board (note the microcontroller closer to the USB port). The “Interface Initialised (SWD)” indicates that the debugger is connected to the MCU.
- Note: it may be possible to use this onboard debugger to connect to other same70 MCUs external to the development board by connecting to the external header pins for SWD.
At this point, if you receive an error indicating “unable to open CMSIS-DAP device”, try a different USB port (or try unplugging other USB devices).Also, confirm that ‘Atmel Corp.’ appears in lsusb when the board is plugged in.
Importing ASF Example into Eclipse
- Launch Eclipse CDT, and navigate to “File->Import”. Select “Existing Projects into Workspace” from “General”.
- From here, navigate to the directory where you downloaded/unzipped the ASF; for me, its called “xdk-asf-3.19.0”
- Navigate to the LED Toggle example project for SAME70 Xplained, which is found at: xdf-asf-3.19.0/sam/applications/led_toggle/same70_xplained_pro/gcc
- Click “Copy Projects into Workspace”, and click Finish.
At this point, the project should be in your workspace, and a directory structure something like the following image, without the binaries is likely what shows up in the project tree:
Note that “config.mk” and “Makefile” are both here, these are important.
If you try to build this, you will likely encounter errors – the pathing for the Makefile doesn’t expect the example to be located in your workspace, so a few files have to change to accommodate this.
![Ubuntu live cd root password Ubuntu live cd root password](/uploads/1/2/5/7/125793374/794419892.png)
Open the Makefile (which is now in your workspace, in the imported project), and notice the following line:
We will need to change this to point to where the “xdk-asf-3.19.0” directory is located. An easy solution (probably not best practices for project structure, but it will work) is to copy the xdk-asf-3.19.0 directory into the project directory, and make the following change in the Makefile:
Next, open “config.mk” in the project directory, and find the following section:
Change this section to the correct path, as here:
Next, right click on the project, and go to properties. From the C/C++ Build section, under “Builder Settings”, uncheck “Use Default Build Command”, and type “make -f Makefile” instead, as in the following image:
Now, apply the change, refresh the project, and attempt to build. With any luck, you’ll end up with a successful build, producing .elf and .hex files that can then be used to program the board.
Installing Program to SAME70 Xplained Pro
We’ll use gdb for this step, so run the following:
Open a terminal, get OpenOCD up and running as in the previous step, and connect to the board. Ensure that the below line appears:
Next, open another terminal, and navigate to the Eclipse workspace where your project resides. Navigate to where the generated files are (look for the .bin and .elf files) and type the following in the terminal
This will cause some additional lines of output to appear in your OpenOCD window; this is expected. See the below:
Next, in gdb, type the following:
Now, pressing the SW0 button (not the reset button) on the SAME70 Xplained Pro dev board will light LED0.
Next Steps
To experiment, look at the “config.mk” file, and see where the source files are being pulled from – to build your own files, just modify these entires in config.mk, and have at it.
Advertisements
< Hempl
- 1Flashing firmware images
- 1.1With the USB DFU bootloader
- 1.1.1Using dfu-programmer
- 1.1.2Using batchisp3
- 1.1With the USB DFU bootloader
There are several ways to write new firmware images to the Mizar32:
With the USB DFU bootloader[edit]
The first 8KB of the Mizar32 flash memory comes pre-programmed with Atmel's USB DFU boot loader, which is able to write to the rest of the flash memory. To talk to it, you can use Atmel's closed-source 'flip' and 'batchisp3' tools, which are awful, or the free and open-source 'dfu-programmer' which is OK.
Using dfu-programmer[edit]
dfu-programmer
is an open-source program to talk to the USB DFU boot loader. It is included in Debian and Ubuntu, for which the installation step is (as root):Fetch the firmware:
Now
- Connect the Mizar32 to your PC with a USB cable
- Power the Mizar32 on (or press its reset button) while holding the user button (SW2) depressed
- On the PC, issue the commands:
If you have the Mizar32 model A:
For the Mizar32 model B:
For the Mizar32 model C:
If it says
dfu-programmer: no device present.
, try running it as root. If so, and you want anyone to be able to run it, you can go, as root:though this opens a security hole so, if you may have malicious users logged into your system, it might be better to add yourself to group '
admin
' in /etc/group
and go:Note that the Debian/Ubuntu program 'dfutool', included in the 'bluez' package, is something completely different.
Bugs in old versions of dfu-programmer[edit]
There is a bug in dfu-programmer v0.5.1 which very occasionally misprograms the flash. The symptom is
The bug is fixed in dfu-programmer-0.5.2 and later.
As if that weren't enough, the Mizar32A carries the automotive-quality ultra-robust version of the AT32UC3A chip with 512KB of flash memory, which takes a few seconds longer to erase its flash memory than dfu-programmer expects (about 14 seconds instead of 10).
This is fixed in dfu-programmer-0.5.5 and later but Debian and Ubuntu still have 0.5.4. You can check the version of your installed
dfu-programmer
by saying![Linux Linux](http://i1-news.softpedia-static.com/images/news2/Fedora-16-Screenshot-Tour-24.jpg)
and you can install a more recent version by compiling from source:
Further reading[edit]
- The Atmel USB DFU Programmer project at sourceforge
Using batchisp3[edit]
Atmel publishes closed-source programs to talk to the USB DFU boot loader: the graphical 'flip' and the command-line 'batchisp3'. They are both of poor quality and only the second one is currently usable with AT32UC3 parts.
Note that the Debian/Ubuntu package 'flip' is something completely different.
Installation on Ubuntu (as root) is (adapted from eLua's AVR32 platform info):
(on Red Hat systems, the
USB_DEVFS_PATH
runes should be omitted).To get
flip
to work at all, you have to cd /usr/local/flip.3.2.1/bin
first, and it doesn't yet support AT32UC3 parts so we can only use the command-line batchisp3
program:- Connect the Mizar32 to your PC with a USB cable
- Power the Mizar32 on (or press its reset button) while holding the user button (SW2) depressed.
- On the PC, issue the command
Note that you have to explicitly give the full pathname of the firmware file (the
$PWD/
trick here). Otherwise it looks for the firmware file in /usr/local/flip.3.2.1/bin/
.Further reading
- The Atmel USB DFU Bootloader Datasheet
- The FLIP home page
Using Batchisp under Windows Vista/7 32bit[edit]
- Download the latest version of Flip for Windows from Atmel's web site (
BATCHISP.EXE
is inside the Flip installer) and follow the instructions for installation. At the moment, only Batchisp supports AT32UC3A microprocessors while Flip does not support its yet, so you must install Flip but can't use it.
- Activate the DFU Bootloader: connect the Mizar32 to your PC with a USB cable, connect the power plug and press and hold the reset button while holding the user button (SW2), then release the reset button, then release the user button.
- Go to the Windows Control Panel, right-click on Computer → Properties → Device Manager → right-click on 'AT32UC3A DFU' → Update Driver Software → 'Browse my computer for driver software' and select the path Flipusb (here, it's
c:Program Files (x86)AtmelFlip 3.4.3usb
) and click OK. Now Windows tells you 'Windows can't verify the publisher of this driver software' click on 'Install this software anyway'. Now your Mizar32 driver for Batchisp is installed.
- Open your Windows Command Processor: Start → type 'cmd' in 'Search command and file' → Right-click on cmd.exe → Start as Administrator. Type 'PATH' followed by entire path of your Batchisp.exe directory; on our machine the command is:
- Restart Windows. Now Windows is able to find the
Batchisp.exe
program
- Download [1] and decompress this file in some directory. Run your Windows Command Processor: Start → type 'cmd' in 'Search command and file' → Right-click on cmd.exe → Start as Administrator. Type the following command (this command is case sensitive):
where:
at32uc3aXXXX
is your Atmel device that can be:at32uc3a0128
,at32uc3a0256
orat32uc3a0512
.Mizar32_firmware_directory
is the entire PATH where you stored the Mizar32 firmware.elua_lualong_at32uc3aXXXX.elf
is the firmware version.
For example, you can flash a Mizar32 B (the 256Kb version) with this command line:
If batchisp can't run because 'MSVCR71.dll is missing'
- download the file msvcr71.dll into your
Flipbin
directory (on this PC it'sc:Program Files (x86)AtmelFlip 3.4.3bin
) - Re-type the batchisp command above to update Mizar32 firmware.
Further reading
- The Atmel USB DFU Bootloader Datasheet
- The FLIP home page
Please report any feedback or suggestions on this procedure to
[email protected]
Using Batchisp under Windows Vista/7 64bit[edit]
- Download the latest version of Flip for Windows from the Atmel web site (Batchisp.exe is inside Flip installation). Follow the video instructions for installation. At the moment only Batchisp supports AT32UC3A microprocessors; Flip does not support it yet, so you have to install Flip but can't use it.
- Download and unzip this USB driver, because Atmel's original drivers are unsigned and Windows Vista/7 64bit does not let you install unsigned driver. Unpack the .zip file downloaded in the
Flipusb
folder; on our machines the folder is:
- Activate the DFU Bootloader: connect the Mizar32 to your PC with a USB cable Connect the power plug and press and hold the reset button while holding the user button (SW2), release the reset button, then release the user button.
- Go to the Windows Control Panel with: right-click on Computer --> Properties --> Device Manager --> right-click on 'AT32UC3A DFU' --> Update Driver Software --> 'Browse my computer for the driver software' and select the path where you copied the new USB signed driver (on this machine
c:Program Files (x86)AtmelFlip 3.4.3usbatmel-flip-3.4.2-signed-driver
) and click OK. Now your Mizar32 driver for Batchisp is installed.
- Open your Windows Command Processor: Start --> type 'cmd' in 'Search commands and files' --> Right-click on cmd.exe --> Start as Administrator. Type 'Path' followed by entire path of your
Batchisp.exe
directory; on our machine the command is:
Path c:Program File (x86)AtmelFlip 3.4.3bin
- Restart Windows. Now Windows is able to find the
Batchisp.exe
program.
- Download [2] and unpack this file, then run your Windows Command Processor: Start --> type 'cmd' in 'Search commands and files' --> Right-click on cmd.exe --> Start as Administrator and type the following command (this command is case sensitive):
where:
at32uc3aXXXX
is your Atmel device that can be: at32uc3a0128, at32uc3a0256, at32uc3a0512.Mizar32_firmware_directory
is the entire PATH where you stored the Mizar32 firmware.hempl_at32uc3aXXXX.elf
is the firmware file version.
We flash our Mizar32 B (256KB version) with this command line:
Further reading
- The Atmel USB DFU Bootloader Datasheet
- The FLIP home page
With a JTAG programmer[edit]
A JTAG programmer is a device that lets you do more than the USB DFU bootloader, including updating the USB DFU bootloader itself, and requires special software on your PC to drive it.
If you need to do this, please contact
[email protected]
Retrieved from 'https://en.wikibooks.org/w/index.php?title=Hempl/Flashing_firmware&oldid=2987483'