initial stab at avr32 support
This commit is contained in:
16
arch/avr32/compile.mk
Normal file
16
arch/avr32/compile.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
$(BUILDDIR)/%.o: %.c $(SRCDEPS)
|
||||
@$(MKDIR)
|
||||
@echo compiling $<
|
||||
$(NOECHO)$(CC) $(CFLAGS) --std=c99 $(INCLUDES) -c $< -MD -MT $@ -MF $(@:%o=%d) -o $@
|
||||
|
||||
$(BUILDDIR)/%.o: %.cpp $(SRCDEPS)
|
||||
@$(MKDIR)
|
||||
@echo compiling $<
|
||||
$(NOECHO)$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c $< -MD -MT $@ -MF $(@:%o=%d) -o $@
|
||||
|
||||
$(BUILDDIR)/%.o: %.S $(SRCDEPS)
|
||||
@$(MKDIR)
|
||||
@echo compiling $<
|
||||
$(NOECHO)$(CC) $(CFLAGS) $(ASMFLAGS) $(INCLUDES) -c $< -MD -MT $@ -MF $(@:%o=%d) -o $@
|
||||
|
||||
0
arch/avr32/crt0.S
Normal file
0
arch/avr32/crt0.S
Normal file
31
arch/avr32/include/arch/arch_thread.h
Normal file
31
arch/avr32/include/arch/arch_thread.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Travis Geiselbrecht
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __AVR32_ARCH_THREAD_H
|
||||
#define __ARV32_ARCH_THREAD_H
|
||||
|
||||
struct arch_thread {
|
||||
vaddr_t sp;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
30
arch/avr32/include/arch/defines.h
Normal file
30
arch/avr32/include/arch/defines.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Travis Geiselbrecht
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __ARCH_CPU_H
|
||||
#define __ARCH_CPU_H
|
||||
|
||||
/* avr32 specific stuff */
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
#endif
|
||||
|
||||
62
arch/avr32/rules.mk
Normal file
62
arch/avr32/rules.mk
Normal file
@@ -0,0 +1,62 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
# can override this in local.mk
|
||||
ENABLE_THUMB?=true
|
||||
|
||||
DEFINES += \
|
||||
AVR32_CPU_$(AVR32_CPU)=1
|
||||
|
||||
INCLUDES += \
|
||||
-I$(LOCAL_DIR)/include
|
||||
|
||||
BOOTOBJS += \
|
||||
$(LOCAL_DIR)/crt0.o
|
||||
|
||||
OBJS += \
|
||||
|
||||
# $(LOCAL_DIR)/arch.Ao \
|
||||
$(LOCAL_DIR)/asm.o \
|
||||
$(LOCAL_DIR)/cache.o \
|
||||
$(LOCAL_DIR)/cache-ops.o \
|
||||
$(LOCAL_DIR)/ops.o \
|
||||
$(LOCAL_DIR)/exceptions.o \
|
||||
$(LOCAL_DIR)/faults.o \
|
||||
$(LOCAL_DIR)/mmu.o \
|
||||
$(LOCAL_DIR)/thread.o \
|
||||
$(LOCAL_DIR)/dcc.o
|
||||
|
||||
# set the default toolchain to arm elf and set a #define
|
||||
TOOLCHAIN_PREFIX ?= avr32-elf-
|
||||
|
||||
# make sure some bits were set up
|
||||
MEMVARS_SET := 0
|
||||
ifneq ($(MEMBASE),)
|
||||
MEMVARS_SET := 1
|
||||
endif
|
||||
ifneq ($(MEMSIZE),)
|
||||
MEMVARS_SET := 1
|
||||
endif
|
||||
ifeq ($(MEMVARS_SET),0)
|
||||
$(error missing MEMBASE or MEMSIZE variable, please set in target rules.mk)
|
||||
endif
|
||||
|
||||
LIBGCC := $(shell $(TOOLCHAIN_PREFIX)gcc $(CFLAGS) $(THUMBCFLAGS) -print-libgcc-file-name)
|
||||
#$(info LIBGCC = $(LIBGCC))
|
||||
|
||||
# potentially generated files that should be cleaned out with clean make rule
|
||||
GENERATED += \
|
||||
$(BUILDDIR)/system-onesegment.ld \
|
||||
$(BUILDDIR)/system-twosegment.ld
|
||||
|
||||
# rules for generating the linker scripts
|
||||
|
||||
$(BUILDDIR)/system-onesegment.ld: $(LOCAL_DIR)/system-onesegment.ld
|
||||
@echo generating $@
|
||||
@$(MKDIR)
|
||||
$(NOECHO)sed "s/%MEMBASE%/$(MEMBASE)/;s/%MEMSIZE%/$(MEMSIZE)/" < $< > $@
|
||||
|
||||
$(BUILDDIR)/system-twosegment.ld: $(LOCAL_DIR)/system-twosegment.ld
|
||||
@echo generating $@
|
||||
@$(MKDIR)
|
||||
$(NOECHO)sed "s/%ROMBASE%/$(ROMBASE)/;s/%MEMBASE%/$(MEMBASE)/;s/%MEMSIZE%/$(MEMSIZE)/" < $< > $@
|
||||
|
||||
83
arch/avr32/system-onesegment.ld
Normal file
83
arch/avr32/system-onesegment.ld
Normal file
@@ -0,0 +1,83 @@
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = %MEMBASE%;
|
||||
|
||||
/* text/read-only data */
|
||||
.text.boot : { *(.text.boot) }
|
||||
.text : { *(.text .text.* .glue_7* .gnu.linkonce.t.*) } =0x9090
|
||||
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
|
||||
.rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
|
||||
.rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
|
||||
.rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
|
||||
.rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
|
||||
.rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) } =0x9090
|
||||
.plt : { *(.plt) }
|
||||
|
||||
.rodata : {
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
. = ALIGN(4);
|
||||
__commands_start = .;
|
||||
KEEP (*(.commands))
|
||||
__commands_end = .;
|
||||
. = ALIGN(4);
|
||||
__apps_start = .;
|
||||
KEEP (*(.apps))
|
||||
__apps_end = .;
|
||||
. = ALIGN(4);
|
||||
__rodata_end = . ;
|
||||
}
|
||||
|
||||
/* writable data */
|
||||
__data_start_rom = .; /* in one segment binaries, the rom data address is on top of the ram data address */
|
||||
__data_start = .;
|
||||
.data : SUBALIGN(4) { *(.data .data.* .gnu.linkonce.d.*) }
|
||||
|
||||
__ctor_list = .;
|
||||
.ctors : { *(.ctors) }
|
||||
__ctor_end = .;
|
||||
__dtor_list = .;
|
||||
.dtors : { *(.dtors) }
|
||||
__dtor_end = .;
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
|
||||
__data_end = .;
|
||||
|
||||
/* unintialized data (in same segment as writable data) */
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss .bss.*) }
|
||||
|
||||
. = ALIGN(4);
|
||||
_end = .;
|
||||
|
||||
. = %MEMBASE% + %MEMSIZE%;
|
||||
_end_of_ram = .;
|
||||
|
||||
/* Strip unnecessary stuff */
|
||||
/DISCARD/ : { *(.comment .note .eh_frame) }
|
||||
}
|
||||
@@ -40,6 +40,10 @@
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#if defined(ARCH_AVR32)
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(_X86_)
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
9
lib/libc/string/arch/avr32/rules.mk
Normal file
9
lib/libc/string/arch/avr32/rules.mk
Normal file
@@ -0,0 +1,9 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
ASM_STRING_OPS :=
|
||||
|
||||
OBJS += \
|
||||
|
||||
# filter out the C implementation
|
||||
C_STRING_OPS := $(filter-out $(ASM_STRING_OPS),$(C_STRING_OPS))
|
||||
|
||||
0
platform/at32ap7/debug.c
Normal file
0
platform/at32ap7/debug.c
Normal file
0
platform/at32ap7/interrupts.c
Normal file
0
platform/at32ap7/interrupts.c
Normal file
0
platform/at32ap7/platform.c
Normal file
0
platform/at32ap7/platform.c
Normal file
26
platform/at32ap7/rules.mk
Normal file
26
platform/at32ap7/rules.mk
Normal file
@@ -0,0 +1,26 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
ARCH := avr32
|
||||
CPU := generic
|
||||
|
||||
MODULES += \
|
||||
lib/cbuf
|
||||
|
||||
INCLUDES += \
|
||||
-I$(LOCAL_DIR)/include
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/debug.o \
|
||||
$(LOCAL_DIR)/interrupts.o \
|
||||
$(LOCAL_DIR)/platform.o \
|
||||
$(LOCAL_DIR)/timer.o
|
||||
|
||||
|
||||
# $(LOCAL_DIR)/console.o \
|
||||
|
||||
MEMBASE := 0x00000000
|
||||
#MEMSIZE := 0x02000000 # 32MB
|
||||
|
||||
LINKER_SCRIPT += \
|
||||
$(BUILDDIR)/system-onesegment.ld
|
||||
|
||||
0
platform/at32ap7/timer.c
Normal file
0
platform/at32ap7/timer.c
Normal file
10
project/ngw100-test.mk
Normal file
10
project/ngw100-test.mk
Normal file
@@ -0,0 +1,10 @@
|
||||
# top level project rules for the armemu-test project
|
||||
#
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
TARGET := ngw100
|
||||
MODULES += \
|
||||
app/tests \
|
||||
app/stringtests \
|
||||
app/shell
|
||||
|
||||
0
target/ngw100/init.c
Normal file
0
target/ngw100/init.c
Normal file
14
target/ngw100/rules.mk
Normal file
14
target/ngw100/rules.mk
Normal file
@@ -0,0 +1,14 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
PLATFORM := at32ap7
|
||||
|
||||
MODULES +=
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o
|
||||
|
||||
MEMSIZE := 0x02000000 # 32MB
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE)
|
||||
|
||||
Reference in New Issue
Block a user