diff --git a/quad/Makefile b/quad/Makefile index 42c990ec18d1b86f3fa9b05ef4985f015a5a669b..867de1bd9694a5d3f664c94a37c9a5c9beb3064e 100644 --- a/quad/Makefile +++ b/quad/Makefile @@ -1,8 +1,7 @@ INCDIR = inc LIBDIR = lib -ZYBOLIBDIR = lib-zybo -.PHONY: default zybo all test clean +.PHONY: default test clean deep-clean default: $(MAKE) -C src/test @@ -10,17 +9,16 @@ default: $(MAKE) -C src/computation_graph $(MAKE) -C src/quad_app -zybo: - $(MAKE) -C src/test zybo - $(MAKE) -C src/queue zybo - $(MAKE) -C src/computation_graph zybo - $(MAKE) -C src/quad_app zybo - -all: default zybo - test: $(MAKE) -C src/queue test $(MAKE) -C src/computation_graph test clean: - rm -rf $(INCDIR) $(LIBDIR) $(ZYBOLIBDIR) + rm -rf $(INCDIR) $(LIBDIR) + +deep-clean: + make clean + $(MAKE) -C src/test clean + $(MAKE) -C src/queue clean + $(MAKE) -C src/computation_graph clean + $(MAKE) -C src/quad_app clean diff --git a/quad/library.mk b/quad/library.mk index e5f70e9d72fe3e760752627cf3105f97cbd7689b..ab20cd9b1880cb08e6ca384b113206e3bdf6813c 100644 --- a/quad/library.mk +++ b/quad/library.mk @@ -1,27 +1,21 @@ GCC = gcc AR = ar -ZYBOGCC = /remote/Xilinx/2015.4/SDK/2015.4/gnu/arm/lin/bin/arm-xilinx-eabi-gcc -ZYBOAR = /remote/Xilinx/2015.4/SDK/2015.4/gnu/arm/lin/bin/arm-xilinx-eabi-ar INCDIR = $(TOP)/inc OBJDIR = obj -ZYBOOBJDIR = obj-zybo LIBDIR = $(TOP)/lib -ZYBOLIBDIR = $(TOP)/lib-zybo SOURCES = $(wildcard *.c) TESTSOURCES = $(wildcard test/*.c) HEADERS = $(wildcard *.h) INCLUDES = $(addprefix $(INCDIR)/, $(HEADERS)) OBJECTS = $(patsubst %.c, $(OBJDIR)/%.o, $(SOURCES)) -ZYBOOBJECTS = $(patsubst %.c, $(ZYBOOBJDIR)/%.o, $(SOURCES)) TESTOBJECTS = $(patsubst $.c, %.o, $(TESTSOURCES)) TARGET = $(LIBDIR)/lib$(NAME).a -ZYBOTARGET = $(ZYBOLIBDIR)/lib$(NAME).a TESTBIN = run_tests -.PHONY: default zybo all test clean +.PHONY: default test clean ################ ## User Targets @@ -29,15 +23,11 @@ TESTBIN = run_tests default: $(TARGET) $(INCLUDES) -zybo: $(ZYBOTARGET) $(INCLUDES) - -all: default zybo - test: $(TESTBIN) ./$(TESTBIN) clean: - rm -rf $(TARGET) $(ZYBOTARGET) $(INCLUDES) $(OBJDIR) $(ZYBOOBJDIR) + rm -rf $(TARGET) $(INCLUDES) $(OBJDIR) #################### ## Internal Targets @@ -46,15 +36,9 @@ clean: $(TARGET): $(OBJECTS) | $(LIBDIR) $(AR) rcs $@ $^ -$(ZYBOTARGET): $(ZYBOOBJECTS) | $(ZYBOLIBDIR) - $(ZYBOAR) rcs $@ $^ - $(OBJDIR)/%.o : %.c | $(OBJDIR) $(INCDIR) $(GCC) -c -g -o $@ $< -I$(INCDIR) -$(ZYBOOBJDIR)/%.o : %.c | $(ZYBOOBJDIR) $(INCDIR) - $(ZYBOGCC) -c -g -o $@ $< -I$(INCDIR) - $(INCDIR)/%.h : %.h | $(INCDIR) cp $^ $(INCDIR) @@ -67,12 +51,5 @@ $(OBJDIR): $(LIBDIR): mkdir $(LIBDIR) -$(ZYBOOBJDIR): - mkdir $(ZYBOOBJDIR) - -$(ZYBOLIBDIR): - mkdir $(ZYBOLIBDIR) - - $(TESTBIN): $(TESTOBJECTS) $(OBJECTS) $(GCC) -o $(TESTBIN) $^ -I$(INCDIR) -L$(LIBDIR) $(REQLIBS) diff --git a/quad/src/quad_app/Copy of original lscript.ld b/quad/src/quad_app/Copy of original lscript.ld deleted file mode 100644 index 970979a58cb47d318dbc9197e5ceb885993cc867..0000000000000000000000000000000000000000 --- a/quad/src/quad_app/Copy of original lscript.ld +++ /dev/null @@ -1,284 +0,0 @@ -/*******************************************************************/ -/* */ -/* This file is automatically generated by linker script generator.*/ -/* */ -/* Version: Xilinx EDK 14.7 EDK_P.20131013 */ -/* */ -/* Copyright (c) 2010 Xilinx, Inc. All rights reserved. */ -/* */ -/* Description : Cortex-A9 Linker Script */ -/* */ -/*******************************************************************/ - -_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000; -_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x2000; - -_ABORT_STACK_SIZE = DEFINED(_ABORT_STACK_SIZE) ? _ABORT_STACK_SIZE : 1024; -_SUPERVISOR_STACK_SIZE = DEFINED(_SUPERVISOR_STACK_SIZE) ? _SUPERVISOR_STACK_SIZE : 2048; -_FIQ_STACK_SIZE = DEFINED(_FIQ_STACK_SIZE) ? _FIQ_STACK_SIZE : 1024; -_UNDEF_STACK_SIZE = DEFINED(_UNDEF_STACK_SIZE) ? _UNDEF_STACK_SIZE : 1024; - -/* Define Memories in the system */ - -MEMORY -{ - ps7_ddr_0_S_AXI_BASEADDR : ORIGIN = 0x00100000, LENGTH = 0x1FF00000 - ps7_ram_0_S_AXI_BASEADDR : ORIGIN = 0x00000000, LENGTH = 0x00030000 - ps7_ram_1_S_AXI_BASEADDR : ORIGIN = 0xFFFF0000, LENGTH = 0x0000FE00 -} - -/* Specify the default entry point to the program */ - -ENTRY(_vector_table) - -/* Define the sections, and where they are mapped in memory */ - -SECTIONS -{ -.text : { - *(.vectors) - *(.boot) - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - *(.plt) - *(.gnu_warning) - *(.gcc_execpt_table) - *(.glue_7) - *(.glue_7t) - *(.vfp11_veneer) - *(.ARM.extab) - *(.gnu.linkonce.armextab.*) -} > ps7_ddr_0_S_AXI_BASEADDR - -.init : { - KEEP (*(.init)) -} > ps7_ddr_0_S_AXI_BASEADDR - -.fini : { - KEEP (*(.fini)) -} > ps7_ddr_0_S_AXI_BASEADDR - -.rodata : { - __rodata_start = .; - *(.rodata) - *(.rodata.*) - *(.gnu.linkonce.r.*) - __rodata_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.rodata1 : { - __rodata1_start = .; - *(.rodata1) - *(.rodata1.*) - __rodata1_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.sdata2 : { - __sdata2_start = .; - *(.sdata2) - *(.sdata2.*) - *(.gnu.linkonce.s2.*) - __sdata2_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.sbss2 : { - __sbss2_start = .; - *(.sbss2) - *(.sbss2.*) - *(.gnu.linkonce.sb2.*) - __sbss2_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.data : { - __data_start = .; - *(.data) - *(.data.*) - *(.gnu.linkonce.d.*) - *(.jcr) - *(.got) - *(.got.plt) - __data_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.data1 : { - __data1_start = .; - *(.data1) - *(.data1.*) - __data1_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.got : { - *(.got) -} > ps7_ddr_0_S_AXI_BASEADDR - -.ctors : { - __CTOR_LIST__ = .; - ___CTORS_LIST___ = .; - KEEP (*crtbegin.o(.ctors)) - KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - __CTOR_END__ = .; - ___CTORS_END___ = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.dtors : { - __DTOR_LIST__ = .; - ___DTORS_LIST___ = .; - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - __DTOR_END__ = .; - ___DTORS_END___ = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.fixup : { - __fixup_start = .; - *(.fixup) - __fixup_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.eh_frame : { - *(.eh_frame) -} > ps7_ddr_0_S_AXI_BASEADDR - -.eh_framehdr : { - __eh_framehdr_start = .; - *(.eh_framehdr) - __eh_framehdr_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.gcc_except_table : { - *(.gcc_except_table) -} > ps7_ddr_0_S_AXI_BASEADDR - -.mmu_tbl (ALIGN(16384)) : { - __mmu_tbl_start = .; - *(.mmu_tbl) - __mmu_tbl_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.ARM.exidx : { - __exidx_start = .; - *(.ARM.exidx*) - *(.gnu.linkonce.armexidix.*.*) - __exidx_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.preinit_array : { - __preinit_array_start = .; - KEEP (*(SORT(.preinit_array.*))) - KEEP (*(.preinit_array)) - __preinit_array_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.init_array : { - __init_array_start = .; - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - __init_array_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.fini_array : { - __fini_array_start = .; - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array)) - __fini_array_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.ARM.attributes : { - __ARM.attributes_start = .; - *(.ARM.attributes) - __ARM.attributes_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.sdata : { - __sdata_start = .; - *(.sdata) - *(.sdata.*) - *(.gnu.linkonce.s.*) - __sdata_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.sbss (NOLOAD) : { - __sbss_start = .; - *(.sbss) - *(.sbss.*) - *(.gnu.linkonce.sb.*) - __sbss_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.tdata : { - __tdata_start = .; - *(.tdata) - *(.tdata.*) - *(.gnu.linkonce.td.*) - __tdata_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.tbss : { - __tbss_start = .; - *(.tbss) - *(.tbss.*) - *(.gnu.linkonce.tb.*) - __tbss_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.bss (NOLOAD) : { - __bss_start = .; - *(.bss) - *(.bss.*) - *(.gnu.linkonce.b.*) - *(COMMON) - __bss_end = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 ); - -_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 ); - -/* Generate Stack and Heap definitions */ - -.heap (NOLOAD) : { - . = ALIGN(16); - _heap = .; - HeapBase = .; - _heap_start = .; - . += _HEAP_SIZE; - _heap_end = .; - HeapLimit = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -.stack (NOLOAD) : { - . = ALIGN(16); - _stack_end = .; - . += _STACK_SIZE; - _stack = .; - __stack = _stack; - . = ALIGN(16); - _irq_stack_end = .; - . += _STACK_SIZE; - __irq_stack = .; - _supervisor_stack_end = .; - . += _SUPERVISOR_STACK_SIZE; - . = ALIGN(16); - __supervisor_stack = .; - _abort_stack_end = .; - . += _ABORT_STACK_SIZE; - . = ALIGN(16); - __abort_stack = .; - _fiq_stack_end = .; - . += _FIQ_STACK_SIZE; - . = ALIGN(16); - __fiq_stack = .; - _undef_stack_end = .; - . += _UNDEF_STACK_SIZE; - . = ALIGN(16); - __undef_stack = .; -} > ps7_ddr_0_S_AXI_BASEADDR - -_end = .; -} - diff --git a/quad/src/quad_app/main.c b/quad/src/quad_app/quad_app.c similarity index 98% rename from quad/src/quad_app/main.c rename to quad/src/quad_app/quad_app.c index b76fd3fe3b00d3c8087f63e05e9030c37202cc5e..fd195159c34054309d9c9facb80b0bc1545376cb 100644 --- a/quad/src/quad_app/main.c +++ b/quad/src/quad_app/quad_app.c @@ -20,7 +20,7 @@ //#define BENCH_TEST //#define UART_BENCHMARK -int quad_main() +int quad_main(int (*setup_hardware)(hardware_t *hardware_struct)) { // Structures to be used throughout modular_structs_t structs = { }; diff --git a/quad/src/quad_app/quad_app.h b/quad/src/quad_app/quad_app.h new file mode 100644 index 0000000000000000000000000000000000000000..ef4cab71f718e52eb7b200b05e555a3f8ad3bffa --- /dev/null +++ b/quad/src/quad_app/quad_app.h @@ -0,0 +1,6 @@ +#ifndef QUAD_APP_H +#define QUAD_APP_H + +int quad_main(int (*setup_hardware)(hardware_t *hardware_struct)); + +#endif diff --git a/quad/xsdk_workspace/modular_quad_pid/src/main.c b/quad/xsdk_workspace/modular_quad_pid/src/main.c index 66d95246cb53f7fd1b4c97d225fc1efddac0dcbb..fac5b292519db353db2de0059becb4d392f4f02c 100644 --- a/quad/xsdk_workspace/modular_quad_pid/src/main.c +++ b/quad/xsdk_workspace/modular_quad_pid/src/main.c @@ -1,8 +1,8 @@ #include <stdio.h> #include "hw_impl_zybo.h" -#include "type_def.h" +#include "quad_app.h" -void setup_hardware(hardware_t *hardware) { +int setup_hardware(hardware_t *hardware) { hardware->i2c = create_zybo_i2c(); hardware->pwm_inputs = create_zybo_pwm_inputs(); hardware->pwm_outputs = create_zybo_pwm_outputs(); @@ -14,6 +14,6 @@ void setup_hardware(hardware_t *hardware) { int main() { - + quad_main(setup_hardware); return 0; }