#include .section .text .align 1 main: // stack starts at 0x24001FFF downto 0x24000000 which is the first 2K of SRAM // after pagin is enabled we will access SRAM from the P3 segment by remapping the address lddpc sp,.stackBase // keep top of stack in r7, and use 8 byte in the stack. It is a buffer for our local vars mov r7, sp sub sp, 8 // initialize PIOA mov r6,0x80000 lddpc r8,.pioa st.w r8[AVR32_PIO_PER],r6 st.w r8[AVR32_PIO_OER],r6 st.w r8[AVR32_PIO_IDR],r6 st.w r8[AVR32_PIO_PUDR],r6 mov r9,0 test: sub r9, -1 lddpc r4,.andvar and r4, r9, r4 breq br2 st.w r8[AVR32_PIO_CODR],r6 rjmp test br2: st.w r8[AVR32_PIO_SODR],r6 rjmp test // contants. They can stay in the text section, we won't modify them .stackBase: .int 0x24001FFF .pioa: .int 0xFFE02800 .andvar: .int 0x0800000 // data section: this will be loaded into ram. It will then need to be referenced // with a pointer and a displacement be .section .data .var2: .int 0xFFFFFFFF