Tomas Niño Kehoe | 18 May 06:58 2013


Hi all,

I'd like to announce the existence of a NetBSD port to the AVR32 processor architecture.
This port is being developed in the context of my engineering thesis at the University of Buenos Aires, Argentina. It is directed by Leandro Santi.

This is my first experience with AVR32. My previous experience with RISC architectures involves MIPS. Consecuently, the MIPS port was taken as a staring point into NetBSD. Some parts of the MD code contain MIPS code snippets -guarded by #ifdef notyet clauses- acting as a
reference. These will be removed in the near future. Multiple MIPS implementations were studied to be
able to understand the interaction between Machine Dependent code (MD) and Machine independent code (MI).

The milestone that will mark the end of this thesis is the execution of a static 32-bit Linux binary, read from an in-memory file system supported by md.c. Currently, the system is able to mount the filesystem successfully, yet system call support and Linux compatibilty are currently under development. The rationale here is related to the inexistence of a NetBSD/avr32 API, vs. the immediate availability of the Linux system call emulation interface ofNetBSD.  Support for a proper NetBSD/avr32 API will be developed, but not within the context of my thesis (see below).

Bear in mind that this port was produced in an academic context subject to time restrictions (and therefore scope restrictions), and due to the lack of the gcc compiler and related toolchain, including the NetBSD, and port-specific config(1), genassym(1), some compromises were taken to enable the development of this port.

For similar reasons, some other compromises were taken:

o The assym.h emited by genassym(1) is handcrafted, containing only the offset definitions needed by this port.

o There is no file, however we have payed special attention to preserve the semantics of the generated headers.

o The ioconf.c file created by config(1) is handcrafted, containing only a few device definitions.

o There are no device definition files for config(9) to configure the kernel. All optional header files were created and definitions were added as needed through the development cycle.

o The global curlwp reference, which is held in a fixed register in the MIPS port is being stored in memory.

oCurrently, the clock tick is implemented using the CPU COUNT register, for simplicity reasons.

o The linux port of the compiler is being used: This has been done on purpose, in order to be able to bootstrap the kernel of the operating system within the context of my thesis. We believe that a proper, NetBSD specific port of gcc should be made available early in the userland-centric porting effort, which would begin right after the end of my thesis.

o pmap.c tags every page with the D (dirty) bit set (rationale:early unavailability of the trap.c machinery). We except to implement proper handling of the D bit soon. Finally, these are the next work items in line:

o It would be nice to locate the board-specific code in a separate directory, mimicking the vast amount of examples already provided in the source code of the kernel.

o MB(9) functions are NOPs for the time being.

o compare-and-swap functions have race conditions.

o Integrate with the NetBSD build system: Makefiles are Linux and GNU make-specific due to the unavailability of the toolchain for anything else than Linux (i'm currently developing in a Linux workstation).

In the near future, i'm hoping to include support for execution of NetBSD 32bit binaries and improve exception handling.

Currently, work is being focused on the trap machinery and related exceptions, in order to complete the necessary trap.c glue looking to execute the static userland shell. Will post a follow-up in a few days.

Code can be found here: 

Starting kernel at 90000000 (params at 11fc0040)...

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 5.1.0_PATCH (MYKERNEL) #0: Thu Jan 12 20:05:02 ARST 2012
root <at> netbsd-5-1:/tomas/new/src/sys/arch/i386/compile/MYKERNEL
Atmel AT32AP7000 SoC
total memory = 32768 KB
avail memory = 29728 KB
sysctl_createv: sysctl_locate(disknames) returned 2
sysctl_createv: sysctl_locate(iostatnames) returned 2
sysctl_createv: sysctl_locate(iostats) returned 2
mainbus0 (root)
cpu0 at mainbus0: Atmel AT32AP7000 SoC (0x1) Rev. 0, no FPU
cpu0: 16KB/32B 4-way set-associative Instruction cache
cpu0: 16KB/32B 4-way set-associative Data cache
cpu0: unified TLB, 32 entries
at32bus0 at mainbus0
at32pm0 at at32bus0
at32intc0 at at32bus0
at32clock0 at at32bus0
rn_init: radix functions require max_keylen be set
boot device: <unknown>
root on md0a dumps on md0b
root file system type: ext2fs
WARNING: no TOD clock present
WARNING: using filesystem time
warning: no /dev/console
panic: Unrecoverable Exception

Christos Zoulas | 18 May 19:44 2013

Re: NetBSD/avr32

In article <CAEv1cWcb1-+eyU+enmDQ9oMH8tZUanu8k4sPUrXW8uVpwfAXzA <at>>,
Tomas Niño Kehoe  <tomasninokehoe <at>> wrote:
>Hi all,
>I'd like to announce the existence of a NetBSD port to the AVR32 processor
>This port is being developed in the context of my engineering thesis at the
>University of Buenos Aires, Argentina. It is directed by Leandro Santi.

Looks like you've made a lot of progress. You might be interested in looking


Valery Ushakov | 18 May 21:45 2013

Re: NetBSD/avr32

On Sat, May 18, 2013 at 01:58:36 -0300, Tomas Ni?o Kehoe wrote:

> I'd like to announce the existence of a NetBSD port to the AVR32
> processor architecture.


> Atmel AT32AP7000 SoC

Is this this the same SoC that is used in NGW-100?