SAM-BA
AT91SAM series, equipped with USB device capability, provide SAM-BA interface for easy downloading their firmware without JTAGs or any ISP tools. First, you may want ATMEL SAM-BA software for linux here. Depending on your linux settings (kernel maybe) you may need usbserial module also.
Just plug in your SAM board to the usb port and see what happens. lsusb shows how your linux box recognize your SAM board:
Bus 002 Device 023: ID 03eb:6124 Atmel Corp. ......
The vendor id 0x03eb is dedicated to Atmel. Then you can check how you linux box connect it to a device driver by running dmesg
[50341.865033] cdc-acm 2-5.2:1.0: ttyACM0: USB ACM device
If you find the message like above, you probably have newly created device in /dev:
crw-rw---- 1 root dialout 166, 0 2011-03-04 12:15 /dev/ttyACM0
Since SAM-BA uses /dev/ttyUSBx, you have to create a symbolic link:
$ sudo ln -s /dev/ttyACM0 /dev/ttyUSB0
Now, you are ready to fire up the SAM-BA
$ ./sam-ba
If the above senario is not the case for you, you may need usbserial kernel module, which is explained in the README.linux file of the SAM-BA linux software, i.e., you load the usbserial module:
$ sudo modprobe usbserial vendor=0x03eb product=0x6124
Then you will have /dev/ttyUSBx device when you plug in your SAM board.
Friday, March 4, 2011
Thursday, March 3, 2011
EFM32STK linux toolchain
Sourcery G++ (Lite)
EFM32STK comes with CodeSourcery examples so you don't have to bother with constructing your own startup code and linker script. Install the CodeSourcery toolchain(bare metal), then all you have to do is changing a couple of lines in the Makefile
TOOLDIR = /your/CodeSourcery/toolchain/root
GCCVERSION = x.x.x
You can get your compiler version by firing up
$ arm-none-eabi-gcc --version
All the examples would be compiled without any complaints and ready to go. You can find your executable image files in the 'exe' subdirectory
Segger embedded J-Link
Thanks to the segger J-Link module embedded in the EFM32 STK board, you can use segger linux driver. Actually the STK itself could be utilized as a (standard) j-link tool. Unlike other vendor specific J-Link tools, there seems to be no limitation in using this. It might be used to other ARM devices (ARM7, ARM9/11, Cortex-M) as well as EFM32G devices. I will give it a try later. (UPDATE: It seems that the embedded J-Link does not work as a standard J-Link tool. You cannot even change the target chain from SWD to JTAG without help of EnergyCommander, which runs only on Windows, not to mention detecting a device on its JTAG connector) Anyway, grab the segger linux driver here and install it. Then you can flash your STK board with the J-Link Commander(just run start):
J-Link>exec device = EFM32G890F128
J-Link>loadbin /your/image/file/directory/xxx.bin 0x0
J-Link>r
J-Link>g
When is comes to debugging, you want execute gdb server with SWD option, because the efm32g processor is not on the JTAG chain but on the SWD,
$ JLinkGDBServer -if SWD
then, gdb
$ arm-none-eabi-gdb /your/exe/directory/xxx.out
Unfortunately, when you connect the jlinkgdbserver,
(gdb) target remote localhost:2331
you will get the following error:
Remote 'g' packet reply is too long: 00000000000....
This is an known issue (at least for JLink_Linux_V422 with arm-2010.09-51-arm-none-eabi). You have to wait until they release a fixed version of linux driver. So for now, without gdb compatibility EFM32STK provides quite limited usage on linux. To make things worse, segger windows j-link driver does not work on virtual machine (vmware player).
Flowgraph generation for the examples
By adding a few lines in the Makefile provided with the examples, you can easily generate a flowgraph of the source, i.e., you may want to add, at the end of the Makefile,
CFLOWFLAGS = -a --omit-arguments --omit-symbol-names
CPPFLAGS = --cpp='arm-none-eabi-cpp -E -D $(DEVICE)'
cflow: $(C_SRC) Makefile
cflow -o $(LST_DIR)/$(PROJECTNAME).cflow \
$(CFLOWFLAGS)$(INCLUDEPATHS) $(CPPFLAGS) $(C_SRC)
Then execute :
make cflow
will generate cflow outout in the lst directory. It is needless to mention that you have to install cflow first before using it.
EFM32STK comes with CodeSourcery examples so you don't have to bother with constructing your own startup code and linker script. Install the CodeSourcery toolchain(bare metal), then all you have to do is changing a couple of lines in the Makefile
TOOLDIR = /your/CodeSourcery/toolchain/root
GCCVERSION = x.x.x
You can get your compiler version by firing up
$ arm-none-eabi-gcc --version
All the examples would be compiled without any complaints and ready to go. You can find your executable image files in the 'exe' subdirectory
Segger embedded J-Link
Thanks to the segger J-Link module embedded in the EFM32 STK board, you can use segger linux driver. Actually the STK itself could be utilized as a (standard) j-link tool. Unlike other vendor specific J-Link tools, there seems to be no limitation in using this. It might be used to other ARM devices (ARM7, ARM9/11, Cortex-M) as well as EFM32G devices. I will give it a try later. (UPDATE: It seems that the embedded J-Link does not work as a standard J-Link tool. You cannot even change the target chain from SWD to JTAG without help of EnergyCommander, which runs only on Windows, not to mention detecting a device on its JTAG connector) Anyway, grab the segger linux driver here and install it. Then you can flash your STK board with the J-Link Commander(just run start):
J-Link>exec device = EFM32G890F128
J-Link>loadbin /your/image/file/directory/xxx.bin 0x0
J-Link>r
J-Link>g
When is comes to debugging, you want execute gdb server with SWD option, because the efm32g processor is not on the JTAG chain but on the SWD,
$ JLinkGDBServer -if SWD
then, gdb
$ arm-none-eabi-gdb /your/exe/directory/xxx.out
Unfortunately, when you connect the jlinkgdbserver,
(gdb) target remote localhost:2331
you will get the following error:
Remote 'g' packet reply is too long: 00000000000....
This is an known issue (at least for JLink_Linux_V422 with arm-2010.09-51-arm-none-eabi). You have to wait until they release a fixed version of linux driver. So for now, without gdb compatibility EFM32STK provides quite limited usage on linux. To make things worse, segger windows j-link driver does not work on virtual machine (vmware player).
Flowgraph generation for the examples
By adding a few lines in the Makefile provided with the examples, you can easily generate a flowgraph of the source, i.e., you may want to add, at the end of the Makefile,
CFLOWFLAGS = -a --omit-arguments --omit-symbol-names
CPPFLAGS = --cpp='arm-none-eabi-cpp -E -D $(DEVICE)'
cflow: $(C_SRC) Makefile
cflow -o $(LST_DIR)/$(PROJECTNAME).cflow \
$(CFLOWFLAGS)$(INCLUDEPATHS) $(CPPFLAGS) $(C_SRC)
Then execute :
make cflow
will generate cflow outout in the lst directory. It is needless to mention that you have to install cflow first before using it.
Subscribe to:
Posts (Atom)