From Sven Kreiss
This is just a quick guide with some more hints which I did not find anywhere else and took me some time to figure out. Hope it will speed up your first tests with these controllers.
Loading the kernel module
As described in various sources, one has to modprobe the usbserial kernel module to get the serial device for SAM-BA. You see that you do not have it when the device gets enumerated but no driver is loaded. Do the following:
sudo modprobe usbserial vendor=0x3EB product=0x6124
Note that you wont see usbserial until you connect the board. It is not a daemon.
Compiler and Example
I downloaded and installed the pre-built compiler from http://www.mikrocontroller.net/articles/ARM_GCC_toolchain_for_Linux_and_Mac_OS_X onto my ubuntu laptop.
- Follow the instructions in the file INSTALL.
- Modprobe usbserial (see above).
- Changing device: sudo ln -s /dev/ttyUSB0 /dev/at91_0
- Programming flash: sam7 --exec set_clock --exec unlock_regions --exec "flash main.bin"
If sam7 shows an error when programming the controller, try to run Sam_I_Am info usb before programming with sam7.
I dont know what the problem was, but Sam_I_Am failed to program larger files to RAM and failed completely to program anything to flash. Sam7utils worked out of the box for me.
Have not looked into the details, but all commands to SAM-BA in interactive mode fail. Using command line options works though.
Sam_I_Am info usb
Sam_I_Am send blink.hex , go
Make sure you have a space before and after the comma.
For this to work, I have this in my .samiamrc file (same as described on their website):
open /dev/ttyUSB0 version set readallow 0 0x300000 set ramwriteallow 0x202000 57344 set flashwriteallow 0x100000 0x40000
More Advanced Example
A nice entry with some more practical hints probably is http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index_at91.html#at91_gamma . On case sensitive systems (like Linux), you have to change the include command at the beginning of Cstartup_SAM7.c from #include "board.h" to #include "Board.h".
[Not sure whether the following is really true.]
You will also need to change the address in common/AT91SAM7S256_memory.ldh from 0x00200000 to 0x00202000.