Skip to content

Commit 3d6d88c

Browse files
committed
USPi library merged into main kernel project
1 parent a0de729 commit 3d6d88c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+88
-232
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
all:
33
make -C kernel
4-
make -C uspi
54
make -C zlib
65
make -C libpng
76
make -C libogg
@@ -15,7 +14,6 @@ all:
1514

1615
clean:
1716
make -C kernel -k clean
18-
make -C uspi -k clean
1917
make -C zlib -k clean
2018
make -C libpng -k clean
2119
make -C libogg -k clean

README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Raspberry Pi Baremetal
33
This a code repository for bare-metal Raspberry Pi libraries and applications
44
ports.
55

6-
kernel - Core startup and kernel code
6+
kernel - Core startup and kernel code, with USB support
7+
provided by USPi library
78

8-
uspi - An USB driver for Raspberry Pi written in C
99
libpng - PNG image file format library
1010
libogg - OGG file format library
1111
libvorbis - OGG Vorbis audio decode library

SDL2/.cproject

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</configuration>
5353
</storageModule>
5454
<storageModule moduleId="org.eclipse.cdt.core.externalSettings">
55-
<externalSettings containerId="uspi;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
55+
<externalSettings containerId="kernel;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
5656
</storageModule>
5757
</cconfiguration>
5858
</storageModule>

SDL2/.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<name>SDL2</name>
44
<comment></comment>
55
<projects>
6-
<project>uspi</project>
6+
<project>kernel</project>
77
</projects>
88
<buildSpec>
99
<buildCommand>

SDL2/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ OBJCOPY := $(TOOLCHAIN)-objcopy
1111
DEPDIR := .deps
1212

1313
ASFLAGS = --warn -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=softfp
14-
CFLAGS = -O3 -Iinclude -Isrc -I../uspi/include -ffreestanding -fvisibility=hidden -marm -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=softfp -D_REENTRANT -D__RASPBERRY_PI__ -DHAVE_USPI
14+
CFLAGS = -O3 -Iinclude -Isrc -I../kernel -ffreestanding -fvisibility=hidden -marm -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=softfp -D_REENTRANT -D__RASPBERRY_PI__ -DHAVE_USPI
1515
CPPFLAGS = $(CFLAGS) -fno-exceptions -fno-unwind-tables -fno-rtti
1616

1717
all: libSDL2.a

SDL2/pkgconfig.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
CFLAGS += -I../SDL2/include
33

4-
LIBS += -L../SDL2 -lSDL2
4+
LDFLAGS += -L../SDL2
5+
6+
LIBS := -lSDL2 $(LIBS)
57
LIBS_DEP += ../SDL2/libSDL2.a

SDL2_image/pkgconfig.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
CFLAGS += -I../SDL2_image
33

4-
LIBS += -L../SDL2_image -lSDL2_image
4+
LDFLAGS += -L../SDL2_image
5+
6+
LIBS := -lSDL2_image $(LIBS)
57
LIBS_DEP += ../SDL2_image/libSDL2_image.a

SDL2_mixer/pkgconfig.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
CFLAGS += -I../SDL2_mixer
33

4-
LIBS += -L../SDL2_mixer -lSDL2_mixer
4+
LDFLAGS += -L../SDL2_mixer
5+
6+
LIBS := -lSDL2_mixer $(LIBS)
57
LIBS_DEP += ../SDL2_mixer/libSDL2_mixer.a

abbaye/.cproject

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
<externalSettings containerId="SDL2;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
5858
<externalSettings containerId="SDL2_mixer;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
5959
<externalSettings containerId="SDL2_image;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
60-
<externalSettings containerId="uspi;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
6160
</storageModule>
6261
</cconfiguration>
6362
</storageModule>

abbaye/.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<project>SDL2_mixer</project>
88
<project>SDL2_image</project>
99
<project>kernel</project>
10-
<project>uspi</project>
1110
</projects>
1211
<buildSpec>
1312
<buildCommand>

abbaye/Makefile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@ all: kernel.img
33

44
include ../kernel/common.mk
55

6-
include ../SDL2_image/pkgconfig.mk
7-
include ../SDL2_mixer/pkgconfig.mk
8-
include ../SDL2/pkgconfig.mk
9-
include ../uspi/pkgconfig.mk
106
include ../libvorbis/pkgconfig.mk
117
include ../libpng/pkgconfig.mk
12-
13-
KOBJS = \
14-
../kernel/start.o \
15-
../kernel/syscalls.o
8+
include ../SDL2/pkgconfig.mk
9+
include ../SDL2_image/pkgconfig.mk
10+
include ../SDL2_mixer/pkgconfig.mk
1611

