Create generic kconfig script for pic32 platform.

This commit is contained in:
Serge Vakulenko
2015-08-30 21:10:19 -07:00
parent 0aaf6c25f6
commit d80a636a62
10 changed files with 586 additions and 343 deletions

278
sys/pic32/Config.generic Normal file
View File

@@ -0,0 +1,278 @@
#
# Generic kernel configuration for PIC32 processor.
#
# This file contains all the devices and all the options available
# for the pic32 platform. It's not expected to be buildable, as some
# devices and options are mutually exclusive or incompatible.
# It's intended to be used as a reference or as a starting point
# when creating configuration for a new board.
#
machine "pic32"
cpu "PIC32MX"
ident CHIPKIT_MAX
# Linker script
ldscript "pic32/bootloader-max32.ld"
# Need to set locally
timezone 8 dst
maxusers 2
# Standard system options
options "CPU_KHZ=80000" # Oscillator frequency of CPU core
options "BUS_KHZ=80000" # Frequency of peripheral bus
options "HZ=100" # Rate of clock interrupt
#???options "BUS_DIV=1" # Bus clock divisor 1/2/4/8
#???options "CRYSTAL=8" # PLL input frequency in MHz
#???options "CPU_IDIV=2" # PLL input divisor 1/2/3/4/5/6/10/12
#???options "CPU_ODIV=1" # PLL output divisor 1/2/4/8/16/32/64/256
#???options "CPU_MUL=20" # PLL multiplier 15/16/17/18/19/20/21/24
options "EXEC_AOUT" # Run a.out binaries
options "EXEC_ELF" # Run ELF binaries
options "EXEC_SCRIPT" # Run shell scripts
options "UCB_METER" # Collect kernel statistics
options "NPROC=10" # Number of processes, default 10
options "NBUF=10" # Number of i/o buffers, default 10
options "NFILE=24" # Number of files, default 24
options "NINODE=24" # Number of i-nodes, default 24
options "NMOUNT=2" # Number of mounted filesystems, default 2
options "SMAPSIZ=NPROC" # Size of swap map, default NPROC
options "HALTREBOOT" # Reboot the processor on halt()
options "KERNEL_HIGHLIGHT" # Highlight kernel messages
options "PARTITION='%1'" # Partition schema for RAM device
# LEDs
options "LED_DISK_PORT=TRISF" # for disk activity LED...
options "LED_DISK_PIN=0" # ...use pin RF0
options "LED_DISK_INVERT" # invert disk LED
options "LED_SWAP_PORT=TRISF" # for swap activity LED...
options "LED_SWAP_PIN=1" # ...use pin RF1
options "LED_SWAP_INVERT" # invert swap LED
options "LED_TTY_PORT=TRISA" # for tty LED...
options "LED_TTY_PIN=2" # ...use pin RA2
options "LED_TTY_INVERT" # invert tty LED
options "LED_KERNEL_PORT=TRISA" # for kernel actibity LED...
options "LED_KERNEL_PIN=3" # ...use pin RA3
options "LED_KERNEL_INVERT" # invert kernel LED
# Root filesystem at /dev/sd0a, swap at /dev/sd0b
config unix root on sd0a
swap on sd0b
dumps on sd0b
# Serial UART ports
device uart1 # Serial-to-USB converter
device uart2
device uart3
device uart4
options "UART_ENABLED" # TODO: delete this option
options "UART1_BAUD=115200" # default speed
options "UART4_BAUD=115200" # default speed
options "UART4_ENA_PORT=TRISB" # to enable power for uart4...
options "UART4_ENA_PIN=13" # ...use pin RB13
# USB UART ports
device uartusb # USB device mode, CDC function
options "UARTUSB_BAUD=115200" # default speed
options "USB_AUTOBOOT=YES" # don't wait for <Enter> on boot
options "UARTUSB_ENABLED" # TODO: delete this option
options "USB_MAX_EP_NUMBER=3" # parameters of USB device...
options "USB_NUM_STRING_DESCRIPTORS=3" # ...specific for CDC function
# Console options
options "CONSOLE_DEVICE=tty0" # /dev/tty0
#TODO: options "CONS_MAJOR=17" # use UART device as console
#TODO: options "CONS_MINOR=0" # use uart1 unit as console
# SPI ports
controller spi2 # SD card
options "SPI_ENABLED" # TODO: delete this option
# microSD card
disk sd0 at spi2 flags 0x3e # select pin RC14
options "SD0_MHZ=10" # speed 10 MHz
options "SD0_PORT=2" # at spi2 TODO: delete
options "SD0_CS_PORT=TRISC" # for chip select... TODO: use flags
options "SD0_CS_PIN=14" # ...use pin RC14 TODO: use flags
options "SD0_ENA_PORT=TRISA" # to enable SD card...
options "SD0_ENA_PIN=5" # ...use pin RA5
# General purpose I/O ports
device gpio0
options "GPIO_ENABLED" # TODO: delete this option
options "GPIO_CLEAR_PORT=TRISA" # clear on startup...
options "GPIO_CLEAR_PIN=5" # ...pin RA5
# ADC driver
device adc0
options "ADC_ENABLED" # TODO: delete this option
# PWM driver
device pwm0
options "PWM_ENABLED" # TODO: delete this option
# GLCD driver
device glcd
options "GLCD_ENABLED" # TODO: delete this option
# HX8357 driver
device hxtft
options "HX8357_ENABLED" # TODO: delete this option
# Skeleton driver
device skel0
options "SKEL_ENABLED" # TODO: delete this option
# Pseudo terminals
pseudo-device pty 4
options "PTY_ENABLED" # TODO: delete this option
# System log
pseudo-device log
options "LOG_ENABLED" # TODO: delete this option
# Power control
pseudo-device power
options "POWER_ENABLED" # TODO: delete this option
options "POWER_LED_PORT=TRISA" # for power LED...
options "POWER_LED_PIN=3" # ...use pin RA3
options "POWER_SWITCH_PORT=TRISA" # for power switch...
options "POWER_SWITCH_PIN=4" # ...use pin RA4
options "POWER_CONTROL_PORT=TRISA" # for power switch...
options "POWER_CONTROL_PIN=5" # ...use pin RA5
#--------------------------------------------
# Custom RAM disk devices
#
# sdramp - SDRAM block device
disk sdramp0 # SDRAM on external memory bus
options "SDRAMP_ENABLED" # TODO: delete this option
options "KERNEL_EXECUTABLE_RAM" # allow kernel code in RAM area
# sramc - SRAM block device
disk sramc0 # SRAM via 4-wire CPLD interface
options "SRAMC_ENABLED" # TODO: delete this option
options "SRAMC_DATA_PORT=TRISE" # for DATA signal...
options "SRAMC_DATA_PIN=0" # ...use pin RE0
options "SRAMC_LDA_PORT=TRISC" # for LDA signal...
options "SRAMC_LDA_PIN=13" # ...use pin RC13
options "SRAMC_RD_PORT=TRISF" # for RD signal...
options "SRAMC_RD_PIN=1" # ...use pin RF1
options "SRAMC_WR_PORT=TRISF" # for WR signal...
options "SRAMC_WR_PIN=0" # ...use pin RF0
# picga - SPI block device
controller spi1 # RAM disk: picga
disk picga0 at spi1
options "PICGA_ENABLED" # TODO: delete this option
options "PICGA_BUS=SPI1CON" # TODO: delete this option
options "PICGA_CS_PORT=TRISA" # for CS...
options "PICGA_CS_PIN=4" # ...use pin RA4
# mrams - SPI block device
controller spi1 # RAM disk: mrams
disk mrams0 at spi1
options "MRAMS_ENABLED" # TODO: delete this option
options "MRAMS_PORT=SPI1CON" # TODO: delete this option
options "MRAMS_CHIPS=6" # number of chips
options "MRAMS_CHIPSIZE=512" # chip size in kbytes
options "MRAMS_MHZ=10" # speed 10 MHz
options "MRAMS_CS0_PORT=TRISA" # for CS0...
options "MRAMS_CS0_PIN=4" # ...use pin RA4
options "MRAMS_CS1_PORT=TRISA" # for CS1...
options "MRAMS_CS1_PIN=2" # ...use pin RA2
options "MRAMS_CS2_PORT=TRISB" # for CS2...
options "MRAMS_CS2_PIN=14" # ...use pin RB14
options "MRAMS_CS3_PORT=TRISB" # for CS3...
options "MRAMS_CS3_PIN=12" # ...use pin RB12
options "MRAMS_CS4_PORT=TRISB" # for CS4...
options "MRAMS_CS4_PIN=10" # ...use pin RB10
options "MRAMS_CS5_PORT=TRISB" # for CS5...
options "MRAMS_CS5_PIN=11" # ...use pin RB11
options "MRAMS_LED0_PORT=TRISF" # for LED0...
options "MRAMS_LED0_PIN=0" # ...use pin RF0
options "MRAMS_LED1_PORT=TRISF" # for LED1...
options "MRAMS_LED1_PIN=1" # ...use pin RF1
options "MRAMS_LED2_PORT=TRISF" # for LED2...
options "MRAMS_LED2_PIN=2" # ...use pin RF2
options "MRAMS_LED3_PORT=TRISF" # for LED3...
options "MRAMS_LED3_PIN=3" # ...use pin RF3
options "MRAMS_LED4_PORT=TRISF" # for LED4...
options "MRAMS_LED4_PIN=4" # ...use pin RF4
options "MRAMS_LED5_PORT=TRISF" # for LED5...
options "MRAMS_LED5_PIN=5" # ...use pin RF5
# spirams - SPI block device
controller spi1 # RAM disk: spirams
disk spirams0 at spi1
options "SPIRAMS_ENABLED" # TODO: delete this option
options "SPIRAMS_PORT=SPI1CON" # TODO: delete this option
options "SPIRAMS_CHIPSIZE=128" # chip size in kbytes
options "SPIRAMS_CHIPS=16" # number of chips
options "SPIRAMS_MHZ=10" # speed 10 MHz
options "SPIRAMS_CS0_PORT=TRISF" # for CS0...
options "SPIRAMS_CS0_PIN=0" # ...use pin RF0
options "SPIRAMS_CS1_PORT=TRISF" # for CS1...
options "SPIRAMS_CS1_PIN=1" # ...use pin RF1
options "SPIRAMS_CS2_PORT=TRISF" # for CS2...
options "SPIRAMS_CS2_PIN=2" # ...use pin RF2
options "SPIRAMS_CS3_PORT=TRISF" # for CS3...
options "SPIRAMS_CS3_PIN=3" # ...use pin RF3
options "SPIRAMS_CS4_PORT=TRISF" # for CS4...
options "SPIRAMS_CS4_PIN=4" # ...use pin RF4
options "SPIRAMS_CS5_PORT=TRISF" # for CS5...
options "SPIRAMS_CS5_PIN=5" # ...use pin RF5
options "SPIRAMS_CS6_PORT=TRISF" # for CS6...
options "SPIRAMS_CS6_PIN=6" # ...use pin RF6
options "SPIRAMS_CS7_PORT=TRISF" # for CS7...
options "SPIRAMS_CS7_PIN=7" # ...use pin RF7
options "SPIRAMS_CS8_PORT=TRISF" # for CS8...
options "SPIRAMS_CS8_PIN=8" # ...use pin RF8
options "SPIRAMS_CS9_PORT=TRISF" # for CS9...
options "SPIRAMS_CS9_PIN=9" # ...use pin RF9
options "SPIRAMS_CS10_PORT=TRISF" # for CS10...
options "SPIRAMS_CS10_PIN=10" # ...use pin RF10
options "SPIRAMS_CS11_PORT=TRISF" # for CS11...
options "SPIRAMS_CS11_PIN=11" # ...use pin RF11
options "SPIRAMS_CS12_PORT=TRISF" # for CS12...
options "SPIRAMS_CS12_PIN=12" # ...use pin RF12
options "SPIRAMS_CS13_PORT=TRISF" # for CS13...
options "SPIRAMS_CS13_PIN=13" # ...use pin RF13
options "SPIRAMS_CS14_PORT=TRISF" # for CS14...
options "SPIRAMS_CS14_PIN=14" # ...use pin RF14
options "SPIRAMS_CS15_PORT=TRISF" # for CS15...
options "SPIRAMS_CS15_PIN=15" # ...use pin RF15
options "SPIRAMS_LED0_PORT=TRISG" # for LED0...
options "SPIRAMS_LED0_PIN=0" # ...use pin RG0
options "SPIRAMS_LED1_PORT=TRISG" # for LED1...
options "SPIRAMS_LED1_PIN=1" # ...use pin RG1
options "SPIRAMS_LED2_PORT=TRISG" # for LED2...
options "SPIRAMS_LED2_PIN=2" # ...use pin RG2
options "SPIRAMS_LED3_PORT=TRISG" # for LED3...
options "SPIRAMS_LED3_PIN=3" # ...use pin RG3
options "SPIRAMS_LED4_PORT=TRISG" # for LED4...
options "SPIRAMS_LED4_PIN=4" # ...use pin RG4
options "SPIRAMS_LED5_PORT=TRISG" # for LED5...
options "SPIRAMS_LED5_PIN=5" # ...use pin RG5
options "SPIRAMS_LED6_PORT=TRISG" # for LED6...
options "SPIRAMS_LED6_PIN=6" # ...use pin RG6
options "SPIRAMS_LED7_PORT=TRISG" # for LED7...
options "SPIRAMS_LED7_PIN=7" # ...use pin RG7
options "SPIRAMS_LED8_PORT=TRISG" # for LED8...
options "SPIRAMS_LED8_PIN=8" # ...use pin RG8
options "SPIRAMS_LED9_PORT=TRISG" # for LED9...
options "SPIRAMS_LED9_PIN=9" # ...use pin RG9
options "SPIRAMS_LED10_PORT=TRISG" # for LED10...
options "SPIRAMS_LED10_PIN=10" # ...use pin RG10
options "SPIRAMS_LED11_PORT=TRISG" # for LED11...
options "SPIRAMS_LED11_PIN=11" # ...use pin RG11
options "SPIRAMS_LED12_PORT=TRISG" # for LED12...
options "SPIRAMS_LED12_PIN=12" # ...use pin RG12
options "SPIRAMS_LED13_PORT=TRISG" # for LED13...
options "SPIRAMS_LED13_PIN=13" # ...use pin RG13
options "SPIRAMS_LED14_PORT=TRISG" # for LED14...
options "SPIRAMS_LED14_PIN=14" # ...use pin RG14
options "SPIRAMS_LED15_PORT=TRISG" # for LED15...
options "SPIRAMS_LED15_PIN=15" # ...use pin RG15

