Commit 14a84cc7 authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'build-changes'

parents 922fbf87 f05f3757
......@@ -19,3 +19,8 @@ config DETERMINISTIC_BINARY
changes.
If in doubt, say No.
# The following will soon become a choice with ppsi
config PTP_NOPOSIX
boolean
default y
\ No newline at end of file
......@@ -11,20 +11,17 @@ SIZE = $(CROSS_COMPILE)size
-include $(CURDIR)/.config
OBJS_WRC = wrc_main.o \
wrc_ptp.o \
monitor/monitor.o
PTP_NOPOSIX = ptp-noposix
INCLUDE_DIRS = -I$(PTP_NOPOSIX)/wrsw_hal \
-I$(PTP_NOPOSIX)/libptpnetif \
-I$(PTP_NOPOSIX)/softpll \
-Iinclude
obj-y = arch/lm32/crt0.o arch/lm32/irq.o arch/lm32/debug.o
obj-y += wrc_main.o wrc_ptp.o monitor/monitor.o
CFLAGS = -include $(CURDIR)/include/generated/autoconf.h
cflags-y = -include $(CURDIR)/include/generated/autoconf.h \
-Iinclude -I.
CFLAGS_PTPD = -ffreestanding \
cflags-$(CONFIG_PTP_NOPOSIX) += \
-ffreestanding \
-DPTPD_FREESTANDING \
-DWRPC_EXTRA_SLIM \
-DPTPD_MSBF \
......@@ -34,9 +31,13 @@ CFLAGS_PTPD = -ffreestanding \
-DPTPD_TRACE_MASK=0 \
-include $(PTP_NOPOSIX)/compat.h \
-include $(PTP_NOPOSIX)/PTPWRd/dep/trace.h \
-include $(PTP_NOPOSIX)/libposix/ptpd-wrappers.h
-include $(PTP_NOPOSIX)/libposix/ptpd-wrappers.h \
-I$(PTP_NOPOSIX)/wrsw_hal \
-I$(PTP_NOPOSIX)/libptpnetif \
-I$(PTP_NOPOSIX)/softpll \
-I$(PTP_NOPOSIX)/PTPWRd
OBJS_PTPD = $(PTP_NOPOSIX)/PTPWRd/arith.o \
obj-$(CONFIG_PTP_NOPOSIX) += $(PTP_NOPOSIX)/PTPWRd/arith.o \
$(PTP_NOPOSIX)/PTPWRd/bmc.o \
$(PTP_NOPOSIX)/PTPWRd/dep/msg.o \
$(PTP_NOPOSIX)/PTPWRd/dep/net.o \
......@@ -55,8 +56,6 @@ CFLAGS_PLATFORM = -mmultiply-enabled -mbarrel-shift-enabled
LDFLAGS_PLATFORM = -mmultiply-enabled -mbarrel-shift-enabled \
-nostdlib -T arch/lm32/ram.ld
OBJS_PLATFORM = arch/lm32/crt0.o arch/lm32/irq.o arch/lm32/debug.o
include shell/shell.mk
include tests/tests.mk
include lib/lib.mk
......@@ -64,33 +63,38 @@ include sockitowm/sockitowm.mk
include dev/dev.mk
CFLAGS += $(CFLAGS_PLATFORM) $(CFLAGS_EB) $(CFLAGS_PTPD) $(INCLUDE_DIRS) \
-ffunction-sections -fdata-sections -Os -Iinclude \
-include include/trace.h \
$(PTPD_CFLAGS) -I$(PTP_NOPOSIX)/PTPWRd -I. -Isoftpll
CFLAGS = $(CFLAGS_PLATFORM) $(cflags-y) \
-ffunction-sections -fdata-sections -Os \
-include include/trace.h
LDFLAGS = $(LDFLAGS_PLATFORM) \
-ffunction-sections -fdata-sections -Wl,--gc-sections -Os -Iinclude
-Wl,--gc-sections -Os -lgcc -lc
OBJS = $(OBJS_PLATFORM) $(OBJS_WRC) $(OBJS_PTPD) \
$(OBJS_SHELL) $(OBJS_TESTS) $(OBJS_LIB) \
$(OBJS_SOCKITOWM) $(OBJS_SOFTPLL) $(OBJS_DEV)
OBJS = $(obj-y)
OUTPUT = wrc
REVISION=$(shell git describe --dirty --always)
all: tools wrc
all: tools $(OUTPUT).ram $(OUTPUT).vhd
.PRECIOUS: %.elf %.bin
.PHONY: all tools clean gitmodules
wrc: silentoldconfig $(OBJS)
$(OUTPUT).elf: silentoldconfig gitmodules $(OBJS)
$(CC) $(CFLAGS) -DGIT_REVISION=\"$(REVISION)\" -c revision.c
$(SIZE) -t $(OBJS)
${CC} -o $(OUTPUT).elf revision.o $(OBJS) $(LDFLAGS)
${OBJCOPY} -O binary $(OUTPUT).elf $(OUTPUT).bin
${CC} -o $@ revision.o $(OBJS) $(LDFLAGS)
${OBJDUMP} -d $(OUTPUT).elf > $(OUTPUT)_disasm.S
cd tools; $(MAKE)
./tools/genraminit $(OUTPUT).bin 0 > $(OUTPUT).ram
./tools/genramvhd -s 90112 $(OUTPUT).bin > $(OUTPUT).vhd
$(SIZE) $@
%.bin: %.elf
${OBJCOPY} -O binary $^ $@
%.ram: tools %.bin
./tools/genraminit $*.bin 0 > $@
%.vhd: tools %.bin
./tools/genramvhd -s 90112 $*.bin > $@
$(OBJS): include/board.h
......@@ -105,7 +109,16 @@ clean:
${CC} $(CFLAGS) $(PTPD_CFLAGS) $(INCLUDE_DIR) $(LIB_DIR) -c $*.c -o $@
tools:
make -C tools
$(MAKE) -C tools
# if needed, check out the submodules (first time only), so users
# who didn't read carefully the manual won't get confused
gitmodules:
@test -d ptp-noposix/libposix || echo "Checking out submodules"
@test -d ptp-noposix/libposix || \
git submodule init && git submodule update
# following targets from Makefile.kconfig
silentoldconfig:
......@@ -116,3 +129,4 @@ scripts_basic config %config:
$(MAKE) -f Makefile.kconfig $@
.config: silentoldconfig
/*
* Simulator Link script for Lattice Mico32.
* Contributed by Jon Beniston <jon@beniston.com>
* Link script for Lattice Mico32. Very loosely based on
* code contributed by Jon Beniston <jon@beniston.com>
*
* Jon's license (BSD-style):
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -26,8 +28,6 @@
OUTPUT_FORMAT("elf32-lm32")
ENTRY(_start)
/*INPUT() */
GROUP(-lgcc -lc)
MEMORY
{
......@@ -36,114 +36,24 @@ MEMORY
SECTIONS
{
.boot : { *(.boot) } > ram
.boot : { *(.boot) } > ram
/* Code */
.text :
{
. = ALIGN(4);
_ftext = .;
_ftext_rom = LOADADDR(.text);
*(.text .stub .text.* .gnu.linkonce.t.*)
*(.gnu.warning)
KEEP (*(.init))
KEEP (*(.fini))
/* Constructors and destructors */
KEEP (*crtbegin*.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
KEEP (*(.jcr))
_etext = .;
} > ram =0
/* Exception handlers */
.eh_frame_hdr : { *(.eh_frame_hdr) } > ram
.eh_frame : { KEEP (*(.eh_frame)) } > ram
.gcc_except_table : { *(.gcc_except_table) *(.gcc_except_table.*) } > ram
/* Read-only data */
.rodata :
{
. = ALIGN(4);
_frodata = .;
_frodata_rom = LOADADDR(.rodata);
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1)
_erodata = .;
} > ram
/* Data */
.data :
{
. = ALIGN(4);
_fdata = .;
_fdata_rom = LOADADDR(.data);
*(.data .data.* .gnu.linkonce.d.*)
*(.data1)
SORT(CONSTRUCTORS)
_gp = ALIGN(16) + 0x7ff0;
*(.sdata .sdata.* .gnu.linkonce.s.*)
_edata = .;
} > ram
.text : { *(.text .text.*) } > ram =0
/* BSS */
.bss :
{
. = ALIGN(4);
_fbss = .;
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
_end = .;
PROVIDE (end = .);
} > ram
.rodata : { *(.rodata .rodata.*) } > ram
/* First location in stack is highest address in RAM */
PROVIDE(_fstack = ORIGIN(ram) + LENGTH(ram) - 4);
.data : {
*(.data .data.*)
_gp = ALIGN(16) + 0x7ff0; /* FIXME: what is this? */
} > ram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.bss : {
_fbss = .;
*(.bss .bss.*)
*(COMMON)
_ebss = .;
} > ram
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* First location in stack is highest address in RAM */
PROVIDE(_fstack = ORIGIN(ram) + LENGTH(ram) - 4);
}
#include "board.h"
/* Board-specific initialization code */
int board_init()
{
}
int board_update()
{
}
#include "board.h"
/* Board-specific initialization code */
int board_init()
{
}
int board_update()
{
}
OBJS_DEV = dev/eeprom.o \
dev/endpoint.o \
dev/ep_pfilter.o \
dev/i2c.o \
dev/minic.o \
dev/pps_gen.o \
dev/syscon.o \
dev/uart.o \
dev/sfp.o \
dev/onewire.o \
dev/sdb.o
obj-y += \
dev/eeprom.o \
dev/endpoint.o \
dev/ep_pfilter.o \
dev/i2c.o \
dev/minic.o \
dev/pps_gen.o \
dev/syscon.o \
dev/uart.o \
dev/sfp.o \
dev/onewire.o \
dev/sdb.o
OBJS_LIB= lib/mprintf.o \
lib/util.o
obj-y += lib/mprintf.o lib/util.o
ifdef CONFIG_ETHERBONE
OBJS_LIB += lib/arp.o lib/icmp.o lib/ipv4.o lib/bootp.o
endif
\ No newline at end of file
obj-$(CONFIG_ETHERBONE) += lib/arp.o lib/icmp.o lib/ipv4.o lib/bootp.o
OBJS_SHELL = shell/shell.o \
shell/environ.o \
shell/cmd_version.o \
shell/cmd_pll.o \
shell/cmd_sfp.o \
shell/cmd_stat.o \
shell/cmd_ptp.o \
shell/cmd_mode.o \
shell/cmd_calib.o \
shell/cmd_time.o \
shell/cmd_gui.o \
shell/cmd_sdb.o \
shell/cmd_mac.o \
shell/cmd_init.o
obj-y += \
shell/shell.o \
shell/environ.o \
shell/cmd_version.o \
shell/cmd_pll.o \
shell/cmd_sfp.o \
shell/cmd_stat.o \
shell/cmd_ptp.o \
shell/cmd_mode.o \
shell/cmd_calib.o \
shell/cmd_time.o \
shell/cmd_gui.o \
shell/cmd_sdb.o \
shell/cmd_mac.o \
shell/cmd_init.o
ifdef CONFIG_ETHERBONE
OBJS_SHELL += shell/cmd_ip.o
endif
obj-$(CONFIG_ETHERBONE) += shell/cmd_ip.o
OBJS_SOCKITOWM = \
obj-y += \
sockitowm/crcutil.o \
sockitowm/eep43.o \
sockitowm/findtype.o \
......
OBJS_TESTS = tests/measure_t24p.o
\ No newline at end of file
obj-y += tests/measure_t24p.o
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment