NGW/NGW100 Embedded Development Quick Start

From AVRFreaks Wiki

Jump to: navigation, search

If you own a JTAGICEmkII or another emulator, please read the Embedded Development Quick Start . It applies equally to the NGW100.

Contents

Embedded development without emulator / programmer

All tough not recommended embedded development without an emulator is possible. The following quick start will tell you how to execute native applications on the AP7000 fitted on NGW100, but you will not be able to debug your application in a debugger.


The most critical step is to get your great new standalone application onto the Network Gateway. To achieve this we will leverage the boot loader's (U-Boot) possibility to download into ram and execute it.

Two approaches to get code onto NGW100 without programmer

If you have a small enough application (<32k) you can download it directly to SRAM. This is preferred because no initialization of the CPU is required to access this memory.

If your application is larger than 32k you'll have to use SDRAM where there is plenty of room, 16M on NGW100. The downside is that you'll have to be careful when changing clock parameters etc. or the CPU will not be able to get the next instruction.

Loading arbitrary code into U-Boot memory

This is simple enough. uboot can retrieve binaries in a variety of ways, the easiest being TFTP. Place your binary at a tftp server and in U-Boot write:

Uboot>set bootfile <your binary>; dhcp [memory location]; go [memory location]

UBoot will load your binary into memory [memory location] and set the program counter at the first address.

AP7000 memory map

memory location physical memory
0x00000000 Flash
0x10000000 SDRAM*
0x24000000 SRAM

* For SDRAM you should use 0x10300000 to avoid messing with U-boot's variables.

Writing flash with U-Boot

Warning: You must be careful when following this procedure. If you overwrite the flash sectors containing U-Boot, your NGW100 will be lost until you get hold of a JTAGICE mkII or another emulator/programmer.

Warning: This procedure will erase your Linux partition on NGW100's flash. Be sure to have a copy so you can write it back, or be prepared to use NFS root from this point and beyond.

Download your binary to a sdram location as explained above. Then to modify the flash we'll do:

Uboot>erase 0x20000 +0x7d0000

This will erase the flash from location 0x20000 and 0x7d0000 bytes onwards. this is MOST IMPORTANT. This is the Linux root section of flash. Below (from 0 to 0x20000) resides U-Boot, and you will not want to erase it without access to a programmer. Above it (at 0x7f0000) resides the U-Boot environment. You'll probably want to keep that also.

Then to copy your binary into flash write:

Uboot>cp [location in SDRAM where binary is stored] 0x20000 [length of binary]


You can use the same procedure to write the Linux root back to flash.

Static version created: 2007-03-07
Copyright (c) 2007 Atmel Corporation