refactored Makefile, fixed support for different Raspberry versions
This commit is contained in:
parent
6dc9452b2a
commit
a7b87c4c05
13 changed files with 94 additions and 98076 deletions
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
*.o
|
||||
*.a
|
||||
*.elf
|
||||
*.img
|
||||
*.lst
|
||||
*.map
|
|
@ -19,11 +19,11 @@
|
|||
#include "Keyboard.h"
|
||||
#include <string.h>
|
||||
#include <uspi.h>
|
||||
#include "timer.h"
|
||||
#include "Timer.h"
|
||||
#include "debug.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "uspi\devicenameservice.h"
|
||||
#include "uspi/devicenameservice.h"
|
||||
}
|
||||
|
||||
#define REPEAT_RATE 8
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
#include <uspi\usbkeyboard.h>
|
||||
#include <uspi/usbkeyboard.h>
|
||||
}
|
||||
|
||||
#define MAX_KEYS 0x7f
|
||||
|
|
94
Makefile
94
Makefile
|
@ -1,81 +1,31 @@
|
|||
#
|
||||
# Makefile
|
||||
#
|
||||
OBJS = armc-start.o armc-cstartup.o armc-cstubs.o armc-cppstubs.o \
|
||||
exception.o main.o rpi-aux.o rpi-mailbox-interface.o rpi-mailbox.o \
|
||||
rpi-gpio.o rpi-interrupts.o cache.o ff.o interrupt.o Keyboard.o \
|
||||
Pi1541.o DiskImage.o iec_bus.o iec_commands.o m6502.o m6522.o \
|
||||
Drive.o gcr.o prot.o lz.o emmc.o diskio.o options.o Screen.o \
|
||||
Timer.o FileBrowser.o DiskCaddy.o ROMs.o InputMappings.o xga_font_data.o
|
||||
|
||||
OBJS = armc-start.o armc-cstartup.o armc-cstubs.o armc-cppstubs.o exception.o main.o rpi-aux.o rpi-mailbox-interface.o rpi-mailbox.o rpi-gpio.o rpi-interrupts.o cache.o ff.o interrupt.o keyboard.o Pi1541.o DiskImage.o iec_bus.o iec_commands.o m6502.o m6522.o drive.o gcr.o prot.o lz.o emmc.o diskio.o options.o Screen.o Timer.o FileBrowser.o DiskCaddy.o ROMs.o InputMappings.o xga_font_data.o
|
||||
LIBS = uspi/lib/libuspi.a
|
||||
INCLUDE = -Iuspi/include/
|
||||
|
||||
kernel.img: $(OBJS) $(OBJSS)
|
||||
$(LD) -o kernel.elf -Map kernel.map -T linker.ld $(OBJS) $(LIBS)
|
||||
$(PREFIX)objdump -d kernel.elf | $(PREFIX)c++filt > kernel.lst
|
||||
$(PREFIX)objcopy kernel.elf -O binary kernel.img
|
||||
wc -c kernel.img
|
||||
TARGET ?= kernel
|
||||
|
||||
GCC_BASE = "C:/Program Files (x86)/GNU Tools ARM Embedded/5.4 2016q2"
|
||||
.PHONY: all $(LIBS)
|
||||
|
||||
RASPPI ?= 3
|
||||
PREFIX ?= arm-none-eabi-
|
||||
all: $(TARGET)
|
||||
|
||||
CC = $(PREFIX)gcc
|
||||
CPP = $(PREFIX)g++
|
||||
AS = $(CC)
|
||||
LD = $(PREFIX)ld
|
||||
AR = $(PREFIX)ar
|
||||
$(TARGET): $(OBJS) $(LIBS)
|
||||
@echo " LINK $@"
|
||||
$(Q)$(CC) $(CFLAGS) -o $(TARGET).elf -Xlinker -Map=$(TARGET).map -T linker.ld -nostartfiles $(OBJS) $(LIBS)
|
||||
$(Q)$(PREFIX)objdump -d $(TARGET).elf | $(PREFIX)c++filt > $(TARGET).lst
|
||||
$(Q)$(PREFIX)objcopy $(TARGET).elf -O binary $(TARGET).img
|
||||
|
||||
ifeq ($(strip $(RASPPI)),0)
|
||||
#ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPIZERO=1 -DDEBUG
|
||||
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPIZERO=1
|
||||
CFLAGS += -DRPIZERO=1
|
||||
endif
|
||||
ifeq ($(strip $(RASPPI)),1)
|
||||
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfloat-abi=hard -DRPIZERO=1
|
||||
CFLAGS += -DRPIBPLUS=1
|
||||
endif
|
||||
ifeq ($(strip $(RASPPI)),2)
|
||||
ARCH ?= -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -marm -DRPI2=1
|
||||
CFLAGS += -DRPI2=1
|
||||
endif
|
||||
ifeq ($(strip $(RASPPI)),3)
|
||||
ARCH ?= -march=armv8-a -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm -DRPI3=1 -DDEBUG -DNDEBUG
|
||||
#ARCH ?= -march=armv8-a -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm -DRPI3=1
|
||||
CFLAGS += -DRPI3=1
|
||||
endif
|
||||
uspi/lib/libuspi.a:
|
||||
$(MAKE) -C uspi/lib
|
||||
|
||||
LIBS = $(GCC_BASE)/arm-none-eabi/lib/fpu/libc.a $(GCC_BASE)/lib/gcc/arm-none-eabi/5.4.1/fpu/libgcc.a
|
||||
LIBS += uspi/lib/libuspi.a -lstdc++
|
||||
clean: clean_libs
|
||||
|
||||
INCLUDE += -I $(GCC_BASE)/arm-none-eabi/include -I $(GCC_BASE)/lib/gcc/arm-none-eabi/5.4.1/include
|
||||
#INCLUDE += -I USB/include
|
||||
INCLUDE += -I uspi/include
|
||||
#INCLUDE += -I uspi/include/uspi
|
||||
clean_libs:
|
||||
$(MAKE) -C uspi/lib clean
|
||||
|
||||
AFLAGS += $(ARCH) $(INCLUDE)
|
||||
CFLAGS += $(ARCH) -Wall -Wno-psabi -fsigned-char -fno-builtin $(INCLUDE)
|
||||
#-Wno-packed-bitfield-compat
|
||||
#CFLAGS += -O3
|
||||
#CFLAGS += -O4
|
||||
CFLAGS += -Ofast
|
||||
CPPFLAGS+= $(CFLAGS) -fno-exceptions -fno-rtti -std=c++0x -Wno-write-strings
|
||||
|
||||
CFLAGS += -fno-delete-null-pointer-checks -fdata-sections -ffunction-sections -u _printf_float
|
||||
|
||||
%.o: %.S
|
||||
$(AS) $(AFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
#assm add -S
|
||||
%.o: %.cpp
|
||||
$(CPP) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
# rm -f *.o *.a *.elf *.lst *.img *.cir *.map *~ $(EXTRACLEAN)
|
||||
del *.o
|
||||
del *.a
|
||||
del *.elf
|
||||
del *.img
|
||||
|
||||
|
||||
|
||||
|
||||
#arm-none-eabi-objdump -D kernel.elf > kernel.elf.asm
|
||||
include Makefile.rules
|
51
Makefile.rules
Normal file
51
Makefile.rules
Normal file
|
@ -0,0 +1,51 @@
|
|||
# To show build commands: make
|
||||
ifneq ($(V),1)
|
||||
Q := @
|
||||
endif
|
||||
|
||||
RASPPI ?= 3
|
||||
PREFIX ?= arm-none-eabi-
|
||||
|
||||
CC = $(PREFIX)gcc
|
||||
CPP = $(PREFIX)g++
|
||||
AS = $(CC)
|
||||
LD = $(PREFIX)ld
|
||||
AR = $(PREFIX)ar
|
||||
|
||||
ifeq ($(strip $(RASPPI)),0)
|
||||
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPIZERO=1
|
||||
CFLAGS += -DRPIZERO=1 -DRASPPI=1
|
||||
else ifeq ($(strip $(RASPPI)),1)
|
||||
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPIBPLUS=1
|
||||
CFLAGS += -DRPIBPLUS=1 -DRASPPI=1
|
||||
else ifeq ($(strip $(RASPPI)),2)
|
||||
ARCH ?= -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -marm -DRPI2=1
|
||||
CFLAGS += -DRPI2=1
|
||||
else ifeq ($(strip $(RASPPI)),3)
|
||||
ARCH ?= -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm -DRPI3=1
|
||||
CFLAGS += -DRPI3=1
|
||||
else
|
||||
$(error RASPPI must be one of: 0, 1, 2, 3)
|
||||
endif
|
||||
|
||||
AFLAGS += $(ARCH)
|
||||
CFLAGS += $(ARCH) -Wall -Wno-psabi -fsigned-char -fno-builtin -Ofast -DNDEBUG
|
||||
CPPFLAGS += $(CFLAGS) -fno-exceptions -fno-rtti -std=c++0x -Wno-write-strings
|
||||
CFLAGS += -fno-delete-null-pointer-checks -fdata-sections -ffunction-sections -u _printf_float
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
%.o: %.S
|
||||
@echo " AS $@"
|
||||
$(Q)$(AS) $(AFLAGS) $(INCLUDE) -c -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
@echo " CC $@"
|
||||
$(Q)$(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $<
|
||||
|
||||
%.o: %.cpp
|
||||
@echo " CPP $@"
|
||||
$(Q)$(CPP) $(CPPFLAGS) $(INCLUDE) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
$(RM) *.o *.a *.elf *.lst *.img *.map
|
10
README.md
10
README.md
|
@ -17,13 +17,9 @@ Building
|
|||
--------
|
||||
|
||||
I use GNU Tools ARM Embedded tool chain 5.4.1 on Windows using make. https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads/5-2016-q2-update
|
||||
There are two make files.
|
||||
One in uspi\lib and Pi1541's make file the root folder.
|
||||
You will need to edit the make files to set GCC_BASE to the location of your GNU tools.
|
||||
(If anyone knows how to fix this requirement then please fix it. arm-none-eabi-gcc can find the include paths why can't arm-none-eabi-ld find the library paths?)
|
||||
|
||||
You need to build uspi\lib first.
|
||||
Change to uspi\lib and make.
|
||||
Change back to the root folder of the project and again make.
|
||||
```
|
||||
make
|
||||
```
|
||||
This will build kernel.img
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _Singleton_h_
|
||||
#define _Singleton_h_
|
||||
|
||||
#include "Types.h"
|
||||
#include "types.h"
|
||||
|
||||
template <typename T>
|
||||
class Singleton
|
||||
|
|
2
Timer.c
2
Timer.c
|
@ -1,4 +1,4 @@
|
|||
#include "timer.h"
|
||||
#include "Timer.h"
|
||||
#include "bcm2835int.h"
|
||||
#include "rpiHardware.h"
|
||||
|
||||
|
|
92402
kernel.lst
92402
kernel.lst
File diff suppressed because it is too large
Load diff
5519
kernel.map
5519
kernel.map
File diff suppressed because it is too large
Load diff
2
main.cpp
2
main.cpp
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "defs.h"
|
||||
#include <string.h>
|
||||
#include "timer.h"
|
||||
#include "Timer.h"
|
||||
#include "ROMs.h"
|
||||
#include "stb_image.h"
|
||||
extern "C"
|
||||
|
|
2
types.h
2
types.h
|
@ -2,7 +2,7 @@
|
|||
#define types_h
|
||||
|
||||
#include <stddef.h>
|
||||
#include <uspi\types.h>
|
||||
#include <uspi/types.h>
|
||||
#include "integer.h"
|
||||
|
||||
typedef unsigned long long u64;
|
||||
|
|
|
@ -27,76 +27,12 @@ OBJS = uspilibrary.o \
|
|||
dwhcirootport.o usbmouse.o \
|
||||
dwhciframeschednsplit.o usbgamepad.o synchronize.o usbstring.o usbmidi.o
|
||||
|
||||
INCLUDE = -I../include
|
||||
|
||||
all: libuspi.a
|
||||
|
||||
libuspi.a: $(OBJS)
|
||||
# rm -f libuspi.a
|
||||
$(AR) cr libuspi.a $(OBJS)
|
||||
|
||||
USPIHOME = ..
|
||||
|
||||
GCC_BASE = "C:/Program Files (x86)/GNU Tools ARM Embedded/7 2017-q4-major"
|
||||
|
||||
RASPPI ?= 3
|
||||
PREFIX ?= arm-none-eabi-
|
||||
|
||||
CC = $(PREFIX)gcc
|
||||
CPP = $(PREFIX)g++
|
||||
AS = $(CC)
|
||||
LD = $(PREFIX)ld
|
||||
AR = $(PREFIX)ar
|
||||
|
||||
ifeq ($(strip $(RASPPI)),0)
|
||||
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPIZERO=1
|
||||
CFLAGS += -DRPIZERO=1
|
||||
CFLAGS += -DRASPPI=1
|
||||
endif
|
||||
ifeq ($(strip $(RASPPI)),1)
|
||||
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfloat-abi=hard -DRPIZERO=1
|
||||
CFLAGS += -DRPIBPLUS=1
|
||||
CFLAGS += -DRASPPI=1
|
||||
endif
|
||||
ifeq ($(strip $(RASPPI)),2)
|
||||
ARCH ?= -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -marm -DRPI2=1
|
||||
CFLAGS += -DRPI2=1
|
||||
endif
|
||||
ifeq ($(strip $(RASPPI)),3)
|
||||
ARCH ?= -march=armv8-a -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm -DRPI3=1 -DDEBUG -DNDEBUG
|
||||
#ARCH ?= -march=armv8-a -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm -DRPI3=1
|
||||
CFLAGS += -DRPI3=1
|
||||
endif
|
||||
|
||||
LIBS = $(GCC_BASE)/arm-none-eabi/lib/fpu/libc.a $(GCC_BASE)/lib/gcc/arm-none-eabi/5.4.1/fpu/libgcc.a
|
||||
|
||||
INCLUDE += -I $(GCC_BASE)/arm-none-eabi/include -I $(GCC_BASE)/lib/gcc/arm-none-eabi/5.4.1/include -I include
|
||||
INCLUDE += -I $(USPIHOME)/include
|
||||
|
||||
AFLAGS += $(ARCH) $(INCLUDE)
|
||||
CFLAGS += $(ARCH) -Wall -Wno-psabi -fsigned-char -fno-builtin $(INCLUDE)
|
||||
# -Wno-packed-bitfield-compat
|
||||
#CFLAGS += -O3
|
||||
#CFLAGS += -O4
|
||||
CFLAGS += -Ofast
|
||||
|
||||
CPPFLAGS+= $(CFLAGS) -fno-exceptions -fno-rtti -std=c++0x -Wno-write-strings -llibusb
|
||||
|
||||
CFLAGS += -fno-delete-null-pointer-checks -fdata-sections -ffunction-sections -u _printf_float
|
||||
|
||||
%.o: %.S
|
||||
$(AS) $(AFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
#assm add -S
|
||||
%.o: %.cpp
|
||||
$(CPP) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
# rm -f *.o *.a *.elf *.lst *.img *.cir *.map *~ $(EXTRACLEAN)
|
||||
del *.o
|
||||
del *.a
|
||||
del *.elf
|
||||
del *.img
|
||||
|
||||
@echo " LINK $@"
|
||||
$(Q)$(AR) cr libuspi.a $(OBJS)
|
||||
|
||||
include ../../Makefile.rules
|
Loading…
Reference in a new issue