1712
OBJS = \
1813
data/enemies.o data/map.o \
@@ -30,8 +25,8 @@ CFLAGS += -finline-functions -funswitch-loops -fpredictive-commoning -fgcse-afte
3025

3126
-include $(DEPDIR)/*.Po
3227

33-
kernel.img: $(KOBJS) $(OBJS) Makefile ../kernel/raspberry.ld $(LIBS_DEP)
34-
$(CXX) $(LDFLAGS) $(KOBJS) $(OBJS) $(LIBS)
28+
kernel.img: $(OBJS) Makefile ../kernel/raspberry.ld $(LIBS_DEP)
29+
$(CXX) $(LDFLAGS) $(OBJS) $(LIBS)
3530
$(OBJCOPY) kernel.elf -O binary kernel.img
3631
rm kernel.elf
3732

kernel/.cproject

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1958204956" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
2626
<listOptionValue builtIn="false" value="HAVE_USPI"/>
2727
</option>
28-
<option id="gnu.c.compiler.option.include.paths.461836132" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
28+
<option id="gnu.c.compiler.option.include.paths.461836132" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
2929
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/uspi/include}&quot;"/>
3030
</option>
3131
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.460505247" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>

kernel/Makefile

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,56 @@
11

22
all: libkernel.a
33

4+
-include common.mk
5+
46
OBJS = \
7+
start.o \
58
audio.o \
69
console.o \
710
emmc.o \
811
fb.o \
912
ff.o \
1013
platform.o \
14+
syscalls.o \
1115
usb.o \
12-
wiring.o \
16+
wiring.o
17+
18+
ifeq ($(USPI),1)
19+
OBJS += \
20+
uspi/devicenameservice.o \
21+
uspi/dwhcidevice.o \
22+
uspi/dwhciframeschednper.o \
23+
uspi/dwhciframeschednsplit.o \
24+
uspi/dwhciframeschedper.o \
25+
uspi/dwhciregister.o \
26+
uspi/dwhcirootport.o \
27+
uspi/dwhcixferstagedata.o \
28+
uspi/keymap.o \
29+
uspi/macaddress.o \
30+
uspi/smsc951x.o \
31+
uspi/string.o \
32+
uspi/usbconfigparser.o \
33+
uspi/usbdevice.o \
34+
uspi/usbdevicefactory.o \
35+
uspi/usbendpoint.o \
36+
uspi/usbgamepad.o \
37+
uspi/usbkeyboard.o \
38+
uspi/usbmassdevice.o \
39+
uspi/usbmouse.o \
40+
uspi/usbrequest.o \
41+
uspi/usbstandardhub.o \
42+
uspi/usbstring.o \
43+
uspi/uspilibrary.o \
44+
uspi/util.o \
45+
uspi/synchronize.o \
46+
uspi/uspios.o
47+
endif
1348

14-
-include common.mk
1549
-include $(DEPDIR)/*.Po
1650

1751
libkernel.a: $(OBJS) start.o syscalls.o Makefile raspberry.ld
1852
$(AR) rcs -o $@ $(OBJS)
1953

2054
clean:
21-
rm -f $(OBJS) libkernel.a
55+
rm -f $(OBJS) start.o syscalls.o libkernel.a
2256
rm -rf $(DEPDIR)

kernel/common.mk

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11

2-
TOOLCHAIN := arm-none-eabi
2+
TOOLCHAIN := arm-none-eabi-
33

4-
CC := $(TOOLCHAIN)-gcc
5-
CXX := $(TOOLCHAIN)-g++
6-
LD := $(TOOLCHAIN)-ld
7-
AS := $(TOOLCHAIN)-as
8-
AR := $(TOOLCHAIN)-ar
9-
OBJCOPY := $(TOOLCHAIN)-objcopy
4+
CC := $(TOOLCHAIN)gcc
5+
CXX := $(TOOLCHAIN)g++
6+
LD := $(TOOLCHAIN)ld
7+
AS := $(TOOLCHAIN)as
8+
AR := $(TOOLCHAIN)ar
9+
OBJCOPY := $(TOOLCHAIN)objcopy
1010

1111
DEPDIR := .deps
12+
USPI := 1
1213

1314
ASFLAGS = --warn -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=softfp
14-
CFLAGS = -Wall -O2 -ffreestanding -marm -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=softfp -fsigned-char -D__RASPBERRY_PI__ -DHAVE_USPI -I../kernel -I../uspi/include
15+
CFLAGS = -Wall -O2 -ffreestanding -marm -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=softfp -fsigned-char -I../kernel -D__RASPBERRY_PI__
1516
CPPFLAGS = $(CFLAGS) -fno-exceptions -fno-unwind-tables -fno-rtti
1617
LDFLAGS = -T ../kernel/raspberry.ld -nostartfiles -fno-exceptions -fno-unwind-tables -fno-rtti -Wl,-Map=kernel.map -o kernel.elf
1718

18-
LIBS = -L../kernel -lkernel -L../uspi -luspi
19-
LIBS_DEP = ../kernel/libkernel.a ../uspi/libuspi.a
19+
ifeq ($(USPI),1)
20+
CFLAGS += -DHAVE_USPI
21+
endif
22+
23+
LDFLAGS += -L../kernel
24+
LIBS += -lkernel
25+
LIBS_DEP += ../kernel/libkernel.a
2026

2127
%.o: %.c
2228
@mkdir -p $(DEPDIR)/$(@D)

kernel/raspberry.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
ENTRY(_start)
22

3+
STARTUP(start.o)
4+
35
SECTIONS
46
{
57
. = 0x8000;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

libpng/pkgconfig.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
CFLAGS += -I../libpng -I../zlib
33

4-
LIBS += -L../libpng -lpng -L../zlib -lz
4+
LDFLAGS += -L../libpng -L../zlib
5+
6+
LIBS := -lpng -lz $(LIBS)
57
LIBS_DEP += ../libpng/libpng.a ../zlib/libz.a

libvorbis/pkgconfig.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
CFLAGS += -I../libvorbis/include -I../libogg/include
33

4-
LIBS += -L../libvorbis -L../libogg -lvorbis -logg
4+
LDFLAGS += -L../libvorbis -L../libogg
5+
6+
LIBS := -lvorbis -logg $(LIBS)
57
LIBS_DEP += ../libvorbis/libvorbis.a ../libogg/libogg.a

template/.cproject

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
</storageModule>
6060
<storageModule moduleId="org.eclipse.cdt.core.externalSettings">
6161
<externalSettings containerId="kernel;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
62-
<externalSettings containerId="uspi;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
6362
</storageModule>
6463
</cconfiguration>
6564
</storageModule>

template/.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<comment></comment>
55
<projects>
66
<project>kernel</project>
7-
<project>uspi</project>
87
</projects>
98
<buildSpec>
109
<buildCommand>

template/Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ all: kernel.img
33

44
include ../kernel/common.mk
55

6-
OBJS = \
7-
../kernel/start.o \
8-
../kernel/syscalls.o \
9-
main.o
6+
OBJS = main.o
107

118
-include $(DEPDIR)/*.Po
129

@@ -16,5 +13,5 @@ kernel.img: $(OBJS) Makefile ../kernel/raspberry.ld $(LIBS_DEP)
1613
rm kernel.elf
1714

1815
clean:
19-
rm -f *.o kernel.elf kernel.img kernel.map
16+
rm -f $(OBJS) kernel.elf kernel.img kernel.map
2017
rm -rf $(DEPDIR)

template/main.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535

3636
#endif
3737

38-
FATFS FatFs;
39-
FATFS USPiFatFs;
40-
4138
#if defined(__cplusplus)
4239
extern "C" {
4340
#endif

template_sdl/.cproject

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
</storageModule>
4747
<storageModule moduleId="org.eclipse.cdt.core.externalSettings">
4848
<externalSettings containerId="SDL2;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
49-
<externalSettings containerId="uspi;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
5049
</storageModule>
5150
</cconfiguration>
5251
</storageModule>

template_sdl/.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<comment></comment>
55
<projects>
66
<project>SDL2</project>
7-
<project>uspi</project>
87
</projects>
98
<buildSpec>
109
<buildCommand>

template_sdl/Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ all: kernel.img
44
include ../kernel/common.mk
55
include ../SDL2/pkgconfig.mk
66

7-
OBJS = \
8-
../kernel/start.o \
9-
../kernel/syscalls.o \
10-
main.o
7+
OBJS = main.o
118

129
-include $(DEPDIR)/*.Po
1310

@@ -17,5 +14,5 @@ kernel.img: $(OBJS) Makefile ../kernel/raspberry.ld $(LIBS_DEP)
1714
rm kernel.elf
1815

1916
clean:
20-
rm -f *.o kernel.elf kernel.img kernel.map
17+
rm -f $(OBJS) kernel.elf kernel.img kernel.map
2118
rm -rf $(DEPDIR)

0 commit comments

Comments
 (0)