diff --git a/rootfs.manifest b/rootfs.manifest index f3356d0..54085cc 100644 --- a/rootfs.manifest +++ b/rootfs.manifest @@ -698,55 +698,92 @@ file /share/dict/words file /share/misc/more.help # -# Files: /share/example +# Files: /share/examples/asm # default filemode 0664 -dir /share/example -file /share/example/ashello.S -file /share/example/blkjack.bas -file /share/example/chello.c -file /share/example/echo.S -file /share/example/fact.fth -file /share/example/hilow.bas -file /share/example/Makefile -file /share/example/prime.scm -file /share/example/skeleton.c -file /share/example/stars.bas -file /share/example/stdarg.c +dir /share/examples +dir /share/examples/asm +file /share/examples/asm/Makefile +file /share/examples/asm/ashello.S +file /share/examples/asm/echo.S # -# Files: /share/smallc +# Files: /share/examples/basic # -dir /share/smallc -file /share/smallc/adc.c -file /share/smallc/gpio.c -file /share/smallc/hello.c -file /share/smallc/Makefile -file /share/smallc/primelist.c -file /share/smallc/primesum.c -file /share/smallc/q8.c -file /share/smallc/rain.c -file /share/smallc/test1.c -file /share/smallc/test2.c -file /share/smallc/test3.c -file /share/smallc/webserver.c +dir /share/examples/basic +file /share/examples/basic/blkjack.bas +file /share/examples/basic/hilow.bas +file /share/examples/basic/stars.bas # -# Files: /share/smallerc +# Files: /share/examples/forth # -dir /share/smallerc -file /share/smallerc/adc.c -file /share/smallerc/gpio.c -file /share/smallerc/hello.c -file /share/smallerc/Makefile -file /share/smallerc/primelist.c -file /share/smallerc/primesum.c -file /share/smallerc/q8.c -file /share/smallerc/rain.c -file /share/smallerc/test1.c -file /share/smallerc/test2.c -file /share/smallerc/test3.c +dir /share/examples/forth +file /share/examples/forth/fact.fth + +# +# Files: /share/examples/scheme +# +dir /share/examples/scheme +file /share/examples/scheme/prime.scm + +# +# Files: /share/examples/c +# +dir /share/examples/c +file /share/examples/c/Makefile +file /share/examples/c/adc.c +file /share/examples/c/gpio.c +file /share/examples/c/hello.c +file /share/examples/c/primelist.c +file /share/examples/c/primesum.c +file /share/examples/c/q8.c +file /share/examples/c/rain.c +file /share/examples/c/skeleton.c +file /share/examples/c/stdarg.c +file /share/examples/c/test1.c +file /share/examples/c/test2.c +file /share/examples/c/test3.c + +# +# Files: /share/examples/smallc +# +dir /share/examples/smallc +file /share/examples/smallc/Makefile +file /share/examples/smallc/adc.c +file /share/examples/smallc/gpio.c +file /share/examples/smallc/hello.c +file /share/examples/smallc/primelist.c +file /share/examples/smallc/primesum.c +file /share/examples/smallc/q8.c +file /share/examples/smallc/rain.c +file /share/examples/smallc/test1.c +file /share/examples/smallc/test2.c +file /share/examples/smallc/test3.c +file /share/examples/smallc/webserver.c + +# +# Files: /share/examples/sensors +# +dir /share/examples/sensors +file /share/examples/sensors/Makefile +file /share/examples/sensors/README.txt +file /share/examples/sensors/buzzer.c +file /share/examples/sensors/buzzer.sh +file /share/examples/sensors/irled.c +file /share/examples/sensors/laser.c +file /share/examples/sensors/laser.sh +file /share/examples/sensors/led2.c +file /share/examples/sensors/led2-portio.sh +file /share/examples/sensors/led2.sh +file /share/examples/sensors/led3.c +file /share/examples/sensors/led3-portio.sh +file /share/examples/sensors/led3.sh +file /share/examples/sensors/led7.c +file /share/examples/sensors/pbuzz.c +file /share/examples/sensors/relay.c +file /share/examples/sensors/relay.sh # # Files: /var diff --git a/share/example/Makefile b/share/example/Makefile deleted file mode 100644 index 63d9e20..0000000 --- a/share/example/Makefile +++ /dev/null @@ -1,20 +0,0 @@ - -all: ashello echo chello stdarg skeleton - -ashello: ashello.o - $(LD) ashello.o -o $@ - -chello: chello.o - $(CC) chello.o -o $@ - -echo: echo.o - $(LD) $@.o -o $@ - -stdarg: stdarg.o - $(CC) stdarg.o -o $@ - -skeleton: skeleton.o - $(CC) skeleton.o -o $@ - -clean: - rm -f *.o ashello echo chello stdarg skeleton *.dis *~ diff --git a/share/example/Makefile-host b/share/example/Makefile-host deleted file mode 100644 index 1f4f425..0000000 --- a/share/example/Makefile-host +++ /dev/null @@ -1,29 +0,0 @@ -TOPSRC = $(shell cd ../..; pwd) -include $(TOPSRC)/target.mk - -CFLAGS += -Werror -ASFLAGS += -DCROSS -ASLDFLAGS = --oformat=elf32-tradlittlemips -N -nostartfiles -T $(TOPSRC)/src/elf32-mips.ld - -all: chello cplus echo stdarg - -chello: chello.o - ${CC} ${LDFLAGS} -o chello.elf chello.o ${LIBS} - ${OBJDUMP} -S chello.elf > chello.dis - ${SIZE} chello.elf - ${ELF2AOUT} chello.elf $@ - -cplus: cplus.o - ${CXX} ${LDFLAGS} -nostdlib -o cplus.elf cplus.o ${LIBS} - ${OBJDUMP} -S cplus.elf > cplus.dis - ${SIZE} cplus.elf - ${ELF2AOUT} cplus.elf $@ - -echo: echo.o - ${LD} ${ASLDFLAGS} -o $@.elf $@.o - ${OBJDUMP} -S $@.elf > $@.dis - ${SIZE} $@.elf - ${ELF2AOUT} $@.elf $@ - -clean: - rm -f *.o *.elf ${MAN} chello cplus echo stdarg *.elf *.dis tags *~ diff --git a/share/examples/asm/Makefile b/share/examples/asm/Makefile new file mode 100644 index 0000000..27b66d9 --- /dev/null +++ b/share/examples/asm/Makefile @@ -0,0 +1,11 @@ + +all: ashello echo + +ashello: ashello.o + $(LD) ashello.o -o $@ + +echo: echo.o + $(LD) $@.o -o $@ + +clean: + rm -f *.o ashello echo *.dis *~ diff --git a/share/examples/asm/Makefile-host b/share/examples/asm/Makefile-host new file mode 100644 index 0000000..29ba567 --- /dev/null +++ b/share/examples/asm/Makefile-host @@ -0,0 +1,17 @@ +TOPSRC = $(shell cd ../../..; pwd) +include $(TOPSRC)/target.mk + +CFLAGS += -Werror +ASFLAGS += -DCROSS +ASLDFLAGS = --oformat=elf32-tradlittlemips -N -nostartfiles -T $(TOPSRC)/src/elf32-mips.ld + +all: echo + +echo: echo.o + ${LD} ${ASLDFLAGS} -o $@.elf $@.o + ${OBJDUMP} -S $@.elf > $@.dis + ${SIZE} $@.elf + ${ELF2AOUT} $@.elf $@ + +clean: + rm -f *.o *.elf ${MAN} echo *.elf *.dis tags *~ diff --git a/share/example/ashello.S b/share/examples/asm/ashello.S similarity index 100% rename from share/example/ashello.S rename to share/examples/asm/ashello.S diff --git a/share/example/echo.S b/share/examples/asm/echo.S similarity index 100% rename from share/example/echo.S rename to share/examples/asm/echo.S diff --git a/share/example/blkjack.bas b/share/examples/basic/blkjack.bas similarity index 100% rename from share/example/blkjack.bas rename to share/examples/basic/blkjack.bas diff --git a/share/example/hilow.bas b/share/examples/basic/hilow.bas similarity index 100% rename from share/example/hilow.bas rename to share/examples/basic/hilow.bas diff --git a/share/example/stars.bas b/share/examples/basic/stars.bas similarity index 100% rename from share/example/stars.bas rename to share/examples/basic/stars.bas diff --git a/share/examples/c/Makefile b/share/examples/c/Makefile new file mode 100644 index 0000000..ada7a70 --- /dev/null +++ b/share/examples/c/Makefile @@ -0,0 +1,44 @@ +CC = cc +PROG = hello stdarg skeleton primelist primesum test1 test2 test3 \ + gpio adc rain q8 + +all: $(PROG) + +hello: hello.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +stdarg: stdarg.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +skeleton: skeleton.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +primelist: primelist.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +primesum: primesum.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +gpio: gpio.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +adc: adc.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +rain: rain.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +q8: q8.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +test1: test1.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +test2: test2.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +test3: test3.c + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $? + +clean: + rm -f *.o *~ $(PROG) diff --git a/share/examples/c/Makefile-host b/share/examples/c/Makefile-host new file mode 100644 index 0000000..f828620 --- /dev/null +++ b/share/examples/c/Makefile-host @@ -0,0 +1,15 @@ +TOPSRC = $(shell cd ../../..; pwd) +include $(TOPSRC)/target.mk + +CFLAGS += -Werror + +all: chello stdarg + +chello: chello.o + ${CC} ${LDFLAGS} -o chello.elf chello.o ${LIBS} + ${OBJDUMP} -S chello.elf > chello.dis + ${SIZE} chello.elf + ${ELF2AOUT} chello.elf $@ + +clean: + rm -f *.o *.elf ${MAN} chello stdarg *.elf *.dis tags *~ diff --git a/share/smallerc/adc.c b/share/examples/c/adc.c similarity index 100% rename from share/smallerc/adc.c rename to share/examples/c/adc.c diff --git a/share/smallerc/gpio.c b/share/examples/c/gpio.c similarity index 100% rename from share/smallerc/gpio.c rename to share/examples/c/gpio.c diff --git a/share/example/chello.c b/share/examples/c/hello.c similarity index 100% rename from share/example/chello.c rename to share/examples/c/hello.c diff --git a/share/smallerc/primelist.c b/share/examples/c/primelist.c similarity index 100% rename from share/smallerc/primelist.c rename to share/examples/c/primelist.c diff --git a/share/smallerc/primesum.c b/share/examples/c/primesum.c similarity index 100% rename from share/smallerc/primesum.c rename to share/examples/c/primesum.c diff --git a/share/smallerc/q8.c b/share/examples/c/q8.c similarity index 100% rename from share/smallerc/q8.c rename to share/examples/c/q8.c diff --git a/share/smallerc/rain.c b/share/examples/c/rain.c similarity index 100% rename from share/smallerc/rain.c rename to share/examples/c/rain.c diff --git a/share/example/skeleton.c b/share/examples/c/skeleton.c similarity index 100% rename from share/example/skeleton.c rename to share/examples/c/skeleton.c diff --git a/share/example/stdarg.c b/share/examples/c/stdarg.c similarity index 100% rename from share/example/stdarg.c rename to share/examples/c/stdarg.c diff --git a/share/smallerc/test1.c b/share/examples/c/test1.c similarity index 100% rename from share/smallerc/test1.c rename to share/examples/c/test1.c diff --git a/share/smallerc/test2.c b/share/examples/c/test2.c similarity index 100% rename from share/smallerc/test2.c rename to share/examples/c/test2.c diff --git a/share/smallerc/test3.c b/share/examples/c/test3.c similarity index 100% rename from share/smallerc/test3.c rename to share/examples/c/test3.c diff --git a/share/examples/cplus/Makefile-host b/share/examples/cplus/Makefile-host new file mode 100644 index 0000000..9b5b535 --- /dev/null +++ b/share/examples/cplus/Makefile-host @@ -0,0 +1,15 @@ +TOPSRC = $(shell cd ../../..; pwd) +include $(TOPSRC)/target.mk + +CFLAGS += -Werror + +all: cplus + +cplus: cplus.o + ${CXX} ${LDFLAGS} -nostdlib -o cplus.elf cplus.o ${LIBS} + ${OBJDUMP} -S cplus.elf > cplus.dis + ${SIZE} cplus.elf + ${ELF2AOUT} cplus.elf $@ + +clean: + rm -f *.o *.elf ${MAN} cplus *.elf *.dis tags *~ diff --git a/share/example/cplus.cpp b/share/examples/cplus/cplus.cpp similarity index 100% rename from share/example/cplus.cpp rename to share/examples/cplus/cplus.cpp diff --git a/share/example/fact.fth b/share/examples/forth/fact.fth similarity index 100% rename from share/example/fact.fth rename to share/examples/forth/fact.fth diff --git a/share/example/prime.scm b/share/examples/scheme/prime.scm similarity index 100% rename from share/example/prime.scm rename to share/examples/scheme/prime.scm diff --git a/share/examples/sensors/Makefile b/share/examples/sensors/Makefile new file mode 100644 index 0000000..5e6eb74 --- /dev/null +++ b/share/examples/sensors/Makefile @@ -0,0 +1,27 @@ +PROG = led2 led3 relay buzzer laser pbuzz irled + +all: $(PROG) + +relay: relay.c + cc $? -o $@ + +buzzer: buzzer.c + cc $? -o $@ + +pbuzz: pbuzz.c + cc $? -o $@ + +laser: laser.c + cc $? -o $@ + +led2: led2.c + cc $? -o $@ + +led3: led3.c + cc $? -o $@ + +irled: irled.c + cc $? -o $@ + +clean: + rm -f *.o *~ $(PROG) diff --git a/share/examples/sensors/README.txt b/share/examples/sensors/README.txt new file mode 100644 index 0000000..7d94c53 --- /dev/null +++ b/share/examples/sensors/README.txt @@ -0,0 +1,4 @@ +Examples for 37-in-1 sensor kit. + +For details, see: + https://github.com/sergev/RetroBSD-and-37-Sensor-Kit/wiki diff --git a/share/examples/sensors/buzzer.c b/share/examples/sensors/buzzer.c new file mode 100644 index 0000000..e3195ec --- /dev/null +++ b/share/examples/sensors/buzzer.c @@ -0,0 +1,48 @@ +/* + * Example for RetroBSD on Olimex Duinomite board. + * Active buzzer is connected to D0 pin of Duinomite board. + * Use ioctl() calls to poll the user button, and control the buzzer. + */ +#include +#include +#include + +/* + * Pin D0 is connected to signal RE0 on pic32 chip. + * User button is connected to signal RD8 on pic32 chip. + */ +#define MASK_D0 (1 << 0) /* signal RE0 */ +#define MASK_BUTTON (1 << 8) /* signal RD8 */ + +int main() +{ + int fd, portb; + char *devname = "/dev/porta"; + + /* Open GPIO driver. */ + fd = open(devname, 1); + if (fd < 0) { + perror(devname); + return -1; + } + + /* Configure pins. */ + ioctl(fd, GPIO_PORTD | GPIO_CONFIN, MASK_BUTTON); + ioctl(fd, GPIO_PORTE | GPIO_CONFOUT, MASK_D0); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + + for (;;) { + /* Poll button at RD8 every 20 msec (active low). */ + usleep(20000); + portb = ioctl(fd, GPIO_PORTD | GPIO_POLL, 0); + + if (~portb & MASK_BUTTON) { + /* Enable buzzer at D0. */ + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D0); + } else { + /* Disable buzzer at D0. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + } + } + return 0; +} diff --git a/share/examples/sensors/buzzer.sh b/share/examples/sensors/buzzer.sh new file mode 100644 index 0000000..f6a02fe --- /dev/null +++ b/share/examples/sensors/buzzer.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# Set signal RD8 as input, RE0 as output. +echo -------i-------- > /dev/confd +echo ---------------o > /dev/confe +echo ---------------0 > /dev/porte + +while : +do + # Poll button (active low) + read portd < /dev/portd + case $portd in + ???????0????????) + # Switch buzzer on + echo ---------------1 > /dev/porte + ;; + ???????1????????) + # Switch buzzer off + echo ---------------0 > /dev/porte + ;; + esac +done diff --git a/share/examples/sensors/irled.c b/share/examples/sensors/irled.c new file mode 100644 index 0000000..87fd738 --- /dev/null +++ b/share/examples/sensors/irled.c @@ -0,0 +1,56 @@ +/* + * Example for RetroBSD on Olimex Duinomite board. + * Infrared LED is connected to D0 pin of Duinomite board. + * Use ioctl() calls to poll the user button, and control the buzzer. + */ +#include +#include +#include + +/* + * Pin D0 is connected to signal RE0 on pic32 chip. + * User button is connected to signal RD8 on pic32 chip. + */ +#define MASK_D0 (1 << 0) /* signal RE0 */ +#define MASK_BUTTON (1 << 8) /* signal RD8 */ + +int main() +{ + int fd, portb; + char *devname = "/dev/porta"; + + /* Open GPIO driver. */ + fd = open(devname, 1); + if (fd < 0) { + perror(devname); + return -1; + } + + /* Configure pins. */ + ioctl(fd, GPIO_PORTD | GPIO_CONFIN, MASK_BUTTON); + ioctl(fd, GPIO_PORTE | GPIO_CONFOUT, MASK_D0); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + + for (;;) { + /* Poll button at RD8 (active low). */ + portb = ioctl(fd, GPIO_PORTD | GPIO_POLL, 0); + + if (~portb & MASK_BUTTON) { + /* Transmit a series of three pulses 50 msec each, + * repeat every second. */ + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D0); + usleep(50000); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + usleep(50000); + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D0); + usleep(50000); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + usleep(50000); + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D0); + usleep(50000); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + usleep(750000); + } + } + return 0; +} diff --git a/share/examples/sensors/laser.c b/share/examples/sensors/laser.c new file mode 100644 index 0000000..1337c1b --- /dev/null +++ b/share/examples/sensors/laser.c @@ -0,0 +1,48 @@ +/* + * Example for RetroBSD on Olimex Duinomite board. + * Laser is connected to D0 pin of Duinomite board. + * Use ioctl() calls to poll the user button, and control the laser. + */ +#include +#include +#include + +/* + * Pin D0 is connected to signal RE0 on pic32 chip. + * User button is connected to signal RD8 on pic32 chip. + */ +#define MASK_D0 (1 << 0) /* signal RE0 */ +#define MASK_BUTTON (1 << 8) /* signal RD8 */ + +int main() +{ + int fd, portb; + char *devname = "/dev/porta"; + + /* Open GPIO driver. */ + fd = open(devname, 1); + if (fd < 0) { + perror(devname); + return -1; + } + + /* Configure pins. */ + ioctl(fd, GPIO_PORTD | GPIO_CONFIN, MASK_BUTTON); + ioctl(fd, GPIO_PORTE | GPIO_CONFOUT, MASK_D0); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + + for (;;) { + /* Poll button at RD8 every 20 msec (active low). */ + usleep(20000); + portb = ioctl(fd, GPIO_PORTD | GPIO_POLL, 0); + + if (~portb & MASK_BUTTON) { + /* Enable laser at D0. */ + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D0); + } else { + /* Disable laser at D0. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + } + } + return 0; +} diff --git a/share/examples/sensors/laser.sh b/share/examples/sensors/laser.sh new file mode 100644 index 0000000..2c76302 --- /dev/null +++ b/share/examples/sensors/laser.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# Set signal RD8 as input, RE0 as output. +echo -------i-------- > /dev/confd +echo ---------------o > /dev/confe +echo ---------------0 > /dev/porte + +while : +do + # Poll button (active low) + read portd < /dev/portd + case $portd in + ???????0????????) + # Switch relay on + echo ---------------1 > /dev/porte + ;; + ???????1????????) + # Switch relay off + echo ---------------0 > /dev/porte + ;; + esac +done diff --git a/share/examples/sensors/led2-portio.sh b/share/examples/sensors/led2-portio.sh new file mode 100644 index 0000000..6e47fa7 --- /dev/null +++ b/share/examples/sensors/led2-portio.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Example for RetroBSD on Olimex Duinomite board. +# RGB LED is connected to D1 and D0 pins of Duinomite board. +# Use /dev/porte device to control LED. +# + +# Pins D0 and D1 are connected to signals RE0 and RE1 of pic32 chip. +# Set up them as output. +portio -o e0 e1 +portio -c e0 e1 + +while : +do + portio -c e0 -s e1 + portio -c e1 -s e0 +done diff --git a/share/examples/sensors/led2.c b/share/examples/sensors/led2.c new file mode 100644 index 0000000..21138d9 --- /dev/null +++ b/share/examples/sensors/led2.c @@ -0,0 +1,44 @@ +/* + * Example for RetroBSD on Olimex Duinomite board. + * RGB LED is connected to D1 and D0 pins of Duinomite board. + * Use ioctl() calls to control LED. + */ +#include +#include +#include + +/* + * Pins D0 and D1 are connected to signals RE0 and RE1 of pic32 chip. + */ +#define MASK_D0 (1 << 0) /* signal RE0 */ +#define MASK_D1 (1 << 1) /* signal RE1 */ + +int main() +{ + int fd; + char *devname = "/dev/porta"; + + /* Open GPIO driver. */ + fd = open(devname, 1); + if (fd < 0) { + perror(devname); + return -1; + } + + /* Configure pins as output. */ + ioctl(fd, GPIO_PORTE | GPIO_CONFOUT, MASK_D0 | MASK_D1); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0 | MASK_D1); + + for (;;) { + /* Clear D0, set D1. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D1); + usleep(250000); + + /* Clear D1, set D0. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D1); + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D0); + usleep(250000); + } + return 0; +} diff --git a/share/examples/sensors/led2.sh b/share/examples/sensors/led2.sh new file mode 100644 index 0000000..cb4e801 --- /dev/null +++ b/share/examples/sensors/led2.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# Example for RetroBSD on Olimex Duinomite board. +# RGB LED is connected to D1 and D0 pins of Duinomite board. +# Use /dev/porte device to control LED. +# + +# Pins D0 and D1 are connected to signals RE0 and RE1 of pic32 chip. +# Set up them as output. +echo --------------oo > /dev/confe +echo --------------00 > /dev/porte + +while : +do + echo --------------10 > /dev/porte + sleep 1 + echo --------------01 > /dev/porte + sleep 1 +done diff --git a/share/examples/sensors/led3-portio.sh b/share/examples/sensors/led3-portio.sh new file mode 100644 index 0000000..f8dd9d4 --- /dev/null +++ b/share/examples/sensors/led3-portio.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Example for RetroBSD on Olimex Duinomite board. +# RGB LED is connected to D7, D6 and D5 pins of Duinomite board. +# Use portio utility to control LED. +# + +# Pins D5, D6 and D7 are connected to signals RE5, RE6 and RE7 of pic32 chip. +# Set up them as output. +portio -o e5-7 +portio -c e5-7 + +while : +do + portio -c e5 -s e7 + portio -c e7 -s e6 + portio -c e6 -s e5 +done diff --git a/share/examples/sensors/led3.c b/share/examples/sensors/led3.c new file mode 100644 index 0000000..4b3323f --- /dev/null +++ b/share/examples/sensors/led3.c @@ -0,0 +1,50 @@ +/* + * Example for RetroBSD on Olimex Duinomite board. + * RGB LED is connected to D7, D6 and D5 pins of Duinomite board. + * Use ioctl() calls to control LED. + */ +#include +#include +#include + +/* + * Pins D5, D6 and D7 are connected to signals RE5, RE6 and RE7 of pic32 chip. + */ +#define MASK_D5 (1 << 5) /* signal RE5 */ +#define MASK_D6 (1 << 6) /* signal RE6 */ +#define MASK_D7 (1 << 7) /* signal RE7 */ + +int main() +{ + int fd; + char *devname = "/dev/porta"; + + /* Open GPIO driver. */ + fd = open(devname, 1); + if (fd < 0) { + perror(devname); + return -1; + } + + /* Configure pins as output. */ + ioctl(fd, GPIO_PORTE | GPIO_CONFOUT, MASK_D5 | MASK_D6 | MASK_D7); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D5 | MASK_D6 | MASK_D7); + + for (;;) { + /* Clear D5, set D7. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D5); + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D7); + usleep(100000); + + /* Clear D7, set D6. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D7); + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D6); + usleep(100000); + + /* Clear D6, set D5. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D6); + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D5); + usleep(100000); + } + return 0; +} diff --git a/share/examples/sensors/led3.sh b/share/examples/sensors/led3.sh new file mode 100644 index 0000000..cbc4486 --- /dev/null +++ b/share/examples/sensors/led3.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Example for RetroBSD on Olimex Duinomite board. +# RGB LED is connected to D7, D6 and D5 pins of Duinomite board. +# Use /dev/porte device to control LED. +# + +# Pins D5, D6 and D7 are connected to signals RE5, RE6 and RE7 of pic32 chip. +# Set up them as output. +echo --------ooo----- > /dev/confe +echo --------000----- > /dev/porte + +while : +do + echo --------100----- > /dev/porte + sleep 1 + echo --------010----- > /dev/porte + sleep 1 + echo --------001----- > /dev/porte + sleep 1 +done diff --git a/share/examples/sensors/led7.c b/share/examples/sensors/led7.c new file mode 100644 index 0000000..9105611 --- /dev/null +++ b/share/examples/sensors/led7.c @@ -0,0 +1,41 @@ +/* + * Example for RetroBSD on Olimex Duinomite board. + * RGB LED is connected to D7, D6 and D5 pins of Duinomite board. + * Use ioctl() calls to control LED. + */ +#include +#include +#include + +/* + * Pin D2 is connected to signal RE2 on pic32 chip. + */ +#define MASK_D2 (1 << 2) /* signal RE2 */ + +int main() +{ + int fd; + char *devname = "/dev/porta"; + + /* Open GPIO driver. */ + fd = open(devname, 1); + if (fd < 0) { + perror(devname); + return -1; + } + + /* Configure pin as output. */ + ioctl(fd, GPIO_PORTE | GPIO_CONFOUT, MASK_D2); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D2); + + for (;;) { + /* Set D2. */ + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D2); + sleep(15); + + /* Clear D2. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D2); + sleep(3); + } + return 0; +} diff --git a/share/examples/sensors/pbuzz.c b/share/examples/sensors/pbuzz.c new file mode 100644 index 0000000..1bf23bc --- /dev/null +++ b/share/examples/sensors/pbuzz.c @@ -0,0 +1,48 @@ +/* + * Example for RetroBSD on Olimex Duinomite board. + * Passive buzzer is connected to D0 pin of Duinomite board. + * Use ioctl() calls to poll the user button, and control the buzzer. + */ +#include +#include +#include + +/* + * Pin D0 is connected to signal RE0 on pic32 chip. + * User button is connected to signal RD8 on pic32 chip. + */ +#define MASK_D0 (1 << 0) /* signal RE0 */ +#define MASK_BUTTON (1 << 8) /* signal RD8 */ + +int main() +{ + int fd, portb; + char *devname = "/dev/porta"; + + /* Open GPIO driver. */ + fd = open(devname, 1); + if (fd < 0) { + perror(devname); + return -1; + } + + /* Configure pins. */ + ioctl(fd, GPIO_PORTD | GPIO_CONFIN, MASK_BUTTON); + ioctl(fd, GPIO_PORTE | GPIO_CONFOUT, MASK_D0); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + + for (;;) { + /* Poll button at RD8 (active low). */ + portb = ioctl(fd, GPIO_PORTD | GPIO_POLL, 0); + + if (~portb & MASK_BUTTON) { + /* Toggle buzzer at D0. */ + ioctl(fd, GPIO_PORTE | GPIO_INVERT, MASK_D0); + usleep(5000); + } else { + /* Disable buzzer at D0. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + } + } + return 0; +} diff --git a/share/examples/sensors/relay.c b/share/examples/sensors/relay.c new file mode 100644 index 0000000..119e9c8 --- /dev/null +++ b/share/examples/sensors/relay.c @@ -0,0 +1,48 @@ +/* + * Example for RetroBSD on Olimex Duinomite board. + * Relay is connected to D0 pin of Duinomite board. + * Use ioctl() calls to poll the user button, and control the relay. + */ +#include +#include +#include + +/* + * Pin D0 is connected to signal RE0 on pic32 chip. + * User button is connected to signal RD8 on pic32 chip. + */ +#define MASK_D0 (1 << 0) /* signal RE0 */ +#define MASK_BUTTON (1 << 8) /* signal RD8 */ + +int main() +{ + int fd, portb; + char *devname = "/dev/porta"; + + /* Open GPIO driver. */ + fd = open(devname, 1); + if (fd < 0) { + perror(devname); + return -1; + } + + /* Configure pins. */ + ioctl(fd, GPIO_PORTD | GPIO_CONFIN, MASK_BUTTON); + ioctl(fd, GPIO_PORTE | GPIO_CONFOUT, MASK_D0); + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + + for (;;) { + /* Poll button at RD8 every 20 msec (active low). */ + usleep(20000); + portb = ioctl(fd, GPIO_PORTD | GPIO_POLL, 0); + + if (~portb & MASK_BUTTON) { + /* Enable relay at D0. */ + ioctl(fd, GPIO_PORTE | GPIO_SET, MASK_D0); + } else { + /* Disable relay at D0. */ + ioctl(fd, GPIO_PORTE | GPIO_CLEAR, MASK_D0); + } + } + return 0; +} diff --git a/share/examples/sensors/relay.sh b/share/examples/sensors/relay.sh new file mode 100644 index 0000000..2c76302 --- /dev/null +++ b/share/examples/sensors/relay.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# Set signal RD8 as input, RE0 as output. +echo -------i-------- > /dev/confd +echo ---------------o > /dev/confe +echo ---------------0 > /dev/porte + +while : +do + # Poll button (active low) + read portd < /dev/portd + case $portd in + ???????0????????) + # Switch relay on + echo ---------------1 > /dev/porte + ;; + ???????1????????) + # Switch relay off + echo ---------------0 > /dev/porte + ;; + esac +done diff --git a/share/smallc/Makefile b/share/examples/smallc/Makefile similarity index 100% rename from share/smallc/Makefile rename to share/examples/smallc/Makefile diff --git a/share/smallc/adc.c b/share/examples/smallc/adc.c similarity index 100% rename from share/smallc/adc.c rename to share/examples/smallc/adc.c diff --git a/share/smallc/gpio.c b/share/examples/smallc/gpio.c similarity index 100% rename from share/smallc/gpio.c rename to share/examples/smallc/gpio.c diff --git a/share/smallc/hello.c b/share/examples/smallc/hello.c similarity index 100% rename from share/smallc/hello.c rename to share/examples/smallc/hello.c diff --git a/share/smallc/primelist.c b/share/examples/smallc/primelist.c similarity index 100% rename from share/smallc/primelist.c rename to share/examples/smallc/primelist.c diff --git a/share/smallc/primesum.c b/share/examples/smallc/primesum.c similarity index 100% rename from share/smallc/primesum.c rename to share/examples/smallc/primesum.c diff --git a/share/smallc/q8.c b/share/examples/smallc/q8.c similarity index 100% rename from share/smallc/q8.c rename to share/examples/smallc/q8.c diff --git a/share/smallc/rain.c b/share/examples/smallc/rain.c similarity index 100% rename from share/smallc/rain.c rename to share/examples/smallc/rain.c diff --git a/share/smallc/test1.c b/share/examples/smallc/test1.c similarity index 100% rename from share/smallc/test1.c rename to share/examples/smallc/test1.c diff --git a/share/smallc/test2.c b/share/examples/smallc/test2.c similarity index 100% rename from share/smallc/test2.c rename to share/examples/smallc/test2.c diff --git a/share/smallc/test3.c b/share/examples/smallc/test3.c similarity index 100% rename from share/smallc/test3.c rename to share/examples/smallc/test3.c diff --git a/share/smallc/webserver.c b/share/examples/smallc/webserver.c similarity index 100% rename from share/smallc/webserver.c rename to share/examples/smallc/webserver.c diff --git a/share/smallerc/Makefile b/share/smallerc/Makefile deleted file mode 100644 index 977a786..0000000 --- a/share/smallerc/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -CC = cc -PROG = hello primelist primesum test1 test2 test3 gpio adc rain \ - q8 - -all: $(PROG) - -hello: hello.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) hello.c - -primelist: primelist.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) primelist.c - -primesum: primesum.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) primesum.c - -gpio: gpio.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) gpio.c - -adc: adc.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) adc.c - -rain: rain.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) rain.c - -q8: q8.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) q8.c - -test1: test1.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) test1.c - -test2: test2.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) test2.c - -test3: test3.c - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) test3.c - -clean: - rm -f *.o $(PROG) diff --git a/share/smallerc/hello.c b/share/smallerc/hello.c deleted file mode 100644 index c72c91b..0000000 --- a/share/smallerc/hello.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) -{ - printf("Hello, Smaller C World!\n"); -} diff --git a/src/cmd/adc-demo/Makefile b/src/cmd/adc-demo/Makefile index 74a1794..17472d8 100644 --- a/src/cmd/adc-demo/Makefile +++ b/src/cmd/adc-demo/Makefile @@ -10,7 +10,6 @@ include $(TOPSRC)/target.mk OBJS = adc-demo.o SRCS = adc-demo.c -LIBS += -lcurses -ltermcap -lc all: adc-demo diff --git a/src/cmd/adc-demo/adc-demo.c b/src/cmd/adc-demo/adc-demo.c index 812032f..4d37023 100644 --- a/src/cmd/adc-demo/adc-demo.c +++ b/src/cmd/adc-demo/adc-demo.c @@ -1,93 +1,63 @@ #include #include -#include #include #include #include +int fd[16]; +int value[16]; -WINDOW *win; - -struct channel { - int fd; - int value; - char enabled; -}; +void putsym(int c, int count) +{ + while (count-- > 1) + putchar(c); +} int main(int argc, char **argv) { - struct channel channels[16]; - char temp[100]; - int i; + char buf[100]; + int i, opt; long flags; - int value; - const char opts[] = ":d:"; - int opt; - unsigned long delay = 100; + unsigned long delay_msec = 100; - for(i=0; i<16; i++) - channels[i].enabled = 1; - - while((opt = getopt(argc, argv, opts)) != -1) - { - switch(opt) - { + while ((opt = getopt(argc, argv, ":d:")) != -1) { + switch (opt) { case 'd': - delay = atol(optarg); + delay_msec = strtol(optarg, 0, 0); break; } } - for(i=0; i<16; i++) - { - if(channels[i].enabled == 1) - { - sprintf(temp,"/dev/adc%d",i); - channels[i].fd = open(temp,O_RDWR); - if(!channels[i].fd) - { - printf("Error: unable to open %s\n",temp); - exit(10); - } - fcntl(channels[i].fd,F_GETFD,&flags); - flags |= O_NONBLOCK; - fcntl(channels[i].fd,F_SETFD,&flags); + for (i=0; i<16; i++) { + sprintf(buf, "/dev/adc%d", i); + fd[i] = open(buf, O_RDWR); + if (fd[i] < 0) { + perror(buf); + return -1; } + fcntl(fd[i], F_GETFD, &flags); + flags |= O_NONBLOCK; + fcntl(fd[i], F_SETFD, &flags); } - win = initscr(); + /* Clear screen. */ + printf("\33[2J"); - clear(); - while(1) - { - clear(); - for(i=0; i<16; i++) - { - if(channels[i].enabled == 1) - { - if(read(channels[i].fd,temp,20)) - { - if(sscanf(temp,"%d",&value)) - { - channels[i].value = value; - } - } - sprintf(temp,"adc%-2d %4d ",i,channels[i].value); - mvwaddstr(win,i,0,temp); - for(value=0; value>4; value++) - { - mvwaddch(win,i,value+11,'='); - } - // clrtoeol(); + for (;;) { + /* Top of screen. */ + printf("\33[H"); + + for (i=0; i<16; i++) { + if (read(fd[i], buf, 20) > 0) { + value[i] = strtol(buf, 0, 0); } + printf("adc%-2d %4d ", i, value[i]); + putsym('=', value[i] >> 4); + + /* Clear to end of line. */ + printf("\33[K"); + printf("\n"); } - refresh(); - usleep(delay * 1000); + usleep(delay_msec * 1000); } - - for(i=0; i<16; i++) - { - close(channels[i].fd); - } - endwin(); } diff --git a/sys/pic32/duinomite/DUINOMITE b/sys/pic32/duinomite/DUINOMITE index bdde407..b5b49da 100644 --- a/sys/pic32/duinomite/DUINOMITE +++ b/sys/pic32/duinomite/DUINOMITE @@ -19,3 +19,5 @@ device sd0 port=3 cs=D5 power=B13 device gpio device foreignbootloader +device adc +device oc diff --git a/sys/pic32/duinomite/Makefile b/sys/pic32/duinomite/Makefile index 8fba7b2..0336247 100644 --- a/sys/pic32/duinomite/Makefile +++ b/sys/pic32/duinomite/Makefile @@ -6,9 +6,10 @@ S = ../../../tools/configsys/../../sys/kernel vpath %.c $(M):$(S) vpath %.S $(M):$(S) -KERNOBJ += clock.o cons.o devsw.o exception.o exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o gpio.o init_main.o init_sysent.o kern_clock.o kern_descrip.o kern_exec.o kern_exit.o kern_fork.o kern_mman.o kern_proc.o kern_prot.o kern_prot2.o kern_resource.o kern_sig.o kern_sig2.o kern_subr.o kern_synch.o kern_sysctl.o kern_time.o machdep.o mem.o rd_sd.o rdisk.o signal.o spi_bus.o startup.o subr_prf.o subr_rmap.o swap.o sys_generic.o sys_inode.o sys_pipe.o sys_process.o syscalls.o sysctl.o tty.o tty_subr.o tty_tty.o ufs_alloc.o ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_mount.o ufs_namei.o ufs_subr.o ufs_syscalls.o ufs_syscalls2.o usb_device.o usb_function_cdc.o usb_uart.o vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o +KERNOBJ += adc.o clock.o cons.o devsw.o exception.o exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o gpio.o init_main.o init_sysent.o kern_clock.o kern_descrip.o kern_exec.o kern_exit.o kern_fork.o kern_mman.o kern_proc.o kern_prot.o kern_prot2.o kern_resource.o kern_sig.o kern_sig2.o kern_subr.o kern_synch.o kern_sysctl.o kern_time.o machdep.o mem.o oc.o rd_sd.o rdisk.o signal.o spi_bus.o startup.o subr_prf.o subr_rmap.o swap.o sys_generic.o sys_inode.o sys_pipe.o sys_process.o syscalls.o sysctl.o tty.o tty_subr.o tty_tty.o ufs_alloc.o ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_mount.o ufs_namei.o ufs_subr.o ufs_syscalls.o ufs_syscalls2.o usb_device.o usb_function_cdc.o usb_uart.o vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o EXTRA_TARGETS = +DEFS += -DADC_ENABLED=YES DEFS += -DBUS_DIV=1 DEFS += -DBUS_KHZ=80000 DEFS += -DCONSOLE_DEVICE=ttyUSB0 @@ -50,6 +51,7 @@ DEFS += -DLED_DISK_PIN=12 DEFS += -DLED_DISK_PORT=TRISB DEFS += -DLED_KERNEL_PIN=15 DEFS += -DLED_KERNEL_PORT=TRISB +DEFS += -DOC_ENABLED=YES DEFS += -DPIC32MX7 DEFS += -DSD0_CS_PIN=5 DEFS += -DSD0_CS_PORT=TRISD diff --git a/sys/pic32/gpio.c b/sys/pic32/gpio.c index 0fe7dd3..40abd95 100644 --- a/sys/pic32/gpio.c +++ b/sys/pic32/gpio.c @@ -155,7 +155,7 @@ filter_out (mask, portnum, portaddr, pin) } /* - * Some pins are not available in harsware or used by other drivers. + * Some pins are not available in hardware or used by other drivers. * Remove them from the mask. */ static u_int @@ -245,7 +245,7 @@ gpio_print (dev, buf) register u_int mask, conf, tris; register char c; - conf = gpio_confmask [unit]; + conf = gpio_confmask[unit]; tris = reg->tris; if (minor(dev) & MINOR_CONF) { /* /dev/confX device: port configuration mask */ @@ -293,28 +293,35 @@ gpio_parse (dev, buf) c = *buf++; if (c <= ' ' || c > '~') break; - if (c == 'x' || c == 'X') - gpio_confmask [unit] &= ~mask; - else if (c == 'i' || c == 'I') + + if (c == 'x' || c == 'X') { + gpio_confmask[unit] &= ~mask; reg->trisset = mask; - else if (c == 'o' || c == 'O') { + } else if (c == 'i' || c == 'I') { + gpio_confmask[unit] |= mask; + reg->trisset = mask; + } else if (c == 'o' || c == 'O') { + gpio_confmask[unit] |= mask; reg->odcclr = mask; reg->trisclr = mask; } else if (c == 'd' || c == 'D') { + gpio_confmask[unit] |= mask; reg->odcset = mask; reg->trisclr = mask; } } } else { /* /dev/portX device: port value mask */ - u_int conf = gpio_confmask [unit]; + u_int conf = gpio_confmask[unit]; u_int tris = reg->tris; for (mask=1<<(NPINS-1); mask; mask>>=1) { c = *buf++; if (c <= ' ' || c > '~') break; + if (! (conf & mask) || (tris & mask)) continue; + if (c == '0') reg->latclr = mask; else @@ -555,16 +562,16 @@ gpioioctl (dev, cmd, addr, flag) if (cmd & GPIO_COMMAND & (GPIO_CONFIN | GPIO_CONFOUT | GPIO_CONFOD)) mask = gpio_filter (mask, unit); else - mask &= gpio_confmask [unit]; + mask &= gpio_confmask[unit]; if (cmd & GPIO_COMMAND & GPIO_CONFIN) { /* configure as input */ PRINTDBG ("TRIS%cSET %p := %04x\n", unit+'A', ®->trisset, mask); reg->trisset = mask; - gpio_confmask [unit] |= mask; + gpio_confmask[unit] |= mask; /* skip output-only bits */ - gpio_confmask [unit] ^= mask & ~reg->tris; + gpio_confmask[unit] ^= mask & ~reg->tris; } if (cmd & GPIO_COMMAND & (GPIO_CONFOUT | GPIO_CONFOD)) { if (cmd & GPIO_COMMAND & GPIO_CONFOUT) { @@ -578,20 +585,20 @@ gpioioctl (dev, cmd, addr, flag) } PRINTDBG ("TRIS%cCLR %p := %04x\n", unit+'A', ®->trisclr, mask); reg->trisclr = mask; - gpio_confmask [unit] |= mask; + gpio_confmask[unit] |= mask; /* skip input-only bits */ - gpio_confmask [unit] ^= mask & reg->tris; + gpio_confmask[unit] ^= mask & reg->tris; } if (cmd & GPIO_COMMAND & GPIO_DECONF) { /* deconfigure */ - gpio_confmask [unit] &= ~mask; + gpio_confmask[unit] &= ~mask; } if (cmd & GPIO_COMMAND & GPIO_STORE) { /* store all outputs */ value = reg->lat; PRINTDBG ("LAT%c %p -> %04x\n", unit+'A', ®->lat, value); - value &= ~gpio_confmask [unit]; + value &= ~gpio_confmask[unit]; value |= mask; PRINTDBG ("LAT%c %p := %04x\n", unit+'A', ®->lat, value); reg->lat = value; diff --git a/sys/pic32/maximite-color/MAXIMITE-COLOR b/sys/pic32/maximite-color/MAXIMITE-COLOR index 8d29d77..010864c 100644 --- a/sys/pic32/maximite-color/MAXIMITE-COLOR +++ b/sys/pic32/maximite-color/MAXIMITE-COLOR @@ -20,4 +20,4 @@ device sd0 port=4 cs=A1 device gpio -device bootloader button=C13 user=0x1d005000 led=E1 +#device bootloader button=C13 user=0x1d005000 led=E1 diff --git a/sys/pic32/maximite-color/Makefile b/sys/pic32/maximite-color/Makefile index 856905a..5895249 100644 --- a/sys/pic32/maximite-color/Makefile +++ b/sys/pic32/maximite-color/Makefile @@ -6,13 +6,9 @@ S = ../../../tools/configsys/../../sys/kernel vpath %.c $(M):$(S) vpath %.S $(M):$(S) -KERNOBJ += clock.o cons.o devsw.o exception.o exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o gpio.o init_main.o init_sysent.o kern_clock.o kern_descrip.o kern_exec.o kern_exit.o kern_fork.o kern_mman.o kern_proc.o kern_prot.o kern_prot2.o kern_resource.o kern_sig.o kern_sig2.o kern_subr.o kern_synch.o kern_sysctl.o kern_time.o machdep.o mem.o rd_sd.o rdisk.o signal.o spi_bus.o startup.o subr_prf.o subr_rmap.o swap.o sys_generic.o sys_inode.o sys_pipe.o sys_process.o syscalls.o sysctl.o tty.o tty_subr.o tty_tty.o ufs_alloc.o ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_mount.o ufs_namei.o ufs_subr.o ufs_syscalls.o ufs_syscalls2.o usb_device.o usb_function_cdc.o usb_uart.o vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = bootloader +KERNOBJ += clock.o cons.o devcfg.o devsw.o exception.o exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o gpio.o init_main.o init_sysent.o kern_clock.o kern_descrip.o kern_exec.o kern_exit.o kern_fork.o kern_mman.o kern_proc.o kern_prot.o kern_prot2.o kern_resource.o kern_sig.o kern_sig2.o kern_subr.o kern_synch.o kern_sysctl.o kern_time.o machdep.o mem.o rd_sd.o rdisk.o signal.o spi_bus.o startup.o subr_prf.o subr_rmap.o swap.o sys_generic.o sys_inode.o sys_pipe.o sys_process.o syscalls.o sysctl.o tty.o tty_subr.o tty_tty.o ufs_alloc.o ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_mount.o ufs_namei.o ufs_subr.o ufs_syscalls.o ufs_syscalls2.o usb_device.o usb_function_cdc.o usb_uart.o vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o +EXTRA_TARGETS = -DEFS += -DBL_BUTTON_PIN=13 -DEFS += -DBL_BUTTON_PORT=TRISC -DEFS += -DBL_LED_PIN=1 -DEFS += -DBL_LED_PORT=TRISE DEFS += -DBUS_DIV=1 DEFS += -DBUS_KHZ='CPU_KHZ/BUS_DIV' DEFS += -DCONSOLE_DEVICE=ttyUSB0 @@ -48,14 +44,7 @@ DEFS += -DDC3_VBUSON=DEVCFG3_FVBUSONIO DEFS += -DEXEC_AOUT DEFS += -DEXEC_ELF DEFS += -DEXEC_SCRIPT -DEFS += -DFLASH_USER=0x1d005000 DEFS += -DGPIO_ENABLED=YES -DEFS += -DHID_FEATURE_REPORT_BYTES=2 -DEFS += -DHID_INPUT_REPORT_BYTES=2 -DEFS += -DHID_INT_IN_EP_SIZE=64 -DEFS += -DHID_INT_OUT_EP_SIZE=64 -DEFS += -DHID_OUTPUT_REPORT_BYTES=2 -DEFS += -DHID_RPT01_SIZE=29 DEFS += -DKERNEL DEFS += -DLED_DISK_PIN=1 DEFS += -DLED_DISK_PORT=TRISE @@ -68,7 +57,6 @@ DEFS += -DSD0_CS_PORT=TRISA DEFS += -DSD0_PORT=4 DEFS += -DUARTUSB_ENABLED=YES DEFS += -DUCB_METER -DEFS += -DUSB_EP0_BUFF_SIZE=8 DEFS += -DUSB_MAX_EP_NUMBER=3 DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3