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

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 \

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.

1 comment:

  1. Hi,

    energyAware Commander is now available on linux, but you should be able to switch to SWD mode by issuing "si 1" in Jlink Commander.