WWW.DUMAIS.IO

NGW100 - Getting startedLast edited on Feb 25, 2012

Installing the development environment

I wrote this howto because everywhere I was looking , people kept talking about the "buildroot". I didn't want that. I just wanted the basic stuff to get me going and do standalone development without installing all the linux kernel files and libc etc...

First, download these files:

  • AVR32_Header_Files.zip
  • binutils-2.18.atmel.1.0.1.tar.bz2
  • gcc-4.2.2.atmel.1.1.3.tar.bz2

1 - compile binutils

./configure  --prefix=/opt/avr32 --program-prefix=avr32- --target=avr32-linux
make
make install

Now add the /opt/avr32/bin path in your PATH. I installed that in /opt/avr32 and all the applications are prefixed with "avr32-" (avr32-ar, avr32-as etc)

2 - compile GCC

mkdir build
cd build
../configure --target=avr32-linux --prefix=/opt/avr32 --enable-languages=c --disable-threads --disable-libmudflap --disable-libssp --disable-libgomp --program-prefix="avr32-"
make
make install

3 - copy the header files

Now unzip the header files in /opt/avr32/avr32-linux/include (the "include" folder will need to be created first)

4 - Make a test application

I made this code as a test application that flashes a led on the board. Compile it using this Makefile and see if it works

5 - upload the test application on your device

The first thing to do is to connect the board using a serial port. By default communication is established at 115200 8N1. when booting the device, you have 1second to press "space" to get in the uboot prompt. I connected the "lan" port of the device to my switch and entered the following commands:

setenv tftpip 192.168.1.3
setenv serverip 192.168.1.36
setenv bootcmd 'set ipaddr 192.168.1.37;tftpboot 0x24004000 firmware.bin;go 0x24004000'
saveenv

the bootcmd variable tells uboot what to do at boot time. In this case, it will connect to the tftp server located at the address provided in 'tftpip' and download "firmware.bin" and store it at memory location 0x24004000. After that, it will jump to that address.

If you're trying to upload in flash memory, you need to unprotect a whole block, erase it and write to it. Blocks are 64k in size and alligned on 64k boundaries. So let's say we want to copy our firmware at 0x100000 (23rd sector in parallel flash chip) we would do the following. Assume that the firmware has been downloaded to 0x24004000 first and is 0x242 byte in size:

protect off 0x100000 0x10ffff
era 0x100000 0x10ffff
cp.b 0x24004000 0x100000 242
protect on all