Added gcc make toolchain for remote compilation
Signed-off-by: Joppe Blondel <joppe@blondel.nl>
This commit is contained in:
@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
TARGET := app.elf
|
TARGET := app.elf
|
||||||
|
|
||||||
|
BUILDROOT ?= $(shell pwd)
|
||||||
BUILDDIR := build
|
BUILDDIR := build
|
||||||
|
|
||||||
SRCDIRS := src
|
SRCDIRS := $(BUILDROOT)/src
|
||||||
SRCFILESC := $(shell find $(SRCDIRS) -type f -name "*.c")
|
SRCFILESC := $(shell find $(SRCDIRS) -type f -name "*.c")
|
||||||
OBJFILESC := $(SRCFILESC:%.c=$(BUILDDIR)/%.c.o) $(BUILDDIR)/src/ps7_init.o
|
OBJFILESC := $(SRCFILESC:%.c=$(BUILDDIR)/%.c.o) $(BUILDDIR)/src/ps7_init.o
|
||||||
DEPFILESC := $(SRCFILESC:%.c=$(BUILDDIR)/%.c.d)
|
DEPFILESC := $(SRCFILESC:%.c=$(BUILDDIR)/%.c.d)
|
||||||
@ -25,8 +26,8 @@ LD := $(CROSS_COMPILE)gcc
|
|||||||
CC_WARNING := -Wall -Wextra
|
CC_WARNING := -Wall -Wextra
|
||||||
CC_LIBS := -lgcc
|
CC_LIBS := -lgcc
|
||||||
CC_FLAGS := -nostdlib -fno-builtin -g -mcpu=cortex-a9
|
CC_FLAGS := -nostdlib -fno-builtin -g -mcpu=cortex-a9
|
||||||
CC_INCLUDES := -I src -I ../OUT/ip/zynqps
|
CC_INCLUDES := -I $(BUILDROOT)/src -I $(BUILDROOT)/../OUT/ip/zynqps
|
||||||
LD_FLAGS := -Wl,-Tlinker.ld
|
LD_FLAGS := -Wl,-T$(BUILDROOT)/linker.ld
|
||||||
|
|
||||||
.PHONY: $(TARGET) all clean
|
.PHONY: $(TARGET) all clean
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
@ -48,10 +49,10 @@ $(BUILDDIR)/$(TARGET): $(OBJFILES)
|
|||||||
$(LD) $(CC_FLAGS) $(LD_FLAGS) -o $(BUILDDIR)/$(TARGET) $(OBJFILES) $(CC_LIBS)
|
$(LD) $(CC_FLAGS) $(LD_FLAGS) -o $(BUILDDIR)/$(TARGET) $(OBJFILES) $(CC_LIBS)
|
||||||
$(XILINX_BASE)/bin/$(CROSS_COMPILE)objdump -D $(BUILDDIR)/$(TARGET) > DISASS
|
$(XILINX_BASE)/bin/$(CROSS_COMPILE)objdump -D $(BUILDDIR)/$(TARGET) > DISASS
|
||||||
|
|
||||||
$(BUILDDIR)/src/ps7_init.o : ../OUT/ip/zynqps/ps7_init.c ../OUT/ip/zynqps/ps7_init.h
|
$(BUILDDIR)/src/ps7_init.o : $(BUILDROOT)/../OUT/ip/zynqps/ps7_init.c $(BUILDROOT)/../OUT/ip/zynqps/ps7_init.h
|
||||||
echo 'CC ' $@
|
echo 'CC ' $@
|
||||||
-mkdir -p $(shell dirname $@)
|
-mkdir -p $(shell dirname $@)
|
||||||
$(CC) $(CC_FLAGS) $(CC_WARNING) $(CC_INCLUDES) -MD -o $(BUILDDIR)/src/ps7_init.o -c ../OUT/ip/zynqps/ps7_init.c
|
$(CC) $(CC_FLAGS) $(CC_WARNING) $(CC_INCLUDES) -MD -o $(BUILDDIR)/src/ps7_init.o -c $(BUILDROOT)/../OUT/ip/zynqps/ps7_init.c
|
||||||
|
|
||||||
$(OBJFILES): $(BUILDDIR)/%.c.o: %.c
|
$(OBJFILES): $(BUILDDIR)/%.c.o: %.c
|
||||||
echo 'CC ' $@
|
echo 'CC ' $@
|
||||||
|
@ -75,6 +75,15 @@ _start:
|
|||||||
ldr sp, =__proc0_svc_stack /* load SVC mode stack pointer */
|
ldr sp, =__proc0_svc_stack /* load SVC mode stack pointer */
|
||||||
/* We are now in SVC mode */
|
/* We are now in SVC mode */
|
||||||
|
|
||||||
|
// Disable L1 cache
|
||||||
|
mov r0, #0
|
||||||
|
mcr p15, 0, r0, c7, c7, 0 // Invalidate cache
|
||||||
|
mcr p15, 0, r0, c8, c7, 0 // Invalidate tlb
|
||||||
|
mrc p15, 0, r0, c1, c0, 0
|
||||||
|
bic r0, r0, #0x1000
|
||||||
|
bic r0, r0, #0x0004
|
||||||
|
mcr p15, 0, r0, c1, c0, 0
|
||||||
|
|
||||||
/* Set vector table base address */
|
/* Set vector table base address */
|
||||||
ldr r0, =vectortable
|
ldr r0, =vectortable
|
||||||
mcr p15, #0, r0, c12, c0, #0
|
mcr p15, #0, r0, c12, c0, #0
|
||||||
|
@ -12,4 +12,5 @@ void main(){
|
|||||||
|
|
||||||
printf("Hello World!\n");
|
printf("Hello World!\n");
|
||||||
|
|
||||||
|
for(;;);
|
||||||
}
|
}
|
@ -90,4 +90,28 @@ files_verilog = OUT/synth/impl_netlist.v
|
|||||||
#files_sysverilog =
|
#files_sysverilog =
|
||||||
#files_xci =
|
#files_xci =
|
||||||
files_other = OUT/synth/impl_netlist.sdf
|
files_other = OUT/synth/impl_netlist.sdf
|
||||||
|
# ######################################
|
||||||
|
|
||||||
|
# ######################################
|
||||||
|
# Firmware compilation
|
||||||
|
[target.firmware]
|
||||||
|
toolchain = gccmake
|
||||||
|
|
||||||
|
# Toolchain settings
|
||||||
|
output_files = build/app.elf DISASS
|
||||||
|
buildroot = SW
|
||||||
|
|
||||||
|
# Fileset
|
||||||
|
files_makefile = SW/Makefile
|
||||||
|
files_other = SW/linker.ld
|
||||||
|
SW/src/boot.S
|
||||||
|
SW/src/main.c
|
||||||
|
SW/src/printf.c
|
||||||
|
SW/src/printf.h
|
||||||
|
SW/src/uart.c
|
||||||
|
SW/src/uart.h
|
||||||
|
SW/src/xil_io.h
|
||||||
|
SW/src/zynq.h
|
||||||
|
OUT/ip/zynqps/ps7_init.c
|
||||||
|
OUT/ip/zynqps/ps7_init.h
|
||||||
# ######################################
|
# ######################################
|
49
remotesyn/toolchains/gccmake.py
Normal file
49
remotesyn/toolchains/gccmake.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import shutil
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
def do(config, target, log, subprocesses, prefix='.'):
|
||||||
|
shutil.rmtree(config.get('project', 'build_dir', fallback='build'), True)
|
||||||
|
|
||||||
|
log("Starting gcc-make build process")
|
||||||
|
|
||||||
|
log(" - parsing options")
|
||||||
|
files_makefile = config.get(f'target.{target}', 'files_makefile', fallback='')
|
||||||
|
buildroot = config.get(f'target.{target}', 'buildroot', fallback='.')
|
||||||
|
output_files = config.get(f'target.{target}', 'output_files', fallback='').split()
|
||||||
|
build_dir = config.get(f'project', 'build_dir', fallback='build')
|
||||||
|
out_dir = config.get(f'project', 'out_dir', fallback='out')
|
||||||
|
|
||||||
|
prefix = f'{os.getcwd()}/{prefix}'
|
||||||
|
build_dir = f'{prefix}/{build_dir}'
|
||||||
|
out_dir = f'{prefix}/{out_dir}/{target}'
|
||||||
|
|
||||||
|
log(" - creating output directories")
|
||||||
|
os.makedirs(build_dir, exist_ok=True)
|
||||||
|
os.makedirs(out_dir, exist_ok=True)
|
||||||
|
|
||||||
|
log(" - Copy makefile to build directory")
|
||||||
|
shutil.copy(f"{prefix}/{files_makefile}", f"{build_dir}/Makefile")
|
||||||
|
|
||||||
|
log(" - run make")
|
||||||
|
p = subprocess.Popen(f"BUILDROOT={prefix}/{buildroot} make 2>make.log",
|
||||||
|
shell=True, cwd=build_dir,
|
||||||
|
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
subprocesses.append(p)
|
||||||
|
while p.poll() is None:
|
||||||
|
time.sleep(1)
|
||||||
|
res = p.returncode
|
||||||
|
|
||||||
|
log(" - copy logs")
|
||||||
|
shutil.copy(f'{build_dir}/make.log', f'{out_dir}/make.log')
|
||||||
|
|
||||||
|
if res!=0:
|
||||||
|
log("ERROR: make returned with:", res)
|
||||||
|
return res
|
||||||
|
|
||||||
|
log(" - copy output files")
|
||||||
|
for f in output_files:
|
||||||
|
shutil.copy(f'{build_dir}/{f}', f'{out_dir}/{os.path.basename(f)}')
|
||||||
|
|
||||||
|
return 0
|
Reference in New Issue
Block a user