121
sys/pic32/Makefile.kconf Normal file
View File

@@ -0,0 +1,121 @@
#
# Makefile for RetroBSD, pic32 target
#
# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g).
# PROF is set to -pg by kconfig if profiling is requested (kconfig -p).
ifndef MIPS_GCC_ROOT
ifeq (/usr/local/mips-2014.05,$(wildcard /usr/local/mips-2014.05))
MIPS_GCC_ROOT = /usr/local/mips-2014.05
endif
ifeq (/usr/local/mips-gcc-4.8.1,$(wildcard /usr/local/mips-gcc-4.8.1))
MIPS_GCC_ROOT = /usr/local/mips-gcc-4.8.1
endif
ifeq (/usr/local/pic32-tools,$(wildcard /usr/local/pic32-tools))
MIPS_GCC_ROOT = /usr/local/pic32-tools
endif
ifdef UECIDE
MIPS_GCC_ROOT = ${UECIDE}/compilers/pic32-tools
endif
endif
ifeq (${MIPS_GCC_ROOT}/bin/mips-sde-elf-gcc,$(wildcard ${MIPS_GCC_ROOT}/bin/mips-sde-elf-gcc))
MIPS_GCC_PREFIX ?= ${MIPS_GCC_ROOT}/bin/mips-sde-elf-
endif
ifeq (${MIPS_GCC_ROOT}/bin/mips-elf-gcc,$(wildcard ${MIPS_GCC_ROOT}/bin/mips-elf-gcc))
MIPS_GCC_PREFIX ?= ${MIPS_GCC_ROOT}/bin/mips-elf-
endif
ifeq (${MIPS_GCC_ROOT}/bin/pic32-gcc,$(wildcard ${MIPS_GCC_ROOT}/bin/pic32-gcc))
MIPS_GCC_PREFIX ?= ${MIPS_GCC_ROOT}/bin/pic32-
endif
AS = ${MIPS_GCC_PREFIX}as ${DEBUG} -mips32r2 -EL
CC = ${MIPS_GCC_PREFIX}gcc ${DEBUG} -mips32r2 -EL -nostdinc -fno-builtin -Werror -Wall
CPP = ${MIPS_GCC_PREFIX}cpp
LD = ${MIPS_GCC_PREFIX}gcc -mips32r2 -EL
LDFLAGS = -nostdlib -T $A/${LDSCRIPT} -Wl,-Map=unix.map
SIZE = ${MIPS_GCC_PREFIX}size
OBJCOPY = ${MIPS_GCC_PREFIX}objcopy
OBJDUMP = ${MIPS_GCC_PREFIX}objdump
ifeq (${MIPS_GCC_ROOT}/bin/mips-elf-gcc,$(wildcard ${MIPS_GCC_ROOT}/bin/mips-elf-gcc))
LDFLAGS += -Wl,--oformat=elf32-littlemips
endif
ifeq (${MIPS_GCC_ROOT}/bin/pic32-gcc,$(wildcard ${MIPS_GCC_ROOT}/bin/pic32-gcc))
LDFLAGS += -Wl,--oformat=elf32-tradlittlemips
endif
# source tree is located via $S relative to the compilation directory
S = ../..
A = $S/pic32
COPTS = -I. -I$S/include ${IDENT} -DKERNEL
CFLAGS = -O ${COPTS}
# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
# is marked as config-dependent.
NORMAL_C = ${CC} -c ${CFLAGS} ${PROF} $<
NORMAL_C_C = ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
DRIVER_C = ${CC} -c ${CFLAGS} ${PROF} $<
DRIVER_C_C = ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
PROFILE_C = ${CC} -p -c ${COPTS} $<
NORMAL_S = ${CPP} ${COPTS} $< | ${AS} -o $@
NORMAL_S_C = ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
%OBJS
%CFILES
# load lines for config "xxx" will be emitted as:
# xxx: ${SYSTEM_DEP} swapxxx.o
# ${SYSTEM_LD_HEAD}
# ${SYSTEM_LD} swapxxx.o
# ${SYSTEM_LD_TAIL}
SYSTEM_OBJ = startup.o ${OBJS} ioconf.o
ifeq (devcfg.c,$(wildcard devcfg.c))
SYSTEM_OBJ += devcfg.o
endif
SYSTEM_DEP = Makefile machine sys ${SYSTEM_OBJ}
SYSTEM_LD_HEAD = sh $S/pic32/newvers.sh; ${CC} $(CFLAGS) -c vers.c; rm -f $@
SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o unix.elf; \
${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o unix.elf
SYSTEM_LD_TAIL = ${SIZE} unix.elf; \
$(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ unix.hex; \
$(OBJDUMP) -d -S unix.elf > unix.dis
%LOAD
clean:
rm -f *.elf *.o *.map *.dis
clean-all: clean
rm -f *.h *.c machine sys Makefile
#startup.o: $A/pic32/startup.S $A/include/machAsmDefs.h \
# $A/include/machConst.h $A/include/reg.h $A/include/assym.h
# ${CPP} ${COPTS} ${PARAM} -DLOCORE $A/pic32/startup.s | \
# ${AS} -o startup.o
# the following are necessary because the files depend on the types of
# cpu's included in the system configuration
clock.o machdep.o conf.o: Makefile
machine:
ln -s $A $@
sys:
ln -s $S/include $@
depend: machine
mkdep ${COPTS} ${CFILES} ioconf.c
ioconf.o: ioconf.c
${CC} -c ${CFLAGS} ioconf.c
%RULES

80
sys/pic32/files.kconf Normal file
View File

@@ -0,0 +1,80 @@
kernel/exec_aout.c standard
kernel/exec_conf.c standard
kernel/exec_elf.c standard
kernel/exec_script.c standard
kernel/exec_subr.c standard
kernel/init_main.c standard
kernel/init_sysent.c standard
kernel/kern_clock.c standard
kernel/kern_descrip.c standard
kernel/kern_exec.c standard
kernel/kern_exit.c standard
kernel/kern_fork.c standard
kernel/kern_mman.c standard
kernel/kern_proc.c standard
kernel/kern_prot.c standard
kernel/kern_prot2.c standard
kernel/kern_resource.c standard
kernel/kern_sig.c standard
kernel/kern_sig2.c standard
kernel/kern_subr.c standard
kernel/kern_synch.c standard
kernel/kern_sysctl.c standard
kernel/kern_time.c standard
kernel/rdisk.c standard
kernel/subr_log.c optional log
kernel/subr_prf.c standard
kernel/subr_rmap.c standard
kernel/sys_generic.c standard
kernel/sys_inode.c standard
kernel/sys_pipe.c standard
kernel/sys_process.c standard
kernel/syscalls.c standard
kernel/tty.c standard
kernel/tty_subr.c standard
kernel/tty_tty.c standard
kernel/ufs_alloc.c standard
kernel/ufs_bio.c standard
kernel/ufs_bmap.c standard
kernel/ufs_dsort.c standard
kernel/ufs_fio.c standard
kernel/ufs_inode.c standard
kernel/ufs_mount.c standard
kernel/ufs_namei.c standard
kernel/ufs_subr.c standard
kernel/ufs_syscalls.c standard
kernel/ufs_syscalls2.c standard
kernel/vfs_vnops.c standard
kernel/vm_sched.c standard
kernel/vm_swap.c standard
kernel/vm_swp.c standard
pic32/adc.c optional adc
pic32/clock.c standard
pic32/cons.c standard
pic32/devsw.c standard
pic32/exception.c standard
pic32/glcd.c optional glcd
pic32/gpio.c optional gpio
pic32/hx8357.c optional hxtft
pic32/machdep.c standard
pic32/mem.c standard
pic32/picga.c optional picga
pic32/power_control.c optional power
pic32/pwm.c optional pwm
pic32/rd_mrams.c optional mrams
pic32/rd_sd.c optional sd
pic32/rd_sdramp.c optional sdramp
pic32/rd_spirams.c optional spirams
pic32/rd_sramc.c optional sramc
pic32/sdram.S optional sdramp
pic32/signal.c standard
pic32/skel.c optional skel
pic32/spi.c optional spi
pic32/spi_bus.c optional spi
pic32/startup.S standard
pic32/swap.c standard
pic32/sysctl.c standard
pic32/uart.c optional uart
pic32/usb_device.c optional uartusb
pic32/usb_function_cdc.c optional uartusb
pic32/usb_uart.c optional uartusb

View File

@@ -178,7 +178,7 @@ startup()
#ifdef KERNEL_EXECUTABLE_RAM
/*
* Set boundry for kernel executable ram on smallest
* 2k boundry required to allow the keram segement to fit.
* 2k boundry required to allow the keram segment to fit.
* This means that there is possibly some u0area ramspace that
* is executable, but as it is isolated from userspace this
* should be ok, given the apparent goals of this project.
@@ -498,7 +498,7 @@ boot(dev, howto)
(*dump)(dumpdev);
}
/* Restart from dev, howto */
#ifdef USB_NUM_STRING_DESCRIPTORS
#ifdef UARTUSB_ENABLED
/* Disable USB module, and wait awhile for the USB cable
* capacitance to discharge down to disconnected (SE0) state.
*/
@@ -539,15 +539,15 @@ boot(dev, howto)
#ifdef HALTREBOOT
printf("press any key to reboot...");
cngetc();
/* Unlock access to reset register */
SYSKEY = 0;
SYSKEY = 0xaa996655;
SYSKEY = 0x556699aa;
/* Reset microcontroller */
RSWRSTSET = 1;
(void) RSWRST;
/* Unlock access to reset register */
SYSKEY = 0;
SYSKEY = 0xaa996655;
SYSKEY = 0x556699aa;
/* Reset microcontroller */
RSWRSTSET = 1;
(void) RSWRST;
#endif
for (;;) {

92
sys/pic32/max32/Config Normal file
View File

@@ -0,0 +1,92 @@
#
# chipKIT Max32 board
#
# To build the kernel, use:
# cd sys/pic32/max32
# kconfig Config
# make clean
# make
#
machine "pic32"
cpu "PIC32MX"
ident CHIPKIT_MAX
# Linker script
ldscript "pic32/bootloader-max32.ld"
# Need to set locally
timezone 8 dst
maxusers 2
# Standard system options
options "CPU_KHZ=80000" # Oscillator frequency of CPU core
options "BUS_KHZ=80000" # Frequency of peripheral bus
options "HZ=100" # Rate of clock interrupt
#???options "BUS_DIV=1" # Bus clock divisor 1/2/4/8
#???options "CRYSTAL=8" # PLL input frequency in MHz
#???options "CPU_IDIV=2" # PLL input divisor 1/2/3/4/5/6/10/12
#???options "CPU_ODIV=1" # PLL output divisor 1/2/4/8/16/32/64/256
#???options "CPU_MUL=20" # PLL multiplier 15/16/17/18/19/20/21/24
options "EXEC_AOUT" # Run a.out binaries
options "EXEC_ELF" # Run ELF binaries
options "EXEC_SCRIPT" # Run shell scripts
options "UCB_METER" # Collect kernel statistics
# LEDs
#options "LED_DISK_PORT=TRISF" # for disk activity LED...
#options "LED_DISK_PIN=0" # ...use pin RF0
#options "LED_DISK_INVERT" # invert disk LED
#options "LED_SWAP_PORT=TRISF" # for swap activity LED...
#options "LED_SWAP_PIN=1" # ...use pin RF1
#options "LED_SWAP_INVERT" # invert swap LED
#options "LED_TTY_PORT=TRISA" # for tty LED...
#options "LED_TTY_PIN=2" # ...use pin RA2
#options "LED_TTY_INVERT" # invert tty LED
#options "LED_KERNEL_PORT=TRISA" # for kernel actibity LED...
#options "LED_KERNEL_PIN=3" # ...use pin RA3
#options "LED_KERNEL_INVERT" # invert kernel LED
# Root filesystem at /dev/sd0a, swap at /dev/sd0b
config unix root on sd0a
swap on sd0b
dumps on sd0b
# Serial UART ports
device uart1 # Serial-to-USB converter
device uart2
device uart3
device uart4
options "UART_ENABLED" # TODO: delete this option
# Console options
options "CONSOLE_DEVICE=tty0" # /dev/tty0
#TODO: options "CONS_MAJOR=17" # use UART device as console
#TODO: options "CONS_MINOR=0" # use uart1 unit as console
# SPI ports
controller spi2 # SD card
options "SPI_ENABLED" # TODO: delete this option
# microSD card
disk sd0 at spi2 flags 0x3e # select pin RC14
options "SD0_MHZ=10" # speed 10 MHz
options "SD0_PORT=2" # at spi2 TODO: delete
options "SD0_CS_PORT=TRISC" # for chip select... TODO: use flags
options "SD0_CS_PIN=14" # ...use pin RC14 TODO: use flags
# General purpose I/O ports
device gpio0
options "GPIO_ENABLED" # TODO: delete this option
# ADC driver
device adc0
options "ADC_ENABLED" # TODO: delete this option
# PWM driver
device pwm0
options "PWM_ENABLED" # TODO: delete this option
# Skeleton driver
device skel0
options "SKEL_ENABLED" # TODO: delete this option

View File

@@ -23,13 +23,13 @@ echo $GITREV >.oldversion
echo $GITREV ${USER-root} `pwd` `date +'%Y-%m-%d'` `hostname` $CV| \
awk ' {
version = $1;
version = $1;
user = $2;
dir = $3;
date = $4;
host = $5;
host = $5;
cv = $6;
printf "const char version[] = \"2.11 BSD Unix for PIC32, revision G%s build %d:\\n", version, cv;
printf " Compiled %s by %s@%s:\\n", date, user, host;
printf " %s\\n\";\n", dir;
printf "const char version[] = \"2.11 BSD Unix for PIC32, revision G%s build %d:\\n", version, cv;
printf " Compiled %s by %s@%s:\\n", date, user, host;
printf " %s\\n\";\n", dir;
}'

View File

@@ -1,149 +0,0 @@
#
# Makefile for 4.4 BSD, pic32 target
#
# This makefile is constructed from a machine description:
# config machineid
# Most changes should be made in the machine description
# /sys/conf/``machineid''
# after which you should do
# config machineid
# Machine generic makefile changes should be made in
# /sys/conf/Makefile.``machinetype''
# after which config should be rerun for all machines of that type.
#
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
#
# -DTRACE compile in kernel tracing hooks
# -DQUOTA compile in file system quotas
#
# DEBUG is set to -g by config if debugging is requested (config -g).
# PROF is set to -pg by config if profiling is requested (config -p).
.if exists(${MIPS_GCC_ROOT}/bin/mips-sde-elf-gcc)
MIPS_GCC_PREFIX ?= ${MIPS_GCC_ROOT}/bin/mips-sde-elf-
.endif
.if exists(${MIPS_GCC_ROOT}/bin/mips-elf-gcc)
MIPS_GCC_PREFIX ?= ${MIPS_GCC_ROOT}/bin/mips-elf-
.endif
AS= ${MIPS_GCC_PREFIX}as ${DEBUG} -mips32r2 -EL
CC= ${MIPS_GCC_PREFIX}gcc ${DEBUG} -mips32r2 -EL -msoft-float -nostdinc -fno-builtin -Werror -Wall
CPP= ${MIPS_GCC_PREFIX}cpp
LD= ${MIPS_GCC_PREFIX}gcc -mips32r2 -EL
LDFLAGS= -nostdlib -T $A/${LDSCRIPT} -Wl,-Map=vmunix.map
SIZE= ${MIPS_GCC_PREFIX}size
OBJCOPY= ${MIPS_GCC_PREFIX}objcopy
OBJDUMP= ${MIPS_GCC_PREFIX}objdump
.if exists(${MIPS_GCC_ROOT}/bin/mips-elf-gcc)
LDFLAGS+= -Wl,--oformat=elf32-littlemips
.endif
# source tree is located via $S relative to the compilation directory
S= ../..
A= $S/mips
COPTS= -I. -I$S ${IDENT} -DKERNEL
CFLAGS= -O ${COPTS}
# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
# is marked as config-dependent.
NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
PROFILE_C= ${CC} -p -c ${COPTS} $<
NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@
NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
%OBJS
%CFILES
# load lines for config "xxx" will be emitted as:
# xxx: ${SYSTEM_DEP} swapxxx.o
# ${SYSTEM_LD_HEAD}
# ${SYSTEM_LD} swapxxx.o
# ${SYSTEM_LD_TAIL}
SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o vnode_if.o
SYSTEM_DEP= Makefile ${SYSTEM_OBJ} $S/libkern/libkern.a
SYSTEM_LD_HEAD= sh $S/conf/newvers.sh; ${CC} $(CFLAGS) -c vers.c; rm -f $@
SYSTEM_LD= -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -L$S/libkern -lkern -o vmunix.elf; \
${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -L$S/libkern -lkern -o vmunix.elf
SYSTEM_LD_TAIL= ${SIZE} vmunix.elf; \
$(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ vmunix.hex; \
$(OBJDUMP) -d -S vmunix.elf > vmunix.dis
%LOAD
$S/libkern/libkern.a:
cd $S/libkern && ${MAKE} all
clean:
rm -f eddep *vmunix.elf vmunix.gdb tags *.o locore.i [a-z]*.s \
Errs errs linterrs makelinks
lint: /tmp param.c
@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
$A/pic32/Locore.c ${CFILES} $A/pic32/swapgeneric.c \
ioconf.c param.c
symbols.sort: $A/pic32/symbols.raw
grep -v '^#' $A/pic32/symbols.raw \
| sed 's/^ //' | sort -u > symbols.sort
locore.o: $A/pic32/locore.s $A/include/machAsmDefs.h \
$A/include/machConst.h $A/include/reg.h $A/include/assym.h
${CPP} ${COPTS} ${PARAM} -DLOCORE $A/pic32/locore.s | \
${AS} -o locore.o
# the following is necessary because autoconf.o depends on #if GENERIC
autoconf.o: Makefile
# the following are necessary because the files depend on the types of
# cpu's included in the system configuration
clock.o machdep.o autoconf.o conf.o: Makefile
# depend on network configuration
uipc_proto.o vfs_conf.o: Makefile
machine:
ln -s $A/include $@
depend: machine param.c vnode_if.h
mkdep ${COPTS} ${CFILES} ioconf.c param.c
links:
egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
sort -u | comm -23 - dontlink | \
sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
sh makelinks && rm -f dontlink
tags:
@echo "see $S/kern/Makefile for tags"
ioconf.o: ioconf.c
${CC} -c ${CFLAGS} ioconf.c
param.c: $S/conf/param.c
rm -f param.c
cp $S/conf/param.c .
param.o: param.c Makefile
${CC} -c ${CFLAGS} ${PARAM} param.c
vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
%RULES

View File

@@ -1,179 +0,0 @@
isofs/cd9660/cd9660_bmap.c optional cd9660
isofs/cd9660/cd9660_lookup.c optional cd9660
isofs/cd9660/cd9660_node.c optional cd9660
isofs/cd9660/cd9660_rrip.c optional cd9660
isofs/cd9660/cd9660_util.c optional cd9660
isofs/cd9660/cd9660_vfsops.c optional cd9660
isofs/cd9660/cd9660_vnops.c optional cd9660
kern/init_main.c standard
kern/init_sysent.c standard
kern/kern_acct.c standard
kern/kern_clock.c standard
kern/kern_descrip.c standard
kern/kern_exec.c standard
kern/kern_exit.c standard
kern/kern_fork.c standard
kern/kern_ktrace.c standard
kern/kern_malloc.c standard
kern/kern_physio.c standard
kern/kern_proc.c standard
kern/kern_prot.c standard
kern/kern_resource.c standard
kern/kern_sig.c standard
kern/kern_subr.c standard
kern/kern_synch.c standard
kern/kern_sysctl.c standard
kern/kern_time.c standard
kern/kern_xxx.c standard
kern/kern_lock.c standard
kern/subr_log.c standard
kern/subr_prf.c standard
kern/subr_prof.c standard
kern/subr_rmap.c standard
kern/subr_xxx.c standard
kern/sys_generic.c standard
kern/sys_process.c standard
kern/sys_socket.c standard
kern/sysv_shm.c optional sysvshm
kern/tty.c standard
kern/tty_compat.c standard
kern/tty_conf.c standard
kern/tty_pty.c optional pty
kern/tty_subr.c standard
kern/tty_tb.c optional tb
kern/tty_tty.c standard
kern/uipc_domain.c standard
kern/uipc_mbuf.c standard
kern/uipc_proto.c standard
kern/uipc_socket.c standard
kern/uipc_socket2.c standard
kern/uipc_syscalls.c standard
kern/uipc_usrreq.c standard
kern/vfs_bio.c standard
kern/vfs_cache.c standard
kern/vfs_cluster.c standard
kern/vfs_conf.c standard
kern/vfs_init.c standard
kern/vfs_lookup.c standard
kern/vfs_subr.c standard
kern/vfs_syscalls.c standard
kern/vfs_vnops.c standard
miscfs/deadfs/dead_vnops.c standard
miscfs/fdesc/fdesc_vfsops.c optional fdesc
miscfs/fdesc/fdesc_vnops.c optional fdesc
miscfs/fifofs/fifo_vnops.c optional fifo
miscfs/kernfs/kernfs_vfsops.c optional kernfs
miscfs/kernfs/kernfs_vnops.c optional kernfs
miscfs/nullfs/null_subr.c optional nullfs
miscfs/nullfs/null_vfsops.c optional nullfs
miscfs/nullfs/null_vnops.c optional nullfs
miscfs/portal/portal_vfsops.c optional portal
miscfs/portal/portal_vnops.c optional portal
miscfs/procfs/procfs_subr.c optional procfs
miscfs/procfs/procfs_vnops.c optional procfs
miscfs/procfs/procfs_vfsops.c optional procfs
miscfs/procfs/procfs_note.c optional procfs
miscfs/procfs/procfs_mem.c optional procfs
miscfs/procfs/procfs_ctl.c optional procfs
miscfs/procfs/procfs_status.c optional procfs
miscfs/procfs/procfs_regs.c optional procfs
miscfs/procfs/procfs_fpregs.c optional procfs
miscfs/specfs/spec_vnops.c standard
miscfs/umapfs/umap_subr.c optional umapfs
miscfs/umapfs/umap_vfsops.c optional umapfs
miscfs/umapfs/umap_vnops.c optional umapfs
miscfs/union/union_subr.c optional union
miscfs/union/union_vfsops.c optional union
miscfs/union/union_vnops.c optional union
net/bpf.c optional bpfilter
net/bpf_filter.c optional bpfilter
net/if.c standard
net/if_ethersubr.c optional ether
net/if_loop.c optional loop
net/if_sl.c optional sl
net/radix.c standard
net/raw_cb.c standard
net/raw_usrreq.c standard
net/route.c standard
net/rtsock.c standard
net/slcompress.c optional sl
netinet/if_ether.c optional ether
netinet/igmp.c optional inet
netinet/in.c optional inet
netinet/in_pcb.c optional inet
netinet/in_proto.c optional inet
netinet/ip_icmp.c optional inet
netinet/ip_input.c optional inet
netinet/ip_mroute.c optional inet mrouting
netinet/ip_output.c optional inet
netinet/raw_ip.c optional inet
netinet/tcp_debug.c optional inet
netinet/tcp_input.c optional inet
netinet/tcp_output.c optional inet
netinet/tcp_subr.c optional inet
netinet/tcp_timer.c optional inet
netinet/tcp_usrreq.c optional inet
netinet/udp_usrreq.c optional inet
nfs/nfs_bio.c optional nfs
nfs/nfs_node.c optional nfs
nfs/nfs_nqlease.c optional nfs
nfs/nfs_serv.c optional nfs
nfs/nfs_socket.c optional nfs
nfs/nfs_srvcache.c optional nfs
nfs/nfs_subs.c optional nfs
nfs/nfs_syscalls.c optional nfs
nfs/nfs_vfsops.c optional nfs
nfs/nfs_vnops.c optional nfs
ufs/ffs/ffs_alloc.c optional ffs
ufs/ffs/ffs_alloc.c optional mfs
ufs/ffs/ffs_balloc.c optional ffs
ufs/ffs/ffs_balloc.c optional mfs
ufs/ffs/ffs_inode.c optional ffs
ufs/ffs/ffs_inode.c optional mfs
ufs/ffs/ffs_subr.c optional ffs
ufs/ffs/ffs_subr.c optional mfs
ufs/ffs/ffs_tables.c optional ffs
ufs/ffs/ffs_tables.c optional mfs
ufs/ffs/ffs_vfsops.c optional ffs
ufs/ffs/ffs_vfsops.c optional mfs
ufs/ffs/ffs_vnops.c optional ffs
ufs/ffs/ffs_vnops.c optional mfs
ufs/lfs/lfs_alloc.c optional lfs
ufs/lfs/lfs_bio.c optional lfs
ufs/lfs/lfs_balloc.c optional lfs
ufs/lfs/lfs_cksum.c optional lfs
ufs/lfs/lfs_debug.c optional lfs
ufs/lfs/lfs_inode.c optional lfs
ufs/lfs/lfs_segment.c optional lfs
ufs/lfs/lfs_subr.c optional lfs
ufs/lfs/lfs_syscalls.c optional lfs
ufs/lfs/lfs_vfsops.c optional lfs
ufs/lfs/lfs_vnops.c optional lfs
ufs/mfs/mfs_vfsops.c optional mfs
ufs/mfs/mfs_vnops.c optional mfs
ufs/ufs/ufs_bmap.c standard
ufs/ufs/ufs_disksubr.c standard
ufs/ufs/ufs_ihash.c standard
ufs/ufs/ufs_inode.c standard
ufs/ufs/ufs_lockf.c standard
ufs/ufs/ufs_lookup.c standard
ufs/ufs/ufs_quota.c standard
ufs/ufs/ufs_vfsops.c standard
ufs/ufs/ufs_vnops.c standard
vm/device_pager.c optional devpager
vm/swap_pager.c optional swappager
vm/vm_fault.c standard
vm/vm_glue.c standard
vm/vm_init.c standard
vm/vm_kern.c standard
vm/vm_map.c standard
vm/vm_meter.c standard
vm/vm_mmap.c standard
vm/vm_object.c standard
vm/vm_page.c standard
vm/vm_pageout.c standard
vm/vm_pager.c standard
vm/vm_swap.c standard
vm/vm_unix.c standard
vm/vm_user.c standard
vm/vnode_pager.c optional vnodepager

View File

@@ -400,7 +400,7 @@ void do_rules(f)
fprintf(f, "%so: $S/%s%c\n", tail(np), np, och);
special = ftp->f_special;
if (special == 0) {
char *ftype;
char *ftype = "???";
static char cmd[128];
switch (ftp->f_type) {