From d80a636a62c861328a0486545c6068a153a81f4d Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Sun, 30 Aug 2015 21:10:19 -0700 Subject: [PATCH 01/32] Create generic kconfig script for pic32 platform. --- sys/pic32/Config.generic | 278 +++++++++++++++++++++ sys/pic32/Makefile.kconf | 121 +++++++++ {tools/kconfig => sys/pic32}/devices.kconf | 0 sys/pic32/files.kconf | 80 ++++++ sys/pic32/machdep.c | 18 +- sys/pic32/max32/Config | 92 +++++++ sys/pic32/newvers.sh | 10 +- tools/kconfig/Makefile.kconf | 149 ----------- tools/kconfig/files.kconf | 179 ------------- tools/kconfig/mkmakefile.c | 2 +- 10 files changed, 586 insertions(+), 343 deletions(-) create mode 100644 sys/pic32/Config.generic create mode 100644 sys/pic32/Makefile.kconf rename {tools/kconfig => sys/pic32}/devices.kconf (100%) create mode 100644 sys/pic32/files.kconf create mode 100644 sys/pic32/max32/Config delete mode 100644 tools/kconfig/Makefile.kconf delete mode 100644 tools/kconfig/files.kconf diff --git a/sys/pic32/Config.generic b/sys/pic32/Config.generic new file mode 100644 index 0000000..38a02fa --- /dev/null +++ b/sys/pic32/Config.generic @@ -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 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 diff --git a/sys/pic32/Makefile.kconf b/sys/pic32/Makefile.kconf new file mode 100644 index 0000000..b189b33 --- /dev/null +++ b/sys/pic32/Makefile.kconf @@ -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 diff --git a/tools/kconfig/devices.kconf b/sys/pic32/devices.kconf similarity index 100% rename from tools/kconfig/devices.kconf rename to sys/pic32/devices.kconf diff --git a/sys/pic32/files.kconf b/sys/pic32/files.kconf new file mode 100644 index 0000000..4b25a7e --- /dev/null +++ b/sys/pic32/files.kconf @@ -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 diff --git a/sys/pic32/machdep.c b/sys/pic32/machdep.c index 504ed99..18d0125 100644 --- a/sys/pic32/machdep.c +++ b/sys/pic32/machdep.c @@ -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 (;;) { diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config new file mode 100644 index 0000000..80e6333 --- /dev/null +++ b/sys/pic32/max32/Config @@ -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 diff --git a/sys/pic32/newvers.sh b/sys/pic32/newvers.sh index 7bb01fb..6dc5638 100644 --- a/sys/pic32/newvers.sh +++ b/sys/pic32/newvers.sh @@ -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; }' diff --git a/tools/kconfig/Makefile.kconf b/tools/kconfig/Makefile.kconf deleted file mode 100644 index 3b587c4..0000000 --- a/tools/kconfig/Makefile.kconf +++ /dev/null @@ -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 diff --git a/tools/kconfig/files.kconf b/tools/kconfig/files.kconf deleted file mode 100644 index 42db771..0000000 --- a/tools/kconfig/files.kconf +++ /dev/null @@ -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 diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index 88538e4..9a581d9 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -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) { From 585773955b09be602490ffcb963b9497dd6d42d5 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 31 Aug 2015 00:21:41 -0700 Subject: [PATCH 02/32] Fix include paths in the kernel sources. Max32 kernel successfully compiled with kconfig utility. --- sys/include/param.h | 4 +- sys/kernel/exec_aout.c | 34 ++-- sys/kernel/exec_conf.c | 9 +- sys/kernel/exec_elf.c | 32 ++- sys/kernel/exec_script.c | 14 +- sys/kernel/exec_subr.c | 32 +-- sys/kernel/init_main.c | 45 +++-- sys/kernel/init_sysent.c | 6 +- sys/kernel/kern_clock.c | 14 +- sys/kernel/kern_descrip.c | 24 +-- sys/kernel/kern_exec.c | 29 ++- sys/kernel/kern_exit.c | 20 +- sys/kernel/kern_fork.c | 20 +- sys/kernel/kern_glob.c | 6 +- sys/kernel/kern_mman.c | 10 +- sys/kernel/kern_proc.c | 8 +- sys/kernel/kern_prot.c | 8 +- sys/kernel/kern_prot2.c | 8 +- sys/kernel/kern_resource.c | 12 +- sys/kernel/kern_sig.c | 14 +- sys/kernel/kern_subr.c | 10 +- sys/kernel/kern_synch.c | 18 +- sys/kernel/kern_sysctl.c | 2 +- sys/kernel/kern_time.c | 10 +- sys/kernel/rdisk.c | 18 +- sys/kernel/subr_log.c | 24 +-- sys/kernel/subr_prf.c | 20 +- sys/kernel/subr_rmap.c | 8 +- sys/kernel/sys_generic.c | 22 +- sys/kernel/sys_inode.c | 34 ++-- sys/kernel/sys_pipe.c | 18 +- sys/kernel/sys_process.c | 14 +- sys/kernel/tty.c | 26 +-- sys/kernel/tty_pty.c | 28 +-- sys/kernel/tty_subr.c | 10 +- sys/kernel/tty_tty.c | 12 +- sys/kernel/ufs_alloc.c | 20 +- sys/kernel/ufs_bio.c | 18 +- sys/kernel/ufs_bmap.c | 20 +- sys/kernel/ufs_dsort.c | 9 +- sys/kernel/ufs_fio.c | 16 +- sys/kernel/ufs_inode.c | 20 +- sys/kernel/ufs_mount.c | 26 +-- sys/kernel/ufs_namei.c | 20 +- sys/kernel/ufs_subr.c | 18 +- sys/kernel/ufs_syscalls.c | 20 +- sys/kernel/ufs_syscalls2.c | 22 +- sys/kernel/vfs_vnops.c | 3 +- sys/kernel/vm_sched.c | 14 +- sys/kernel/vm_swap.c | 14 +- sys/kernel/vm_swp.c | 16 +- sys/pic32/Config.generic | 17 +- sys/pic32/Makefile.kconf | 35 ++-- sys/pic32/adc.c | 17 +- sys/pic32/clock.c | 4 +- sys/pic32/cons.c | 16 +- sys/pic32/devsw.c | 50 ++--- sys/pic32/exception.c | 18 +- sys/pic32/files.kconf | 1 - sys/pic32/glcd.c | 16 +- sys/pic32/gpio.c | 14 +- sys/pic32/hx8357.c | 21 +- sys/pic32/machdep.c | 50 +++-- sys/pic32/max32/.gitignore | 3 + sys/pic32/max32/Config | 36 ++-- sys/pic32/max32/Makefile | 404 +++++++++++++++++++++++++++++++++---- sys/pic32/mem.c | 10 +- sys/pic32/picga.c | 21 +- sys/pic32/power_control.c | 12 +- sys/pic32/pwm.c | 16 +- sys/pic32/rd_flash.c | 12 +- sys/pic32/rd_mrams.c | 17 +- sys/pic32/rd_sd.c | 17 +- sys/pic32/rd_sdramp.c | 19 +- sys/pic32/rd_spirams.c | 17 +- sys/pic32/rd_sramc.c | 15 +- sys/pic32/sdram.S | 2 +- sys/pic32/signal.c | 16 +- sys/pic32/skel.c | 14 +- sys/pic32/spi.c | 16 +- sys/pic32/spi_bus.c | 14 +- sys/pic32/ssd1926-sdcard.c | 2 +- sys/pic32/startup.S | 2 +- sys/pic32/swap.c | 23 +-- sys/pic32/sysctl.c | 36 ++-- sys/pic32/uart.c | 14 +- tools/kconfig/main.c | 1 - tools/kconfig/mkswapconf.c | 8 + 88 files changed, 1098 insertions(+), 787 deletions(-) diff --git a/sys/include/param.h b/sys/include/param.h index 5d57ebb..42d7940 100644 --- a/sys/include/param.h +++ b/sys/include/param.h @@ -51,7 +51,7 @@ /* * Signals */ -#include +#include #define NBPW sizeof(int) /* number of bytes in an integer */ @@ -111,7 +111,7 @@ #define MAXHOSTNAMELEN 64 #if defined(KERNEL) && defined(INET) -# include "machine/net_mac.h" +# include #endif /* diff --git a/sys/kernel/exec_aout.c b/sys/kernel/exec_aout.c index 68aa9d8..89cbff2 100644 --- a/sys/kernel/exec_aout.c +++ b/sys/kernel/exec_aout.c @@ -1,20 +1,20 @@ -#include "param.h" -#include "systm.h" -#include "map.h" -#include "inode.h" -#include "user.h" -#include "proc.h" -#include "buf.h" -#include "namei.h" -#include "fs.h" -#include "mount.h" -#include "file.h" -#include "resource.h" -#include "exec.h" -#include "exec_aout.h" -#include "dir.h" -#include "uio.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include int exec_aout_check(struct exec_params *epp) { diff --git a/sys/kernel/exec_conf.c b/sys/kernel/exec_conf.c index 002ca0a..01c7ff4 100644 --- a/sys/kernel/exec_conf.c +++ b/sys/kernel/exec_conf.c @@ -1,5 +1,3 @@ -/* $NetBSD: exec_conf.c,v 1.43 2000/06/09 22:38:57 oki Exp $ */ - /* * Copyright (c) 1993, 1994 Christopher G. Demetriou * All rights reserved. @@ -29,10 +27,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -#include "param.h" -#include "inode.h" -#include "exec.h" +#include +#include +#include #ifdef EXEC_SCRIPT int exec_script_check(struct exec_params *epp); diff --git a/sys/kernel/exec_elf.c b/sys/kernel/exec_elf.c index 82062b0..e2d9c1c 100644 --- a/sys/kernel/exec_elf.c +++ b/sys/kernel/exec_elf.c @@ -1,5 +1,3 @@ -/* $NetBSD: exec_elf32.c,v 1.49.2.2 2000/11/03 20:00:38 tv Exp $ */ - /*- * Copyright (c) 1994 The NetBSD Foundation, Inc. * All rights reserved. @@ -62,22 +60,20 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include "param.h" -#include "systm.h" -#include "kernel.h" -#include "map.h" -#include "user.h" -#include "proc.h" -#include "inode.h" -#include "namei.h" -#include "exec.h" -#include "exec_elf.h" -#include "fcntl.h" -#include "signalvar.h" -#include "mount.h" -#include "stat.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include extern char sigcode[], esigcode[]; diff --git a/sys/kernel/exec_script.c b/sys/kernel/exec_script.c index fa04b86..315bee1 100644 --- a/sys/kernel/exec_script.c +++ b/sys/kernel/exec_script.c @@ -1,10 +1,10 @@ -#include "param.h" -#include "inode.h" -#include "dir.h" -#include "namei.h" -#include "exec.h" -#include "user.h" -#include "systm.h" +#include +#include +#include +#include +#include +#include +#include int exec_script_check(struct exec_params *epp) diff --git a/sys/kernel/exec_subr.c b/sys/kernel/exec_subr.c index 3f58560..3a5de8b 100644 --- a/sys/kernel/exec_subr.c +++ b/sys/kernel/exec_subr.c @@ -1,19 +1,19 @@ -#include "param.h" -#include "systm.h" -#include "map.h" -#include "inode.h" -#include "user.h" -#include "proc.h" -#include "buf.h" -#include "namei.h" -#include "fs.h" -#include "mount.h" -#include "file.h" -#include "resource.h" -#include "exec.h" -#include "dir.h" -#include "uio.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * How memory is set up. diff --git a/sys/kernel/init_main.c b/sys/kernel/init_main.c index 593b49c..8251313 100644 --- a/sys/kernel/init_main.c +++ b/sys/kernel/init_main.c @@ -3,25 +3,25 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "fs.h" -#include "mount.h" -#include "map.h" -#include "proc.h" -#include "ioctl.h" -#include "inode.h" -#include "conf.h" -#include "buf.h" -#include "fcntl.h" -#include "vm.h" -#include "clist.h" -#include "reboot.h" -#include "systm.h" -#include "kernel.h" -#include "namei.h" -#include "stat.h" -#include "rdisk.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include u_int swapstart, nswap; /* start and size of swap space */ size_t physmem; /* total amount of physical memory */ @@ -150,8 +150,11 @@ main() s = spl0(); rdisk_init(); - pipedev = rootdev = get_boot_device(); - swapdev = get_swap_device(); + if (rootdev == NODEV) + rootdev = get_boot_device(); + if (swapdev == NODEV) + swapdev = get_swap_device(); + pipedev = rootdev; /* Mount a root filesystem. */ for (;;) { diff --git a/sys/kernel/init_sysent.c b/sys/kernel/init_sysent.c index ce46da4..1466335 100644 --- a/sys/kernel/init_sysent.c +++ b/sys/kernel/init_sysent.c @@ -5,9 +5,9 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "glob.h" +#include +#include +#include #ifdef INET # define ifnet(narg, name) narg, name diff --git a/sys/kernel/kern_clock.c b/sys/kernel/kern_clock.c index 1c93cb8..3b63959 100644 --- a/sys/kernel/kern_clock.c +++ b/sys/kernel/kern_clock.c @@ -3,13 +3,13 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "callout.h" -#include "dk.h" -#include "kernel.h" -#include "systm.h" +#include +#include +#include +#include +#include +#include +#include int noproc; /* no one is running just now */ diff --git a/sys/kernel/kern_descrip.c b/sys/kernel/kern_descrip.c index 6200ecc..c35e4a4 100644 --- a/sys/kernel/kern_descrip.c +++ b/sys/kernel/kern_descrip.c @@ -3,20 +3,20 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "file.h" -#include "systm.h" -#include "inode.h" -#include "ioctl.h" -#include "stat.h" -#include "conf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef INET -#include "socket.h" -#include "socketvar.h" +#include +#include #endif -#include +#include const struct devspec fddevs[] = { { 0, "stdin" }, diff --git a/sys/kernel/kern_exec.c b/sys/kernel/kern_exec.c index 18f0162..6e25e5c 100644 --- a/sys/kernel/kern_exec.c +++ b/sys/kernel/kern_exec.c @@ -3,20 +3,20 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "map.h" -#include "inode.h" -#include "user.h" -#include "proc.h" -#include "buf.h" -#include "namei.h" -#include "fs.h" -#include "mount.h" -#include "file.h" -#include "signalvar.h" -#include "exec.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * exec system call, with and without environments. @@ -153,4 +153,3 @@ done: if (ip) iput(ip); } - diff --git a/sys/kernel/kern_exit.c b/sys/kernel/kern_exit.c index 2dbe097..9a10ff9 100644 --- a/sys/kernel/kern_exit.c +++ b/sys/kernel/kern_exit.c @@ -3,16 +3,16 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "map.h" -#include "user.h" -#include "proc.h" -#include "inode.h" -#include "vm.h" -#include "file.h" -#include "wait.h" -#include "kernel.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * Notify parent that vfork child is finished with parent's data. Called diff --git a/sys/kernel/kern_fork.c b/sys/kernel/kern_fork.c index 656df03..f5e7d81 100644 --- a/sys/kernel/kern_fork.c +++ b/sys/kernel/kern_fork.c @@ -3,16 +3,16 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "map.h" -#include "user.h" -#include "proc.h" -#include "inode.h" -#include "file.h" -#include "vm.h" -#include "kernel.h" -#include "syslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include int mpid; /* generic for unique process id's */ diff --git a/sys/kernel/kern_glob.c b/sys/kernel/kern_glob.c index 71b3e59..0054950 100644 --- a/sys/kernel/kern_glob.c +++ b/sys/kernel/kern_glob.c @@ -6,9 +6,9 @@ * byte = rdglob(addr); * success = wrglob(addr,byte); */ -#include "param.h" -#include "systm.h" -#include "user.h" +#include +#include +#include #ifndef GLOBSZ #define GLOBSZ 256 diff --git a/sys/kernel/kern_mman.c b/sys/kernel/kern_mman.c index 4705f05..b7f324d 100644 --- a/sys/kernel/kern_mman.c +++ b/sys/kernel/kern_mman.c @@ -3,11 +3,11 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "vm.h" -#include "systm.h" +#include +#include +#include +#include +#include void brk() diff --git a/sys/kernel/kern_proc.c b/sys/kernel/kern_proc.c index da4d820..4a302d6 100644 --- a/sys/kernel/kern_proc.c +++ b/sys/kernel/kern_proc.c @@ -3,10 +3,10 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "systm.h" +#include +#include +#include +#include /* * Is p an inferior of the current process? diff --git a/sys/kernel/kern_prot.c b/sys/kernel/kern_prot.c index 7b7306c..8666885 100644 --- a/sys/kernel/kern_prot.c +++ b/sys/kernel/kern_prot.c @@ -5,10 +5,10 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "systm.h" +#include +#include +#include +#include void getpid() diff --git a/sys/kernel/kern_prot2.c b/sys/kernel/kern_prot2.c index bbe5287..c184cb3 100644 --- a/sys/kernel/kern_prot2.c +++ b/sys/kernel/kern_prot2.c @@ -35,10 +35,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "systm.h" +#include +#include +#include +#include void setuid() diff --git a/sys/kernel/kern_resource.c b/sys/kernel/kern_resource.c index 707da9c..63bb3de 100644 --- a/sys/kernel/kern_resource.c +++ b/sys/kernel/kern_resource.c @@ -3,12 +3,12 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "systm.h" -#include "vm.h" -#include "kernel.h" +#include +#include +#include +#include +#include +#include /* * Resource controls and accounting. diff --git a/sys/kernel/kern_sig.c b/sys/kernel/kern_sig.c index 0d52cbd..02cbb63 100644 --- a/sys/kernel/kern_sig.c +++ b/sys/kernel/kern_sig.c @@ -3,13 +3,13 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "user.h" -#include "inode.h" -#include "proc.h" -#include "namei.h" -#include "signalvar.h" +#include +#include +#include +#include +#include +#include +#include /* * Can the current process send the signal `signum' to process `q'? diff --git a/sys/kernel/kern_subr.c b/sys/kernel/kern_subr.c index d1d88e5..9cb5d52 100644 --- a/sys/kernel/kern_subr.c +++ b/sys/kernel/kern_subr.c @@ -3,11 +3,11 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "user.h" -#include "buf.h" -#include "uio.h" +#include +#include +#include +#include +#include /* * Move data to/from user space. diff --git a/sys/kernel/kern_synch.c b/sys/kernel/kern_synch.c index f8d011f..2b35c1f 100644 --- a/sys/kernel/kern_synch.c +++ b/sys/kernel/kern_synch.c @@ -3,15 +3,15 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "buf.h" -#include "signal.h" -#include "signalvar.h" -#include "vm.h" -#include "kernel.h" -#include "systm.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #define SQSIZE 16 /* Must be power of 2 */ diff --git a/sys/kernel/kern_sysctl.c b/sys/kernel/kern_sysctl.c index a7a28b6..bdf7f77 100644 --- a/sys/kernel/kern_sysctl.c +++ b/sys/kernel/kern_sysctl.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include sysctlfn kern_sysctl; sysctlfn hw_sysctl; diff --git a/sys/kernel/kern_time.c b/sys/kernel/kern_time.c index f585529..4c488b1 100644 --- a/sys/kernel/kern_time.c +++ b/sys/kernel/kern_time.c @@ -3,11 +3,11 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "kernel.h" -#include "systm.h" +#include +#include +#include +#include +#include static void setthetime (tv) diff --git a/sys/kernel/rdisk.c b/sys/kernel/rdisk.c index 6631c10..cb79890 100644 --- a/sys/kernel/rdisk.c +++ b/sys/kernel/rdisk.c @@ -1,12 +1,12 @@ -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "errno.h" -#include "dk.h" -#include "debug.h" -#include "ioctl.h" -#include "rdisk.h" -#include "conf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #define Q2(X) #X #define QUOTE(X) Q2((X)) diff --git a/sys/kernel/subr_log.c b/sys/kernel/subr_log.c index a45d936..ec4063b 100644 --- a/sys/kernel/subr_log.c +++ b/sys/kernel/subr_log.c @@ -19,18 +19,18 @@ #define NLOG 1 int nlog = 1; -#include "param.h" -#include "user.h" -#include "proc.h" -#include "ioctl.h" -#include "msgbuf.h" -#include "file.h" -#include "inode.h" -#include "errno.h" -#include "uio.h" -#include "map.h" -#include "systm.h" -#include "conf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include const struct devspec logdevs[] = { { 0, "klog" }, diff --git a/sys/kernel/subr_prf.c b/sys/kernel/subr_prf.c index c7c3065..902d467 100644 --- a/sys/kernel/subr_prf.c +++ b/sys/kernel/subr_prf.c @@ -3,16 +3,16 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "buf.h" -#include "msgbuf.h" -#include "conf.h" -#include "ioctl.h" -#include "tty.h" -#include "reboot.h" -#include "systm.h" -#include "syslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define TOCONS 0x1 #define TOTTY 0x2 diff --git a/sys/kernel/subr_rmap.c b/sys/kernel/subr_rmap.c index 56eb615..66fddab 100644 --- a/sys/kernel/subr_rmap.c +++ b/sys/kernel/subr_rmap.c @@ -3,10 +3,10 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "map.h" -#include "vm.h" +#include +#include +#include +#include /* * Resource map handling routines. diff --git a/sys/kernel/sys_generic.c b/sys/kernel/sys_generic.c index c052fe5..6f88f2e 100644 --- a/sys/kernel/sys_generic.c +++ b/sys/kernel/sys_generic.c @@ -3,17 +3,17 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "signalvar.h" -#include "inode.h" -#include "file.h" -#include "ioctl.h" -#include "conf.h" -#include "uio.h" -#include "kernel.h" -#include "systm.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include int selwait; diff --git a/sys/kernel/sys_inode.c b/sys/kernel/sys_inode.c index 2ba579a..a285881 100644 --- a/sys/kernel/sys_inode.c +++ b/sys/kernel/sys_inode.c @@ -3,23 +3,23 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "signalvar.h" -#include "inode.h" -#include "buf.h" -#include "fs.h" -#include "file.h" -#include "stat.h" -#include "mount.h" -#include "conf.h" -#include "uio.h" -#include "ioctl.h" -#include "tty.h" -#include "kernel.h" -#include "systm.h" -#include "syslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include daddr_t rablock; /* block to be read ahead */ diff --git a/sys/kernel/sys_pipe.c b/sys/kernel/sys_pipe.c index bf3e5e0..7c380ba 100644 --- a/sys/kernel/sys_pipe.c +++ b/sys/kernel/sys_pipe.c @@ -3,15 +3,15 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "user.h" -#include "proc.h" -#include "inode.h" -#include "file.h" -#include "fs.h" -#include "mount.h" -#include "uio.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include int readp (fp, uio, flag) diff --git a/sys/kernel/sys_process.c b/sys/kernel/sys_process.c index 1f9ecd8..66b49f3 100644 --- a/sys/kernel/sys_process.c +++ b/sys/kernel/sys_process.c @@ -3,13 +3,13 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "user.h" -#include "proc.h" -#include "inode.h" -#include "vm.h" -#include "ptrace.h" +#include +#include +#include +#include +#include +#include +#include /* * sys-trace system call. diff --git a/sys/kernel/tty.c b/sys/kernel/tty.c index 4933a94..a5fef87 100644 --- a/sys/kernel/tty.c +++ b/sys/kernel/tty.c @@ -3,19 +3,19 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "ioctl.h" -#include "tty.h" -#include "proc.h" -#include "file.h" -#include "conf.h" -#include "dk.h" -#include "uio.h" -#include "kernel.h" -#include "systm.h" -#include "inode.h" -#include "syslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static int rts = TIOCM_RTS; diff --git a/sys/kernel/tty_pty.c b/sys/kernel/tty_pty.c index 5a08a92..32cedc4 100644 --- a/sys/kernel/tty_pty.c +++ b/sys/kernel/tty_pty.c @@ -6,22 +6,22 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "pty.h" +#include #if NPTY > 0 -#include "param.h" -#include "systm.h" -#include "ioctl.h" -#include "tty.h" -#include "user.h" -#include "conf.h" -#include "file.h" -#include "proc.h" -#include "uio.h" -#include "kernel.h" -#include "inode.h" -#include "types.h" -#include "ttydev.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include const struct devspec ptsdevs[] = { { 0, "ttyp0" }, { 1, "ttyp1" }, { 2, "ttyp2" }, { 3, "ttyp3" }, diff --git a/sys/kernel/tty_subr.c b/sys/kernel/tty_subr.c index 9d3d4ea..0c785d7 100644 --- a/sys/kernel/tty_subr.c +++ b/sys/kernel/tty_subr.c @@ -3,11 +3,11 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "clist.h" -#include "ioctl.h" -#include "tty.h" -#include "systm.h" +#include +#include +#include +#include +#include char cwaiting; diff --git a/sys/kernel/tty_tty.c b/sys/kernel/tty_tty.c index 8a63d5d..63774a4 100644 --- a/sys/kernel/tty_tty.c +++ b/sys/kernel/tty_tty.c @@ -10,12 +10,12 @@ * Indirect driver for controlling tty. * */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "ioctl.h" -#include "tty.h" -#include "conf.h" +#include +#include +#include +#include +#include +#include const struct devspec sydevs[] = { { 0, "tty" }, diff --git a/sys/kernel/ufs_alloc.c b/sys/kernel/ufs_alloc.c index 2d78f67..8670241 100644 --- a/sys/kernel/ufs_alloc.c +++ b/sys/kernel/ufs_alloc.c @@ -3,16 +3,16 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "fs.h" -#include "dir.h" -#include "inode.h" -#include "buf.h" -#include "user.h" -#include "kernel.h" -#include "mount.h" -#include "proc.h" -#include "systm.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include typedef struct fblk *FBLKP; diff --git a/sys/kernel/ufs_bio.c b/sys/kernel/ufs_bio.c index 5e4ce91..00d04bb 100644 --- a/sys/kernel/ufs_bio.c +++ b/sys/kernel/ufs_bio.c @@ -3,15 +3,15 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "buf.h" -#include "user.h" -#include "conf.h" -#include "fs.h" -#include "dk.h" -#include "systm.h" -#include "map.h" -#include "proc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * Read in (if necessary) the block and return a buffer pointer. diff --git a/sys/kernel/ufs_bmap.c b/sys/kernel/ufs_bmap.c index f768f37..54ce4ed 100644 --- a/sys/kernel/ufs_bmap.c +++ b/sys/kernel/ufs_bmap.c @@ -3,16 +3,16 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "conf.h" -#include "dir.h" -#include "inode.h" -#include "user.h" -#include "buf.h" -#include "fs.h" -#include "mount.h" -#include "uio.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * Bmap defines the structure of file system storage diff --git a/sys/kernel/ufs_dsort.c b/sys/kernel/ufs_dsort.c index 4e8f9fc..f3e7a83 100644 --- a/sys/kernel/ufs_dsort.c +++ b/sys/kernel/ufs_dsort.c @@ -9,11 +9,10 @@ /* * generalized seek sort for disk */ - -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "dk.h" +#include +#include +#include +#include void disksort (dp, bp) diff --git a/sys/kernel/ufs_fio.c b/sys/kernel/ufs_fio.c index 8f7d33b..ea707db 100644 --- a/sys/kernel/ufs_fio.c +++ b/sys/kernel/ufs_fio.c @@ -3,14 +3,14 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "fs.h" -#include "inode.h" -#include "mount.h" -#include "namei.h" -#include "systm.h" -#include "stat.h" +#include +#include +#include +#include +#include +#include +#include +#include /* * Check mode permission on inode pointer. diff --git a/sys/kernel/ufs_inode.c b/sys/kernel/ufs_inode.c index 31bf5a0..860336c 100644 --- a/sys/kernel/ufs_inode.c +++ b/sys/kernel/ufs_inode.c @@ -3,16 +3,16 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "inode.h" -#include "fs.h" -#include "mount.h" -#include "kernel.h" -#include "buf.h" -#include "systm.h" -#include "syslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define INOHSZ 16 /* must be power of two */ #define INOHASH(dev,ino) (((dev)+(ino))&(INOHSZ-1)) diff --git a/sys/kernel/ufs_mount.c b/sys/kernel/ufs_mount.c index 0e2f91b..e934889 100644 --- a/sys/kernel/ufs_mount.c +++ b/sys/kernel/ufs_mount.c @@ -3,19 +3,19 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "user.h" -#include "inode.h" -#include "fs.h" -#include "buf.h" -#include "mount.h" -#include "file.h" -#include "namei.h" -#include "conf.h" -#include "stat.h" -#include "ioctl.h" -#include "proc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * Common code for mount and umount. diff --git a/sys/kernel/ufs_namei.c b/sys/kernel/ufs_namei.c index 905a651..f86fe40 100644 --- a/sys/kernel/ufs_namei.c +++ b/sys/kernel/ufs_namei.c @@ -3,16 +3,16 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "dir.h" -#include "inode.h" -#include "fs.h" -#include "mount.h" -#include "user.h" -#include "buf.h" -#include "namei.h" -#include "proc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include int dirchk = 0; diff --git a/sys/kernel/ufs_subr.c b/sys/kernel/ufs_subr.c index bf4b889..38e4b19 100644 --- a/sys/kernel/ufs_subr.c +++ b/sys/kernel/ufs_subr.c @@ -3,15 +3,15 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "fs.h" -#include "inode.h" -#include "buf.h" -#include "mount.h" -#include "kernel.h" -#include "systm.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include int updlock; /* lock for sync */ diff --git a/sys/kernel/ufs_syscalls.c b/sys/kernel/ufs_syscalls.c index 85a425c..3ec55dc 100644 --- a/sys/kernel/ufs_syscalls.c +++ b/sys/kernel/ufs_syscalls.c @@ -3,16 +3,16 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "user.h" -#include "inode.h" -#include "namei.h" -#include "fs.h" -#include "file.h" -#include "stat.h" -#include "kernel.h" -#include "proc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * Common routine for chroot and chdir. diff --git a/sys/kernel/ufs_syscalls2.c b/sys/kernel/ufs_syscalls2.c index f3dfed2..39bc460 100644 --- a/sys/kernel/ufs_syscalls2.c +++ b/sys/kernel/ufs_syscalls2.c @@ -2,17 +2,17 @@ * ufs_syscalls was getting too large. Various UFS related system calls were * relocated to this file. */ -#include "param.h" -#include "sys/file.h" -#include "user.h" -#include "inode.h" -#include "buf.h" -#include "fs.h" -#include "namei.h" -#include "mount.h" -#include "kernel.h" -#include "systm.h" -#include "proc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static int statfs1 (mp, sbp) diff --git a/sys/kernel/vfs_vnops.c b/sys/kernel/vfs_vnops.c index 98ecd3e..56080f3 100644 --- a/sys/kernel/vfs_vnops.c +++ b/sys/kernel/vfs_vnops.c @@ -41,8 +41,7 @@ #include #include #include - -#include "systm.h" +#include /* * 2.11BSD does not have "vnodes", having instead only old fashioned "inodes". diff --git a/sys/kernel/vm_sched.c b/sys/kernel/vm_sched.c index 8a9cb88..72aa3ee 100644 --- a/sys/kernel/vm_sched.c +++ b/sys/kernel/vm_sched.c @@ -3,13 +3,13 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "vm.h" -#include "kernel.h" -#include "systm.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include #define MINFINITY -32767 /* minus infinity */ diff --git a/sys/kernel/vm_swap.c b/sys/kernel/vm_swap.c index d89f5ae..588b011 100644 --- a/sys/kernel/vm_swap.c +++ b/sys/kernel/vm_swap.c @@ -3,13 +3,13 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "map.h" -#include "buf.h" -#include "systm.h" -#include "vm.h" +#include +#include +#include +#include +#include +#include +#include /* * Swap a process in. diff --git a/sys/kernel/vm_swp.c b/sys/kernel/vm_swp.c index 4af7dd3..34cc484 100644 --- a/sys/kernel/vm_swp.c +++ b/sys/kernel/vm_swp.c @@ -3,14 +3,14 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "proc.h" -#include "buf.h" -#include "conf.h" -#include "systm.h" -#include "vm.h" -#include "uio.h" +#include +#include +#include +#include +#include +#include +#include +#include /* * swap I/O diff --git a/sys/pic32/Config.generic b/sys/pic32/Config.generic index 38a02fa..bb6b9d3 100644 --- a/sys/pic32/Config.generic +++ b/sys/pic32/Config.generic @@ -9,11 +9,11 @@ # machine "pic32" -cpu "PIC32MX" +cpu "PIC32MX7" ident CHIPKIT_MAX # Linker script -ldscript "pic32/bootloader-max32.ld" +ldscript "cfg/bootloader-max32.ld" # Need to set locally timezone 8 dst @@ -23,11 +23,7 @@ maxusers 2 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 "BUS_DIV=1" # Bus clock divisor 1/2/4/8 options "EXEC_AOUT" # Run a.out binaries options "EXEC_ELF" # Run ELF binaries options "EXEC_SCRIPT" # Run shell scripts @@ -66,8 +62,13 @@ device uart1 # Serial-to-USB converter device uart2 device uart3 device uart4 -options "UART_ENABLED" # TODO: delete this option +options "UART1_ENABLED" # TODO: delete this option +options "UART2_ENABLED" # TODO: delete this option +options "UART3_ENABLED" # TODO: delete this option +options "UART4_ENABLED" # TODO: delete this option options "UART1_BAUD=115200" # default speed +options "UART2_BAUD=115200" # default speed +options "UART3_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 diff --git a/sys/pic32/Makefile.kconf b/sys/pic32/Makefile.kconf index b189b33..5ccb5c5 100644 --- a/sys/pic32/Makefile.kconf +++ b/sys/pic32/Makefile.kconf @@ -33,7 +33,7 @@ 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 +LDFLAGS = -nostdlib -T $S/pic32/${LDSCRIPT} -Wl,-Map=unix.map SIZE = ${MIPS_GCC_PREFIX}size OBJCOPY = ${MIPS_GCC_PREFIX}objcopy OBJDUMP = ${MIPS_GCC_PREFIX}objdump @@ -47,9 +47,8 @@ endif # source tree is located via $S relative to the compilation directory S = ../.. -A = $S/pic32 -COPTS = -I. -I$S/include ${IDENT} -DKERNEL +COPTS = -I. ${IDENT} -DKERNEL CFLAGS = -O ${COPTS} # compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} @@ -65,8 +64,8 @@ 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 $@ +NORMAL_S = ${CC} -c ${COPTS} $< +NORMAL_S_C = ${CC} -c ${COPTS} ${PARAM} $< %OBJS @@ -77,37 +76,43 @@ NORMAL_S_C = ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@ # ${SYSTEM_LD_HEAD} # ${SYSTEM_LD} swapxxx.o # ${SYSTEM_LD_TAIL} -SYSTEM_OBJ = startup.o ${OBJS} ioconf.o +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_DEP = Makefile ioconf.c swapunix.c machine sys ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh $S/pic32/newvers.sh > vers.c; ${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; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ $(OBJDUMP) -d -S unix.elf > unix.dis %LOAD clean: - rm -f *.elf *.o *.map *.dis + rm -f *.elf *.o *.map *.dis *.bin clean-all: clean - rm -f *.h *.c machine sys Makefile + rm -f *.h *.c machine sys -#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 +reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + +load: unix.elf + pic32prog unix.hex + +startup.o: $S/pic32/startup.S + ${NORMAL_S} # 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 $@ + ln -s $S/pic32 $@ sys: ln -s $S/include $@ diff --git a/sys/pic32/adc.c b/sys/pic32/adc.c index eb442e7..2a919a6 100644 --- a/sys/pic32/adc.c +++ b/sys/pic32/adc.c @@ -21,15 +21,14 @@ * arising out of or in connection with the use or performance of * this software. */ - -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "systm.h" -#include "uio.h" -#include "adc.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include const struct devspec adcdevs[] = { { 0, "adc0" }, { 1, "adc1" }, { 2, "adc2" }, { 3, "adc3" }, diff --git a/sys/pic32/clock.c b/sys/pic32/clock.c index 8f46aff..00ea1aa 100644 --- a/sys/pic32/clock.c +++ b/sys/pic32/clock.c @@ -3,8 +3,8 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "machine/pic32mx.h" +#include +#include /* * Setup core timer for `hz' timer interrupts per second. diff --git a/sys/pic32/cons.c b/sys/pic32/cons.c index 5734bc5..7573ac3 100644 --- a/sys/pic32/cons.c +++ b/sys/pic32/cons.c @@ -5,15 +5,15 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "tty.h" -#include "systm.h" +#include +#include +#include +#include +#include +#include -#include "uart.h" -#include "usb_uart.h" +#include +#include #define CONCAT(x,y) x ## y #define BBAUD(x) CONCAT(B,x) diff --git a/sys/pic32/devsw.c b/sys/pic32/devsw.c index 4f2c5a9..1cdb59d 100644 --- a/sys/pic32/devsw.c +++ b/sys/pic32/devsw.c @@ -3,54 +3,54 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "conf.h" -#include "buf.h" -#include "time.h" -#include "ioctl.h" -#include "resource.h" -#include "inode.h" -#include "proc.h" -#include "clist.h" -#include "tty.h" -#include "systm.h" -#include "rdisk.h" -#include "errno.h" -#include "uart.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include "swap.h" +#include extern int strcmp(char *s1, char *s2); #ifdef UARTUSB_ENABLED -# include "usb_uart.h" +# include #endif #ifdef GPIO_ENABLED -# include "gpio.h" +# include #endif #ifdef ADC_ENABLED -# include "adc.h" +# include #endif #ifdef SPI_ENABLED -# include "spi.h" +# include #endif #ifdef GLCD_ENABLED -# include "glcd.h" +# include #endif #ifdef PWM_ENABLED -# include "pwm.h" +# include #endif #ifdef PICGA_ENABLED -# include "picga.h" +# include #endif #ifdef PTY_ENABLED -# include "pty.h" +# include #endif #ifdef HX8357_ENABLED -# include "hx8357.h" +# include #endif #ifdef SKEL_ENABLED -# include "skel.h" +# include #endif /* diff --git a/sys/pic32/exception.c b/sys/pic32/exception.c index c7dbd45..4f2c3d3 100644 --- a/sys/pic32/exception.c +++ b/sys/pic32/exception.c @@ -3,15 +3,15 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "signalvar.h" -#include "systm.h" -#include "user.h" -#include "proc.h" -#include "vm.h" -#include "uart.h" -#include "usb_uart.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include //#define TRACE_EXCEPTIONS diff --git a/sys/pic32/files.kconf b/sys/pic32/files.kconf index 4b25a7e..dff2eb4 100644 --- a/sys/pic32/files.kconf +++ b/sys/pic32/files.kconf @@ -71,7 +71,6 @@ 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 diff --git a/sys/pic32/glcd.c b/sys/pic32/glcd.c index a27d6dc..7adcb34 100644 --- a/sys/pic32/glcd.c +++ b/sys/pic32/glcd.c @@ -21,14 +21,14 @@ * arising out of or in connection with the use or performance of * this software. */ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "systm.h" -#include "sys/uio.h" -#include "glcd.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include const struct devspec glcddevs[] = { { 0, "glcd0" }, diff --git a/sys/pic32/gpio.c b/sys/pic32/gpio.c index a6d474a..0937fe9 100644 --- a/sys/pic32/gpio.c +++ b/sys/pic32/gpio.c @@ -21,13 +21,13 @@ * arising out of or in connection with the use or performance of * this software. */ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "gpio.h" -#include "systm.h" -#include "uio.h" +#include +#include +#include +#include +#include +#include +#include const struct devspec gpiodevs[] = { { 0, "porta" }, { 1, "portb" }, { 2, "portc" }, { 3, "portd" }, diff --git a/sys/pic32/hx8357.c b/sys/pic32/hx8357.c index f827ff1..e496326 100644 --- a/sys/pic32/hx8357.c +++ b/sys/pic32/hx8357.c @@ -21,17 +21,16 @@ * arising out of or in connection with the use or performance of * this software. */ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "systm.h" -#include "uio.h" -#include "adc.h" -#include "debug.h" -#include "hx8357.h" - -#include "fonts/default.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include char frame[40][80]; diff --git a/sys/pic32/machdep.c b/sys/pic32/machdep.c index 18d0125..9e54a15 100644 --- a/sys/pic32/machdep.c +++ b/sys/pic32/machdep.c @@ -3,32 +3,32 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "dir.h" -#include "inode.h" -#include "user.h" -#include "proc.h" -#include "fs.h" -#include "map.h" -#include "buf.h" -#include "file.h" -#include "clist.h" -#include "callout.h" -#include "reboot.h" -#include "msgbuf.h" -#include "namei.h" -#include "mount.h" -#include "systm.h" -#include "debug.h" -#include "uart.h" -#include "usb_uart.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef UARTUSB_ENABLED # include # include #endif #ifdef HX8357_ENABLED -#include "hx8357.h" +#include #endif #ifdef POWER_ENABLED @@ -147,9 +147,15 @@ nodump(dev) int (*dump)(dev_t) = nodump; -dev_t rootdev, swapdev, pipedev; - +#ifdef CONFIG +/* + * Build using old configuration utility (configsys). + */ +dev_t rootdev = NODEV; +dev_t swapdev = NODEV; dev_t dumpdev = NODEV; +#endif +dev_t pipedev; daddr_t dumplo = (daddr_t) 1024; /* diff --git a/sys/pic32/max32/.gitignore b/sys/pic32/max32/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/max32/.gitignore +++ b/sys/pic32/max32/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index 80e6333..6c0dd06 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -9,43 +9,30 @@ # machine "pic32" -cpu "PIC32MX" +cpu "PIC32MX7" ident CHIPKIT_MAX # Linker script -ldscript "pic32/bootloader-max32.ld" +ldscript "cfg/bootloader-max32.ld" # Need to set locally timezone 8 dst maxusers 2 # Standard system options +#options "CONFIG=MAX32" # TODO 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 "BUS_DIV=1" # Bus clock divisor 1/2/4/8 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 +# LED +options "LED_KERNEL_PORT=TRISA" # for kernel actibity LED... +options "LED_KERNEL_PIN=3" # ...use pin RA3 # Root filesystem at /dev/sd0a, swap at /dev/sd0b config unix root on sd0a @@ -57,7 +44,10 @@ device uart1 # Serial-to-USB converter device uart2 device uart3 device uart4 -options "UART_ENABLED" # TODO: delete this option +options "UART1_ENABLED" # TODO: delete this option +options "UART2_ENABLED" # TODO: delete this option +options "UART3_ENABLED" # TODO: delete this option +options "UART4_ENABLED" # TODO: delete this option # Console options options "CONSOLE_DEVICE=tty0" # /dev/tty0 @@ -88,5 +78,5 @@ device pwm0 options "PWM_ENABLED" # TODO: delete this option # Skeleton driver -device skel0 -options "SKEL_ENABLED" # TODO: delete this option +#device skel0 +#options "SKEL_ENABLED" # TODO: delete this option diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index d5d74e8..b139e4d 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -1,51 +1,367 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +IDENT=-DCHIPKIT_MAX -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=14 -DSD0_CS_PORT=TRISC -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART4_ENABLED -DUART3_ENABLED -DUART2_ENABLED -DUART1_ENABLED -DLED_KERNEL_PIN=3 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000 +LDSCRIPT="cfg/bootloader-max32.ld" +PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=2 +# +# 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). -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 -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 pwm.o rd_sd.o rdisk.o signal.o spi.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 uart.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 vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = +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 -DEFS += -DADC_ENABLED=YES -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=tty0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_KERNEL_PIN=3 -DEFS += -DLED_KERNEL_PORT=TRISA -DEFS += -DPIC32MX7 -DEFS += -DPWM_ENABLED=YES -DEFS += -DSD0_CS_PIN=14 -DEFS += -DSD0_CS_PORT=TRISC -DEFS += -DSD0_MHZ=10 -DEFS += -DSD0_PORT=2 -DEFS += -DSPI_ENABLED=YES -DEFS += -DUART1_BAUD=115200 -DEFS += -DUART1_ENABLED=YES -DEFS += -DUART2_BAUD=115200 -DEFS += -DUART2_ENABLED=YES -DEFS += -DUART3_BAUD=115200 -DEFS += -DUART3_ENABLED=YES -DEFS += -DUART4_BAUD=115200 -DEFS += -DUART4_ENABLED=YES -DEFS += -DUCB_METER +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 $S/pic32/${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 -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-max32.ld +# source tree is located via $S relative to the compilation directory +S = ../.. -CONFIG = MAX32 -CONFIGPATH = ../../../tools/configsys +COPTS = -I. ${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 = ${CC} -c ${COPTS} $< +NORMAL_S_C = ${CC} -c ${COPTS} ${PARAM} $< + +OBJS=exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o uart.o + +CFILES=$S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/uart.c swapunix.c + +# 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 ioconf.c swapunix.c machine sys ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh $S/pic32/newvers.sh > vers.c; ${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; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ + $(OBJDUMP) -d -S unix.elf > unix.dis + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${NORMAL_C} + +all: unix.elf + +clean: + rm -f *.elf *.o *.map *.dis *.bin + +clean-all: clean + rm -f *.h *.c machine sys + +reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + +load: unix.elf + pic32prog unix.hex + +startup.o: $S/pic32/startup.S + ${NORMAL_S} + +# 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 $S/pic32 $@ + +sys: + ln -s $S/include $@ + +depend: machine + mkdep ${COPTS} ${CFILES} ioconf.c + +ioconf.o: ioconf.c + ${CC} -c ${CFLAGS} ioconf.c + +exec_aout.o: $S/kernel/exec_aout.c + ${NORMAL_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${NORMAL_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${NORMAL_C} + +exec_script.o: $S/kernel/exec_script.c + ${NORMAL_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${NORMAL_C} + +init_main.o: $S/kernel/init_main.c + ${NORMAL_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${NORMAL_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${NORMAL_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${NORMAL_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${NORMAL_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${NORMAL_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${NORMAL_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${NORMAL_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${NORMAL_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${NORMAL_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${NORMAL_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${NORMAL_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${NORMAL_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${NORMAL_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${NORMAL_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${NORMAL_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${NORMAL_C} + +kern_time.o: $S/kernel/kern_time.c + ${NORMAL_C} + +rdisk.o: $S/kernel/rdisk.c + ${NORMAL_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${NORMAL_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${NORMAL_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${NORMAL_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${NORMAL_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${NORMAL_C} + +sys_process.o: $S/kernel/sys_process.c + ${NORMAL_C} + +syscalls.o: $S/kernel/syscalls.c + ${NORMAL_C} + +tty.o: $S/kernel/tty.c + ${NORMAL_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${NORMAL_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${NORMAL_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${NORMAL_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${NORMAL_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${NORMAL_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${NORMAL_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${NORMAL_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${NORMAL_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${NORMAL_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${NORMAL_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${NORMAL_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${NORMAL_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${NORMAL_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${NORMAL_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${NORMAL_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${NORMAL_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${NORMAL_C} + +adc.o: $S/pic32/adc.c + ${NORMAL_C} + +clock.o: $S/pic32/clock.c + ${NORMAL_C} + +cons.o: $S/pic32/cons.c + ${NORMAL_C} + +devsw.o: $S/pic32/devsw.c + ${NORMAL_C} + +exception.o: $S/pic32/exception.c + ${NORMAL_C} + +gpio.o: $S/pic32/gpio.c + ${NORMAL_C} + +machdep.o: $S/pic32/machdep.c + ${NORMAL_C} + +mem.o: $S/pic32/mem.c + ${NORMAL_C} + +pwm.o: $S/pic32/pwm.c + ${NORMAL_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${NORMAL_C} + +signal.o: $S/pic32/signal.c + ${NORMAL_C} + +spi.o: $S/pic32/spi.c + ${NORMAL_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${NORMAL_C} + +swap.o: $S/pic32/swap.c + ${NORMAL_C} + +sysctl.o: $S/pic32/sysctl.c + ${NORMAL_C} + +uart.o: $S/pic32/uart.c + ${NORMAL_C} -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/mem.c b/sys/pic32/mem.c index e8e9301..bf406a0 100644 --- a/sys/pic32/mem.c +++ b/sys/pic32/mem.c @@ -3,11 +3,11 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "conf.h" -#include "systm.h" -#include "uio.h" +#include +#include +#include +#include +#include const struct devspec mmdevs[] = { { 0, "mem" }, diff --git a/sys/pic32/picga.c b/sys/pic32/picga.c index c6aec3f..8aaf924 100644 --- a/sys/pic32/picga.c +++ b/sys/pic32/picga.c @@ -21,16 +21,15 @@ * arising out of or in connection with the use or performance of * this software. */ - -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "systm.h" -#include "uio.h" -#include "picga.h" -#include "spi_bus.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include const struct devspec picgadevs[] = { { 0, "picga" }, @@ -45,7 +44,7 @@ void blockdelay(unsigned int v) { for( ; v>0 ; v--) asm volatile ("nop"); -} +} void picga_command(unsigned char cmd, unsigned char len, void *data) { diff --git a/sys/pic32/power_control.c b/sys/pic32/power_control.c index 2a379c5..bfb3d37 100644 --- a/sys/pic32/power_control.c +++ b/sys/pic32/power_control.c @@ -1,9 +1,9 @@ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "systm.h" -#include "machparam.h" -#include "reboot.h" +#include +#include +#include +#include +#include +#include volatile unsigned int psCounter; int countdown; diff --git a/sys/pic32/pwm.c b/sys/pic32/pwm.c index e52206c..792bbdc 100644 --- a/sys/pic32/pwm.c +++ b/sys/pic32/pwm.c @@ -22,14 +22,14 @@ * arising out of or in connection with the use or performance of * this software. */ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "systm.h" -#include "sys/uio.h" -#include "pwm.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include /* * Devices: diff --git a/sys/pic32/rd_flash.c b/sys/pic32/rd_flash.c index 51ec7fa..d3eef65 100644 --- a/sys/pic32/rd_flash.c +++ b/sys/pic32/rd_flash.c @@ -1,9 +1,9 @@ -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "errno.h" -#include "dk.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include extern unsigned char flash_data[] asm("_binary_flash_img_start"); extern unsigned char flash_data_size[] asm("_binary_flash_img_size"); diff --git a/sys/pic32/rd_mrams.c b/sys/pic32/rd_mrams.c index 92bf16e..6446e7d 100644 --- a/sys/pic32/rd_mrams.c +++ b/sys/pic32/rd_mrams.c @@ -1,12 +1,11 @@ -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "errno.h" -#include "dk.h" -#include "rdisk.h" -#include "spi_bus.h" - -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include #define MRAM_WREN 0x06 #define MRAM_WRDI 0x04 diff --git a/sys/pic32/rd_sd.c b/sys/pic32/rd_sd.c index 8cd84f2..6da12ce 100644 --- a/sys/pic32/rd_sd.c +++ b/sys/pic32/rd_sd.c @@ -29,15 +29,14 @@ * arising out of or in connection with the use or performance of * this software. */ -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "errno.h" -#include "dk.h" -#include "rdisk.h" -#include "spi_bus.h" - -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include /* * Two SD/MMC disks on SPI. diff --git a/sys/pic32/rd_sdramp.c b/sys/pic32/rd_sdramp.c index 8640dbc..203e8a1 100644 --- a/sys/pic32/rd_sdramp.c +++ b/sys/pic32/rd_sdramp.c @@ -5,20 +5,19 @@ * * This code could use a bit of optimization. */ - -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "errno.h" -#include "dk.h" -#include "sdram.h" -#include "rd_sdramp.h" -#include "rdisk.h" +#include +#include +#include +#include +#include +#include +#include +#include /* * See rd_sdramp_config.h for sdramp port/pin configuration */ -#include "rd_sdramp_config.h" +#include int sw_dkn = -1; /* Statistics slot number */ diff --git a/sys/pic32/rd_spirams.c b/sys/pic32/rd_spirams.c index eb6bdd7..0fd3277 100644 --- a/sys/pic32/rd_spirams.c +++ b/sys/pic32/rd_spirams.c @@ -1,12 +1,11 @@ -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "errno.h" -#include "dk.h" -#include "rdisk.h" -#include "spi_bus.h" - -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include #define SPIRAM_WREN 0x06 #define SPIRAM_WRDI 0x04 diff --git a/sys/pic32/rd_sramc.c b/sys/pic32/rd_sramc.c index 08cadd5..56fb10a 100644 --- a/sys/pic32/rd_sramc.c +++ b/sys/pic32/rd_sramc.c @@ -16,14 +16,13 @@ * Signals PMRD, PMWR are active LOW and idle HIGH * Signal PMA0 is LOW when accessing RAM Data, and HIGH when accessing RAM Addresses */ -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "errno.h" -#include "dk.h" -#include "rdisk.h" - -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include int sw_dkn = -1; /* Statistics slot number */ diff --git a/sys/pic32/sdram.S b/sys/pic32/sdram.S index 47b86cb..93b4fb5 100644 --- a/sys/pic32/sdram.S +++ b/sys/pic32/sdram.S @@ -15,7 +15,7 @@ /* * See rd_sdramp_config.h for sdramp port/pin configuration */ -#include "rd_sdramp_config.h" +#include /* Offsets (from TRISA) for the various port control registers */ #define TRIS_OFFSET 0x0 diff --git a/sys/pic32/signal.c b/sys/pic32/signal.c index c25e170..1a97819 100644 --- a/sys/pic32/signal.c +++ b/sys/pic32/signal.c @@ -3,14 +3,14 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "systm.h" -#include "signalvar.h" -#include "user.h" -#include "proc.h" -#include "buf.h" -#include "map.h" -#include "syslog.h" +#include +#include +#include +#include +#include +#include +#include +#include //#define DIAGNOSTIC diff --git a/sys/pic32/skel.c b/sys/pic32/skel.c index 015085e..e5e3989 100644 --- a/sys/pic32/skel.c +++ b/sys/pic32/skel.c @@ -21,13 +21,13 @@ * arising out of or in connection with the use or performance of * this software. */ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "systm.h" -#include "uio.h" -#include "skel.h" +#include +#include +#include +#include +#include +#include +#include /* * List of device names and minor numbers. diff --git a/sys/pic32/spi.c b/sys/pic32/spi.c index fe4ca18..5cc83a2 100644 --- a/sys/pic32/spi.c +++ b/sys/pic32/spi.c @@ -21,14 +21,14 @@ * arising out of or in connection with the use or performance of * this software. */ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "systm.h" -#include "uio.h" -#include "spi.h" -#include "spi_bus.h" +#include +#include +#include +#include +#include +#include +#include +#include const struct devspec spidevs[] = { { 0, "spi1" }, diff --git a/sys/pic32/spi_bus.c b/sys/pic32/spi_bus.c index 814d836..0431b6d 100644 --- a/sys/pic32/spi_bus.c +++ b/sys/pic32/spi_bus.c @@ -1,10 +1,10 @@ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "systm.h" -#include "uio.h" -#include "spi_bus.h" +#include +#include +#include +#include +#include +#include +#include #define NSPI 4 /* Ports SPI1...SPI4 */ diff --git a/sys/pic32/ssd1926-sdcard.c b/sys/pic32/ssd1926-sdcard.c index 3bc2260..a3424c1 100644 --- a/sys/pic32/ssd1926-sdcard.c +++ b/sys/pic32/ssd1926-sdcard.c @@ -28,7 +28,7 @@ * Sean Justice 15_Sept-2008 First release * Anton Alkhimenok 06_Jun-2009 Ported to PIC24 */ -#include "ssd1926.h" +#include /* * Helper Macros diff --git a/sys/pic32/startup.S b/sys/pic32/startup.S index 6e3599a..fcbe9b2 100644 --- a/sys/pic32/startup.S +++ b/sys/pic32/startup.S @@ -22,7 +22,7 @@ # arising out of or in connection with the use or performance of # this software. # -#include "machine/io.h" +#include #define UBASE 0x7f008000 /* User space base address */ diff --git a/sys/pic32/swap.c b/sys/pic32/swap.c index 1feb0fa..36b01ac 100644 --- a/sys/pic32/swap.c +++ b/sys/pic32/swap.c @@ -2,18 +2,17 @@ * Simple proxy for swap partition. Forwards requests for /dev/swap on to the * device specified by swapdev */ - -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "errno.h" -#include "dk.h" -#include "uio.h" -#include "conf.h" -#include "fcntl.h" -#include "map.h" -#include "swap.h" -#include "rdisk.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifndef NTMP #define NTMP 3 diff --git a/sys/pic32/sysctl.c b/sys/pic32/sysctl.c index 230e762..aa1bbd2 100644 --- a/sys/pic32/sysctl.c +++ b/sys/pic32/sysctl.c @@ -3,24 +3,24 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "user.h" -#include "ioctl.h" -#include "proc.h" -#include "kernel.h" -#include "file.h" -#include "inode.h" -#include "sysctl.h" -#include "cpu.h" -#include "tty.h" -#include "systm.h" -#include "dk.h" -#include "vmsystm.h" -#include "ptrace.h" -#include "namei.h" -#include "vmmeter.h" -#include "map.h" -#include "conf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * Errno messages. diff --git a/sys/pic32/uart.c b/sys/pic32/uart.c index 7539d70..c4d5a22 100644 --- a/sys/pic32/uart.c +++ b/sys/pic32/uart.c @@ -5,13 +5,13 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ -#include "param.h" -#include "conf.h" -#include "user.h" -#include "ioctl.h" -#include "tty.h" -#include "systm.h" -#include "uart.h" +#include +#include +#include +#include +#include +#include +#include #define CONCAT(x,y) x ## y #define BBAUD(x) CONCAT(B,x) diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index ee5d6c5..f599672 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -92,7 +92,6 @@ usage: fputs("usage: kconfig [-gp] sysname\n", stderr); makefile(); /* build Makefile */ headers(); /* make a lot of .h files */ swapconf(); /* swap config files */ - printf("Don't forget to run \"make depend\"\n"); exit(0); } diff --git a/tools/kconfig/mkswapconf.c b/tools/kconfig/mkswapconf.c index e680528..abe3231 100644 --- a/tools/kconfig/mkswapconf.c +++ b/tools/kconfig/mkswapconf.c @@ -93,6 +93,13 @@ do_swap(fl) fprintf(fp, "dev_t\tdumpdev = makedev(%d, %d);\t/* %s */\n", major(fl->f_dumpdev), minor(fl->f_dumpdev), devtoname(fl->f_dumpdev)); +#if 1 + /* Only one swap device is supported. */ + dev = swap->f_swapdev; + fprintf(fp, "dev_t\tswapdev = makedev(%d, %d);\t/* %s */\n", + major(swap->f_swapdev), minor(swap->f_swapdev), + devtoname(swap->f_swapdev)); +#else fprintf(fp, "\n"); fprintf(fp, "struct\tswdevt swdevt[] = {\n"); do { @@ -104,6 +111,7 @@ do_swap(fl) } while (swap && swap->f_type == SWAPSPEC); fprintf(fp, "\t{ NODEV, 0, 0 }\n"); fprintf(fp, "};\n"); +#endif fclose(fp); return (swap); } From 635d8ff2f75aeec2bb5d6599288e0117496a7f2f Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Tue, 1 Sep 2015 19:46:57 -0700 Subject: [PATCH 03/32] GCC configuration script unified for both kconfig and configsys. Ling scripts modified for compatibility with CodeScape toolchain. Fixed gcc warnings in kernel and kconfig. --- sys/kernel/sys_generic.c | 2 +- sys/pic32/Makefile.kconf | 46 +++----------- sys/pic32/cfg/bare.ld | 3 + sys/pic32/cfg/bootloader-max32.ld | 2 + sys/pic32/cfg/bootloader-maxcolor.ld | 2 + sys/pic32/cfg/bootloader-sdram.ld | 2 + sys/pic32/cfg/bootloader-ubw32.ld | 2 + sys/pic32/gcc-config.mk | 91 +++++++++++++--------------- sys/pic32/kernel-post.mk | 18 +++--- sys/pic32/max32/Makefile | 46 +++----------- tools/Makefile | 2 +- tools/kconfig/mkswapconf.c | 4 +- 12 files changed, 85 insertions(+), 135 deletions(-) diff --git a/sys/kernel/sys_generic.c b/sys/kernel/sys_generic.c index 6f88f2e..197aa49 100644 --- a/sys/kernel/sys_generic.c +++ b/sys/kernel/sys_generic.c @@ -228,7 +228,7 @@ selscan(ibits, obits, nfd, retval) fd_set *ibits, *obits; int nfd, *retval; { - register int i, j, flag; + register int i, j, flag = 0; fd_mask bits; struct file *fp; int which, n = 0; diff --git a/sys/pic32/Makefile.kconf b/sys/pic32/Makefile.kconf index 5ccb5c5..0a0a188 100644 --- a/sys/pic32/Makefile.kconf +++ b/sys/pic32/Makefile.kconf @@ -3,49 +3,23 @@ # # 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 +# +include ../gcc-config.mk 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 $S/pic32/${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${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 +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} endif -# source tree is located via $S relative to the compilation directory +# sources are located via $S relative to the compilation directory S = ../.. COPTS = -I. ${IDENT} -DKERNEL @@ -81,7 +55,7 @@ ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys ${SYSTEM_OBJ} -SYSTEM_LD_HEAD = sh $S/pic32/newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ @@ -104,7 +78,7 @@ reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig load: unix.elf pic32prog unix.hex -startup.o: $S/pic32/startup.S +startup.o: ../startup.S ${NORMAL_S} # the following are necessary because the files depend on the types of @@ -112,10 +86,10 @@ startup.o: $S/pic32/startup.S clock.o machdep.o conf.o: Makefile machine: - ln -s $S/pic32 $@ + ln -s .. $@ sys: - ln -s $S/include $@ + ln -s ../../include $@ depend: machine mkdep ${COPTS} ${CFILES} ioconf.c diff --git a/sys/pic32/cfg/bare.ld b/sys/pic32/cfg/bare.ld index adc7434..69bab8d 100644 --- a/sys/pic32/cfg/bare.ld +++ b/sys/pic32/cfg/bare.ld @@ -82,6 +82,9 @@ SECTIONS *(.glue_7t) *(.glue_7) __rodata_start = . ; *(.rodata .rodata.* .gnu.linkonce.r.* .rel.dyn) + __abiflags = . ; + *(.MIPS.abiflags) + *(.dinit) /* Align here to ensure that the .text section ends on word boundary. */ . = ALIGN (32 / 8); _etext = .; diff --git a/sys/pic32/cfg/bootloader-max32.ld b/sys/pic32/cfg/bootloader-max32.ld index 54bc462..a5ce399 100644 --- a/sys/pic32/cfg/bootloader-max32.ld +++ b/sys/pic32/cfg/bootloader-max32.ld @@ -42,6 +42,8 @@ SECTIONS *(.glue_7t) *(.glue_7) __rodata_start = . ; *(.rodata .rodata.* .gnu.linkonce.r.* .rel.dyn) + __abiflags = . ; + *(.MIPS.abiflags) *(.dinit) /* Align here to ensure that the .text section ends on word boundary. */ . = ALIGN (32 / 8); diff --git a/sys/pic32/cfg/bootloader-maxcolor.ld b/sys/pic32/cfg/bootloader-maxcolor.ld index 84af529..62f0934 100644 --- a/sys/pic32/cfg/bootloader-maxcolor.ld +++ b/sys/pic32/cfg/bootloader-maxcolor.ld @@ -42,6 +42,8 @@ SECTIONS *(.glue_7t) *(.glue_7) __rodata_start = . ; *(.rodata .rodata.* .gnu.linkonce.r.* .rel.dyn) + __abiflags = . ; + *(.MIPS.abiflags) *(.dinit) /* Align here to ensure that the .text section ends on word boundary. */ . = ALIGN (32 / 8); diff --git a/sys/pic32/cfg/bootloader-sdram.ld b/sys/pic32/cfg/bootloader-sdram.ld index ba65550..c4f29e7 100644 --- a/sys/pic32/cfg/bootloader-sdram.ld +++ b/sys/pic32/cfg/bootloader-sdram.ld @@ -46,6 +46,8 @@ SECTIONS *(.glue_7t) *(.glue_7) __rodata_start = . ; *(.rodata .rodata.* .gnu.linkonce.r.* .rel.dyn) + __abiflags = . ; + *(.MIPS.abiflags) *(.dinit) /* Align here to ensure that the .text section ends on word boundary. */ . = ALIGN (32 / 8); diff --git a/sys/pic32/cfg/bootloader-ubw32.ld b/sys/pic32/cfg/bootloader-ubw32.ld index ac39fe0..5b856fe 100644 --- a/sys/pic32/cfg/bootloader-ubw32.ld +++ b/sys/pic32/cfg/bootloader-ubw32.ld @@ -42,6 +42,8 @@ SECTIONS *(.glue_7t) *(.glue_7) __rodata_start = . ; *(.rodata .rodata.* .gnu.linkonce.r.* .rel.dyn) + __abiflags = . ; + *(.MIPS.abiflags) *(.dinit) /* Align here to ensure that the .text section ends on word boundary. */ . = ALIGN (32 / 8); diff --git a/sys/pic32/gcc-config.mk b/sys/pic32/gcc-config.mk index 30c202d..f52eff6 100644 --- a/sys/pic32/gcc-config.mk +++ b/sys/pic32/gcc-config.mk @@ -1,9 +1,11 @@ # chipKIT PIC32 compiler from UECIDE -ifdef UECIDE -ifndef GCCPREFIX - GCCPREFIX = ${UECIDE}/compilers/pic32-tools/bin/pic32- - LDFLAGS = -Wl,--oformat=elf32-tradlittlemips -endif +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Use UECIDE package from http://uecide.org/download +ifndef MIPS_GCC_PREFIX + ifdef UECIDE + MIPS_GCC_PREFIX = $(UECIDE)/compilers/pic32-tools/bin/pic32- + MIPS_GCC_FORMAT = elf32-tradlittlemips + endif endif # chipKIT PIC32 compiler on Linux @@ -14,62 +16,53 @@ endif # to pic32-tools/lib/gcc/pic32mx/4.5.1/include. # MPLABX C32 compiler doesn't support some functionality # we need, so use chipKIT compiler by default. -ifndef GCCPREFIX -ifeq (/usr/local/pic32-tools/bin/pic32-gcc,$(wildcard /usr/local/pic32-tools/bin/pic32-gcc)) - GCCPREFIX = /usr/local/pic32-tools/bin/pic32- - LDFLAGS = -Wl,--oformat=elf32-tradlittlemips -endif +ifndef MIPS_GCC_PREFIX + ifeq (/usr/local/pic32-tools/bin/pic32-gcc,$(wildcard /usr/local/pic32-tools/bin/pic32-gcc)) + MIPS_GCC_PREFIX = /usr/local/pic32-tools/bin/pic32- + MIPS_GCC_FORMAT = elf32-tradlittlemips + endif endif # Generic MIPS toolchain # ~~~~~~~~~~~~~~~~~~~~~~ # You can build it from sources, as described on page # http://retrobsd.org/wiki/doku.php/doc/toolchain-mips -ifndef GCCPREFIX -ifeq (/usr/local/mips-gcc-4.8.1/bin/mips-elf-gcc,$(wildcard /usr/local/mips-gcc-4.8.1/bin/mips-elf-gcc)) - GCCPREFIX = /usr/local/mips-gcc-4.8.1/bin/mips-elf- - LDFLAGS = -endif +ifndef MIPS_GCC_PREFIX + ifeq (/usr/local/mips-gcc-4.8.1/bin/mips-elf-gcc,$(wildcard /usr/local/mips-gcc-4.8.1/bin/mips-elf-gcc)) + MIPS_GCC_PREFIX = /usr/local/mips-gcc-4.8.1/bin/mips-elf- + endif endif # Mentor Sourcery CodeBench Lite toolchain # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# You can download a Linux or Windows binary package from -# https://sourcery.mentor.com/GNUToolchain/release2641 -ifndef GCCPREFIX -ifeq (/usr/local/mips-2013.11/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2013.11/bin/mips-sde-elf-gcc)) - GCCPREFIX = /usr/local/mips-2013.11/bin/mips-sde-elf- - LDFLAGS = -Wl,--oformat=elf32-tradlittlemips -endif -endif -ifndef GCCPREFIX -ifeq (/usr/local/mips-2014.05/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2014.05/bin/mips-sde-elf-gcc)) - GCCPREFIX = /usr/local/mips-2014.05/bin/mips-sde-elf- - LDFLAGS = -Wl,--oformat=elf32-tradlittlemips +ifndef MIPS_GCC_PREFIX + # Download a Linux binary package from + # https://sourcery.mentor.com/GNUToolchain/release2641 + ifeq (/usr/local/mips-2013.11/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2013.11/bin/mips-sde-elf-gcc)) + MIPS_GCC_PREFIX = /usr/local/mips-2013.11/bin/mips-sde-elf- + MIPS_GCC_FORMAT = elf32-tradlittlemips + endif endif +ifndef MIPS_GCC_PREFIX + # Download a Linux binary package from + # https://sourcery.mentor.com/GNUToolchain/release2774 + ifeq (/usr/local/mips-2014.05/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2014.05/bin/mips-sde-elf-gcc)) + MIPS_GCC_PREFIX = /usr/local/mips-2014.05/bin/mips-sde-elf- + MIPS_GCC_FORMAT = elf32-tradlittlemips + endif endif -ifndef GCCPREFIX +# Imagination Codescape MIPS SDK Essentials +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Download a Linux binary package from: +# http://community.imgtec.com/developers/mips/tools/codescape-mips-sdk/download-codescape-mips-sdk-essentials/ +ifndef MIPS_GCC_ROOT + ifeq (/opt/imgtec/Toolchains/mips-mti-elf/2015.01-7,$(wildcard /opt/imgtec/Toolchains/mips-mti-elf/2015.01-7)) + MIPS_GCC_ROOT = /opt/imgtec/Toolchains/mips-mti-elf/2015.01-7 + MIPS_GCC_FORMAT = elf32-tradlittlemips + endif +endif + +ifndef MIPS_GCC_PREFIX $(error Unable to locate any GCC MIPS toolchain!) endif - -# UECIDE on Linux -ifneq (,$(wildcard $UECIDE/cores/chipKIT)) - AVRDUDE = $UECIDE/cores/chipKIT/tools/linux64/avrdude \ - -C $UECIDE/cores/chipKIT/tools/linux64/avrdude.conf -V \ - -P /dev/ttyUSB* -endif - -# chipKIT MPIDE on Mac OS X -ifneq (,$(wildcard /Applications/Mpide.app/Contents/Resources/Java/hardware/tools/avr)) - AVRDUDE = /Applications/Mpide.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude \ - -C /Applications/Mpide.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf \ - -P /dev/tty.usbserial-* -endif - -# chipKIT MPIDE on Linux -ifneq (,$(wildcard /opt/mpide-0023-linux-20120903/hardware/tools/avrdude)) - AVRDUDE = /opt/mpide-0023-linux-20120903/hardware/tools/avrdude \ - -C /opt/mpide-0023-linux-20120903/hardware/tools/avrdude.conf \ - -P /dev/ttyUSB0 -endif diff --git a/sys/pic32/kernel-post.mk b/sys/pic32/kernel-post.mk index dff8579..44c0c5b 100644 --- a/sys/pic32/kernel-post.mk +++ b/sys/pic32/kernel-post.mk @@ -5,16 +5,19 @@ ASFLAGS = -I. -I$(H) $(DEFS) $(DEPFLAGS) include $(BUILDPATH)/gcc-config.mk -CC = $(GCCPREFIX)gcc -EL -g -mips32r2 +CC = $(MIPS_GCC_PREFIX)gcc -EL -g -mips32r2 CC += -nostdinc -fno-builtin -Werror -Wall -fno-dwarf2-cfi-asm -LDFLAGS += -nostdlib -SIZE = $(GCCPREFIX)size -OBJDUMP = $(GCCPREFIX)objdump -OBJCOPY = $(GCCPREFIX)objcopy -PROGTOOL = $(AVRDUDE) -c stk500v2 -p pic32 -b 115200 +LDFLAGS = -nostdlib +SIZE = $(MIPS_GCC_PREFIX)size +OBJDUMP = $(MIPS_GCC_PREFIX)objdump +OBJCOPY = $(MIPS_GCC_PREFIX)objcopy DEFS += -DCONFIG=$(CONFIG) +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif + all: .deps sys machine unix.elf $(SIZE) unix.elf @@ -44,9 +47,6 @@ unix.elf: $(KERNOBJ) $(LDSCRIPT) load: unix.hex pic32prog $(BLREBOOT) unix.hex -loadmax: unix.hex - $(PROGTOOL) -U flash:w:unix.hex:i - vers.o: $(BUILDPATH)/newvers.sh $(H)/*.h $(M)/*.[ch] $(S)/*.c sh $(BUILDPATH)/newvers.sh > vers.c $(CC) -c vers.c diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index b139e4d..09ba959 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -6,49 +6,23 @@ PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=2 # # 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 +# +include ../gcc-config.mk 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 $S/pic32/${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${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 +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} endif -# source tree is located via $S relative to the compilation directory +# sources are located via $S relative to the compilation directory S = ../.. COPTS = -I. ${IDENT} -DKERNEL @@ -120,7 +94,7 @@ ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys ${SYSTEM_OBJ} -SYSTEM_LD_HEAD = sh $S/pic32/newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ @@ -151,7 +125,7 @@ reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig load: unix.elf pic32prog unix.hex -startup.o: $S/pic32/startup.S +startup.o: ../startup.S ${NORMAL_S} # the following are necessary because the files depend on the types of @@ -159,10 +133,10 @@ startup.o: $S/pic32/startup.S clock.o machdep.o conf.o: Makefile machine: - ln -s $S/pic32 $@ + ln -s .. $@ sys: - ln -s $S/include $@ + ln -s ../../include $@ depend: machine mkdep ${COPTS} ${CFILES} ioconf.c diff --git a/tools/Makefile b/tools/Makefile index ae7452a..4218b65 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,4 +1,4 @@ -SUBDIR = elf2aout fsutil virtualmips mkrd configsys icache +SUBDIR = elf2aout fsutil virtualmips mkrd configsys kconfig icache all install depend: ${SUBDIR} -for i in ${SUBDIR}; do ${MAKE} -C $$i ${MFLAGS} DESTDIR=${DESTDIR} $@; done diff --git a/tools/kconfig/mkswapconf.c b/tools/kconfig/mkswapconf.c index abe3231..d93e302 100644 --- a/tools/kconfig/mkswapconf.c +++ b/tools/kconfig/mkswapconf.c @@ -61,7 +61,6 @@ do_swap(fl) FILE *fp; char swapname[80]; register struct file_list *swap; - dev_t dev; if (eq(fl->f_fn, "generic")) { fl = fl->f_next; @@ -95,7 +94,6 @@ do_swap(fl) devtoname(fl->f_dumpdev)); #if 1 /* Only one swap device is supported. */ - dev = swap->f_swapdev; fprintf(fp, "dev_t\tswapdev = makedev(%d, %d);\t/* %s */\n", major(swap->f_swapdev), minor(swap->f_swapdev), devtoname(swap->f_swapdev)); @@ -103,7 +101,7 @@ do_swap(fl) fprintf(fp, "\n"); fprintf(fp, "struct\tswdevt swdevt[] = {\n"); do { - dev = swap->f_swapdev; + int dev = swap->f_swapdev; fprintf(fp, "\t{ makedev(%d, %d), %d, %d },\t/* %s */\n", major(dev), minor(dev), swap->f_swapflag, swap->f_swapsize, swap->f_fn); From 592e2014fb91b3c9463df30c513fdbe5435d4bec Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Wed, 2 Sep 2015 18:19:30 -0700 Subject: [PATCH 04/32] Kconfig: remove unused options config-dependent, device-driver and profiling-routine. Kernel makefile updated. --- sys/pic32/Makefile.kconf | 23 ++---- sys/pic32/machdep.c | 12 +-- sys/pic32/machparam.h | 2 + sys/pic32/max32/Config | 2 +- sys/pic32/max32/Makefile | 161 +++++++++++++++++-------------------- tools/kconfig/config.h | 16 +--- tools/kconfig/kconfig.8 | 9 +-- tools/kconfig/main.c | 5 +- tools/kconfig/mkmakefile.c | 58 ++----------- 9 files changed, 104 insertions(+), 184 deletions(-) diff --git a/sys/pic32/Makefile.kconf b/sys/pic32/Makefile.kconf index 0a0a188..e302854 100644 --- a/sys/pic32/Makefile.kconf +++ b/sys/pic32/Makefile.kconf @@ -2,7 +2,6 @@ # 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). # include ../gcc-config.mk @@ -23,23 +22,13 @@ endif S = ../.. COPTS = -I. ${IDENT} -DKERNEL -CFLAGS = -O ${COPTS} +CFLAGS = -O ${COPTS} ${PARAM} -# 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. +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). -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 = ${CC} -c ${COPTS} $< -NORMAL_S_C = ${CC} -c ${COPTS} ${PARAM} $< +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${COPTS} $< %OBJS @@ -79,7 +68,7 @@ load: unix.elf pic32prog unix.hex startup.o: ../startup.S - ${NORMAL_S} + ${COMPILE_S} # the following are necessary because the files depend on the types of # cpu's included in the system configuration diff --git a/sys/pic32/machdep.c b/sys/pic32/machdep.c index 9e54a15..ded621e 100644 --- a/sys/pic32/machdep.c +++ b/sys/pic32/machdep.c @@ -100,10 +100,10 @@ extern void power_off(); #define LED_MISC4_OFF() LAT_CLR(LED_MISC4_PORT) = 1 << LED_MISC4_PIN #endif -int hz = HZ; -int usechz = (1000000L + HZ - 1) / HZ; -struct timezone tz = { 8*60, 1 }; -int nproc = NPROC; +int hz = HZ; +int usechz = (1000000L + HZ - 1) / HZ; +struct timezone tz = { TIMEZONE, DST }; +int nproc = NPROC; struct namecache namecache [NNAMECACHE]; char bufdata [NBUF * MAXBSIZE]; @@ -113,8 +113,8 @@ struct mount mount [NMOUNT]; struct buf buf [NBUF], bfreelist [BQUEUES]; struct bufhd bufhash [BUFHSZ]; struct cblock cfree [NCLIST]; -struct proc proc [NPROC]; -struct file file [NFILE]; +struct proc proc [NPROC]; +struct file file [NFILE]; /* * Remove the ifdef/endif to run the kernel in unsecure mode even when in diff --git a/sys/pic32/machparam.h b/sys/pic32/machparam.h index c2eb51b..c35fc2a 100644 --- a/sys/pic32/machparam.h +++ b/sys/pic32/machparam.h @@ -40,7 +40,9 @@ #ifndef NBUF #define NBUF 10 /* number of i/o buffers */ #endif +#ifndef MAXUSERS #define MAXUSERS 1 /* number of user logins */ +#endif #ifndef NPROC #define NPROC 10 /* number of processes */ #endif diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index 6c0dd06..ca10fdd 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -17,7 +17,7 @@ ldscript "cfg/bootloader-max32.ld" # Need to set locally timezone 8 dst -maxusers 2 +maxusers 1 # Standard system options #options "CONFIG=MAX32" # TODO diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 09ba959..7a850ed 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -1,11 +1,10 @@ IDENT=-DCHIPKIT_MAX -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=14 -DSD0_CS_PORT=TRISC -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART4_ENABLED -DUART3_ENABLED -DUART2_ENABLED -DUART1_ENABLED -DLED_KERNEL_PIN=3 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000 LDSCRIPT="cfg/bootloader-max32.ld" -PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=2 +PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=1 # # 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). # include ../gcc-config.mk @@ -26,25 +25,15 @@ endif S = ../.. COPTS = -I. ${IDENT} -DKERNEL -CFLAGS = -O ${COPTS} +CFLAGS = -O ${COPTS} ${PARAM} -# 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. +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). -NORMAL_C = ${CC} -c ${CFLAGS} ${PROF} $< -NORMAL_C_C = ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${COPTS} $< -DRIVER_C = ${CC} -c ${CFLAGS} ${PROF} $< -DRIVER_C_C = ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< - -PROFILE_C = ${CC} -p -c ${COPTS} $< - -NORMAL_S = ${CC} -c ${COPTS} $< -NORMAL_S_C = ${CC} -c ${COPTS} ${PARAM} $< - -OBJS=exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o \ +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 \ @@ -57,7 +46,7 @@ OBJS=exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o \ clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o uart.o -CFILES=$S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ $S/kernel/exec_script.c $S/kernel/exec_subr.c \ $S/kernel/init_main.c $S/kernel/init_sysent.c \ $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ @@ -108,7 +97,7 @@ unix.elf: ${SYSTEM_DEP} swapunix.o ${SYSTEM_LD_TAIL} swapunix.o: swapunix.c - ${NORMAL_C} + ${COMPILE_C} all: unix.elf @@ -126,7 +115,7 @@ load: unix.elf pic32prog unix.hex startup.o: ../startup.S - ${NORMAL_S} + ${COMPILE_S} # the following are necessary because the files depend on the types of # cpu's included in the system configuration @@ -145,197 +134,197 @@ ioconf.o: ioconf.c ${CC} -c ${CFLAGS} ioconf.c exec_aout.o: $S/kernel/exec_aout.c - ${NORMAL_C} + ${COMPILE_C} exec_conf.o: $S/kernel/exec_conf.c - ${NORMAL_C} + ${COMPILE_C} exec_elf.o: $S/kernel/exec_elf.c - ${NORMAL_C} + ${COMPILE_C} exec_script.o: $S/kernel/exec_script.c - ${NORMAL_C} + ${COMPILE_C} exec_subr.o: $S/kernel/exec_subr.c - ${NORMAL_C} + ${COMPILE_C} init_main.o: $S/kernel/init_main.c - ${NORMAL_C} + ${COMPILE_C} init_sysent.o: $S/kernel/init_sysent.c - ${NORMAL_C} + ${COMPILE_C} kern_clock.o: $S/kernel/kern_clock.c - ${NORMAL_C} + ${COMPILE_C} kern_descrip.o: $S/kernel/kern_descrip.c - ${NORMAL_C} + ${COMPILE_C} kern_exec.o: $S/kernel/kern_exec.c - ${NORMAL_C} + ${COMPILE_C} kern_exit.o: $S/kernel/kern_exit.c - ${NORMAL_C} + ${COMPILE_C} kern_fork.o: $S/kernel/kern_fork.c - ${NORMAL_C} + ${COMPILE_C} kern_mman.o: $S/kernel/kern_mman.c - ${NORMAL_C} + ${COMPILE_C} kern_proc.o: $S/kernel/kern_proc.c - ${NORMAL_C} + ${COMPILE_C} kern_prot.o: $S/kernel/kern_prot.c - ${NORMAL_C} + ${COMPILE_C} kern_prot2.o: $S/kernel/kern_prot2.c - ${NORMAL_C} + ${COMPILE_C} kern_resource.o: $S/kernel/kern_resource.c - ${NORMAL_C} + ${COMPILE_C} kern_sig.o: $S/kernel/kern_sig.c - ${NORMAL_C} + ${COMPILE_C} kern_sig2.o: $S/kernel/kern_sig2.c - ${NORMAL_C} + ${COMPILE_C} kern_subr.o: $S/kernel/kern_subr.c - ${NORMAL_C} + ${COMPILE_C} kern_synch.o: $S/kernel/kern_synch.c - ${NORMAL_C} + ${COMPILE_C} kern_sysctl.o: $S/kernel/kern_sysctl.c - ${NORMAL_C} + ${COMPILE_C} kern_time.o: $S/kernel/kern_time.c - ${NORMAL_C} + ${COMPILE_C} rdisk.o: $S/kernel/rdisk.c - ${NORMAL_C} + ${COMPILE_C} subr_prf.o: $S/kernel/subr_prf.c - ${NORMAL_C} + ${COMPILE_C} subr_rmap.o: $S/kernel/subr_rmap.c - ${NORMAL_C} + ${COMPILE_C} sys_generic.o: $S/kernel/sys_generic.c - ${NORMAL_C} + ${COMPILE_C} sys_inode.o: $S/kernel/sys_inode.c - ${NORMAL_C} + ${COMPILE_C} sys_pipe.o: $S/kernel/sys_pipe.c - ${NORMAL_C} + ${COMPILE_C} sys_process.o: $S/kernel/sys_process.c - ${NORMAL_C} + ${COMPILE_C} syscalls.o: $S/kernel/syscalls.c - ${NORMAL_C} + ${COMPILE_C} tty.o: $S/kernel/tty.c - ${NORMAL_C} + ${COMPILE_C} tty_subr.o: $S/kernel/tty_subr.c - ${NORMAL_C} + ${COMPILE_C} tty_tty.o: $S/kernel/tty_tty.c - ${NORMAL_C} + ${COMPILE_C} ufs_alloc.o: $S/kernel/ufs_alloc.c - ${NORMAL_C} + ${COMPILE_C} ufs_bio.o: $S/kernel/ufs_bio.c - ${NORMAL_C} + ${COMPILE_C} ufs_bmap.o: $S/kernel/ufs_bmap.c - ${NORMAL_C} + ${COMPILE_C} ufs_dsort.o: $S/kernel/ufs_dsort.c - ${NORMAL_C} + ${COMPILE_C} ufs_fio.o: $S/kernel/ufs_fio.c - ${NORMAL_C} + ${COMPILE_C} ufs_inode.o: $S/kernel/ufs_inode.c - ${NORMAL_C} + ${COMPILE_C} ufs_mount.o: $S/kernel/ufs_mount.c - ${NORMAL_C} + ${COMPILE_C} ufs_namei.o: $S/kernel/ufs_namei.c - ${NORMAL_C} + ${COMPILE_C} ufs_subr.o: $S/kernel/ufs_subr.c - ${NORMAL_C} + ${COMPILE_C} ufs_syscalls.o: $S/kernel/ufs_syscalls.c - ${NORMAL_C} + ${COMPILE_C} ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c - ${NORMAL_C} + ${COMPILE_C} vfs_vnops.o: $S/kernel/vfs_vnops.c - ${NORMAL_C} + ${COMPILE_C} vm_sched.o: $S/kernel/vm_sched.c - ${NORMAL_C} + ${COMPILE_C} vm_swap.o: $S/kernel/vm_swap.c - ${NORMAL_C} + ${COMPILE_C} vm_swp.o: $S/kernel/vm_swp.c - ${NORMAL_C} + ${COMPILE_C} adc.o: $S/pic32/adc.c - ${NORMAL_C} + ${COMPILE_C} clock.o: $S/pic32/clock.c - ${NORMAL_C} + ${COMPILE_C} cons.o: $S/pic32/cons.c - ${NORMAL_C} + ${COMPILE_C} devsw.o: $S/pic32/devsw.c - ${NORMAL_C} + ${COMPILE_C} exception.o: $S/pic32/exception.c - ${NORMAL_C} + ${COMPILE_C} gpio.o: $S/pic32/gpio.c - ${NORMAL_C} + ${COMPILE_C} machdep.o: $S/pic32/machdep.c - ${NORMAL_C} + ${COMPILE_C} mem.o: $S/pic32/mem.c - ${NORMAL_C} + ${COMPILE_C} pwm.o: $S/pic32/pwm.c - ${NORMAL_C} + ${COMPILE_C} rd_sd.o: $S/pic32/rd_sd.c - ${NORMAL_C} + ${COMPILE_C} signal.o: $S/pic32/signal.c - ${NORMAL_C} + ${COMPILE_C} spi.o: $S/pic32/spi.c - ${NORMAL_C} + ${COMPILE_C} spi_bus.o: $S/pic32/spi_bus.c - ${NORMAL_C} + ${COMPILE_C} swap.o: $S/pic32/swap.c - ${NORMAL_C} + ${COMPILE_C} sysctl.o: $S/pic32/sysctl.c - ${NORMAL_C} + ${COMPILE_C} uart.o: $S/pic32/uart.c - ${NORMAL_C} + ${COMPILE_C} diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index c08ff50..7601fd4 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -82,17 +82,10 @@ struct file_list { /* * Types. */ -#define DRIVER 1 -#define NORMAL 2 -#define INVISIBLE 3 -#define PROFILING 4 -#define SYSTEMSPEC 5 -#define SWAPSPEC 6 - -/* - * Attributes (flags). - */ -#define CONFIGDEP 1 +#define NORMAL 1 +#define INVISIBLE 2 +#define SYSTEMSPEC 3 +#define SWAPSPEC 4 struct idlst { char *id; @@ -171,7 +164,6 @@ struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; int zone, hadtz; int dst; int hz; -int profiling; int debugging; int maxusers; diff --git a/tools/kconfig/kconfig.8 b/tools/kconfig/kconfig.8 index cb9f9c4..87000ab 100644 --- a/tools/kconfig/kconfig.8 +++ b/tools/kconfig/kconfig.8 @@ -6,7 +6,7 @@ .Nd build kernel configuration files .Sh SYNOPSIS .Nm kconfig -.Op Fl p +.Op Fl g .Ar system_name .Sh DESCRIPTION .Pp @@ -26,15 +26,12 @@ section below) Available option and operand: .Pp .Bl -tag -width SYSTEM_NAME -.It Fl p +.It Fl g If the .Fl p option is supplied, .Nm kconfig -will configure a kernel for profiling; for example, -.Xr kgmon 8 -and -.Xr gprof 1 . +will configure a kernel for debugging. .It Ar SYSTEM_NAME specifies the name of the kernel configuration file containing device specifications, configuration options diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index f599672..1adc326 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -48,14 +48,11 @@ int main(argc, argv) { int ch; - while ((ch = getopt(argc, argv, "gp")) != EOF) + while ((ch = getopt(argc, argv, "g")) != EOF) switch (ch) { case 'g': debugging++; break; - case 'p': - profiling++; - break; case '?': default: goto usage; diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index 9a581d9..e2692fe 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -147,7 +147,7 @@ void read_files() register struct opt *op; char *wd, *this, *needs, *special; char fname[32]; - int nreqs, first = 1, configdep, isdup, std, filetype; + int nreqs, first = 1, isdup, std, filetype; ftab = 0; (void) strcpy(fname, "../files.kconf"); @@ -158,9 +158,7 @@ void read_files() } next: /* - * filename [ standard | optional ] [ config-dependent ] - * [ dev* | profiling-routine ] [ device-driver] - * [ compile-with "compile rule" ] + * filename [ standard | optional ] [ dev* ] [ compile-with "compile rule" ] */ wd = get_word(fp); if (wd == (char *)EOF) { @@ -193,7 +191,6 @@ next: fname, this, tp->f_fn); nreqs = 0; special = 0; - configdep = 0; needs = 0; std = 0; filetype = NORMAL; @@ -207,10 +204,6 @@ nextparam: next_word(fp, wd); if (wd == 0) goto doneparam; - if (eq(wd, "config-dependent")) { - configdep++; - goto nextparam; - } if (eq(wd, "compile-with")) { next_quoted_word(fp, wd); if (wd == 0) { @@ -222,14 +215,6 @@ nextparam: goto nextparam; } nreqs++; - if (eq(wd, "device-driver")) { - filetype = DRIVER; - goto nextparam; - } - if (eq(wd, "profiling-routine")) { - filetype = PROFILING; - goto nextparam; - } if (needs == 0 && nreqs == 1) needs = strdup(wd); if (isdup) @@ -283,15 +268,11 @@ doneparam: fname, this); exit(1); } - if (filetype == PROFILING && profiling == 0) - goto next; if (tp == 0) tp = new_fent(); tp->f_fn = this; tp->f_type = filetype; tp->f_flags = 0; - if (configdep) - tp->f_flags |= CONFIGDEP; tp->f_needs = needs; tp->f_special = special; if (pf && pf->f_type == INVISIBLE) @@ -307,7 +288,7 @@ void do_objs(fp) register char *cp, och, *sp; char swapname[32]; - fprintf(fp, "OBJS="); + fprintf(fp, "OBJS = "); lpos = 6; for (tp = ftab; tp != 0; tp = tp->f_next) { if (tp->f_type == INVISIBLE) @@ -344,7 +325,7 @@ void do_cfiles(fp) register int lpos, len; char swapname[32]; - fputs("CFILES=", fp); + fputs("CFILES = ", fp); lpos = 8; for (tp = ftab; tp; tp = tp->f_next) if (tp->f_type != INVISIBLE) { @@ -400,31 +381,8 @@ void do_rules(f) fprintf(f, "%so: $S/%s%c\n", tail(np), np, och); special = ftp->f_special; if (special == 0) { - char *ftype = "???"; static char cmd[128]; - - switch (ftp->f_type) { - - case NORMAL: - ftype = "NORMAL"; - break; - - case DRIVER: - ftype = "DRIVER"; - break; - - case PROFILING: - if (!profiling) - continue; - ftype = "PROFILE"; - break; - - default: - printf("config: don't know rules for %s\n", np); - break; - } - (void)sprintf(cmd, "${%s_%c%s}", ftype, toupper(och), - ftp->f_flags & CONFIGDEP? "_C" : ""); + sprintf(cmd, "${COMPILE_%c}", toupper(och)); special = cmd; } *cp = och; @@ -476,8 +434,6 @@ void makefile() exit(1); } fprintf(ofp, "IDENT=-D%s", raise(ident)); - if (profiling) - fprintf(ofp, " -DGPROF"); if (cputype == 0) { printf("cpu type must be specified\n"); exit(1); @@ -518,8 +474,6 @@ void makefile() fprintf(ofp, "%s=%s\n", op->op_name, op->op_value); if (debugging) fprintf(ofp, "DEBUG=-g\n"); - if (profiling) - fprintf(ofp, "PROF=-pg\n"); while (fgets(line, BUFSIZ, ifp) != 0) { if (*line != '%') { fprintf(ofp, "%s", line); @@ -564,7 +518,7 @@ void do_swapspec(f, name) else fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n", machinename); - fprintf(f, "\t${NORMAL_C}\n\n"); + fprintf(f, "\t${COMPILE_C}\n\n"); } struct file_list * From a8c229ed368778c9f58cd477c34d1c93dc2368c9 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Wed, 2 Sep 2015 22:19:42 -0700 Subject: [PATCH 05/32] Create kconfig file for WF32 board. --- sys/pic32/machdep.c | 4 + sys/pic32/max32/Config | 6 +- sys/pic32/wf32/.gitignore | 3 + sys/pic32/wf32/Config | 73 ++++++++ sys/pic32/wf32/Makefile | 362 ++++++++++++++++++++++++++++++++++---- sys/pic32/wf32/WF32 | 1 + 6 files changed, 407 insertions(+), 42 deletions(-) create mode 100644 sys/pic32/wf32/Config diff --git a/sys/pic32/machdep.c b/sys/pic32/machdep.c index ded621e..2d8c9da 100644 --- a/sys/pic32/machdep.c +++ b/sys/pic32/machdep.c @@ -102,7 +102,11 @@ extern void power_off(); int hz = HZ; int usechz = (1000000L + HZ - 1) / HZ; +#ifdef TIMEZONE struct timezone tz = { TIMEZONE, DST }; +#else +struct timezone tz = { 8*60, 1 }; +#endif int nproc = NPROC; struct namecache namecache [NNAMECACHE]; diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index ca10fdd..5e466bc 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -1,5 +1,6 @@ # -# chipKIT Max32 board +# chipKIT Max32 board with SD card shield +# For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-chipKIT-Max32 # # To build the kernel, use: # cd sys/pic32/max32 @@ -20,7 +21,6 @@ timezone 8 dst maxusers 1 # Standard system options -#options "CONFIG=MAX32" # TODO options "CPU_KHZ=80000" # Oscillator frequency of CPU core options "BUS_KHZ=80000" # Frequency of peripheral bus options "HZ=100" # Rate of clock interrupt @@ -31,7 +31,7 @@ options "EXEC_SCRIPT" # Run shell scripts options "UCB_METER" # Collect kernel statistics # LED -options "LED_KERNEL_PORT=TRISA" # for kernel actibity LED... +options "LED_KERNEL_PORT=TRISA" # for kernel activity LED... options "LED_KERNEL_PIN=3" # ...use pin RA3 # Root filesystem at /dev/sd0a, swap at /dev/sd0b diff --git a/sys/pic32/wf32/.gitignore b/sys/pic32/wf32/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/wf32/.gitignore +++ b/sys/pic32/wf32/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config new file mode 100644 index 0000000..26e7a33 --- /dev/null +++ b/sys/pic32/wf32/Config @@ -0,0 +1,73 @@ +# +# chipKIT WF32 board with microSD card on 2.4" LCD TFT display shield +# +# To build the kernel, use: +# cd sys/pic32/wf32 +# kconfig Config +# make clean +# make +# +machine "pic32" + +cpu "PIC32MX7" +ident CHIPKIT_WF + +# Linker script +ldscript "cfg/bootloader-max32.ld" + +# Need to set locally +timezone 8 dst +maxusers 1 + +# 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 "EXEC_AOUT" # Run a.out binaries +options "EXEC_ELF" # Run ELF binaries +options "EXEC_SCRIPT" # Run shell scripts +options "UCB_METER" # Collect kernel statistics + +# LED +options "LED_KERNEL_PORT=TRISA" # for kernel activity LED... +options "LED_KERNEL_PIN=0" # ...use pin RA3 +options "LED_DISK_PORT=TRISF" # for disk activity LED... +options "LED_DISK_PIN=0" # ...use pin RF0 +options "LED_TTY_PORT=TRISA" # for serial activity LED... +options "LED_TTY_PIN=1" # ...use pin RA1 + +# 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 +options "UART1_ENABLED" # TODO: delete this option + +# Console options +options "CONSOLE_DEVICE=tty0" # /dev/tty0 + +# SPI ports +controller spi2 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi2 flags 0x44 # select pin RD4 +options "SD0_MHZ=10" # speed 10 MHz +options "SD0_PORT=2" # at spi2 TODO: delete +options "SD0_CS_PORT=TRISD" # for chip select... TODO: use flags +options "SD0_CS_PIN=4" # ...use pin RD4 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 diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index 5e4739a..ec15410 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -1,46 +1,330 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +IDENT=-DCHIPKIT_WF -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=4 -DSD0_CS_PORT=TRISD -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART1_ENABLED -DLED_TTY_PIN=1 -DLED_TTY_PORT=TRISA -DLED_DISK_PIN=0 -DLED_DISK_PORT=TRISF -DLED_KERNEL_PIN=0 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000 +LDSCRIPT="cfg/bootloader-max32.ld" +PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=1 +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=unix.map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 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 uart.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 vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DADC_ENABLED=YES -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=tty0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=0 -DEFS += -DLED_DISK_PORT=TRISF -DEFS += -DLED_KERNEL_PIN=0 -DEFS += -DLED_KERNEL_PORT=TRISA -DEFS += -DLED_TTY_PIN=1 -DEFS += -DLED_TTY_PORT=TRISA -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=4 -DEFS += -DSD0_CS_PORT=TRISD -DEFS += -DSD0_PORT=2 -DEFS += -DUART1_BAUD=115200 -DEFS += -DUART1_ENABLED=YES -DEFS += -DUCB_METER +# sources are located via $S relative to the compilation directory +S = ../.. +COPTS = -I. ${IDENT} -DKERNEL +CFLAGS = -O ${COPTS} ${PARAM} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-max32.ld +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). -CONFIG = WF32 -CONFIGPATH = ../../../tools/configsys +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${COPTS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/uart.c swapunix.c + +# 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 ioconf.c swapunix.c machine sys ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ + $(OBJDUMP) -d -S unix.elf > unix.dis + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix.elf + +clean: + rm -f *.elf *.o *.map *.dis *.bin + +clean-all: clean + rm -f *.h *.c machine sys + +reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + +load: unix.elf + pic32prog unix.hex + +startup.o: ../startup.S + ${COMPILE_S} + +# 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 .. $@ + +sys: + ln -s ../../include $@ + +depend: machine + mkdep ${COPTS} ${CFILES} ioconf.c + +ioconf.o: ioconf.c + ${CC} -c ${CFLAGS} ioconf.c + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +uart.o: $S/pic32/uart.c + ${COMPILE_C} -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/wf32/WF32 b/sys/pic32/wf32/WF32 index 4778b41..7253c86 100644 --- a/sys/pic32/wf32/WF32 +++ b/sys/pic32/wf32/WF32 @@ -1,5 +1,6 @@ # # chipKIT WF32 board with microSD card on 2.4" LCD TFT display shield +# =================================================================== # # See http://misc.ws/2013/11/08/touch-screen-shield-for-arduino-uno/ # for shield information From 9f6a53122ad71b28c3d53fa2bcc61b60757cb9d1 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 11:44:03 -0700 Subject: [PATCH 06/32] Cleanup in kconfig files. --- sys/pic32/Config.generic | 2 ++ sys/pic32/max32/Config | 5 ++--- sys/pic32/max32/Makefile | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/pic32/Config.generic b/sys/pic32/Config.generic index bb6b9d3..7ac93f5 100644 --- a/sys/pic32/Config.generic +++ b/sys/pic32/Config.generic @@ -7,6 +7,8 @@ # It's intended to be used as a reference or as a starting point # when creating configuration for a new board. # +# For details, see http://retrobsd.org/wiki/doku.php/doc/kconfig +# machine "pic32" cpu "PIC32MX7" diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index ca10fdd..7d69ce6 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -7,6 +7,8 @@ # make clean # make # +# For details, see http://retrobsd.org/wiki/doku.php/doc/kconfig +# machine "pic32" cpu "PIC32MX7" @@ -20,7 +22,6 @@ timezone 8 dst maxusers 1 # Standard system options -#options "CONFIG=MAX32" # TODO options "CPU_KHZ=80000" # Oscillator frequency of CPU core options "BUS_KHZ=80000" # Frequency of peripheral bus options "HZ=100" # Rate of clock interrupt @@ -51,8 +52,6 @@ options "UART4_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 diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 7a850ed..8fcbcc8 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -1,4 +1,4 @@ -IDENT=-DCHIPKIT_MAX -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=14 -DSD0_CS_PORT=TRISC -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART4_ENABLED -DUART3_ENABLED -DUART2_ENABLED -DUART1_ENABLED -DLED_KERNEL_PIN=3 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000 +IDENT=-DCHIPKIT_MAX -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=4 -DSD0_CS_PORT=TRISD -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART4_ENABLED -DUART3_ENABLED -DUART2_ENABLED -DUART1_ENABLED -DLED_KERNEL_PIN=3 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000 LDSCRIPT="cfg/bootloader-max32.ld" PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=1 # From fc9d89eff27eac6569c25c8d5f55992e5db40eae Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 12:08:32 -0700 Subject: [PATCH 07/32] Kconfig: use PARAM for all options. --- sys/pic32/Makefile.kconf | 19 +++++--------- sys/pic32/max32/Makefile | 51 ++++++++++++++++++++++++++------------ tools/kconfig/config.h | 1 - tools/kconfig/mkmakefile.c | 37 ++++++++++++++------------- 4 files changed, 61 insertions(+), 47 deletions(-) diff --git a/sys/pic32/Makefile.kconf b/sys/pic32/Makefile.kconf index e302854..812a1f0 100644 --- a/sys/pic32/Makefile.kconf +++ b/sys/pic32/Makefile.kconf @@ -21,14 +21,14 @@ endif # sources are located via $S relative to the compilation directory S = ../.. -COPTS = -I. ${IDENT} -DKERNEL -CFLAGS = -O ${COPTS} ${PARAM} +DEFS = -I. ${PARAM} -DKERNEL +CFLAGS = -O ${DEFS} # compile rules: rules are named COMPILE_${SUFFIX} # SUFFIX is the file suffix, capitalized (e.g. C for a .c file). COMPILE_C = ${CC} -c ${CFLAGS} $< -COMPILE_S = ${CC} -c ${COPTS} $< +COMPILE_S = ${CC} -c ${DEFS} $< %OBJS @@ -67,23 +67,16 @@ reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig load: unix.elf pic32prog unix.hex -startup.o: ../startup.S - ${COMPILE_S} - -# 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 .. $@ sys: ln -s ../../include $@ -depend: machine - mkdep ${COPTS} ${CFILES} ioconf.c +startup.o: ../startup.S + ${COMPILE_S} ioconf.o: ioconf.c - ${CC} -c ${CFLAGS} ioconf.c + ${COMPILE_C} %RULES diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 8fcbcc8..0aefc2d 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -1,6 +1,32 @@ -IDENT=-DCHIPKIT_MAX -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=4 -DSD0_CS_PORT=TRISD -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART4_ENABLED -DUART3_ENABLED -DUART2_ENABLED -DUART1_ENABLED -DLED_KERNEL_PIN=3 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000 -LDSCRIPT="cfg/bootloader-max32.ld" -PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=1 +PARAM = -DCHIPKIT_MAX +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=14 +PARAM += -DSD0_CS_PORT=TRISC +PARAM += -DSD0_PORT=2 +PARAM += -DSD0_MHZ=10 +PARAM += -DSPI_ENABLED +PARAM += -DCONSOLE_DEVICE=tty0 +PARAM += -DUART4_ENABLED +PARAM += -DUART3_ENABLED +PARAM += -DUART2_ENABLED +PARAM += -DUART1_ENABLED +PARAM += -DLED_KERNEL_PIN=3 +PARAM += -DLED_KERNEL_PORT=TRISA +PARAM += -DUCB_METER +PARAM += -DEXEC_SCRIPT +PARAM += -DEXEC_ELF +PARAM += -DEXEC_AOUT +PARAM += -DBUS_DIV=1 +PARAM += -DHZ=100 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DTIMEZONE=480 +PARAM += -DDST=1 +PARAM += -DMAXUSERS=1 +LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target # @@ -24,14 +50,14 @@ endif # sources are located via $S relative to the compilation directory S = ../.. -COPTS = -I. ${IDENT} -DKERNEL -CFLAGS = -O ${COPTS} ${PARAM} +DEFS = -I. ${PARAM} -DKERNEL +CFLAGS = -O ${DEFS} # compile rules: rules are named COMPILE_${SUFFIX} # SUFFIX is the file suffix, capitalized (e.g. C for a .c file). COMPILE_C = ${CC} -c ${CFLAGS} $< -COMPILE_S = ${CC} -c ${COPTS} $< +COMPILE_S = ${CC} -c ${DEFS} $< OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o \ init_main.o init_sysent.o kern_clock.o kern_descrip.o \ @@ -114,24 +140,17 @@ reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig load: unix.elf pic32prog unix.hex -startup.o: ../startup.S - ${COMPILE_S} - -# 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 .. $@ sys: ln -s ../../include $@ -depend: machine - mkdep ${COPTS} ${CFILES} ioconf.c +startup.o: ../startup.S + ${COMPILE_S} ioconf.o: ioconf.c - ${CC} -c ${CFLAGS} ioconf.c + ${COMPILE_C} exec_aout.o: $S/kernel/exec_aout.c ${COMPILE_C} diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index 7601fd4..e1d4cc6 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -163,7 +163,6 @@ struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; int zone, hadtz; int dst; -int hz; int debugging; int maxusers; diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index e2692fe..f8212b6 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -419,6 +419,7 @@ void makefile() char line[BUFSIZ]; struct opt *op; struct users *up; + struct cputype *cp; read_files(); strcpy(line, "../Makefile.kconf"); @@ -433,23 +434,21 @@ void makefile() perror("Makefile"); exit(1); } - fprintf(ofp, "IDENT=-D%s", raise(ident)); + fprintf(ofp, "PARAM = -D%s\n", raise(ident)); if (cputype == 0) { printf("cpu type must be specified\n"); exit(1); } - { struct cputype *cp; - for (cp = cputype; cp; cp = cp->cpu_next) - fprintf(ofp, " -D%s", cp->cpu_name); + for (cp = cputype; cp; cp = cp->cpu_next) { + fprintf(ofp, "PARAM += -D%s\n", cp->cpu_name); } - for (op = opt; op; op = op->op_next) + for (op = opt; op; op = op->op_next) { if (op->op_value) - fprintf(ofp, " -D%s=\"%s\"", op->op_name, op->op_value); + fprintf(ofp, "PARAM += -D%s=\"%s\"\n", op->op_name, op->op_value); else - fprintf(ofp, " -D%s", op->op_name); - fprintf(ofp, "\n"); - if (ldscript) - fprintf(ofp, "LDSCRIPT=\"%s\"\n", ldscript); + fprintf(ofp, "PARAM += -D%s\n", op->op_name); + } + if (hadtz == 0) printf("timezone not specified; gmt assumed\n"); if ((unsigned)machine > NUSERS) { @@ -465,15 +464,19 @@ void makefile() maxusers = up->u_min; } else if (maxusers > up->u_max) printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers); - fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d", - zone, dst, maxusers); - if (hz > 0) - fprintf(ofp, " -DHZ=%d", hz); - fprintf(ofp, "\n"); + fprintf(ofp, "PARAM += -DTIMEZONE=%d\n", zone); + fprintf(ofp, "PARAM += -DDST=%d\n", dst); + fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers); + + if (ldscript) + fprintf(ofp, "LDSCRIPT = \"%s\"\n", ldscript); + for (op = mkopt; op; op = op->op_next) - fprintf(ofp, "%s=%s\n", op->op_name, op->op_value); + fprintf(ofp, "%s = %s\n", op->op_name, op->op_value); + if (debugging) - fprintf(ofp, "DEBUG=-g\n"); + fprintf(ofp, "DEBUG = -g\n"); + while (fgets(line, BUFSIZ, ifp) != 0) { if (*line != '%') { fprintf(ofp, "%s", line); From 94c02410e437aac54f9c5995fc361750937ff136 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 12:51:56 -0700 Subject: [PATCH 08/32] Kconfig: rename machine to architecture, ident to board. Make timezone and maxusers parameters optional. Enable kernel options UCB_METER, EXEC_AOUT, EXEC_ELF and EXEC_SCRIPT by default. --- sys/include/exec.h | 20 --------------- sys/include/exec_elf.h | 2 -- sys/include/vmsystm.h | 28 ++++++++++----------- sys/kernel/exec_conf.c | 12 --------- sys/kernel/exec_subr.c | 5 +--- sys/kernel/kern_exec.c | 2 -- sys/pic32/machparam.h | 7 ++++++ sys/pic32/max32/Config | 14 +++-------- sys/pic32/max32/Makefile | 11 ++------- sys/pic32/wf32/Config | 14 +++-------- sys/pic32/wf32/Makefile | 45 ++++++++++++++++++++++------------ tools/kconfig/config.h | 14 +++++------ tools/kconfig/config.y | 20 +++++++-------- tools/kconfig/kconfig.8 | 4 +-- tools/kconfig/lang.l | 4 +-- tools/kconfig/main.c | 6 ++--- tools/kconfig/mkioconf.c | 2 +- tools/kconfig/mkmakefile.c | 50 +++++++++++--------------------------- 18 files changed, 97 insertions(+), 163 deletions(-) diff --git a/sys/include/exec.h b/sys/include/exec.h index 3d1011a..0dfe247 100644 --- a/sys/include/exec.h +++ b/sys/include/exec.h @@ -8,19 +8,11 @@ #define _SYS_EXEC_H_ #ifdef KERNEL -#ifdef EXEC_SCRIPT #define SHSIZE 64 #define SHPATHLEN 64 -#endif -#ifdef EXEC_ELF #define STRLEN 32 -#endif -#ifdef EXEC_AOUT #include "exec_aout.h" -#endif -#ifdef EXEC_ELF #include "exec_elf.h" -#endif #define NO_ADDR ((caddr_t)(~0U)) /* Indicates addr. not yet filled in */ @@ -34,29 +26,20 @@ struct exec_params { char **userargp; char **userenvp; union { -#ifdef EXEC_SCRIPT char sh[SHSIZE]; -#endif -#ifdef EXEC_AOUT struct exec aout; -#endif -#ifdef EXEC_ELF struct elf_ehdr elf; -#endif } hdr; /* head of file to exec */ int hdr_len; /* number of bytes valid in image_header */ char **argp, **envp; u_short argc, envc; /* count of argument and environment strings */ u_short argbc, envbc; /* total number of chars in argc and envc string pool */ union { -#ifdef EXEC_SCRIPT struct { char interpname[20]; /* real name of the script interpreter */ char interparg[SHPATHLEN]; /* interpreter arg */ char interpreted; /* flag - this executable is interpreted */ } sh; -#endif -#ifdef EXEC_ELF struct { struct buf *stbp; /* String table buffer pointer */ int stbpos; /* String table pos in buffer */ @@ -64,11 +47,8 @@ struct exec_params { int stoffset; /* String table file pos */ char str[STRLEN]; } elf; -#endif -#ifdef EXEC_AOUT struct { } aout; -#endif }; gid_t gid; diff --git a/sys/include/exec_elf.h b/sys/include/exec_elf.h index 6663299..be95611 100644 --- a/sys/include/exec_elf.h +++ b/sys/include/exec_elf.h @@ -476,13 +476,11 @@ struct elf_args { #include "opt_execfmt.h" #endif -#ifdef EXEC_ELF int exec_elf_makecmds __P((struct proc *, struct exec_package *)); int elf_read_from __P((struct proc *, struct vnode *, u_long, caddr_t, int)); void *elf_copyargs __P((struct exec_package *, struct ps_strings *, void *, void *)); -#endif /* common */ int exec_elf_setup_stack __P((struct proc *, struct exec_package *)); diff --git a/sys/include/vmsystm.h b/sys/include/vmsystm.h index 6f68a56..c3ddc81 100644 --- a/sys/include/vmsystm.h +++ b/sys/include/vmsystm.h @@ -1,4 +1,6 @@ /* + * Miscellaneous virtual memory subsystem variables and structures. + * * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. @@ -6,20 +8,6 @@ * @(#)vmsystm.h 7.2.1 (2.11BSD GTE) 1/15/95 */ -/* - * Miscellaneous virtual memory subsystem variables and structures. - */ - -#if defined(KERNEL) && defined(UCB_METER) && !defined(SUPERVISOR) -size_t freemem; /* remaining clicks of free memory */ - -u_short avefree; /* moving average of remaining free clicks */ -u_short avefree30; /* 30 sec (avefree is 5 sec) moving average */ - -/* writable copies of tunables */ -int maxslp; /* max sleep time before very swappable */ -#endif - /* * Fork/vfork accounting. */ @@ -31,6 +19,16 @@ struct forkstat long sizvfork; }; -#if defined(KERNEL) && defined(UCB_METER) && !defined(SUPERVISOR) +#if defined(KERNEL) && defined(UCB_METER) +size_t freemem; /* remaining clicks of free memory */ + +u_short avefree; /* moving average of remaining free clicks */ +u_short avefree30; /* 30 sec (avefree is 5 sec) moving average */ + +/* + * writable copies of tunables + */ +int maxslp; /* max sleep time before very swappable */ + struct forkstat forkstat; #endif diff --git a/sys/kernel/exec_conf.c b/sys/kernel/exec_conf.c index 01c7ff4..60ac3eb 100644 --- a/sys/kernel/exec_conf.c +++ b/sys/kernel/exec_conf.c @@ -31,26 +31,14 @@ #include #include -#ifdef EXEC_SCRIPT int exec_script_check(struct exec_params *epp); -#endif -#ifdef EXEC_AOUT int exec_aout_check(struct exec_params *epp); -#endif -#ifdef EXEC_ELF int exec_elf_check(struct exec_params *epp); -#endif const struct execsw execsw[] = { -#ifdef EXEC_AOUT { exec_aout_check, "a.out" }, /* a.out binaries */ -#endif -#ifdef EXEC_ELF { exec_elf_check, "elf" }, /* 32bit ELF bins */ -#endif -#ifdef EXEC_SCRIPT { exec_script_check, "script" }, /* shell scripts */ -#endif }; int nexecs = (sizeof(execsw) / sizeof(*execsw)); int exec_maxhdrsz; diff --git a/sys/kernel/exec_subr.c b/sys/kernel/exec_subr.c index 3a5de8b..998e755 100644 --- a/sys/kernel/exec_subr.c +++ b/sys/kernel/exec_subr.c @@ -260,13 +260,11 @@ void exec_save_args(struct exec_params *epp) if ((argp = epp->userargp) != NULL) while (argp[argc]) argc++; -#ifdef EXEC_SCRIPT if (epp->sh.interpreted) { argc++; if (epp->sh.interparg[0]) argc++; } -#endif if (argc != 0) { if ((epp->argp = (char **)exec_alloc(argc * sizeof(char *), NBPW, epp)) == NULL) return; @@ -283,7 +281,7 @@ void exec_save_args(struct exec_params *epp) ap = *argp++; else ap = NULL; -#ifdef EXEC_SCRIPT + if (epp->sh.interpreted) { if (epp->argc == 0) ap = epp->sh.interpname; @@ -295,7 +293,6 @@ void exec_save_args(struct exec_params *epp) --argp; } } -#endif if (ap == 0) break; l = strlen(ap)+1; diff --git a/sys/kernel/kern_exec.c b/sys/kernel/kern_exec.c index 6e25e5c..95530f5 100644 --- a/sys/kernel/kern_exec.c +++ b/sys/kernel/kern_exec.c @@ -66,9 +66,7 @@ int exec_check(struct exec_params *epp) * Read the first 'SHSIZE' bytes from the file to execute */ DEBUG("Read header %d bytes from %d\n", sizeof(epp->hdr), 0); -#ifdef EXEC_SCRIPT epp->hdr.sh[0] = '\0'; /* for zero length files */ -#endif error = rdwri (UIO_READ, epp->ip, (caddr_t) &epp->hdr, sizeof(epp->hdr), (off_t)0, IO_UNIT, &r); diff --git a/sys/pic32/machparam.h b/sys/pic32/machparam.h index c35fc2a..9ccca1f 100644 --- a/sys/pic32/machparam.h +++ b/sys/pic32/machparam.h @@ -118,6 +118,13 @@ extern void _keram_start(), _keram_end(); #define USIZE 3072 #define SSIZE 2048 /* initial stack size (bytes) */ +/* + * Collect kernel statistics by default. + */ +#if !defined(UCB_METER) && !defined(NO_UCB_METER) +#define UCB_METER +#endif + #ifdef KERNEL #include "machine/io.h" diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index 70b6b07..f9c4096 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -10,27 +10,19 @@ # # For details, see http://retrobsd.org/wiki/doku.php/doc/kconfig # -machine "pic32" +architecture "pic32" cpu "PIC32MX7" -ident CHIPKIT_MAX +board "CHIPKIT_MAX32" # Linker script ldscript "cfg/bootloader-max32.ld" -# Need to set locally -timezone 8 dst -maxusers 1 - # Standard system options +hz 100 # Rate of clock interrupt 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 "EXEC_AOUT" # Run a.out binaries -options "EXEC_ELF" # Run ELF binaries -options "EXEC_SCRIPT" # Run shell scripts -options "UCB_METER" # Collect kernel statistics # LED options "LED_KERNEL_PORT=TRISA" # for kernel activity LED... diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 0aefc2d..b848dc5 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -1,4 +1,4 @@ -PARAM = -DCHIPKIT_MAX +PARAM = -DCHIPKIT_MAX32 PARAM += -DPIC32MX7 PARAM += -DPWM_ENABLED PARAM += -DADC_ENABLED @@ -15,17 +15,10 @@ PARAM += -DUART2_ENABLED PARAM += -DUART1_ENABLED PARAM += -DLED_KERNEL_PIN=3 PARAM += -DLED_KERNEL_PORT=TRISA -PARAM += -DUCB_METER -PARAM += -DEXEC_SCRIPT -PARAM += -DEXEC_ELF -PARAM += -DEXEC_AOUT PARAM += -DBUS_DIV=1 -PARAM += -DHZ=100 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -PARAM += -DTIMEZONE=480 -PARAM += -DDST=1 -PARAM += -DMAXUSERS=1 +PARAM += -DHZ=100 LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index 26e7a33..83d8c2a 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -7,27 +7,19 @@ # make clean # make # -machine "pic32" +architecture "pic32" cpu "PIC32MX7" -ident CHIPKIT_WF +board "CHIPKIT_WF32" # Linker script ldscript "cfg/bootloader-max32.ld" -# Need to set locally -timezone 8 dst -maxusers 1 - # Standard system options +hz 100 # Rate of clock interrupt 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 "EXEC_AOUT" # Run a.out binaries -options "EXEC_ELF" # Run ELF binaries -options "EXEC_SCRIPT" # Run shell scripts -options "UCB_METER" # Collect kernel statistics # LED options "LED_KERNEL_PORT=TRISA" # for kernel activity LED... diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index ec15410..563bdd1 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -1,6 +1,26 @@ -IDENT=-DCHIPKIT_WF -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=4 -DSD0_CS_PORT=TRISD -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART1_ENABLED -DLED_TTY_PIN=1 -DLED_TTY_PORT=TRISA -DLED_DISK_PIN=0 -DLED_DISK_PORT=TRISF -DLED_KERNEL_PIN=0 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000 -LDSCRIPT="cfg/bootloader-max32.ld" -PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=1 +PARAM = -DCHIPKIT_WF32 +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=4 +PARAM += -DSD0_CS_PORT=TRISD +PARAM += -DSD0_PORT=2 +PARAM += -DSD0_MHZ=10 +PARAM += -DSPI_ENABLED +PARAM += -DCONSOLE_DEVICE=tty0 +PARAM += -DUART1_ENABLED +PARAM += -DLED_TTY_PIN=1 +PARAM += -DLED_TTY_PORT=TRISA +PARAM += -DLED_DISK_PIN=0 +PARAM += -DLED_DISK_PORT=TRISF +PARAM += -DLED_KERNEL_PIN=0 +PARAM += -DLED_KERNEL_PORT=TRISA +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DHZ=100 +LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target # @@ -24,14 +44,14 @@ endif # sources are located via $S relative to the compilation directory S = ../.. -COPTS = -I. ${IDENT} -DKERNEL -CFLAGS = -O ${COPTS} ${PARAM} +DEFS = -I. ${PARAM} -DKERNEL +CFLAGS = -O ${DEFS} # compile rules: rules are named COMPILE_${SUFFIX} # SUFFIX is the file suffix, capitalized (e.g. C for a .c file). COMPILE_C = ${CC} -c ${CFLAGS} $< -COMPILE_S = ${CC} -c ${COPTS} $< +COMPILE_S = ${CC} -c ${DEFS} $< OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o \ init_main.o init_sysent.o kern_clock.o kern_descrip.o \ @@ -114,24 +134,17 @@ reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig load: unix.elf pic32prog unix.hex -startup.o: ../startup.S - ${COMPILE_S} - -# 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 .. $@ sys: ln -s ../../include $@ -depend: machine - mkdep ${COPTS} ${CFILES} ioconf.c +startup.o: ../startup.S + ${COMPILE_S} ioconf.o: ioconf.c - ${CC} -c ${CFLAGS} ioconf.c + ${COMPILE_C} exec_aout.o: $S/kernel/exec_aout.c ${COMPILE_C} diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index e1d4cc6..4192271 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -122,15 +122,14 @@ struct config { }; /* - * Config has a global notion of which machine type is - * being used. + * Config has a global notion of which architecture is being used. */ -int machine; -char *machinename; -#define MACHINE_PIC32 1 +int arch; +char *archname; +#define ARCH_PIC32 1 /* - * For each machine, a set of CPU's may be specified as supported. + * For each architecture, a set of CPU's may be specified as supported. * These and the options (below) are put in the C flags in the makefile. */ struct cputype { @@ -149,7 +148,7 @@ struct opt { struct opt *op_next; } *opt, *mkopt; -char *ident; +char *board; char *ldscript; int do_trace; @@ -163,6 +162,7 @@ struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; int zone, hadtz; int dst; +int hz; int debugging; int maxusers; diff --git a/tools/kconfig/config.y b/tools/kconfig/config.y index e72f9c2..c97f995 100644 --- a/tools/kconfig/config.y +++ b/tools/kconfig/config.y @@ -7,7 +7,9 @@ %token AND %token ANY +%token ARCHITECTURE %token AT +%token BOARD %token COMMA %token CONFIG %token CONTROLLER @@ -21,9 +23,7 @@ %token EQUALS %token FLAGS %token HZ -%token IDENT %token LDSCRIPT -%token MACHINE %token MAJOR %token MASTER %token MAXUSERS @@ -139,13 +139,13 @@ Spec: ; Config_spec: - MACHINE Save_id + ARCHITECTURE Save_id = { if (strcmp($2, "pic32") == 0) { - machine = MACHINE_PIC32; - machinename = "pic32"; + arch = ARCH_PIC32; + archname = "pic32"; } else - yyerror("Unknown machine type"); + yyerror("Unknown architecture"); } | CPU Save_id @@ -162,8 +162,8 @@ Config_spec: | MAKEOPTIONS Mkopt_list | - IDENT ID - = { ident = strdup($2); } + BOARD ID + = { board = strdup($2); } | LDSCRIPT ID = { ldscript = strdup($2); } @@ -758,9 +758,9 @@ void check_nexus(dev, num) register struct device *dev; int num; { - switch (machine) { + switch (arch) { - case MACHINE_PIC32: + case ARCH_PIC32: break; } } diff --git a/tools/kconfig/kconfig.8 b/tools/kconfig/kconfig.8 index 87000ab..9475324 100644 --- a/tools/kconfig/kconfig.8 +++ b/tools/kconfig/kconfig.8 @@ -18,7 +18,7 @@ A second file tells .Nm kconfig what files are needed to generate a kernel and can be augmented by configuration specific set of files -that give alternate files for a specific machine. +that give alternate files for a specific architecture. (see the .Sx FILES section below) @@ -39,7 +39,7 @@ and other system parameters for one kernel configuration. .El .Pp .Nm Kconfig -should be run from the machine and board specific +should be run from the architecture and board specific subdirectory of the system source (like .Pa sys/pic32/max32 ) . .Nm Kconfig diff --git a/tools/kconfig/lang.l b/tools/kconfig/lang.l index 08e5bd2..ac76848 100644 --- a/tools/kconfig/lang.l +++ b/tools/kconfig/lang.l @@ -64,9 +64,9 @@ static struct kt key_words[] = { { "dumps", DUMPS }, { "flags", FLAGS }, { "hz", HZ }, - { "ident", IDENT }, + { "board", BOARD }, { "ldscript", LDSCRIPT }, - { "machine", MACHINE }, + { "architecture", ARCHITECTURE }, { "major", MAJOR }, { "makeoptions", MAKEOPTIONS }, { "master", MASTER }, diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index 1adc326..ab3f6f0 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -76,14 +76,14 @@ usage: fputs("usage: kconfig [-gp] sysname\n", stderr); if (yyparse()) exit(3); - switch (machine) { + switch (arch) { - case MACHINE_PIC32: + case ARCH_PIC32: pic32_ioconf(); break; default: - printf("Specify machine type, e.g. ``machine pic32''\n"); + printf("Specify architecture, e.g. ``architecture pic32''\n"); exit(1); } makefile(); /* build Makefile */ diff --git a/tools/kconfig/mkioconf.c b/tools/kconfig/mkioconf.c index c01ec62..9071230 100644 --- a/tools/kconfig/mkioconf.c +++ b/tools/kconfig/mkioconf.c @@ -65,7 +65,7 @@ wnum(num) return (errbuf); } -#if MACHINE_PIC32 +#if ARCH_PIC32 void pic32_ioconf() { register struct device *dp, *mp; diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index f8212b6..0b52bab 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -34,7 +34,7 @@ /* * Build the makefile for the system, from * the information in the files files and the - * additional files for the machine being compiled to. + * additional files for the architecture being compiled to. */ #include #include "y.tab.h" @@ -108,15 +108,6 @@ new_fent() return (fp); } -static struct users { - int u_default; - int u_min; - int u_max; -} users[] = { - { 2, 1, 16 }, /* MACHINE_PIC32 */ -}; -#define NUSERS (sizeof (users) / sizeof (users[0])) - int opteq(cp, dp) char *cp, *dp; { @@ -164,7 +155,7 @@ next: if (wd == (char *)EOF) { (void) fclose(fp); if (first == 1) { - (void) sprintf(fname, "files.%s", raise(ident)); + (void) sprintf(fname, "files.%s", raise(board)); first++; fp = fopen(fname, "r"); if (fp != 0) @@ -348,7 +339,7 @@ void do_cfiles(fp) } if (eq(fl->f_fn, "generic")) fprintf(fp, "$A/%s/%s ", - machinename, swapname); + archname, swapname); else fprintf(fp, "%s ", swapname); lpos += len + 1; @@ -418,12 +409,11 @@ void makefile() FILE *ifp, *ofp; char line[BUFSIZ]; struct opt *op; - struct users *up; struct cputype *cp; read_files(); strcpy(line, "../Makefile.kconf"); - //(void) strcat(line, machinename); + //strcat(line, archname); ifp = fopen(line, "r"); if (ifp == 0) { perror(line); @@ -434,7 +424,7 @@ void makefile() perror("Makefile"); exit(1); } - fprintf(ofp, "PARAM = -D%s\n", raise(ident)); + fprintf(ofp, "PARAM = -D%s\n", raise(board)); if (cputype == 0) { printf("cpu type must be specified\n"); exit(1); @@ -448,25 +438,14 @@ void makefile() else fprintf(ofp, "PARAM += -D%s\n", op->op_name); } - - if (hadtz == 0) - printf("timezone not specified; gmt assumed\n"); - if ((unsigned)machine > NUSERS) { - printf("maxusers config info isn't present, using pic32\n"); - up = &users[MACHINE_PIC32-1]; - } else - up = &users[machine-1]; - if (maxusers == 0) { - printf("maxusers not specified; %d assumed\n", up->u_default); - maxusers = up->u_default; - } else if (maxusers < up->u_min) { - printf("minimum of %d maxusers assumed\n", up->u_min); - maxusers = up->u_min; - } else if (maxusers > up->u_max) - printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers); - fprintf(ofp, "PARAM += -DTIMEZONE=%d\n", zone); - fprintf(ofp, "PARAM += -DDST=%d\n", dst); - fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers); + if (hadtz) { + fprintf(ofp, "PARAM += -DTIMEZONE=%d\n", zone); + fprintf(ofp, "PARAM += -DDST=%d\n", dst); + } + if (maxusers > 0) + fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers); + if (hz > 0) + fprintf(ofp, "PARAM += -DHZ=%d\n", hz); if (ldscript) fprintf(ofp, "LDSCRIPT = \"%s\"\n", ldscript); @@ -519,8 +498,7 @@ void do_swapspec(f, name) if (!eq(name, "generic")) fprintf(f, "swap%s.o: swap%s.c\n", name, name); else - fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n", - machinename); + fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n", archname); fprintf(f, "\t${COMPILE_C}\n\n"); } From a302352054121cf721f37b412371e08cabb6fb05 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 13:05:37 -0700 Subject: [PATCH 09/32] Modify Makefile.kconf to generate dependency files automatically. --- sys/pic32/Makefile.kconf | 14 +++++++++++--- sys/pic32/max32/Config | 11 ++++------- sys/pic32/max32/Makefile | 14 +++++++++++--- sys/pic32/wf32/Config | 11 ++++------- sys/pic32/wf32/Makefile | 14 +++++++++++--- 5 files changed, 41 insertions(+), 23 deletions(-) diff --git a/sys/pic32/Makefile.kconf b/sys/pic32/Makefile.kconf index 812a1f0..a3c9388 100644 --- a/sys/pic32/Makefile.kconf +++ b/sys/pic32/Makefile.kconf @@ -21,7 +21,8 @@ endif # sources are located via $S relative to the compilation directory S = ../.. -DEFS = -I. ${PARAM} -DKERNEL +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) CFLAGS = -O ${DEFS} # compile rules: rules are named COMPILE_${SUFFIX} @@ -43,7 +44,7 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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 @@ -55,7 +56,7 @@ SYSTEM_LD_TAIL = ${SIZE} unix.elf; \ %LOAD clean: - rm -f *.elf *.o *.map *.dis *.bin + rm -rf .deps *.elf *.o *.map *.dis *.bin clean-all: clean rm -f *.h *.c machine sys @@ -73,6 +74,9 @@ machine: sys: ln -s ../../include $@ +.deps: + mkdir .deps + startup.o: ../startup.S ${COMPILE_S} @@ -80,3 +84,7 @@ ioconf.o: ioconf.c ${COMPILE_C} %RULES + +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index f9c4096..8c9f642 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -11,15 +11,12 @@ # For details, see http://retrobsd.org/wiki/doku.php/doc/kconfig # architecture "pic32" - -cpu "PIC32MX7" -board "CHIPKIT_MAX32" - -# Linker script -ldscript "cfg/bootloader-max32.ld" +cpu "PIC32MX7" # Processor variant +board "CHIPKIT_MAX32" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options -hz 100 # Rate of clock interrupt options "CPU_KHZ=80000" # Oscillator frequency of CPU core options "BUS_KHZ=80000" # Frequency of peripheral bus options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index b848dc5..5e6086c 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -43,7 +43,8 @@ endif # sources are located via $S relative to the compilation directory S = ../.. -DEFS = -I. ${PARAM} -DKERNEL +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) CFLAGS = -O ${DEFS} # compile rules: rules are named COMPILE_${SUFFIX} @@ -101,7 +102,7 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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 @@ -121,7 +122,7 @@ swapunix.o: swapunix.c all: unix.elf clean: - rm -f *.elf *.o *.map *.dis *.bin + rm -rf .deps *.elf *.o *.map *.dis *.bin clean-all: clean rm -f *.h *.c machine sys @@ -139,6 +140,9 @@ machine: sys: ln -s ../../include $@ +.deps: + mkdir .deps + startup.o: ../startup.S ${COMPILE_S} @@ -340,3 +344,7 @@ sysctl.o: $S/pic32/sysctl.c uart.o: $S/pic32/uart.c ${COMPILE_C} + +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index 83d8c2a..2f0554e 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -8,15 +8,12 @@ # make # architecture "pic32" - -cpu "PIC32MX7" -board "CHIPKIT_WF32" - -# Linker script -ldscript "cfg/bootloader-max32.ld" +cpu "PIC32MX7" # Processor variant +board "CHIPKIT_WF32" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options -hz 100 # Rate of clock interrupt options "CPU_KHZ=80000" # Oscillator frequency of CPU core options "BUS_KHZ=80000" # Frequency of peripheral bus options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index 563bdd1..9d0ffec 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -44,7 +44,8 @@ endif # sources are located via $S relative to the compilation directory S = ../.. -DEFS = -I. ${PARAM} -DKERNEL +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) CFLAGS = -O ${DEFS} # compile rules: rules are named COMPILE_${SUFFIX} @@ -102,7 +103,7 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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 @@ -122,7 +123,7 @@ swapunix.o: swapunix.c all: unix.elf clean: - rm -f *.elf *.o *.map *.dis *.bin + rm -rf .deps *.elf *.o *.map *.dis *.bin clean-all: clean rm -f *.h *.c machine sys @@ -140,6 +141,9 @@ machine: sys: ln -s ../../include $@ +.deps: + mkdir .deps + startup.o: ../startup.S ${COMPILE_S} @@ -341,3 +345,7 @@ sysctl.o: $S/pic32/sysctl.c uart.o: $S/pic32/uart.c ${COMPILE_C} + +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif From 328bdf4bbfa3903265398fdf30de54126e932dd4 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 17:15:50 -0700 Subject: [PATCH 10/32] Create kconfig configurations for Duinomite boards. --- Makefile | 37 +- sys/pic32/Makefile | 4 +- sys/pic32/duinomite-e-uart/Makefile | 47 --- sys/pic32/duinomite-e/.gitignore | 9 - sys/pic32/duinomite-e/Makefile | 46 -- .../.gitignore | 3 + sys/pic32/duinomite-emega/Config | 70 +++ sys/pic32/duinomite-emega/Config-uart | 70 +++ .../DUINOMITE-EMEGA} | 0 .../DUINOMITE-EMEGA-UART} | 0 sys/pic32/duinomite-emega/Makefile | 360 ++++++++++++++++ sys/pic32/duinomite-uart/.gitignore | 9 - sys/pic32/duinomite-uart/Makefile | 47 --- sys/pic32/duinomite/.gitignore | 3 + sys/pic32/duinomite/Config | 69 +++ sys/pic32/duinomite/Config-uart | 69 +++ .../DUINOMITE-UART | 0 sys/pic32/duinomite/Makefile | 398 ++++++++++++++++-- sys/pic32/max32/Config | 4 +- sys/pic32/rd_sdramp.c | 2 +- sys/pic32/wf32/Config | 3 + 21 files changed, 1010 insertions(+), 240 deletions(-) delete mode 100644 sys/pic32/duinomite-e-uart/Makefile delete mode 100644 sys/pic32/duinomite-e/.gitignore delete mode 100644 sys/pic32/duinomite-e/Makefile rename sys/pic32/{duinomite-e-uart => duinomite-emega}/.gitignore (77%) create mode 100644 sys/pic32/duinomite-emega/Config create mode 100644 sys/pic32/duinomite-emega/Config-uart rename sys/pic32/{duinomite-e/DUINOMITE-E => duinomite-emega/DUINOMITE-EMEGA} (100%) rename sys/pic32/{duinomite-e-uart/DUINOMITE-E-UART => duinomite-emega/DUINOMITE-EMEGA-UART} (100%) create mode 100644 sys/pic32/duinomite-emega/Makefile delete mode 100644 sys/pic32/duinomite-uart/.gitignore delete mode 100644 sys/pic32/duinomite-uart/Makefile create mode 100644 sys/pic32/duinomite/Config create mode 100644 sys/pic32/duinomite/Config-uart rename sys/pic32/{duinomite-uart => duinomite}/DUINOMITE-UART (100%) diff --git a/Makefile b/Makefile index 4e00a76..824ef7d 100644 --- a/Makefile +++ b/Makefile @@ -8,34 +8,6 @@ # The `make' will compile everything, including a kernel, utilities # and a root filesystem image. -# -# Supported boards -# -MAX32 = sys/pic32/max32/MAX32 -FUBARINO = sys/pic32/fubarino/FUBARINO -FUBARINOBIG = sys/pic32/fubarino/FUBARINO-UART2CONS-UART1-SRAMC -SDXL = sys/pic32/sdxl/SDXL -MAXIMITE = sys/pic32/maximite/MAXIMITE -MAXCOLOR = sys/pic32/maximite-color/MAXCOLOR -DUINOMITE = sys/pic32/duinomite/DUINOMITE -DUINOMITEUART = sys/pic32/duinomite-uart/DUINOMITE-UART -DUINOMITEE = sys/pic32/duinomite-e/DUINOMITE-E -DUINOMITEEUART = sys/pic32/duinomite-e-uart/DUINOMITE-E-UART -PINGUINO = sys/pic32/pinguino-micro/PINGUINO-MICRO -MMBMX7 = sys/pic32/mmb-mx7/MMB-MX7 -WF32 = sys/pic32/wf32/WF32 -UBW32 = sys/pic32/ubw32/UBW32 -UBW32UART = sys/pic32/ubw32-uart/UBW32-UART -UBW32UARTSDRAM = sys/pic32/ubw32-uart-sdram/UBW32-UART-SDRAM -EXPLORER16 = sys/pic32/explorer16/EXPLORER16 -STARTERKIT = sys/pic32/starter-kit/STARTER-KIT -BAREMETAL = sys/pic32/baremetal/BAREMETAL -RETROONE = sys/pic32/retroone/RETROONE -PINGUINO-MICRO = sys/pic32/pinguino-micro/PINGUINO-MICRO - -# Select target board -TARGET ?= $(MAX32) - # Filesystem and swap sizes. FS_MBYTES = 100 U_MBYTES = 100 @@ -57,8 +29,6 @@ FSUTIL = tools/fsutil/fsutil -include Makefile.user -TARGETDIR = $(shell dirname $(TARGET)) -TARGETNAME = $(shell basename $(TARGET)) TOPSRC = $(shell pwd) CONFIG = $(TOPSRC)/tools/configsys/config @@ -69,11 +39,8 @@ all: .profile $(MAKE) kernel $(MAKE) fs -kernel: $(TARGETDIR)/Makefile - $(MAKE) -C $(TARGETDIR) - -$(TARGETDIR)/Makefile: $(CONFIG) $(TARGETDIR)/$(TARGETNAME) - cd $(TARGETDIR) && ../../../tools/configsys/config $(TARGETNAME) +kernel: $(CONFIG) + $(MAKE) -C sys/pic32 all fs: sdcard.img diff --git a/sys/pic32/Makefile b/sys/pic32/Makefile index b07418a..e0f9f93 100644 --- a/sys/pic32/Makefile +++ b/sys/pic32/Makefile @@ -1,8 +1,8 @@ # Programs that live in subdirectories, and have makefiles of their own. # -SUBDIR = baremetal duinomite duinomite-uart duinomite-e \ - duinomite-e-uart explorer16 max32 maximite \ +SUBDIR = baremetal duinomite duinomite-emega \ + explorer16 max32 maximite \ meb starter-kit sdxl ubw32 ubw32-uart \ ubw32-uart-sdram baremetal fubarino mmb-mx7 maximite-color \ 32mxsdram-uart picadillo wf32 pinguino-micro diff --git a/sys/pic32/duinomite-e-uart/Makefile b/sys/pic32/duinomite-e-uart/Makefile deleted file mode 100644 index e0c4acc..0000000 --- a/sys/pic32/duinomite-e-uart/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -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 uart.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 vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = - -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=40000 -DEFS += -DCONSOLE_DEVICE=tty5 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=1 -DEFS += -DLED_DISK_PORT=TRISC -DEFS += -DLED_KERNEL_PIN=15 -DEFS += -DLED_KERNEL_PORT=TRISB -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=12 -DEFS += -DSD0_CS_PORT=TRISG -DEFS += -DSD0_ENA_PIN=13 -DEFS += -DSD0_ENA_PORT=TRISG -DEFS += -DSD0_PORT=3 -DEFS += -DUART5_BAUD=115200 -DEFS += -DUART5_ENABLED=YES -DEFS += -DUART5_ENA_PIN=13 -DEFS += -DUART5_ENA_PORT=TRISG -DEFS += -DUCB_METER - - -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-maximite.ld - -CONFIG = DUINOMITE-E-UART -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/duinomite-e/.gitignore b/sys/pic32/duinomite-e/.gitignore deleted file mode 100644 index 6a22af6..0000000 --- a/sys/pic32/duinomite-e/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.compileversion -.deps/ -.oldversion -machine -sys -unix.bin -unix.map -usbboot.map -vers.c diff --git a/sys/pic32/duinomite-e/Makefile b/sys/pic32/duinomite-e/Makefile deleted file mode 100644 index 12abe54..0000000 --- a/sys/pic32/duinomite-e/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -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 = - -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=40000 -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=1 -DEFS += -DLED_DISK_PORT=TRISC -DEFS += -DLED_KERNEL_PIN=15 -DEFS += -DLED_KERNEL_PORT=TRISB -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=12 -DEFS += -DSD0_CS_PORT=TRISG -DEFS += -DSD0_ENA_PIN=13 -DEFS += -DSD0_ENA_PORT=TRISG -DEFS += -DSD0_PORT=3 -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 - - -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-maximite.ld - -CONFIG = DUINOMITE-E -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/duinomite-e-uart/.gitignore b/sys/pic32/duinomite-emega/.gitignore similarity index 77% rename from sys/pic32/duinomite-e-uart/.gitignore rename to sys/pic32/duinomite-emega/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/duinomite-e-uart/.gitignore +++ b/sys/pic32/duinomite-emega/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/duinomite-emega/Config b/sys/pic32/duinomite-emega/Config new file mode 100644 index 0000000..0f7cd34 --- /dev/null +++ b/sys/pic32/duinomite-emega/Config @@ -0,0 +1,70 @@ +# +# Olimex Duinomite-eMega board +# ============================ +# Console on USB. +# For Windows, use the driver: http://www.schmalzhaus.com/UBW32/FW/UBW32inf.zip +# For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Olimex-Duinomite +# +# To build the kernel, use: +# cd sys/pic32/duinomite-e +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "DUINOMITE" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-maximite.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=40000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISB" # for kernel activity LED... +options "LED_KERNEL_PIN=15" # ...use pin RB15 +options "LED_DISK_PORT=TRISC" # for disk activity LED... +options "LED_DISK_PIN=1" # ...use pin RC1 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + dumps on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# SPI ports +controller spi3 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi3 flags 0x7c # select pin RG12 +options "SD0_PORT=3" # at spi3 TODO: delete +options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags +options "SD0_CS_PIN=12" # ...use pin RG12 TODO: use flags +options "SD0_ENA_PORT=TRISG" # for SD enable... TODO: use flags +options "SD0_ENA_PIN=13" # ...use pin RG13 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 diff --git a/sys/pic32/duinomite-emega/Config-uart b/sys/pic32/duinomite-emega/Config-uart new file mode 100644 index 0000000..34a1709 --- /dev/null +++ b/sys/pic32/duinomite-emega/Config-uart @@ -0,0 +1,70 @@ +# +# Olimex Duinomite-eMega board +# ============================ +# Console on UART5. +# For Windows, use the driver: http://www.schmalzhaus.com/UBW32/FW/UBW32inf.zip +# For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Olimex-Duinomite +# +# To build the kernel, use: +# cd sys/pic32/duinomite-e +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "DUINOMITE" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-maximite.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=40000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISB" # for kernel activity LED... +options "LED_KERNEL_PIN=15" # ...use pin RB15 +options "LED_DISK_PORT=TRISC" # for disk activity LED... +options "LED_DISK_PIN=1" # ...use pin RC1 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + dumps on sd0b + +# Console options +options "CONSOLE_DEVICE=tty4" # Console on UART5 + +# Serial UART ports +device uart5 # RS-232 port +options "UART5_ENABLED" # TODO: delete this option +options "UART5_ENA_PORT=TRISB" # for RS-232 enable... TODO: use flags +options "UART5_ENA_PIN=13" # ...use pin RB13 TODO: use flags + +# SPI ports +controller spi3 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi3 flags 0x7c # select pin RG12 +options "SD0_PORT=3" # at spi3 TODO: delete +options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags +options "SD0_CS_PIN=12" # ...use pin RG12 TODO: use flags +options "SD0_ENA_PORT=TRISG" # for SD enable... TODO: use flags +options "SD0_ENA_PIN=13" # ...use pin RG13 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 diff --git a/sys/pic32/duinomite-e/DUINOMITE-E b/sys/pic32/duinomite-emega/DUINOMITE-EMEGA similarity index 100% rename from sys/pic32/duinomite-e/DUINOMITE-E rename to sys/pic32/duinomite-emega/DUINOMITE-EMEGA diff --git a/sys/pic32/duinomite-e-uart/DUINOMITE-E-UART b/sys/pic32/duinomite-emega/DUINOMITE-EMEGA-UART similarity index 100% rename from sys/pic32/duinomite-e-uart/DUINOMITE-E-UART rename to sys/pic32/duinomite-emega/DUINOMITE-EMEGA-UART diff --git a/sys/pic32/duinomite-emega/Makefile b/sys/pic32/duinomite-emega/Makefile new file mode 100644 index 0000000..02006c2 --- /dev/null +++ b/sys/pic32/duinomite-emega/Makefile @@ -0,0 +1,360 @@ +PARAM = -DDUINOMITE +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_ENA_PIN=13 +PARAM += -DSD0_ENA_PORT=TRISG +PARAM += -DSD0_CS_PIN=12 +PARAM += -DSD0_CS_PORT=TRISG +PARAM += -DSD0_PORT=3 +PARAM += -DSPI_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_DISK_PIN=1 +PARAM += -DLED_DISK_PORT=TRISC +PARAM += -DLED_KERNEL_PIN=15 +PARAM += -DLED_KERNEL_PORT=TRISB +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=40000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DHZ=100 +LDSCRIPT = "cfg/bootloader-maximite.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk + +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 ../${LDSCRIPT} -Wl,-Map=unix.map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump + +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif + +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o usb_device.o \ + usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/usb_device.c $S/pic32/usb_function_cdc.c \ + $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ + $(OBJDUMP) -d -S unix.elf > unix.dis + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix.elf + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin + +clean-all: clean + rm -f *.h *.c machine sys + +reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} + + +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/duinomite-uart/.gitignore b/sys/pic32/duinomite-uart/.gitignore deleted file mode 100644 index 6a22af6..0000000 --- a/sys/pic32/duinomite-uart/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.compileversion -.deps/ -.oldversion -machine -sys -unix.bin -unix.map -usbboot.map -vers.c diff --git a/sys/pic32/duinomite-uart/Makefile b/sys/pic32/duinomite-uart/Makefile deleted file mode 100644 index a605dac..0000000 --- a/sys/pic32/duinomite-uart/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -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 uart.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 vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = - -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=tty4 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=12 -DEFS += -DLED_DISK_PORT=TRISB -DEFS += -DLED_KERNEL_PIN=15 -DEFS += -DLED_KERNEL_PORT=TRISB -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=5 -DEFS += -DSD0_CS_PORT=TRISD -DEFS += -DSD0_ENA_PIN=13 -DEFS += -DSD0_ENA_PORT=TRISB -DEFS += -DSD0_PORT=3 -DEFS += -DUART5_BAUD=115200 -DEFS += -DUART5_ENABLED=YES -DEFS += -DUART5_ENA_PIN=13 -DEFS += -DUART5_ENA_PORT=TRISB -DEFS += -DUCB_METER - - -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-maximite.ld - -CONFIG = DUINOMITE-UART -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/duinomite/.gitignore b/sys/pic32/duinomite/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/duinomite/.gitignore +++ b/sys/pic32/duinomite/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/duinomite/Config b/sys/pic32/duinomite/Config new file mode 100644 index 0000000..dddcc1b --- /dev/null +++ b/sys/pic32/duinomite/Config @@ -0,0 +1,69 @@ +# +# Duinomite and Duinomite-Mega boards +# =================================== +# Console on USB. +# For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Olimex-Duinomite +# +# To build the kernel, use: +# cd sys/pic32/duinomite +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "DUINOMITE" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-maximite.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISB" # for kernel activity LED... +options "LED_KERNEL_PIN=15" # ...use pin RB15 +options "LED_DISK_PORT=TRISB" # for disk activity LED... +options "LED_DISK_PIN=12" # ...use pin RB12 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + dumps on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# SPI ports +controller spi3 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi3 flags 0x45 # select pin RD5 +options "SD0_PORT=3" # at spi3 TODO: delete +options "SD0_CS_PORT=TRISD" # for chip select... TODO: use flags +options "SD0_CS_PIN=5" # ...use pin RD5 TODO: use flags +options "SD0_ENA_PORT=TRISB" # for SD enable... TODO: use flags +options "SD0_ENA_PIN=13" # ...use pin RB13 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 diff --git a/sys/pic32/duinomite/Config-uart b/sys/pic32/duinomite/Config-uart new file mode 100644 index 0000000..f1f3848 --- /dev/null +++ b/sys/pic32/duinomite/Config-uart @@ -0,0 +1,69 @@ +# +# Duinomite and Duinomite-Mega boards +# =================================== +# Console on UART5. +# For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Olimex-Duinomite +# +# To build the kernel, use: +# cd sys/pic32/duinomite +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "DUINOMITE" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-maximite.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISB" # for kernel activity LED... +options "LED_KERNEL_PIN=15" # ...use pin RB15 +options "LED_DISK_PORT=TRISB" # for disk activity LED... +options "LED_DISK_PIN=12" # ...use pin RB12 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + dumps on sd0b + +# Console options +options "CONSOLE_DEVICE=tty4" # Console on UART5 + +# Serial UART ports +device uart5 # RS-232 port +options "UART5_ENABLED" # TODO: delete this option +options "UART5_ENA_PORT=TRISB" # for RS-232 enable... TODO: use flags +options "UART5_ENA_PIN=13" # ...use pin RB13 TODO: use flags + +# SPI ports +controller spi3 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi3 flags 0x45 # select pin RD5 +options "SD0_PORT=3" # at spi3 TODO: delete +options "SD0_CS_PORT=TRISD" # for chip select... TODO: use flags +options "SD0_CS_PIN=5" # ...use pin RD5 TODO: use flags +options "SD0_ENA_PORT=TRISB" # for SD enable... TODO: use flags +options "SD0_ENA_PIN=13" # ...use pin RB13 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 diff --git a/sys/pic32/duinomite-uart/DUINOMITE-UART b/sys/pic32/duinomite/DUINOMITE-UART similarity index 100% rename from sys/pic32/duinomite-uart/DUINOMITE-UART rename to sys/pic32/duinomite/DUINOMITE-UART diff --git a/sys/pic32/duinomite/Makefile b/sys/pic32/duinomite/Makefile index 1801c95..fc7c1f3 100644 --- a/sys/pic32/duinomite/Makefile +++ b/sys/pic32/duinomite/Makefile @@ -1,48 +1,360 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DDUINOMITE +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_ENA_PIN=13 +PARAM += -DSD0_ENA_PORT=TRISB +PARAM += -DSD0_CS_PIN=5 +PARAM += -DSD0_CS_PORT=TRISD +PARAM += -DSD0_PORT=3 +PARAM += -DSPI_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_DISK_PIN=12 +PARAM += -DLED_DISK_PORT=TRISB +PARAM += -DLED_KERNEL_PIN=15 +PARAM += -DLED_KERNEL_PORT=TRISB +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DHZ=100 +LDSCRIPT = "cfg/bootloader-maximite.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=unix.map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 pwm.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 = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DADC_ENABLED=YES -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=12 -DEFS += -DLED_DISK_PORT=TRISB -DEFS += -DLED_KERNEL_PIN=15 -DEFS += -DLED_KERNEL_PORT=TRISB -DEFS += -DPIC32MX7 -DEFS += -DPWM_ENABLED=YES -DEFS += -DSD0_CS_PIN=5 -DEFS += -DSD0_CS_PORT=TRISD -DEFS += -DSD0_ENA_PIN=13 -DEFS += -DSD0_ENA_PORT=TRISB -DEFS += -DSD0_PORT=3 -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o usb_device.o \ + usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/usb_device.c $S/pic32/usb_function_cdc.c \ + $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ + $(OBJDUMP) -d -S unix.elf > unix.dis + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix.elf + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin + +clean-all: clean + rm -f *.h *.c machine sys + +reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-maximite.ld - -CONFIG = DUINOMITE -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index 8c9f642..464b2ab 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -1,5 +1,6 @@ # # chipKIT Max32 board with SD card shield +# ======================================= # For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-chipKIT-Max32 # # To build the kernel, use: @@ -8,7 +9,8 @@ # make clean # make # -# For details, see http://retrobsd.org/wiki/doku.php/doc/kconfig +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig # architecture "pic32" cpu "PIC32MX7" # Processor variant diff --git a/sys/pic32/rd_sdramp.c b/sys/pic32/rd_sdramp.c index 203e8a1..661a3db 100644 --- a/sys/pic32/rd_sdramp.c +++ b/sys/pic32/rd_sdramp.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index 2f0554e..d6e6826 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -7,6 +7,9 @@ # make clean # make # +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# architecture "pic32" cpu "PIC32MX7" # Processor variant board "CHIPKIT_WF32" # Board type From 85469910464ec08193026d06bc456f0a1879f606 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 17:45:31 -0700 Subject: [PATCH 11/32] Fix retroone configuration. Reorganize ubw32 and picadillo configurations. --- .../32mxsdram-uart/32mxsdram-schematics.pdf | Bin 0 -> 31597 bytes sys/pic32/Makefile | 8 ++--- .../picadillo/{Makefile => Makefile-old} | 0 .../Makefile => picadillo/Makefile-rambo-old} | 26 +------------- sys/pic32/picadillo/PICADILLO | 4 +-- .../PICADILLO-RAMBO} | 4 +++ sys/pic32/picadillo_rambo/.gitignore | 9 ----- sys/pic32/retroone/Makefile | 34 ++++++++++-------- sys/pic32/retroone/devcfg.c | 7 ++++ sys/pic32/ubw32-uart-sdram/.gitignore | 9 ----- sys/pic32/ubw32-uart-sdram/devcfg.c | 25 ------------- sys/pic32/ubw32-uart/.gitignore | 9 ----- sys/pic32/ubw32-uart/devcfg.c | 25 ------------- sys/pic32/ubw32/{Makefile => Makefile-old} | 0 .../Makefile => ubw32/Makefile-uart-old} | 0 .../Makefile-uart-sdram-old} | 0 sys/pic32/{ubw32-uart => ubw32}/UBW32-UART | 0 .../UBW32-UART-SDRAM | 0 18 files changed, 36 insertions(+), 124 deletions(-) create mode 100644 sys/pic32/32mxsdram-uart/32mxsdram-schematics.pdf rename sys/pic32/picadillo/{Makefile => Makefile-old} (100%) rename sys/pic32/{picadillo_rambo/Makefile => picadillo/Makefile-rambo-old} (77%) rename sys/pic32/{picadillo_rambo/PICADILLO_RAMBO => picadillo/PICADILLO-RAMBO} (86%) delete mode 100644 sys/pic32/picadillo_rambo/.gitignore delete mode 100644 sys/pic32/ubw32-uart-sdram/.gitignore delete mode 100644 sys/pic32/ubw32-uart-sdram/devcfg.c delete mode 100644 sys/pic32/ubw32-uart/.gitignore delete mode 100644 sys/pic32/ubw32-uart/devcfg.c rename sys/pic32/ubw32/{Makefile => Makefile-old} (100%) rename sys/pic32/{ubw32-uart/Makefile => ubw32/Makefile-uart-old} (100%) rename sys/pic32/{ubw32-uart-sdram/Makefile => ubw32/Makefile-uart-sdram-old} (100%) rename sys/pic32/{ubw32-uart => ubw32}/UBW32-UART (100%) rename sys/pic32/{ubw32-uart-sdram => ubw32}/UBW32-UART-SDRAM (100%) diff --git a/sys/pic32/32mxsdram-uart/32mxsdram-schematics.pdf b/sys/pic32/32mxsdram-uart/32mxsdram-schematics.pdf new file mode 100644 index 0000000000000000000000000000000000000000..57a37d587b5911a6de277053fb67be042b0666f0 GIT binary patch literal 31597 zcmZ^}WmFtp6Sf;9c<|sbI3aj|;1D2zBse6vOVGhxW+1o@3GM`UcN^T@-Q67qX5jFA z@3+=Df6lM&-d+3dU0u~{T~)oAlt0UG@Nn{BG4&lovatARxoPc;t*}Hzx#Z1k&7Cc1 zKfa8pa>-cQIGZ`ra>>{jIh%bpGqE!@6BoyFa&|N`0%EzRPPgjB02>{cZ$Y3hU+yLK zcvW%(A3IY9PDy0xzo@P#Bu9mM99AyJ*HY63Q-__G-$^k?!1xG zcX_sxfOo0zF+uM+pnVB|r^i1d&+x;wD_3|24noTXubg#9=AJ~?^X_721bER;r`ks) z;!>bYWBT>)_?sK2s|1Y5up7vb5!8^BexSy5nn`@&xDjHB9|B&0zH~ zX2FrQ_3Tj&N48K*hrZD4;AFgId1UhT)L^~K+;rPrq1RPga-K9G_&Xx?~CJt6%8ZfK&@1QePF z%oY}2JYUUUH)pI(*M+zy2^_@SF%n2>5nob&^AcNZU*a)7R{9udul#^uGEMF>T*h#4 z)02IGjfb=b`V5yu<_*d5?NcMK)pM*+)B;FrsAR`}BP+z)vF62p%X*H~q=J$z?Nbta z@O3vpseY-59mQXpQ=Sgev3#VUKy7JGOZZjaO8vZ~KS`oZc`Y8ToxpNvP3AjO`!VV6 z(`zS{%F-B{hic391)9NMiN;Y)ij*l4{zmMmwg#r&$zrED9EiW!E97TOuIe`kSt8`^IsT$?yyB&M+p1etp37PE>*8^u$@Q!V zX}!{8;hMK@&1Rk3xx`{?ouXDqi&-1GYEKZ*!Cz zq&L?8-s7n>9fFVPAIOZC7`fDqg2{T+tNuRPDWy~Sy(DVXjnHl-fUIf>i8rQ ze+IzHM*60|Z~Xa~V#TYz%nRHopwh>>_cot!I8?qMJA&*UhUddJJC1MogO|=qL~R)C zMnAJC1_v(+!eW!7vM-?o)?ZFYOxO%AB19XUUokvzPp1Jtj4hGHd2@iqI&KkD|6HO;ohHJ0(WWsUdwu?@vJpTE@lO8nB+eBq?rMZSgr-F^%nO0 z?!)EbnRtKkjusO0*s|-J@u3lbXfEwG%z;)Dm(|4D*Jwfoc;(}CZa;#82yP?FCsSZ=F6WxrBIgdu)3dVk&h`;dHH$JJi!I!`*^Z!uK)SF7vI!wK1f z)aaANBzpd))5Qqo+~CK%_ri-(7NStZ#*l;$Cf75F8=jC|j@S)X(h+LXPN5te+Oe?W z#JDdvXaieZ8LLmumF|cF$lbK$AIos(xk_!;TzQV$)K0)Y?3cK2F7^FB43tBCr~yyk zCE%@p*YaTMmY=o__--f_-qf2R7X$Q{+7s|hZm`&(hBv`;_1Rs=unO=M|}ay-T1Z>LCaAqW>2;pIyC#L_~~*b(^Wyez`R$x3{TH!$67?oSh3l zsj^z`A{RF&QrDT>wZY~x{Js;VWwZT0DpC0GB zf;bNn(fl4xZkA1ElOphb?278H4DF;LZQa!e$M-qGGAtv$-hh7Qp*tRA44ZiiCKPie za9ob~q^s(ZLh z`gfePz!!8!hFg5EvC>pjk6s5i%^T`U()WQ4i{A7ftEEqaz?zRU2}3ftH?Q8fmIU9L zp>+oLWj)xVsT**nOpgtqwU^cL39csl#cb5=~}@n2joXW z$PJw~upgmTDUIq`R_mhH`i7()ZJ#yx#$xx=(yKXD$mqmts=AGiKz`yPM1o|>>0IM) zM|fX*=Ie-Vz1N&MAqszbzUjDN7J+ zUvZ0425L3nvF%aV;SV$N^Jal3`xW^%G5#2qpN@D%#1dJ5pQFD&NygpQe#bt;E+7`q zQFT|&efXmq22f>PRmEKF43dz@)O(0_J!o>3HF`Sd!V4b*5N6ngK*mD20E7m%Axex- zWad(!g|uT7e|Jr;()buaa%Yy`<61&9gr>WQ=SEzH#bJ>YvAQ1cOQ_IEVckcxn z=xo(<>k}UesvW^JM@x5u*D6U!iV`x&S%+3=5$`Jptq3|lJeM_rKI+m9AySA;0Bfa2gr@x`hn)lLCXv=;cXSI}3WTmySz0&0Fz3C3U zdv8#axzLK)`QFb9u_?yW3vCFV@L$nYMMGN8hJVYHYNr$)Ls~v7%4II2t0eJG1@)!O zd3T7gT%^cfJMoP=dqbViCq?qIQe{T%Bb_pJD_K2n`c)Vv2v8L2s!^r>#x za5%_bv=K{ss*^V@Y-Mv_Z_O}|wz7hlFq-1Q4HB!=jc0=837nBfI-*5xKHUSzU%c{T z<58Bkn6P6uyS_YDv-F5iQVwOUl#`VHa$OW#+QI2=GSxuXv~Hk_a{$r`jiYjO+TDS1KSlZotfqRT>!Y1JtUV06Q$izH2AX7{KzLHE=wU!k5cZ^ zqor{M=M!Ycx$+~cMxZn^8 z)z}asa%OcxPhhMo_ma*4F*ju7bLb_YYhh^K%w}TvPr6k5`+BAbOgqYhb(wPr{Z4Vt z$9RD?EoJ60nP3_o+gD?rEcomx|O_f!C^<33HX7uy`-hcKTOr*z^Coh|?58 zJm_7Usn{C?;#aMuG`f6$K1gr;1carC%ORl6Q{ z<@AF+mvy{##|jqZ@xCy4UlE+lT|=zFV#lt~kEY8rPm1dsybgjx_=7Ir*qi&)Lgv`| zh|8Q)5RDV)#7)%#Rh&V6D=|vM{b}p-W`4SOdn;on80v|kwigXmov7u+!>eFEHu+{p zn;7Tw{J5>P4Y(VxQ*yQ!Zl?LB^l2(egF4-vf6{I7*0xyvcp6hh)|rQOI%}}Vp7<&M z@R3t)d{>)=X&caRH^)5R=xpWK*T(Y__6dH@bC%xI%pbI}ZO z{WtVgl$vWCX*#B1*qnAq^(LV93CihTr3nj58Vk*&6wWN4 zo|A?-r0-76MkNx3C}Y&$QwNH(hkiLdJsuJzat7~(OpTe{bO?sAAQS$RPMRHi?Jk_< zXe;A&ycAuJ{ZJ=;mgLyv*95=YZKCC8UH(g)VFG)M8~V6>Uf6 z(+S@vnPbxp?U|#XGJ{6i_}iT=-o35fyG34*Ir;~&VNfH`gJT{!?}uwm!dHhkI&L** zoS5@eCv8Ef_Z7J->);>;nk^c7XDEd8&1oVfgp2UB=?qZT#FE7~fvPQInQm3~K=QjP zPKCD;>)y#ai1UW5z9+TrtGkfenT=q%=j6(}P!Z0B+*((2^T+QJtqz*J9TtX^*?9E~ z((3WEt>=M#)$rgY72Y9HgWAJ#bdp5tz9Qu59X)|0Q^kY4j7@t3#5ykTV3Z5JC<*ou-=MPQXl;HuLr$>@Wj^~L%Q$x#Es$XN<*c! z%?=Hh$=^XL`bS=~@oDSnq zzL(~r)xy)FcY|XQZ=0U!u^kZr{cwCikmz&8MYl6fjpc=jJV}tKjk2C??dRkBOfGA< zn3pe6`(era@U{Ty(ure7#B0NCMH)}wH_Nj0eoq4^;CD=s=a@}mZSiTbFe zldH$VzaxCDo+Tw>hmO~<)XPWr5@Xosq#(vP`8lk+%3l{fI!j$gy9mx*#BYLN%|qEi zY^e#=CD76?9x_N74nxs{xV!aQ4M!<$>xameLWXQ^co)1SnAg>R!Yh`p|Ikcd{J}|K zc>X#2(_ko^sBfLx)h*WbwXwq^2Uo<3SnCw=_N_J1z15u^op#*TTUU%XAJfG|n+*?s zk4vWRWh78vT00r{RE2h;MHI5x27F<5ClY2Qy20+mdGeylBWe1)JX0_9K@sX$%V)s_ zg0&mudR_bMYb19uwXdZv!K!{W&ID2Qw%aHY?EqufX2GiIkMJjZ=ym=X4|dikyRQyc`y8 z>7NC;S;! z3sZ6QsxY;dc2$fs!7ZC<3$HCra4cPUII0gsZL08@@+INeaoXO_glj8}5@xe7CM zwyv%RF35AsTTc2KyRvtS=`3PRoO8SP-ZQ#OGjzaLVlu6jnvJ^$ao-lU!a`(?6#dCJ zlI5n4vo&Qb2lfYr(4DrjcZlM>+uA;I;T#rR{mz$L9-G>(L0r5EDyi+mp1$ZYQnzbs z#mD&We0S&yg!G;2^KA-Yj6%=GxNDa1Y2ZgTvNa57y>Ylg2pX{QyVED}C6wZS?Sw#;8owGyjmhD*yj@l5ZXL3H>N?-V9;N}a zd&atzQ3Ph(%EKFdLEUcT@F6_<h_H*4*u+^`+lG`Nr=caddqfT5_o{*lBDEeymKLLwE0G@!(WC(c4K+-)$45^oaBF zsESA+y)xKo12>p<{yZ%fDNNs?0j!^j4m~t`8rl8_r^eDNdlE$Jhj@V;Sn1nCP zbv-GvWbpDWtCOD~`}QSswgPd+;>B0H_nB4%1eJU^e?5i9Np$PkajS8J3SN3KKHF!& z-FquM#Pq06VO5$I?)mJ@Bd6Z2%Nt=Mz*MK`N9rf%Tj0vM#A|c7(zaXEfn6u=jmD+G zA5vkvpLIXfIrCGJ9Atrf9UV8uzRSb&b%AU<;)w1T7 zo4&<}inPkr>R)L=eX>I$fm?~b(AD1VWp5E^@x`0Kx&Sc)Ki4k*48XgSeLV;(ToW{# z+e&n_Z}F*Bd(o;gm?m*cjH+0NuR*rcK{s^LG9#)_#k{vQI<>&;^4aS%?#FkS10MA1 zrkhs)^4Kj`mQq*p1eD0%n?FT+jN$e!N;|F$d!>Keo!?UVk3{vV+=Hjkr%zm=d^E&V zzRfDQqPN99{%9NS?4k9P{`M^rxG<`Rvf~@0%Y~>V^!RPNh`;>pX7&QpR}7sy5EZcY5w-4SnoRur4j)xnZfn$2bG3&!1;^wi1*gL&8u@v(4(?uozb}z z_VULglCtbRO?|gXj$2*a@LkQS9zO871e9im?0d(3*oVdnQZM?Qm3z1b9Igj~b)PL~ z#ThgVaf$bEt?ulxfQD8b%U=oU@BJ`lLpvg*WGitj-B@MIdTLr^z?n6h>{1Z2Wdc^? znPT2^`Cad;a~%@x?@oWj^*0QqD~6+Pjk^nQ|TGbD|)3W(U+)?imY7S z1xaS#Wm(K@DWo^F^rKtsst3wclgac5Sa*HVndCLn3=!4#2J#fCNMS-z zGNPl4653XQB*v=4e4<$-YZ++oc4sOCN{`gooHX}R34 z8|&_??&WI239s zQFmx?5v1Uu=5jHNi$!7?U3KO~dRY!}(?#V~7|gIdY&22hers5G&B@Gtw@9P6Jg02q zW&h*jtm@Q14i6fVTRqWt`SvC%R@l;o2lKrnu1+WTs|U-yH_iE=W@C3d@$X4oH1dz! z6!BZ&p1KPXULeN31u(X_a*L-;iIfkFPDx~LUA+4dD4Wm&ghNUf>k?g+@oIh)47P0xnHb#sy5lC-zsO_-|vVQ@vU@I%_qll6PM&5CypEtu1Uz`&e>Ibp1(qxg^hL@Y6Hvb z#B61|k*n$BGz*}37Oa+Hw4!MFpyrog(Z(_rxb$^i5Ensem}NY^BH=9p@uLi?f3MW+ zYm%o_U*(H^5~=%EygiNq8?&N<5gD+2qWayOK%7JImv02$kY>8XD{`2wq9nz!>gRN< zqT}!$+^_H0Fb`_z?{7L=iwNPC=tPXi;f~2wV&U_9j*bV2_>hN|kcXU*nFVqNj+H|I zx1*gBc6!1E#JpUer>l47&?!(Nhq)NVUGbN5U*hUH-eu)s7GvI?JLA!B%vr%Md5*jG z3ws!isXk6(Bh;8!bE&glDA)&7bpLXZ$Nr2Xr7Z|H-FgW2W@X1Ta&QczDi`Uh4Q9wF z$El{P6^RzdYB|+x7)t=|p|>7hj?5e-T=!3h6F%aEkFMbzGYj#S*#?n$)(aE;wqwpy zB0Mp4?$RHZL)-N$)@ex6XFIb+9x3KJdC*oS2C{OmpFtpw16wH z_>nOMrtjF0%-L)lK0it#ZD=7~d_%g>LOS?{bcsl$&}I?hI)Khd_Tm;=h68^Hs?GQu z2Q`XGcO9Yj_G%A0$O(y(=p}3^IvQ(5yr=Es+F^VK$wf$nelt_yqGe|9F||86(oz&0 z7>{L+nca zacthRTr$=`{jusO4f&SW#)+3YI=rou`KT1^>yGVYD%w_FAYhHa(1ZbISftq2} zDPwiWLg{v@z})me4tnHe@L<*)If*hAX~3#=PIag5xw{~4!``R;#?=s9D)G#?Z6fE^ zg4@;cOJP!z;aO`=a9yB=>T-S|i}#h$<0~@}lnMI!_P>XZUS7REK+Rx;WDsI%lZ`lS z);R_L)OI>>24ISoIBV2$2%`;O6k<$5;LeR*j{s(N8hlDl)Y`zF3L*(<7- zpTSCwAl(lo%s(7KpFc#M$W6EniNsU>CJkKSboJ3H|1j-~nZJ7w)|%{D<<2KKHStHq zd92viY@4ZMKzb?4ZA9pjiiwBdW;t?HcdSEqYXw!WoW^jBN;@?4KC_3GDmTTBG*Q0}gH(xfY_o58wz zEMJaK^qObg9ClLZn0tB^Ju6VW?;%QZzRe7MFnt={!@4d_&ICpXM?)QtO`DxhB^Yo# z4B1=0(Q$U(Ja?>dj#|5!B>ze0{KGZy;ic`vf8$iU@WhQ<=!VeIoP9?!^Nl0JVd{Ox z#o6cJgRFA<(wy2M?0_h=q}?TIBYN(L zuaoqj5aC`z>ZKHobk^)wxRyopjul^5H+gzFdE=0 zVC{E@-N$DKrNn0>v%rT}wRzBnPr zZFj>zrz7*O*vUqOH}hSWM?pr{^Ph4boDjW*h~g*eGnNO_hq+fj+pZ1b@el&rp4X6V zPXrH!3I4_0ZHF{X4I~P0X5AmSCJU;3exrQx&+wTta~8V(7%jXND6ypk&qZ*9EhHim zZin10pwt<|RIg6zuLN#*KlSYW-r9ThHp5lzKd0r<08;^L5g_V-OQmMkXGR2DtWVbi zi+$O1Vm3KI1mk2ZcI{Otcn}vx6ymh3;upd)zAndik4E3dg9EBjLNmf;Ms6nxx!-n` zUi;MjsI4OI_fDdwcp^5vJxO90>Suv6e!oc=1xA^^yvYNh7r2`r-pQXG!#8(fX4O|i zqTqe_N*~11d*XJjZ_my`-6k}&UmjzMH@3GCtZp6R!_ zKHXixGvuEEwC4hdM?P=?V)Evy?r8>OBs$MU4H$+a-(n{~=DBpm4WZm^nvd(I5+R8B zix>o16)O~}^WJ)qD~c;3;Ue^cTf7o(dW=pbLB_R(w`BxBfI)(2j;o{AhT(5+$+uc3 z@E$e#be=%FXF!jXo4!8 zRZw`w^H2i#NvW^sW^GQ8F4ToyEAP&czH$aA6P{WcZx$gUW2yBVWFH|W)IUELuSz{# z`*Rd!EMt#cVgd!UDKUkv<-ezi11Y$TDW|y@W>|FbzC59n*lmx^+VR6oxbP^Gfo!M3 zer-ygGzT$MMm1Jw_>~1JNO_f4+g`$;t3?9qe;VSbBHIG^+Co)64Vf1iz=LqafIT=; zY`dtI{~b7a^ng8VsnMxA7w=p5es^10W=_B6wE03m*9|n&E2= zr9Fmoer~oz(HDJ&kb7lj?`FyFD~1^_Hu-|Mw`G5*)UJM;CapSE=B`*EeXl0*;&)fp z{(e-!Pw}XtjT&TFIunW)U9EgE`zoX(Vg(v8YD9;jB4=ci;oH zImbA1ta>xrd1lR`4C}uWB}3eW*xBx2Xr;HVm`qdy?CFhPFjCIZ%!tOz7woQaWV?@d z9st0MY@<&60H^!6g)Y*e1SeR#^xzAl_AU~`TUP_tU-^#3U1i=YN_dx{IFoRRk3_9y zZ8}{o*jn;jayUqJZV~=1nVfrxi{#LT7SDHS))4bX|Iy7Ery=)|+%;D)M}pi-HaIrQ zpB?=!EK{}|SB1+K)YKe^vCN}5$TE-6gv9UaYNwF@!R2Q-zbJztGmBgMumfmLmpQX% zD+j4)%covehSyIC|GJ-@-(k|(6E^k7$r`Doksg9&{ehxNfHYbb{p}k4xUx)y4Eoxt z=HY$o%G;WQ)KJV$a0X1L8FS+{YEZ@UXuIF6Ib)~6(aAC8cxWyc)5NIUT_egz< z#=X&bjQ`yK`fH$+{PTitPw&J>o+17UuqV(6)vJJ5Dq&S`-YUHI_#a*kk5VL8j7Gm5 zv$TF%>6#ow3uD;wsb`m-osObgZNDr~(` z+nVhyj$8Y5AM{?p?kyWj{Ziql_*l~2;7`R$5y1-Us?@lOXlcTRQzZCfwCg6#^EmsM zq8qZZp_R5oG=!)IT>%;Q8oYG9%KM#ODd_x)c<$1odmR+zwd)j-wA^w8;xbBrG|7|z zKXkSgM%@T@@=PC{$$rOdwE{W=l&mCwW4-DawX)V79t^B7hAs^r<~s|o;BO5PV`{1A zkSU^&>lpZm(sc@y)!>SI;1kX1KAMY70zk$Rh*aNHu!OQPK`VYP%)ytj$niAN>@-QR zDKRZNMe5znWPEV|KTHeT_Jh7MA$Dh_`PQU$I+2naHeQMd2z?#3fo~-0`cP>M> z8v>UBEV!q|LnLmI6f$qWTt`cM)vSa5kVoLt9I<>+ldvqy*p^3d(;NmPAJ&32sctV! z4_QWTh++x>z0wHf;E9KCPKa*f!{CePXH5k}P9tdY*UJTH5R6d=XSow_(PsIOmA0eM zxxeL=eswP>=J!=%U=98m3QM_U!mGyFp6Klmvy`yuMHVD2*rKWpKC$U@wAosJ^TdZc zDxBqwFWB2b9e4jN4zDP>$@Xr25t>9Y z5=#u*c!cpMY$rj_#9#l2L6fj!*2!AGHiMfCY zJUJ;ZC8F7fgm`>*nn#aVoJfb!?ea*X*S!mRpQwYw>KI6Zw=~(H4LWe~Eq<`aC|K_6 z=z2`bHVbuMjIS^*$qJ#l=q}hAGa33WGs>UIOy`MP@smHx(b!MN%}4b*7|+^d8=xSCYO{lMz5R^I{Ri<3eu;eBvB z4#_Lh*V7K-N1}cAKJPPZcIj}8I?;H0C9@?MBS4ARi%!WEHejG3@{_qY-%ZT!!?)3C zyp2lGrtM*H_l{+%G-B@|bYL29E1&1p|H=CBm#oij)%t()-03O2dWQ?PrA%^J`jwp6 zF;0@)UMg;#_JOLGjr+{j5gilo&Hs2g0HABhNtbs`FvK7 z(sfA2ea1c$py|mhzTzp@`(3)0qETh6rmGqWHL6$|YdG$EP?jvb`}uP@Y+gPs3o-cL z0a^d*Pfxj==m%8RiuBdkFGv}9gu2Ij$#^~gX$ed4;3a0f1B98=gyjRLw{_k%-H%U^ zD7CU{;6JiHwXrh!KW6lb_cr%K7%_UiT+-sWXA=)Mp5=|;E&(p&@1>$79KcFA{+ zyP+(}U&oCf6XDGY?A;c{?MtoOKA^De2T?CTzvZPhl-5*Bn(y|v={W}wcbv(sadnt84r0pv+oIJFi zczvS(e8shMj;A2r9NfhpW3RXT;e7HcBtd1DyMZ0=Ys2+ez1Y%amE(&uxRl0S7kxup zBN3scN(ZU|P_AE}OV$TATQzlK{&R1UwtrARtSS$(8i4I~9x%sXq}E{XJl7SN@B%=u z^Eju3@YvOnr6MPb%qILT!|gZr6&mc#F&}SV>}BgQNc9hSUgyy)w7=Yl5qYt{3AEd+ zBQ5#=&=d!(xVEYjbKr&94#Y?q)#Xs))H(PQ3TonK)hqvpWqjU>|Ch?*>1V^P_GnLY z+njWzfg8puk8)mHT*h(%0e)j%Rrl%k2gk4M2szbL=QBpYn^pIZNvH?}RgWruhE>w} zrmTtR!vuyz)P$=jO*W8#TdN#1lf4j5LzmrmPf4>qM!**lENtFFv&97ebv!}V8MQ-I z@BThN3C~YcL+JA~gDhns(G`y-y|~gJ@xEmJtk68)U8d7Vx~*55|pCvuEujJz=wv4+#8XJmdJP3u05M~K!|ob5hsmvSD>eO-O; z+^K_z8Ci1`0h_}Pet<&O>KzBy24s&2LDCAiOZ}B_@f#!?lK|+d%zSV&1DPET&_TRVb~qS z04s3IHDYR9{b{5H1nc1Zowny)E~5{jz=0*NRA?Drb)%4@Ob-{Z$xd<@m`lhtgwn8mk$tr3L_(%?6F+I;2H>?A#QQUfzTz;)xFX}Hn8okk`D03 z!LeLoO+8hM@ILSFCvHI*YPpPp?UVgoW&Ol896a-54>!nKiv5vSOA2Yhtk2u|Kl6Pz zg=oAn8Eh5zy+DoUl`9@@g@?>nt=s_hsbqO^I7Zy@I5X^=#?%Y%zlYbUou7rl)-9Ox z))jbn<38+Wn|$@0ZX(eC3(=agy5dnZ{_rDfm%;xyl?R}8WT-rTCT1u;Z>~t}cc&5Z zKY7MhsTCakWW3@+8V*KH+eowi0XRXYy5z@Uz;DY%T&#x^qbCeH#u3?Ro|b1CSctI9 z8?15cOCHO^6F8lKz=v3uCk#wemQ)F}pqde3R~LN-z?VHp#Sz&m7~*~WKkF+aeh$~C zXyB)yk7*K8uNU6#LHz#H&esVO156yj3H+lr5N>0A?a|KVE(|S8Ukor1n&u9lZJPz(y#(W6v&J?cVY|x;OJj|P%HfBi?O#3(gr-R=g@o<^RgNkXE1c7KcNnQ+lElkc0Tz8hea#X_Q2OMJ3Aqv}4WO#io&O z$AQ$-KWk#%0H<9_O0*f1ZNoJHO3jb-=93NDRQdYlq2%|1l1> zYhGYEm&|AquSp!qhTqG!DrmVU`sBwN_^*v@&;VY$W$jop?OQmhRkUxeqp zX0Ut1-GPyFbS(2(jxo5!(lJ`iiBz&d5VJ(2e#Qn#Mfgeka#mHf zi+dFEIfs;fJ~C7zjoj2Z31<4T?{7#vtxJV{!WSi*mL)=^0*sqY`yV$&WZWxVd)fs@ z{VrU@plg~YzUW3dkIk&^FtSOWNVf%i5q(|GkRByqFQo9;DW}VDu@q*S^wg?9VpZcD zL-K3%!*@C07vX;H_-Jupitn@M7hL~`$nJ<+%_$lJikq5uomAz4N00IILx=iCBl{UNafxfQ8CN|nYLId0S-W1!7TaCo+^}Z1E;0^; z@R?^B9Bf)#Xgo6+ng|KTM2W}lTqfuYS8m4~P=l9ox*6kE@4$cK<1 z^W_bA3#Eo^fSrN)sac^1KJps($$v&S8$A0QVR7btnfWTGgyP?WT7Oi2XpzPvwV4iy z@|-<9bnmXI{~lNdo4iw9bdDO!9p^B(Ozr}*uaU*`;TvxHbY7`M{kH495Xdy?gB-iH z>}Fi3x<>?09^G3w`&OB^w6OHJyDJrK?I;s%x!9iG6A&(3P=pM+dyEBMoTtn6dBuPQ z0KtFmevsjv6*_x!!-DUAV3eN~+Q+qfy{86LcN8y0TwJEV+1e0GiEavvPfuxvP-J1+GQo3_3zap zfe8aH@pu?n^XqO~X6Rx!1~x}TB`2M$twB!&-u)`xRy8>Qt-#%G37WA4ZPA!pN)Wgy z+5FaQtP_pJVpGTQH3Qk$riSVLn~aL_Q}Ps1q`@;`>yTq4LIhb@ERIiH3rcLmX!>R{_l%P$(?#8Ncor>2=P|RLY_j$bnhIk6;z!QrPfe@*HKR1QRfsSz%;60d z*t@Y3)@vaniwonI-+!IsI;h1;n9@o_OZot;0R8uxKD+py4aP)efr{FCl#s+*?ZWY1 zJsU{$m&$`h%VnfV_hC%qsmndXDSE$g|B(n(sSJh2lT#t@^M}j?8D;WaaxPLOZW^wC8u0%^tuO_x_MQH_Sgfhv2D?hD^YKJj!7eMBYKuj$Zxl&nQ4_fFX5%ns?dsr{D10eaFzj(lozjpZ+}F#U4$~e7Q&-x;-}~3hwbmD(AmDV zBb+$?Sn$6_DQJQQIx*x%w(XA`tQE73>W9tKwSi13g{14XB3s}c$cse1OiQ7Sj_OeG9hyiS&m`=%IWaTGS7~4}Cn;2%DQJ6!{s* zTW(n)hxSQSS*thi#|f(W3nNLR?SJb!bkm+~xk-wCab=R~w!!>Alg7}$*4=YU=5MN@ zrJ1ZMyhvS>{m9H7n9Xr@RI4+6WgcxJ(Ukf7d+ds-_4?Nv$(@^q_I`BYROiZfg-^mJ4u(Z>A^Ek?^jV=HTaBj#p zHwQQ({^`^gzoXC3#*d<0o4idwa9TI9!+=R?>_F`IKuzKruna0XlMRQKK{w^1nLaKft>=0Q_cJ4Wy%){3^Bj z!<8mjW-6M%8V1`_1YW6vdR}{e_nuBFP%NK7FUnm%jj)46R>qECJzvc_6 zZrP(-|E$GD3!D?d@e;=Z%+Q7r)|AINH2CM>;C#E&7I=;4rYz2^aAS|&#gG+2Coa=N zI8WJEwT1SA=WQ&yePyH8+x`d_`3~8fM2*lyNS4X;|8QRIjgQ(AXLzepo_6mIDkF}l z{^t~$$=9fCsdg- z+-Fnry5kQGX31-(SGnfas+62tTd0k;)&7*G#hHXXDK`I4ZQlV7XVW#DAVepK&PqYF z-L<+!^d2>cAX&ZlvU)GkOZ4c`BYH`6g6O>j(W4VR2=d=6d7kHe-~YS*a{b?bUzag^ z=A1LSupR>g_+NM63s^H8V*T=>jT4tIlDY)>{64j1i&c%%r zT0Pg&x#D!Y`NR4#+*qUYseOg|Vf~L{0dvVxaAx*gr=-P*OJ*SA#uQG~wb{==f7N+l z*Ce^#L*hK}^yg9u>QtceneOmb$Xzxo`vJL4eW; zxCXq*%1&q3bgcgB{e$d#OO?}3X6C%0TaC`s!G!s-`mt+h^ik2=?ZtdX6qWZG2pG>X**mTx`;-dCYNUw?ighxG6+Qnn@0L0JPtku!iHmBe05% zDl4qz3D4y<#qi!2D;vw zb$FaAzHa~(e2<6@z^Sn4^icmAK}mWvbE`ji9$6@J>43Y*z0>Uei-sb0*C|m7Df{aU zms96lmYzD#wl8fgooRWi-aK?+PUPlw7hb}w7sy?*Lb2upbvvi_>l2q-sq(=o5guq=bo1irnOvQVj>yFP zxWS)q7T7hf^*uo(2&p{Y)jeo=M_|r|YRCExN8i8#bWy(pUufga1=LgUB5$*ro>pXu zT~P0EdVl%OUgV^F8?dNjgVAwl?Vc`@?I4dsIrRv*p>$8Up?W9i6gC{ua;K-#U0sj7 zm*h?0rz3)Teyfy(`x}oi*fKt!7$xti3WokZ!15)PO= zcs1%J-6ena$*k0GUt8F2+5&Wes9*qMgc@mBLq_$myA*4%R6CLm3s+uYJ<#b~bC%@V zf*!u)p9#8r^v!XXFs=!sjn{)xt3KjkxHS3MTuEk>KuSQ+d|b!m38ZpqBb&oN>Ms48 z*3nbWUelLj?$Qck?P`Ycyx-P7F(0*4r`VVaGU$3YGHYmu* z3P>HMo-XIzGoR#1#))hr#v((1D%@9eL(OSCDW{-+1OqF%BoCzR>n&X39ZTHu#hEig z!c!(BFBq#~DaMW2@T<~M4Hi%8z|ms`BKVQ5g4Xfg^lpDBRLkuv>q3mi2~0rvW>fsT zH=Dbsc&8d5`|R9h+=WM3+VIFD#b(39#2QMQUMy+IQikP~YSPgtD-R`o{>8)8U$65H zWO=-8tsW+pZnHbX`-q-zoprB@=w@sbe5i8`aEblJ<9eTtBmwql)LlLbCehm*caXEX zn|X17CE5=w%-lc$e41heT45voW0ilSA$f+86c_POtJh7UGn zK4I&*PjQ9PFxyl-*#tH2_@U6H)BNepz-$qWqc%MLbksjYEQ26Vl ziX1Lrzd+r7@7r>$52XFGq;nS+Yv#lY=2&lXjIncE$<2A!o7J8H_jWR7WgpI*$4||m zH)9vyYyw%KFN_A?pl=TSwD-TN)EOmuoTbE}TR!BStkceJR3R5HQ~Cbttx9+Mm$#|hCD z70$?fJVrG=FG9M@D!~RxdH5+*(JT%lo8E=cq#+CC%=5Ta*N#O_$pzODeF62K@N*(V z>j2YY{CdO=9>eMdRav1<_gLuw%rWcrT-p6aPE%x60LTRi(Q;0Wl1VM5_CojajvLa9 zSUya3Q?NVfYN!@n&~zA|I(Y?zbbW{<^C(p+JnirE*OW1`$g&e3*q47y=fEtw8?-vO z=w*hI+Et_L3mXC2Jnyg`|xD|VYa3) zPhX|?3L3K6h(tZI6!{XrphK@7b0?tNDagndJ7U8ff>Y&KN#)u8XUZQZ5zhK2ibJQzLmu_)KmrptEhMYa1@Q*OuEQf3qnRxH!! zuL*Mcc*QoKz4AKb{boVONcp+_p{r)qqIi9kSjocutVQXN&xm|G%;DtY0+xc5%-mFV;?Yf8_kQ)qR^Z@iXobcXM&&Uxo#Kz z;@iN&9`h>r2=b0DvwZOg6`UYEY;l(F$>NQyPTX@i>(cKLi7&h`xm-Jl>V7S8!B407b4I&o zB&w%Kyq3JPZ3GmSF%Es~mXbP%2H_RSB{NWC8nD_dBi(TL(~C1My(hqV@I_B>+HtQX zzA=QGgI1zAOUnW}n9%*nJ8w->Y}#H$lNIk?R6=GkEhZCdNs?Lv-jZB4O#GG#s+7!VoEf86e1-ilQ%qhny=SPfm|xhX&VCt7>iQ#k zt9Hx-(agp2hkaQ7YQobiw|D#=Tk=}51v!g?CiwsGM3l=}_ez@bUe~@8DQdxu721iz znRn-QdLz%(V?LPw%}$*^dS~J`;)~`V{B2Hjg_yJ9Njqq7-32>%IklXrGq|Kt$%LPT z{xs+`Kqfe}lVW~=lrVZnPcE9@N5lo@m5qf8TM*gS)opdAb8~(aP$N==TqU-24Io{h z&I3YM)M?UM?q6`Rk`R7${>zU|j6W2Nysgx8@7m8swrHO&-yrPW15Ye(mfAK2wWG z25I@-rR@EoR~|rX81>v=t2mOuN>Fkrq$@qDM}t7+=qbg1(Q*P?EGOix{I&BzLoMXJ zp%z`z!;r)iHeaQbvTZxe!0Jtu{{bUno91i*22yB+@gGuYqE-AksYH1os_9{HKSxS^ zOiRCya>287U#mI;t|9Nq6!p|S zZ&o&%Tr{q>UMT!MQ{t(6TH10AxkqJ`XtgmPf?9g)nkbbsdQ)dwnCMZeF3%2Lsw^R+@evcZF!QP`7*B8%1Gidh`T zHaQ18_waKp!V>%EL>k^np9XCevJ)DP)7RF}3Y1I}E@Ero;u@U3{L2iy`jBondvg63q#=KeRPYx0(>T#~|M$bM zi1%Ck4;O(SRhcbc{XCDb8PPlZqCl7vfz>zyRk!)>xYF2A)5tc-!^tPY)Fg?&A~eA{ zqp_`xMZ$4;xS_}36;IiejJ%jhycDYXrB|~|cy+aZaIi(+bg|vh_IX(-sBclIDvrpFiKOYMzc)8_A%Qq`V6D zX~&sPa>*Jb_*v{lcD(joZze*h$>Z3B?2`O)BT=IKmD#;Wy_2TzV4Fo|ii87y=AVL3 zS%sA;y6zR6C${HN8|@3m|7dP(qBZD(hUJ#(MP@YWc$Ju6ZF2t$9%l- z)*G$i=9$0R`<9WHkJWp$Ee8eD#%~Oh{e&!rv#*jp^m{@`68Xc%n5_+6P~G39jloATQ(+Z)~Oc77(E_uysbwxHQ^+n5wjg?))Fl7t7M9+0=ECq?-5Vv7eS zU)eQiUe;ujrcQj>Cle26z?tha&|5wSC5%Ad^%67-mI}9f6Bv0@breN}gXnTz1+S4Y z@V?rY!|A3?${Wm_s^WK16#5yM?5COE_)K%i@ugNGMlkNd5_}#nAWi66q5m)s;XZQVNkTk+&81B9; z^Pb|1$li|HIZj&D#&ZOOW! zf%0@J0q5Fx%iv6PoT{fz9UR}(E?JR zy&Tl{xHkQ^waepipMe|zK>n{5})n9!bb+8)OnDx8idH*0(meoV~@ zs>@4JhDNLGd=z|IU(sCPK;y#dXy#Y^_?Cbe!keX}y3CH*0z@COL2HlBU?dOlFAyhS zLF-iPKz~={>|I{&KvSFI^e+V8R;zT5(i*}%ha;VdXUqsZnke*Oj6aYgljz{8($Mec z3?5m}ZHRlT+RZxV+l+6v;0_SblWr455dEy_T@F&iR|0F`@?_DC6=Y%CmHks~{_S|?nGGgvw@;f1R_jJ`%2&}%-k{9SGU1Si@wn1Q3i zeQ7N1Zs_U7?}T@9?_h=0RiQs^`(c7LWw%$ety~gGh`Xd!63}97zE5J#ad+vciAI=& z_Z}UDlaTXh(LB3|$%1X2BbO;7Ijk0BqC{^A6x}>Kl|51y`lc_Dv9HcgbGOk@4b|O zRVVD!4g>6wiOTywPH1AUxGydI;&TE_b zquTH<1w8(nBpTy#T;?X9zG0~IQ&wZs;H=;j#hZ?Cgj^r@6{K$u=2jys>CNc5U>(Jj8Ht;q{c*F|{445K#UmUSO3+RU`>31r%H!QkoOlSSFG- zQ88d+7j;mCD=F8K!-278H)7v;r=-KU@lDL)e(YYjk#^X)NhJ1@<@iNP`Kr6AN7#lz zaW4##C-mbYgvn|AkgL`lm%+s(5J^w%F%@iy(DW>#2q{`Spz zY|L!xCvbX~DdW8nDi>3f)emZb>dpExX5vqX>6{^3UDzj(H99Z>iT8!hJKOBx z9o)x!E|~d@?{OZCsukwd8`4W$K*9V+EreU9`B&k>Y=4IDj6{Z#!xy}h;l=;~{meSa zrx8=%u%vlEXatMCU~B*f>D_lzY>WN1i^)b5jwtwkBslUpHsnRaPvdV9s=|4-+2~ z_Q9j+a&|$@Y0`T)kn2VnN?R6$>b^s|L8~q-T;1Bk`R_4OMyg6^*%W2{e+)x{E7OYeKpz}>t`=db$_16Tp8<~ z&Y?}0Puzqx%24H%cFa6q3w4iF?X{%Np`HJN%;w z@TzZ3s*|u_-YL>u$}=aoj!H8KFE|10NE(jQib)(Wi5Pe+(DCmQe8YXepu(^T*<+TQ zy|r?63mZLSG0RG!?r4_)=@sHNn=n9byU}5C>9F(F>c{Ajmkb5+@GZ%M@Hs+cg0Nl{ zV#94;miec%Ej=M4^fvW0ob&rZfPrPg*?a1xeMm&>uo!uCmPz?&ufe85=~_#&UIUH- z;hf|^WTN!DnaA+Q-MX|caVonkaO~Ex0}MVj3w5&OdHX1roD}o;yk=&7SKDqnBuG z_rIq=o1H~4Y`V*$LjnV3MLN;!FmB#tIS%nKG)IO96dLf1*^;2CM5WFrQ>9PpZ?aRE zdtQYV7@2j|Hf;4o7Uq_~xT~D<=xU2#)$@$ziFnnpyyrceQz84O4dXSm6Sz2r#iDlGeLpt7hZG&BHW(UN=6MQUo0@Ox4`# z3xdAiZGX@s;#qy&7oAZa-89JzaZ(zK<}a*7StXSxX5pZBo+HEo)rk+eEeKxKWxz;gZ=TU3T}rSy~V;dF6Mi>?9hqmTjb zN(}1ai{jOQ@*{R_pxc|yn(yP(LR-M9%|v6F4pmwmi~^GKx9FkopYoS zJ-x=KYb#DV^Mk}(xDWc?k#f6k1W}gre$v{h+beyQbCWR8Rlw;jE#a&#Lt+wprh+#ATLKsbp9ott??`u$x?I+0Ge5`f0U*=~dpIMLE@nXVi1#`-`?Z+7g_%rQOa_E~KA^30f zrT{m%k!B*W`BSF@Z_*Lu4(6Y&bDd1P9EdG9ejhUy>o%>zS7yR7t8{$)&Cry7XM)lV zDgS1=iVaq$xXc-_?jS1e=_3aYf{*$$%x@@WP=JPdi#-)GEHj2lcom|UtdqQogS?7K zJQafUlsX}eNrwuAtMDkWj5XDV-Pa!qwuFwVCzHe+4j z#Q%6~liXqqf&;5QqR8u{6CXRcfv2)X)56VYz%@w`K0G_Ww5~KepPjJ^vB4LqJBZl$ zmM)MNY_TnHxr#4jZ4l#OR%%Eg<`XVUba`ViDA!W141v8vNs@43z;!|S_P~z)l%-Sn z1ezNj#t#}W$vmK19u^L9CF%_XUuKhBP&$UddK zprX4IJ%mra9tp=z8u#0Oy$|}x(D>!~H_xAj}d6R4TujtYxycd63l@P55-G0qMc7VVCPiX~NUvnVW-0l~>v#o==q2 z@-;oux1#p!pN=IrNv7Qs^0j6x%VMU<>^Zw9IzQLWjdilZF<(U= z`Y1w@rRjuZ<%h?^L%|pXIyw4;vTI50rx0qLTP#B=wJyRLt2L@|$?0|v-q5KVmy&EV zrv&&Ct~*pBiyXx>{Ig7=sg2yhho7xB9+NJZHtv|oc0e_QA14q}Yhgb5&h?!}I@A2G zeNi=&w{U;H9KA(|-o~)@nSf_S@tyoZ8X;toXSR#bCC{+5$vOgmVtrg*;b@)F*bVwE znQro>0vMbE6XGjW6T~eAN7N1##U1KRGE{9vZV`R=;6b9fo?B1O$$ys0XB$zZU79X; z&${Ywb2Wv{VPNuceKCNR52NnsbX@LPi}Ay(#kE8 ztV~Rl?IE+!!d+yY36+M<0YO2ijgQVkhLXkdnOep}*Q*xl8Ns^!*{uAmdY2A|+Cy*a+$7x8~goUt>&G!J0mLP9*J(&%*L(_8u5}M+t#APRIOk=Y(l-RP1JZene)wpb?5UCp~!zy<}cSH}q#HxHJ9S!cD zDW20IC$yky{GjXgL`oPLbt?9@+@SyH{lEd%FAnd6yB2SJoFbzj%p76hJmeo1{&wXZs9E&o4KNz#jS1{Or28^;mn3!bC)GeBY zmYsuz?V;RALKtdq2JCGn&xUHU^me6Yf*f84e*E}F5aa!Blhq^M{r#F;Yf(qH zWnFO-mwE;{C4#CXRXCpyL?pv7lB{aEE%adsz5Cou;ZmA3!73Cp-V;l~UB_N|$mV;O zCWezjf(u{rB%ffHD#hkU(o?H6?hNr~*c@{y9qd=hURU?~f8I7`>qvv)P~XV_1>*b4 zM;BI7%G%9`7kWyWi`=?GF57nK-uSti;5sAMowi?_-JG-(v?9bFN`2rk7E?*AwAYEN z7B&7rZIDY0*d&NPwN!S0jnAXih1DG5{ZAlj6UO8`qEKjN@*QDBv zd^`kJZ={qABC6Bu17@Z4u<&TupJ0;ReDwKRb(cn=X$B|D?dG;*z&1X@<;)``>;-f3 z4FOEtU5UFcZT^7+*cG3IN8_|2f;V0cWp6O;3w+~y+m%eJ)7zvBEi)KCGH^)?9b9&b zTrSYNo>4NF)eAG^9QKQ&D-{Ue#+QA`K>~-ONK!%)Dlg%pLV<_>eAM!*xHM< zhF11rQ?&U+ABt82^a(<6Zx;Bauf8SpPvca(;a*SFy-z2i7P0e72#s-DuC=+|!iQnEN};t0 zvC2K$c^!BNoG=_w%_?QF=|$xTo>r~+;(Gw0PJKK9?zveiiFnR=P83(;3=6ps9CMvHD_3{t}A(NHV5$MskZj&`@vr^#l10ir4|tg2WGBP7_Pt6{=!`EiQ@L zdx>_ZHrQUJ)X(y@Oe-$lU2C|X0HTYMv;JTh7gZR8HeCS&Fa>g@`R55(|&_oC%2xlmv-dDi^KAEzJ6;To>cAR$#rmk5~#&x7Xsf% zHn$9}3cHU{NtQdM&iR5n2CX#w)xGsf(`DWl+zh`1KUb&oUNlwYCHBnO1)0v3vs7z^ z%l9x^zM{sGV9&J;JKQCbC(76!$Tj;!cQX&CvAl+9?pBG1qWu<=V-$^`Cr=Y*V?)4-}?Ds@5=5II0t-IyI6wP+I@91jgZovCJu;~X z>j6|6TSMQ>FK77+;CguD{8l7>b;%&_r2zINc4`>oQP%^<2A4ev21XiWt!tPKcw+r7 ztv7+YBO{`F9&1HuVIpIDMyLKsj>xL?>s0trtyRd(9cAv8ZgFo~nz|b7Df&YL-IXkn zSVle#*84B?;#+V<_S-4QCN(j-CXixY>tZ`z~Mop$C1q_?+X}|8A-x_~layIuV zjCg7}<7$5M{nr+2ilF1)5PAxuy55htv;5~4g3_(pVjlY+X_fGaKYm4WYZ9Dzos?7CPAG<(j;S`2{NpsJ% zpLwX4D%FoJ)rF_$kALu9hF;NhwJFIQF51KT1uU*|YC za*yOV16*8S#S8+m5t`!R!XKNf%{#EdF~_Id@Z&gQh`&FOrcOaMp!!`)*B^oXwP_C; zbmEr=dSzms+vnYHlvpkvgv1{x5&Sp`ykWmm5zp07^xCRDV`)#r<<{$+Xtdd|5qL-J z&WDG!`1^MvZo8)_ReK}C8iq>)t{ilpQjge1SoL(0)pmbLUpqqk+!WMGbfZ+abo%R7 z(buduuixbn*ShxSpT`+!l!R)WRavqne7oVKnm|n5{?H_+{s<=;>gduPMBdw4U0}JA zFw2rrZZ6TCuH@$KAd4}^n%(O-4{+C8Vqj&giaW5CsP11{r5`$O6K z-4eGs-6wBT+xsSZQ;{@}?2GMzs@e6jRf6b7AN^XP=KzxuL3z`M?zZx&a8l$iqlHoz zBl%w<@fT&jJP%lr2wl5Z5m?_L&y}s6u5`RsmFq4x&hOPW(l(7*txc=1a_`JX=8gsF zNdIf;cB)(a8CrSdH|X&p5^WZvPoq4zR-^`;hUB@LG&J*6)4?4kauVm~DWAP+RSphQ z((lkgdRnz5A@E{2N86di6XA2A>74lkqCNfO=TAHx|Dw&y&r_Xqiz|(6-^%URknQ_w z`%~ld@!0as$m88E3SRUxd9k^%7Tkl^KhRGOkIF8a-aB(>!!Sy*U|j8*pU3@SV|(ND zSQlEUUcp*F+`YEtgDre^OiJ$3IZs>Kb#drPmu#OC(#9S-H9uGFTb@Dbn*iC7(*Sn7 zNkDFt=!f2~_e&k)>PtCSI~Q-ijg8BhZ)nveAbW~V-tbyeoFnAvdAW1!hWm2XS+Q>e zK{QvZ&1FgdojHVM-(dm=k4Uh|T=ojPq5Xt&ULv|R4#P!(GdGWjbm*+Xoeweo?+9-R zP1%Tj(^&DkJVhTY#}Y8IHvDt3Ado{{Mu@tC5cQvvkCz*Y^9RWF&rOBuuC_*CWrT?l zSkcJP3?XKN1U-iU#oYYdAU-ZmT^z8gjU#YxAqWCs*&A6qf?%ji4FRx`gN>8Dfsq4n z-J!C*je(kx<8v@@AtDH@ZiI9M=%j1_WWH-;;JQPwIPei5cL1TTNmRuFK!1cm@%w#k zB0vgA1G*N+0R)yeGjsqw$3Y3JilYkxI5+_uq5nb({hRa;r8vS7VQFLX7mGilDjGQ= z41p35|9@1ClJ0laU{zimUR3Ena-lx{DHKCE7@=MVEMsKpY~*NWfVi&j`W11&YEJr& zs8&P?5B-N8RoNf<>qh=dihl^S6czruDH6)f4HFjr({*qWq%Fe0!pIS%Z)9R-EyVP_ zzL^PRW+=p@$*l-cv=uipHIs3(H&SzZqHf@3VZd+5BqEFh7eN3$Zp4m6*s>d6UpeUj zGIB5wx+kuxAaxIgfD}Ml*;)aO0YX|?T000Jg_y2M1b{pW3}ymdqc~a!F=;6(gB)#a zEG^6&L7W`?98h*Bj16RLkFYXwv9Y%RK{Cefd8sU0(c#JGh0V98*31%VuZeplcNxmlaraD0H3iwub}}v9`=kcN@H1FAQn9NZkx-?jcJy2kwf-ew3}MaBPh zt65p0v;u`EAYo(RWCfToS&9FfF$ex{?q@@TzXi5+vbVfeFhc{dk);tzHV2@qp@77O z1_H)5_Erc$JrK6GmVm`VX$@+~0%IE}bTo6cG!nj6Ur|fP-x*6YlsXDnBCJh>n2_v- zM#cyyOGhSQLwo28Qw|3M)8E};X(s$Tb4>{ThZ&GFK#dR^```T3jO_kmENt%JWZ|Tb z_zw=(7$^>Z(*b$If3*C6=7Z8Jlpg&p#NRCbjqJbBwQCSys(|hQ|7{3`aX|k~&wn4I zf2=<+K?*Usplmyk`}b*`^PkD(FDu3TUsBO7F}Q~PC5Dat zztJnB3MEj96e*QEoA94S4AS1n z7zYA^LT~`|KM#lpnAEvJ#-QIYPJReCu% literal 0 HcmV?d00001 diff --git a/sys/pic32/Makefile b/sys/pic32/Makefile index e0f9f93..18049c8 100644 --- a/sys/pic32/Makefile +++ b/sys/pic32/Makefile @@ -1,11 +1,9 @@ # Programs that live in subdirectories, and have makefiles of their own. # -SUBDIR = baremetal duinomite duinomite-emega \ - explorer16 max32 maximite \ - meb starter-kit sdxl ubw32 ubw32-uart \ - ubw32-uart-sdram baremetal fubarino mmb-mx7 maximite-color \ - 32mxsdram-uart picadillo wf32 pinguino-micro +SUBDIR = baremetal duinomite duinomite-emega explorer16 \ + fubarino max32 maximite maximite-color meb mmb-mx7 \ + picadillo pinguino-micro sdxl starter-kit ubw32 wf32 default: diff --git a/sys/pic32/picadillo/Makefile b/sys/pic32/picadillo/Makefile-old similarity index 100% rename from sys/pic32/picadillo/Makefile rename to sys/pic32/picadillo/Makefile-old diff --git a/sys/pic32/picadillo_rambo/Makefile b/sys/pic32/picadillo/Makefile-rambo-old similarity index 77% rename from sys/pic32/picadillo_rambo/Makefile rename to sys/pic32/picadillo/Makefile-rambo-old index a37cfa6..17c6479 100644 --- a/sys/pic32/picadillo_rambo/Makefile +++ b/sys/pic32/picadillo/Makefile-rambo-old @@ -18,30 +18,6 @@ DEFS += -DCPU_KHZ=80000 DEFS += -DCPU_MUL=20 DEFS += -DCPU_ODIV=1 DEFS += -DCRYSTAL=8 -DEFS += -DDC0_DEBUG=DEVCFG0_DEBUG_DISABLED -DEFS += -DDC0_ICE=0 -DEFS += -DDC1_CKM=0 -DEFS += -DDC1_CKS=0 -DEFS += -DDC1_FNOSC=DEVCFG1_FNOSC_PRIPLL -DEFS += -DDC1_IESO=DEVCFG1_IESO -DEFS += -DDC1_OSCIOFNC=0 -DEFS += -DDC1_PBDIV=DEVCFG1_FPBDIV_1 -DEFS += -DDC1_POSCMOD=DEVCFG1_POSCMOD_HS -DEFS += -DDC1_SOSC=0 -DEFS += -DDC1_WDTEN=0 -DEFS += -DDC1_WDTPS=DEVCFG1_WDTPS_1 -DEFS += -DDC2_PLLIDIV=DEVCFG2_FPLLIDIV_2 -DEFS += -DDC2_PLLMUL=DEVCFG2_FPLLMUL_20 -DEFS += -DDC2_PLLODIV=DEVCFG2_FPLLODIV_1 -DEFS += -DDC2_UPLL=0 -DEFS += -DDC2_UPLLIDIV=DEVCFG2_UPLLIDIV_2 -DEFS += -DDC3_CAN=DEVCFG3_FCANIO -DEFS += -DDC3_ETH=DEVCFG3_FETHIO -DEFS += -DDC3_MII=DEVCFG3_FMIIEN -DEFS += -DDC3_SRS=DEVCFG3_FSRSSEL_7 -DEFS += -DDC3_USBID=DEVCFG3_FUSBIDIO -DEFS += -DDC3_USERID=0xffff -DEFS += -DDC3_VBUSON=DEVCFG3_FVBUSONIO DEFS += -DEXEC_AOUT DEFS += -DEXEC_ELF DEFS += -DEXEC_SCRIPT @@ -96,7 +72,7 @@ DEFS += -DUCB_METER LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-max32.ld -CONFIG = PICADILLO_RAMBO +CONFIG = PICADILLO-RAMBO CONFIGPATH = ../../../tools/configsys include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/picadillo/PICADILLO b/sys/pic32/picadillo/PICADILLO index 5fd32a7..e036a10 100644 --- a/sys/pic32/picadillo/PICADILLO +++ b/sys/pic32/picadillo/PICADILLO @@ -2,8 +2,8 @@ # Picadillo 35T board # =================== # -# Console on UART1 -# SD/MMC card driver on SPI2 +# Console on UART1. +# SD/MMC card driver on SPI2. core pic32mx7 mapping picadillo diff --git a/sys/pic32/picadillo_rambo/PICADILLO_RAMBO b/sys/pic32/picadillo/PICADILLO-RAMBO similarity index 86% rename from sys/pic32/picadillo_rambo/PICADILLO_RAMBO rename to sys/pic32/picadillo/PICADILLO-RAMBO index 9e8dd20..66ddc86 100644 --- a/sys/pic32/picadillo_rambo/PICADILLO_RAMBO +++ b/sys/pic32/picadillo/PICADILLO-RAMBO @@ -1,6 +1,10 @@ # # Picadillo 35T board # =================== +# +# Console on TFT display. +# SD/MMC card driver on SPI2. +# SPI RAM on SPI4. core pic32mx7 mapping picadillo diff --git a/sys/pic32/picadillo_rambo/.gitignore b/sys/pic32/picadillo_rambo/.gitignore deleted file mode 100644 index 6a22af6..0000000 --- a/sys/pic32/picadillo_rambo/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.compileversion -.deps/ -.oldversion -machine -sys -unix.bin -unix.map -usbboot.map -vers.c diff --git a/sys/pic32/retroone/Makefile b/sys/pic32/retroone/Makefile index c08ebdd..c97605e 100644 --- a/sys/pic32/retroone/Makefile +++ b/sys/pic32/retroone/Makefile @@ -9,7 +9,7 @@ vpath %.c $(M):$(S) vpath %.S $(M):$(S) # Kernel options. -DEFS += -I. -I$(H) -DKERNEL -DUCB_METER -DPIC32MX7 +DEFS += -I. -I$(H) -DKERNEL -DPIC32MX7 DEFS += -DGLOBAL_DEBUG # CPU frequency 80 MHz. @@ -38,13 +38,16 @@ ASFLAGS = $(DEFS) $(DEPFLAGS) include ../gcc-config.mk -CC = $(GCCPREFIX)gcc -EL -g -mips32r2 +CC = $(MIPS_GCC_PREFIX)gcc -EL -g -mips32r2 CC += -nostdinc -fno-builtin -Werror -Wall -fno-dwarf2-cfi-asm -LDFLAGS += -nostdlib -T ../cfg/bare.ld -Wl,-Map=unix.map -SIZE = $(GCCPREFIX)size -OBJDUMP = $(GCCPREFIX)objdump -OBJCOPY = $(GCCPREFIX)objcopy -MPIDE = /Applications/Mpide.app/Contents/Resources/Java/ +LDFLAGS = -nostdlib -T ../cfg/bare.ld -Wl,-Map=unix.map +SIZE = $(MIPS_GCC_PREFIX)size +OBJDUMP = $(MIPS_GCC_PREFIX)objdump +OBJCOPY = $(MIPS_GCC_PREFIX)objcopy + +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif # Machine-dependent files: # startup.o MUST be loaded first. @@ -60,6 +63,7 @@ KERNOBJ += init_main.o init_sysent.o kern_clock.o \ subr_log.o subr_prf.o subr_rmap.o \ sys_generic.o sys_inode.o syscalls.o \ sys_pipe.o sys_process.o tty.o exec_conf.o exec_subr.o \ + exec_aout.o exec_elf.o exec_script.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 \ @@ -76,20 +80,20 @@ KERNOBJ += vers.o devcfg.o -include Makefile.local # GPIO driver -KERNOBJ += gpio.o -DEFS += -DGPIO_ENABLED +KERNOBJ += gpio.o +DEFS += -DGPIO_ENABLED # ADC driver -KERNOBJ += adc.o -DEFS += -DADC_ENABLED +KERNOBJ += adc.o +DEFS += -DADC_ENABLED # GLCD driver -KERNOBJ += glcd.o -DEFS += -DGLCD_ENABLED +KERNOBJ += glcd.o +DEFS += -DGLCD_ENABLED # PWM driver -KERNOBJ += pwm.o -DEFS += -DPWM_ENABLED +KERNOBJ += pwm.o +DEFS += -DPWM_ENABLED all: .deps sys machine unix.elf $(SIZE) unix.elf diff --git a/sys/pic32/retroone/devcfg.c b/sys/pic32/retroone/devcfg.c index e17d102..a955010 100644 --- a/sys/pic32/retroone/devcfg.c +++ b/sys/pic32/retroone/devcfg.c @@ -23,3 +23,10 @@ PIC32_DEVCFG ( DEVCFG3_USERID(0xffff) | /* User-defined ID */ DEVCFG3_FSRSSEL_7 | /* Assign irq priority 7 to shadow set */ DEVCFG3_FETHIO); /* Default Ethernet i/o pins */ + +#include "sys/param.h" +#include "sys/conf.h" + +dev_t rootdev = makedev(0, 1); /* sd0a */ +dev_t dumpdev = makedev(0, 2); /* sd0b */ +dev_t swapdev = makedev(0, 2); /* sd0b */ diff --git a/sys/pic32/ubw32-uart-sdram/.gitignore b/sys/pic32/ubw32-uart-sdram/.gitignore deleted file mode 100644 index 6a22af6..0000000 --- a/sys/pic32/ubw32-uart-sdram/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.compileversion -.deps/ -.oldversion -machine -sys -unix.bin -unix.map -usbboot.map -vers.c diff --git a/sys/pic32/ubw32-uart-sdram/devcfg.c b/sys/pic32/ubw32-uart-sdram/devcfg.c deleted file mode 100644 index ad48c89..0000000 --- a/sys/pic32/ubw32-uart-sdram/devcfg.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Chip configuration. - */ -#include "machine/pic32mx.h" - -PIC32_DEVCFG ( - DEVCFG0_DEBUG_DISABLED, /* ICE debugger enabled */ - - DEVCFG1_FNOSC_PRIPLL | /* Primary oscillator with PLL */ - DEVCFG1_POSCMOD_HS | /* HS oscillator */ - DEVCFG1_FPBDIV_1 | /* Peripheral bus clock = SYSCLK/1 */ - DEVCFG1_IESO | /* Internal-external switch over */ - DEVCFG1_WDTPS_1, /* Watchdog postscale = 1/1 */ - - DEVCFG2_FPLLIDIV_2 | /* PLL divider = 1/2 */ - DEVCFG2_FPLLMUL_20 | /* PLL multiplier = 20x */ - DEVCFG2_UPLLIDIV_2 | /* USB PLL divider = 1/2 */ - DEVCFG2_FPLLODIV_1, /* PLL postscaler = 1/1 */ - - DEVCFG3_USERID(0xffff) | /* User-defined ID */ - DEVCFG3_FSRSSEL_7 | /* Assign irq priority 7 to shadow set */ - DEVCFG3_FUSBIDIO | /* USBID pin: controlled by USB */ - DEVCFG3_FVBUSONIO | /* VBuson pin: controlled by USB */ - DEVCFG3_FCANIO | /* Default CAN pins */ - DEVCFG3_FETHIO); /* Default Ethernet i/o pins */ diff --git a/sys/pic32/ubw32-uart/.gitignore b/sys/pic32/ubw32-uart/.gitignore deleted file mode 100644 index 6a22af6..0000000 --- a/sys/pic32/ubw32-uart/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.compileversion -.deps/ -.oldversion -machine -sys -unix.bin -unix.map -usbboot.map -vers.c diff --git a/sys/pic32/ubw32-uart/devcfg.c b/sys/pic32/ubw32-uart/devcfg.c deleted file mode 100644 index ad48c89..0000000 --- a/sys/pic32/ubw32-uart/devcfg.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Chip configuration. - */ -#include "machine/pic32mx.h" - -PIC32_DEVCFG ( - DEVCFG0_DEBUG_DISABLED, /* ICE debugger enabled */ - - DEVCFG1_FNOSC_PRIPLL | /* Primary oscillator with PLL */ - DEVCFG1_POSCMOD_HS | /* HS oscillator */ - DEVCFG1_FPBDIV_1 | /* Peripheral bus clock = SYSCLK/1 */ - DEVCFG1_IESO | /* Internal-external switch over */ - DEVCFG1_WDTPS_1, /* Watchdog postscale = 1/1 */ - - DEVCFG2_FPLLIDIV_2 | /* PLL divider = 1/2 */ - DEVCFG2_FPLLMUL_20 | /* PLL multiplier = 20x */ - DEVCFG2_UPLLIDIV_2 | /* USB PLL divider = 1/2 */ - DEVCFG2_FPLLODIV_1, /* PLL postscaler = 1/1 */ - - DEVCFG3_USERID(0xffff) | /* User-defined ID */ - DEVCFG3_FSRSSEL_7 | /* Assign irq priority 7 to shadow set */ - DEVCFG3_FUSBIDIO | /* USBID pin: controlled by USB */ - DEVCFG3_FVBUSONIO | /* VBuson pin: controlled by USB */ - DEVCFG3_FCANIO | /* Default CAN pins */ - DEVCFG3_FETHIO); /* Default Ethernet i/o pins */ diff --git a/sys/pic32/ubw32/Makefile b/sys/pic32/ubw32/Makefile-old similarity index 100% rename from sys/pic32/ubw32/Makefile rename to sys/pic32/ubw32/Makefile-old diff --git a/sys/pic32/ubw32-uart/Makefile b/sys/pic32/ubw32/Makefile-uart-old similarity index 100% rename from sys/pic32/ubw32-uart/Makefile rename to sys/pic32/ubw32/Makefile-uart-old diff --git a/sys/pic32/ubw32-uart-sdram/Makefile b/sys/pic32/ubw32/Makefile-uart-sdram-old similarity index 100% rename from sys/pic32/ubw32-uart-sdram/Makefile rename to sys/pic32/ubw32/Makefile-uart-sdram-old diff --git a/sys/pic32/ubw32-uart/UBW32-UART b/sys/pic32/ubw32/UBW32-UART similarity index 100% rename from sys/pic32/ubw32-uart/UBW32-UART rename to sys/pic32/ubw32/UBW32-UART diff --git a/sys/pic32/ubw32-uart-sdram/UBW32-UART-SDRAM b/sys/pic32/ubw32/UBW32-UART-SDRAM similarity index 100% rename from sys/pic32/ubw32-uart-sdram/UBW32-UART-SDRAM rename to sys/pic32/ubw32/UBW32-UART-SDRAM From 095e957995b42bb0e8310abe280254958fd399b4 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 18:10:05 -0700 Subject: [PATCH 12/32] Create kernel configuration for Picadillo board. --- sys/kernel/rdisk.c | 10 +- sys/pic32/picadillo/.gitignore | 3 + sys/pic32/picadillo/Config | 64 +++++ sys/pic32/picadillo/Config-rambo | 105 ++++++++ sys/pic32/picadillo/Makefile | 350 +++++++++++++++++++++++++ sys/pic32/picadillo/Makefile-old | 43 --- sys/pic32/picadillo/Makefile-rambo-old | 78 ------ 7 files changed, 527 insertions(+), 126 deletions(-) create mode 100644 sys/pic32/picadillo/Config create mode 100644 sys/pic32/picadillo/Config-rambo create mode 100644 sys/pic32/picadillo/Makefile delete mode 100644 sys/pic32/picadillo/Makefile-old delete mode 100644 sys/pic32/picadillo/Makefile-rambo-old diff --git a/sys/kernel/rdisk.c b/sys/kernel/rdisk.c index cb79890..dcede24 100644 --- a/sys/kernel/rdisk.c +++ b/sys/kernel/rdisk.c @@ -32,19 +32,19 @@ extern int sdopen(int unit, int flags, int mode); extern int sdsize(int unit); #ifdef SRAMC_ENABLED -#include +#include #endif #ifdef SDRAMP_ENABLED -#include +#include #endif #ifdef FLASH_ENABLED -#include +#include #endif #ifdef MRAMS_ENABLED -#include +#include #endif #ifdef SPIRAMS_ENABLED -#include +#include #endif int no_deinit(int u) { return 0; } diff --git a/sys/pic32/picadillo/.gitignore b/sys/pic32/picadillo/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/picadillo/.gitignore +++ b/sys/pic32/picadillo/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/picadillo/Config b/sys/pic32/picadillo/Config new file mode 100644 index 0000000..4e4ed68 --- /dev/null +++ b/sys/pic32/picadillo/Config @@ -0,0 +1,64 @@ +# +# 4D Systems Picadillo-35T board +# ============================== +# Console on USB UART port. +# For details, see http://www.4dsystems.com.au/product/Picadillo_35T/ +# +# To build the kernel, use: +# cd sys/pic32/picadillo +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "PICADILLO_35T" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-max32.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# 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 +options "UART1_ENABLED" # TODO: delete this option + +# Console options +options "CONSOLE_DEVICE=tty0" # /dev/tty0 + +# SPI ports +controller spi2 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi2 flags 0x79 # select pin RG9 +options "SD0_MHZ=10" # speed 10 MHz +options "SD0_PORT=2" # at spi2 TODO: delete +options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags +options "SD0_CS_PIN=9" # ...use pin RG9 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 + +# HX8357 TFT display driver +device hxtft0 +options "HX8357_ENABLED" # TODO: delete this option diff --git a/sys/pic32/picadillo/Config-rambo b/sys/pic32/picadillo/Config-rambo new file mode 100644 index 0000000..65331e0 --- /dev/null +++ b/sys/pic32/picadillo/Config-rambo @@ -0,0 +1,105 @@ +# +# 4D Systems Picadillo-35T board with SPI RAM disk +# ================================================ +# Console on TFT display. +# For details, see http://www.4dsystems.com.au/product/Picadillo_35T/ +# +# To build the kernel, use: +# cd sys/pic32/picadillo +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "PICADILLO_35T" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-max32.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# 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 +options "UART1_ENABLED" # TODO: delete this option + +# Console options +options "CONSOLE_DEVICE=tft0" # LCD screen + +# SPI ports +controller spi2 # SD card +controller spi4 # RAM disk: spirams +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi2 flags 0x79 # select pin RG9 +options "SD0_MHZ=10" # speed 10 MHz +options "SD0_PORT=2" # at spi2 TODO: delete +options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags +options "SD0_CS_PIN=9" # ...use pin RG9 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 + +# HX8357 TFT display driver +device hxtft0 +options "HX8357_ENABLED" # TODO: delete this option + +# spirams - SPI block device +disk spirams0 at spi4 +options "PARTITION='spirams0:sa@2040'" # Partition schema +options "SPIRAMS_ENABLED" # TODO: delete this option +options "SPIRAMS_PORT=SPI4CON" # TODO: delete this option +options "SPIRAMS_CHIPSIZE=128" # chip size in kbytes +options "SPIRAMS_CHIPS=16" # number of chips +options "SPIRAMS_CS0_PORT=TRISA" # for CS0... +options "SPIRAMS_CS0_PIN=0" # ...use pin RA0 +options "SPIRAMS_CS1_PORT=TRISA" # for CS1... +options "SPIRAMS_CS1_PIN=1" # ...use pin RA1 +options "SPIRAMS_CS2_PORT=TRISA" # for CS2... +options "SPIRAMS_CS2_PIN=4" # ...use pin RA4 +options "SPIRAMS_CS3_PORT=TRISA" # for CS3... +options "SPIRAMS_CS3_PIN=5" # ...use pin RA5 +options "SPIRAMS_CS4_PORT=TRISA" # for CS4... +options "SPIRAMS_CS4_PIN=2" # ...use pin RA2 +options "SPIRAMS_CS5_PORT=TRISD" # for CS5... +options "SPIRAMS_CS5_PIN=1" # ...use pin RD1 +options "SPIRAMS_CS6_PORT=TRISD" # for CS6... +options "SPIRAMS_CS6_PIN=2" # ...use pin RD2 +options "SPIRAMS_CS7_PORT=TRISB" # for CS7... +options "SPIRAMS_CS7_PIN=14" # ...use pin RB14 +options "SPIRAMS_CS8_PORT=TRISD" # for CS8... +options "SPIRAMS_CS8_PIN=14" # ...use pin RFD14 +options "SPIRAMS_CS9_PORT=TRISD" # for CS9... +options "SPIRAMS_CS9_PIN=8" # ...use pin RD8 +options "SPIRAMS_CS10_PORT=TRISA" # for CS10... +options "SPIRAMS_CS10_PIN=6" # ...use pin RA6 +options "SPIRAMS_CS11_PORT=TRISA" # for CS11... +options "SPIRAMS_CS11_PIN=7" # ...use pin RA7 +options "SPIRAMS_CS12_PORT=TRISG" # for CS12... +options "SPIRAMS_CS12_PIN=14" # ...use pin RG14 +options "SPIRAMS_CS13_PORT=TRISG" # for CS13... +options "SPIRAMS_CS13_PIN=12" # ...use pin RG12 +options "SPIRAMS_CS14_PORT=TRISG" # for CS14... +options "SPIRAMS_CS14_PIN=13" # ...use pin RG13 +options "SPIRAMS_CS15_PORT=TRISF" # for CS15... +options "SPIRAMS_CS15_PIN=5" # ...use pin RF5 diff --git a/sys/pic32/picadillo/Makefile b/sys/pic32/picadillo/Makefile new file mode 100644 index 0000000..1f9fd3e --- /dev/null +++ b/sys/pic32/picadillo/Makefile @@ -0,0 +1,350 @@ +PARAM = -DPICADILLO_35T +PARAM += -DPIC32MX7 +PARAM += -DHX8357_ENABLED +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=9 +PARAM += -DSD0_CS_PORT=TRISG +PARAM += -DSD0_PORT=2 +PARAM += -DSD0_MHZ=10 +PARAM += -DSPI_ENABLED +PARAM += -DCONSOLE_DEVICE=tty0 +PARAM += -DUART1_ENABLED +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DHZ=100 +LDSCRIPT = "cfg/bootloader-max32.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk + +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 ../${LDSCRIPT} -Wl,-Map=unix.map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump + +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif + +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o hx8357.o machdep.o \ + mem.o pwm.o rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o \ + uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/hx8357.c $S/pic32/machdep.c \ + $S/pic32/mem.c $S/pic32/pwm.c $S/pic32/rd_sd.c $S/pic32/signal.c \ + $S/pic32/spi.c $S/pic32/spi_bus.c $S/pic32/swap.c \ + $S/pic32/sysctl.c $S/pic32/uart.c swapunix.c + +# 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 ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ + $(OBJDUMP) -d -S unix.elf > unix.dis + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix.elf + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin + +clean-all: clean + rm -f *.h *.c machine sys + +reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +hx8357.o: $S/pic32/hx8357.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +uart.o: $S/pic32/uart.c + ${COMPILE_C} + + +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/picadillo/Makefile-old b/sys/pic32/picadillo/Makefile-old deleted file mode 100644 index 956047a..0000000 --- a/sys/pic32/picadillo/Makefile-old +++ /dev/null @@ -1,43 +0,0 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel - -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) - -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 hx8357.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 pwm.o rd_sd.o rdisk.o signal.o spi.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 uart.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 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=tty0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DHX8357_ENABLED -DEFS += -DKERNEL -DEFS += -DPIC32MX7 -DEFS += -DPWM_ENABLED=YES -DEFS += -DSD0_CS_PIN=9 -DEFS += -DSD0_CS_PORT=TRISG -DEFS += -DSD0_PORT=2 -DEFS += -DSPI_ENABLED=YES -DEFS += -DUART1_BAUD=115200 -DEFS += -DUART1_ENABLED=YES -DEFS += -DUCB_METER - - -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-max32.ld - -CONFIG = PICADILLO -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/picadillo/Makefile-rambo-old b/sys/pic32/picadillo/Makefile-rambo-old deleted file mode 100644 index 17c6479..0000000 --- a/sys/pic32/picadillo/Makefile-rambo-old +++ /dev/null @@ -1,78 +0,0 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel - -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) - -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 hx8357.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 rd_spirams.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 uart.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 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=tft0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DHX8357_ENABLED -DEFS += -DKERNEL -DEFS += -DPARTITION="spirams0:sa@2040" -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=9 -DEFS += -DSD0_CS_PORT=TRISG -DEFS += -DSD0_PORT=2 -DEFS += -DSPIRAMS_CHIPS=16 -DEFS += -DSPIRAMS_CHIPSIZE=128 -DEFS += -DSPIRAMS_CS0_PIN=0 -DEFS += -DSPIRAMS_CS0_PORT=TRISA -DEFS += -DSPIRAMS_CS10_PIN=6 -DEFS += -DSPIRAMS_CS10_PORT=TRISA -DEFS += -DSPIRAMS_CS11_PIN=7 -DEFS += -DSPIRAMS_CS11_PORT=TRISA -DEFS += -DSPIRAMS_CS12_PIN=14 -DEFS += -DSPIRAMS_CS12_PORT=TRISG -DEFS += -DSPIRAMS_CS13_PIN=12 -DEFS += -DSPIRAMS_CS13_PORT=TRISG -DEFS += -DSPIRAMS_CS14_PIN=13 -DEFS += -DSPIRAMS_CS14_PORT=TRISG -DEFS += -DSPIRAMS_CS15_PIN=5 -DEFS += -DSPIRAMS_CS15_PORT=TRISF -DEFS += -DSPIRAMS_CS1_PIN=1 -DEFS += -DSPIRAMS_CS1_PORT=TRISA -DEFS += -DSPIRAMS_CS2_PIN=4 -DEFS += -DSPIRAMS_CS2_PORT=TRISA -DEFS += -DSPIRAMS_CS3_PIN=5 -DEFS += -DSPIRAMS_CS3_PORT=TRISA -DEFS += -DSPIRAMS_CS4_PIN=2 -DEFS += -DSPIRAMS_CS4_PORT=TRISA -DEFS += -DSPIRAMS_CS5_PIN=1 -DEFS += -DSPIRAMS_CS5_PORT=TRISD -DEFS += -DSPIRAMS_CS6_PIN=2 -DEFS += -DSPIRAMS_CS6_PORT=TRISD -DEFS += -DSPIRAMS_CS7_PIN=14 -DEFS += -DSPIRAMS_CS7_PORT=TRISB -DEFS += -DSPIRAMS_CS8_PIN=14 -DEFS += -DSPIRAMS_CS8_PORT=TRISD -DEFS += -DSPIRAMS_CS9_PIN=8 -DEFS += -DSPIRAMS_CS9_PORT=TRISD -DEFS += -DSPIRAMS_ENABLED -DEFS += -DSPIRAMS_PORT=4 -DEFS += -DUART1_BAUD=115200 -DEFS += -DUART1_ENABLED=YES -DEFS += -DUCB_METER - - -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-max32.ld - -CONFIG = PICADILLO-RAMBO -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk From d1eb7c79c20374bbbe65f7eaa2afc1e5db7f4dbe Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 18:47:59 -0700 Subject: [PATCH 13/32] New kernel configurations for UBW32 board. --- sys/pic32/Makefile | 7 +- sys/pic32/Makefile.kconf | 4 +- sys/pic32/duinomite-emega/Config | 2 +- sys/pic32/duinomite-emega/Config-uart | 4 +- sys/pic32/duinomite-emega/Makefile | 4 +- sys/pic32/duinomite/Config-uart | 2 +- sys/pic32/duinomite/Makefile | 4 +- sys/pic32/max32/Makefile | 4 +- sys/pic32/picadillo/Config-rambo | 2 +- sys/pic32/picadillo/Makefile | 4 +- sys/pic32/ubw32/.gitignore | 3 + sys/pic32/ubw32/Config | 80 +++++ sys/pic32/ubw32/Config-uart | 77 +++++ sys/pic32/ubw32/Makefile | 369 ++++++++++++++++++++++++ sys/pic32/ubw32/Makefile-old | 55 ---- sys/pic32/ubw32/Makefile-uart-old | 53 ---- sys/pic32/ubw32/Makefile-uart-sdram-old | 52 ---- sys/pic32/ubw32/UBW32-UART-SDRAM | 18 -- sys/pic32/ubw32/devcfg.c | 25 -- sys/pic32/wf32/Makefile | 4 +- 20 files changed, 551 insertions(+), 222 deletions(-) create mode 100644 sys/pic32/ubw32/Config create mode 100644 sys/pic32/ubw32/Config-uart create mode 100644 sys/pic32/ubw32/Makefile delete mode 100644 sys/pic32/ubw32/Makefile-old delete mode 100644 sys/pic32/ubw32/Makefile-uart-old delete mode 100644 sys/pic32/ubw32/Makefile-uart-sdram-old delete mode 100644 sys/pic32/ubw32/UBW32-UART-SDRAM delete mode 100644 sys/pic32/ubw32/devcfg.c diff --git a/sys/pic32/Makefile b/sys/pic32/Makefile index 18049c8..1ee6825 100644 --- a/sys/pic32/Makefile +++ b/sys/pic32/Makefile @@ -14,9 +14,12 @@ install: clean: -for i in $(SUBDIR); do ${MAKE} -C $$i clean; done - find .. -name \*~ | xargs rm -f reconfig: + -for i in $(SUBDIR); do ${MAKE} -C $$i reconfig; done + +configsys: -for i in $(SUBDIR); do echo $$i; \ I=`echo $$i | awk '{print toupper($$0)}'`; \ - (cd $$i; ../../../tools/configsys/config $$I); done + if [ ! -f $$i/Config ]; then \ + (cd $$i; ../../../tools/configsys/config $$I); fi; done diff --git a/sys/pic32/Makefile.kconf b/sys/pic32/Makefile.kconf index a3c9388..6cac4fe 100644 --- a/sys/pic32/Makefile.kconf +++ b/sys/pic32/Makefile.kconf @@ -56,10 +56,10 @@ SYSTEM_LD_TAIL = ${SIZE} unix.elf; \ %LOAD clean: - rm -rf .deps *.elf *.o *.map *.dis *.bin + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h *.c machine sys + rm -f *.h ioconf.c swapunix.c vers.c reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config diff --git a/sys/pic32/duinomite-emega/Config b/sys/pic32/duinomite-emega/Config index 0f7cd34..4a76473 100644 --- a/sys/pic32/duinomite-emega/Config +++ b/sys/pic32/duinomite-emega/Config @@ -6,7 +6,7 @@ # For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Olimex-Duinomite # # To build the kernel, use: -# cd sys/pic32/duinomite-e +# cd sys/pic32/duinomite-emega # kconfig Config # make clean # make diff --git a/sys/pic32/duinomite-emega/Config-uart b/sys/pic32/duinomite-emega/Config-uart index 34a1709..cee16b2 100644 --- a/sys/pic32/duinomite-emega/Config-uart +++ b/sys/pic32/duinomite-emega/Config-uart @@ -6,8 +6,8 @@ # For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Olimex-Duinomite # # To build the kernel, use: -# cd sys/pic32/duinomite-e -# kconfig Config +# cd sys/pic32/duinomite-emega +# kconfig Config-uart # make clean # make # diff --git a/sys/pic32/duinomite-emega/Makefile b/sys/pic32/duinomite-emega/Makefile index 02006c2..71cac18 100644 --- a/sys/pic32/duinomite-emega/Makefile +++ b/sys/pic32/duinomite-emega/Makefile @@ -126,10 +126,10 @@ swapunix.o: swapunix.c all: unix.elf clean: - rm -rf .deps *.elf *.o *.map *.dis *.bin + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h *.c machine sys + rm -f *.h ioconf.c swapunix.c vers.c reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config diff --git a/sys/pic32/duinomite/Config-uart b/sys/pic32/duinomite/Config-uart index f1f3848..0940452 100644 --- a/sys/pic32/duinomite/Config-uart +++ b/sys/pic32/duinomite/Config-uart @@ -6,7 +6,7 @@ # # To build the kernel, use: # cd sys/pic32/duinomite -# kconfig Config +# kconfig Config-uart # make clean # make # diff --git a/sys/pic32/duinomite/Makefile b/sys/pic32/duinomite/Makefile index fc7c1f3..52ca9e5 100644 --- a/sys/pic32/duinomite/Makefile +++ b/sys/pic32/duinomite/Makefile @@ -126,10 +126,10 @@ swapunix.o: swapunix.c all: unix.elf clean: - rm -rf .deps *.elf *.o *.map *.dis *.bin + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h *.c machine sys + rm -f *.h ioconf.c swapunix.c vers.c reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 5e6086c..7266668 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -122,10 +122,10 @@ swapunix.o: swapunix.c all: unix.elf clean: - rm -rf .deps *.elf *.o *.map *.dis *.bin + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h *.c machine sys + rm -f *.h ioconf.c swapunix.c vers.c reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config diff --git a/sys/pic32/picadillo/Config-rambo b/sys/pic32/picadillo/Config-rambo index 65331e0..0002a6b 100644 --- a/sys/pic32/picadillo/Config-rambo +++ b/sys/pic32/picadillo/Config-rambo @@ -6,7 +6,7 @@ # # To build the kernel, use: # cd sys/pic32/picadillo -# kconfig Config +# kconfig Config-rambo # make clean # make # diff --git a/sys/pic32/picadillo/Makefile b/sys/pic32/picadillo/Makefile index 1f9fd3e..bdf929e 100644 --- a/sys/pic32/picadillo/Makefile +++ b/sys/pic32/picadillo/Makefile @@ -119,10 +119,10 @@ swapunix.o: swapunix.c all: unix.elf clean: - rm -rf .deps *.elf *.o *.map *.dis *.bin + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h *.c machine sys + rm -f *.h ioconf.c swapunix.c vers.c reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config diff --git a/sys/pic32/ubw32/.gitignore b/sys/pic32/ubw32/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/ubw32/.gitignore +++ b/sys/pic32/ubw32/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/ubw32/Config b/sys/pic32/ubw32/Config new file mode 100644 index 0000000..c0816f5 --- /dev/null +++ b/sys/pic32/ubw32/Config @@ -0,0 +1,80 @@ +# +# UBW32 board with two SD card slots +# ================================== +# For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Sparkfun-UBW32 +# Console on USB. +# For Windows, use the driver: http://www.schmalzhaus.com/UBW32/FW/UBW32inf.zip +# +# To build the kernel, use: +# cd sys/pic32/ubw32 +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "UBW32" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-ubw32.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISE" # for kernel activity LED... +options "LED_KERNEL_PIN=2" # ...use pin RE2 +options "LED_KERNEL_INVERT" +options "LED_DISK_PORT=TRISE" # for disk activity LED... +options "LED_DISK_PIN=1" # ...use pin RE1 +options "LED_DISK_INVERT" +options "LED_SWAP_PORT=TRISE" # for swap activity LED... +options "LED_SWAP_PIN=0" # ...use pin RE0 +options "LED_SWAP_INVERT" +options "LED_TTY_PORT=TRISE" # for console activity LED... +options "LED_TTY_PIN=3" # ...use pin RE3 +options "LED_TTY_INVERT" + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + dumps on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# SPI ports +controller spi1 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi1 flags 0x19 # select pin RA9 +disk sd1 at spi1 flags 0x1a # select pin RA10 +options "SD0_PORT=1" # sd0 at spi1 TODO: delete +options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: use flags +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags +options "SD1_PORT=1" # sd1 at spi1 TODO: delete +options "SD1_CS_PORT=TRISA" # for sd1 chip select...TODO: use flags +options "SD1_CS_PIN=10" # ...use pin RA9 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 diff --git a/sys/pic32/ubw32/Config-uart b/sys/pic32/ubw32/Config-uart new file mode 100644 index 0000000..bc6d16c --- /dev/null +++ b/sys/pic32/ubw32/Config-uart @@ -0,0 +1,77 @@ +# +# UBW32 board with two SD card slots +# ================================== +# For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Sparkfun-UBW32 +# Console on UART2. +# +# To build the kernel, use: +# cd sys/pic32/ubw32 +# kconfig Config-uart +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "UBW32" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-ubw32.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISE" # for kernel activity LED... +options "LED_KERNEL_PIN=2" # ...use pin RE2 +options "LED_KERNEL_INVERT" +options "LED_DISK_PORT=TRISE" # for disk activity LED... +options "LED_DISK_PIN=1" # ...use pin RE1 +options "LED_DISK_INVERT" +options "LED_SWAP_PORT=TRISE" # for swap activity LED... +options "LED_SWAP_PIN=0" # ...use pin RE0 +options "LED_SWAP_INVERT" +options "LED_TTY_PORT=TRISE" # for console activity LED... +options "LED_TTY_PIN=3" # ...use pin RE3 +options "LED_TTY_INVERT" + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + dumps on sd0b + +# Console options +options "CONSOLE_DEVICE=tty1" # Console on UART2 + +# Serial UART ports +device uart2 # USB-to-serial adapter +options "UART2_ENABLED" # TODO: delete this option + +# SPI ports +controller spi1 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi1 flags 0x19 # select pin RA9 +disk sd1 at spi1 flags 0x1a # select pin RA10 +options "SD0_PORT=1" # sd0 at spi1 TODO: delete +options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: use flags +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags +options "SD1_PORT=1" # sd1 at spi1 TODO: delete +options "SD1_CS_PORT=TRISA" # for sd1 chip select...TODO: use flags +options "SD1_CS_PIN=10" # ...use pin RA9 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 diff --git a/sys/pic32/ubw32/Makefile b/sys/pic32/ubw32/Makefile new file mode 100644 index 0000000..924c12d --- /dev/null +++ b/sys/pic32/ubw32/Makefile @@ -0,0 +1,369 @@ +PARAM = -DUBW32 +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD1_CS_PIN=10 +PARAM += -DSD1_CS_PORT=TRISA +PARAM += -DSD1_PORT=1 +PARAM += -DSD0_CS_PIN=9 +PARAM += -DSD0_CS_PORT=TRISA +PARAM += -DSD0_PORT=1 +PARAM += -DSPI_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_TTY_INVERT +PARAM += -DLED_TTY_PIN=3 +PARAM += -DLED_TTY_PORT=TRISE +PARAM += -DLED_SWAP_INVERT +PARAM += -DLED_SWAP_PIN=0 +PARAM += -DLED_SWAP_PORT=TRISE +PARAM += -DLED_DISK_INVERT +PARAM += -DLED_DISK_PIN=1 +PARAM += -DLED_DISK_PORT=TRISE +PARAM += -DLED_KERNEL_INVERT +PARAM += -DLED_KERNEL_PIN=2 +PARAM += -DLED_KERNEL_PORT=TRISE +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DHZ=100 +LDSCRIPT = "cfg/bootloader-ubw32.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk + +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 ../${LDSCRIPT} -Wl,-Map=unix.map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump + +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif + +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o usb_device.o \ + usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/usb_device.c $S/pic32/usb_function_cdc.c \ + $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ + $(OBJDUMP) -d -S unix.elf > unix.dis + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix.elf + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h ioconf.c swapunix.c vers.c + +reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} + + +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/ubw32/Makefile-old b/sys/pic32/ubw32/Makefile-old deleted file mode 100644 index 5e9a101..0000000 --- a/sys/pic32/ubw32/Makefile-old +++ /dev/null @@ -1,55 +0,0 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -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 = - -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ='CPU_KHZ/BUS_DIV' -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ='((CRYSTAL*1000)/CPU_IDIV*CPU_MUL/CPU_ODIV)' -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_INVERT=YES -DEFS += -DLED_DISK_PIN=1 -DEFS += -DLED_DISK_PORT=TRISE -DEFS += -DLED_KERNEL_INVERT=YES -DEFS += -DLED_KERNEL_PIN=2 -DEFS += -DLED_KERNEL_PORT=TRISE -DEFS += -DLED_SWAP_INVERT=YES -DEFS += -DLED_SWAP_PIN=0 -DEFS += -DLED_SWAP_PORT=TRISE -DEFS += -DLED_TTY_INVERT=YES -DEFS += -DLED_TTY_PIN=3 -DEFS += -DLED_TTY_PORT=TRISE -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=9 -DEFS += -DSD0_CS_PORT=TRISA -DEFS += -DSD0_PORT=1 -DEFS += -DSD1_CS_PIN=10 -DEFS += -DSD1_CS_PORT=TRISA -DEFS += -DSD1_PORT=1 -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 - - -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-ubw32.ld - -CONFIG = UBW32 -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/ubw32/Makefile-uart-old b/sys/pic32/ubw32/Makefile-uart-old deleted file mode 100644 index ad56cbf..0000000 --- a/sys/pic32/ubw32/Makefile-uart-old +++ /dev/null @@ -1,53 +0,0 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -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 uart.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 vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = - -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ='CPU_KHZ/BUS_DIV' -DEFS += -DCONSOLE_DEVICE=tty1 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ='((CRYSTAL*1000)/CPU_IDIV*CPU_MUL/CPU_ODIV)' -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_INVERT=YES -DEFS += -DLED_DISK_PIN=1 -DEFS += -DLED_DISK_PORT=TRISE -DEFS += -DLED_KERNEL_INVERT=YES -DEFS += -DLED_KERNEL_PIN=2 -DEFS += -DLED_KERNEL_PORT=TRISE -DEFS += -DLED_SWAP_INVERT=YES -DEFS += -DLED_SWAP_PIN=0 -DEFS += -DLED_SWAP_PORT=TRISE -DEFS += -DLED_TTY_INVERT=YES -DEFS += -DLED_TTY_PIN=3 -DEFS += -DLED_TTY_PORT=TRISE -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=9 -DEFS += -DSD0_CS_PORT=TRISA -DEFS += -DSD0_PORT=1 -DEFS += -DSD1_CS_PIN=10 -DEFS += -DSD1_CS_PORT=TRISA -DEFS += -DSD1_PORT=1 -DEFS += -DUART2_ENABLED=YES -DEFS += -DUCB_METER - - -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-ubw32.ld - -CONFIG = UBW32-UART -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/ubw32/Makefile-uart-sdram-old b/sys/pic32/ubw32/Makefile-uart-sdram-old deleted file mode 100644 index a0f9359..0000000 --- a/sys/pic32/ubw32/Makefile-uart-sdram-old +++ /dev/null @@ -1,52 +0,0 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -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 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 rd_sdramp.o rdisk.o sdram.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 uart.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 vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = - -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ='CPU_KHZ/BUS_DIV' -DEFS += -DCONSOLE_DEVICE=tty1 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ='((CRYSTAL*1000)/CPU_IDIV*CPU_MUL/CPU_ODIV)' -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DKERNEL -DEFS += -DKERNEL_EXECUTABLE_RAM -DEFS += -DLED_DISK_INVERT=YES -DEFS += -DLED_DISK_PIN=9 -DEFS += -DLED_DISK_PORT=TRISB -DEFS += -DLED_KERNEL_INVERT=YES -DEFS += -DLED_KERNEL_PIN=10 -DEFS += -DLED_KERNEL_PORT=TRISB -DEFS += -DLED_SWAP_INVERT=YES -DEFS += -DLED_SWAP_PIN=8 -DEFS += -DLED_SWAP_PORT=TRISB -DEFS += -DLED_TTY_INVERT=YES -DEFS += -DLED_TTY_PIN=11 -DEFS += -DLED_TTY_PORT=TRISB -DEFS += -DPARTITION="sdramp0:sa@2048,fs@14000" -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=9 -DEFS += -DSD0_CS_PORT=TRISA -DEFS += -DSD0_PORT=2 -DEFS += -DSDRAMP_ENABLED=YES -DEFS += -DUART2_ENABLED=YES -DEFS += -DUCB_METER - - -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-sdram.ld - -CONFIG = UBW32-UART-SDRAM -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/ubw32/UBW32-UART-SDRAM b/sys/pic32/ubw32/UBW32-UART-SDRAM deleted file mode 100644 index 6b0d452..0000000 --- a/sys/pic32/ubw32/UBW32-UART-SDRAM +++ /dev/null @@ -1,18 +0,0 @@ -# -# UBW32 board -# =========== -# -# Console on UART2 - -core pic32mx7 -linker bootloader-sdram -mapping generic - -device kernel invled=B10 -device console invled=B11 device=tty1 -device uart2 -device rdisk invled=B9 invswap=B8 -device sd0 port=2 cs=A9 -device sdramp - -option PARTITION=sdramp0:sa@2048,fs@14000 diff --git a/sys/pic32/ubw32/devcfg.c b/sys/pic32/ubw32/devcfg.c deleted file mode 100644 index ad48c89..0000000 --- a/sys/pic32/ubw32/devcfg.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Chip configuration. - */ -#include "machine/pic32mx.h" - -PIC32_DEVCFG ( - DEVCFG0_DEBUG_DISABLED, /* ICE debugger enabled */ - - DEVCFG1_FNOSC_PRIPLL | /* Primary oscillator with PLL */ - DEVCFG1_POSCMOD_HS | /* HS oscillator */ - DEVCFG1_FPBDIV_1 | /* Peripheral bus clock = SYSCLK/1 */ - DEVCFG1_IESO | /* Internal-external switch over */ - DEVCFG1_WDTPS_1, /* Watchdog postscale = 1/1 */ - - DEVCFG2_FPLLIDIV_2 | /* PLL divider = 1/2 */ - DEVCFG2_FPLLMUL_20 | /* PLL multiplier = 20x */ - DEVCFG2_UPLLIDIV_2 | /* USB PLL divider = 1/2 */ - DEVCFG2_FPLLODIV_1, /* PLL postscaler = 1/1 */ - - DEVCFG3_USERID(0xffff) | /* User-defined ID */ - DEVCFG3_FSRSSEL_7 | /* Assign irq priority 7 to shadow set */ - DEVCFG3_FUSBIDIO | /* USBID pin: controlled by USB */ - DEVCFG3_FVBUSONIO | /* VBuson pin: controlled by USB */ - DEVCFG3_FCANIO | /* Default CAN pins */ - DEVCFG3_FETHIO); /* Default Ethernet i/o pins */ diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index 9d0ffec..de54310 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -123,10 +123,10 @@ swapunix.o: swapunix.c all: unix.elf clean: - rm -rf .deps *.elf *.o *.map *.dis *.bin + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h *.c machine sys + rm -f *.h ioconf.c swapunix.c vers.c reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config From a6396122f64f91783f2b190c8be8c13d9eddd9de Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 19:17:07 -0700 Subject: [PATCH 14/32] New configurations for Fubarino board. Retroone configuration deleted. --- sys/pic32/baremetal/devcfg.c | 2 +- sys/pic32/fubarino/.gitignore | 3 + sys/pic32/fubarino/Config | 69 +++++ sys/pic32/fubarino/Config-uart-sramc | 75 +++++ sys/pic32/fubarino/Makefile | 396 ++++++++++++++++++++++++--- sys/pic32/maximite/devcfg.c | 25 -- sys/pic32/retroone/.gitignore | 9 - sys/pic32/retroone/Makefile | 137 --------- sys/pic32/retroone/README | 2 - sys/pic32/retroone/devcfg.c | 32 --- 10 files changed, 503 insertions(+), 247 deletions(-) create mode 100644 sys/pic32/fubarino/Config create mode 100644 sys/pic32/fubarino/Config-uart-sramc delete mode 100644 sys/pic32/maximite/devcfg.c delete mode 100644 sys/pic32/retroone/.gitignore delete mode 100644 sys/pic32/retroone/Makefile delete mode 100644 sys/pic32/retroone/README delete mode 100644 sys/pic32/retroone/devcfg.c diff --git a/sys/pic32/baremetal/devcfg.c b/sys/pic32/baremetal/devcfg.c index 38790ea..ba09d61 100644 --- a/sys/pic32/baremetal/devcfg.c +++ b/sys/pic32/baremetal/devcfg.c @@ -7,7 +7,7 @@ PIC32_DEVCFG ( DEVCFG0_DEBUG_DISABLED, /* ICE debugger enabled */ DEVCFG1_FNOSC_FRCDIVPLL | /* Internal FRC oscillator with PLL */ - DEVCFG1_POSCMOD_DISABLE | /* No crystal */ + DEVCFG1_POSCMOD_DISABLE | /* No crystal */ DEVCFG1_OSCIOFNC | /* CLKO output active */ DEVCFG1_FPBDIV_1 | /* Peripheral bus clock = SYSCLK/1 */ DEVCFG1_FCKM_DISABLE | /* Fail-safe clock monitor disable */ diff --git a/sys/pic32/fubarino/.gitignore b/sys/pic32/fubarino/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/fubarino/.gitignore +++ b/sys/pic32/fubarino/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/fubarino/Config b/sys/pic32/fubarino/Config new file mode 100644 index 0000000..385e630 --- /dev/null +++ b/sys/pic32/fubarino/Config @@ -0,0 +1,69 @@ +# +# Fubarino SD board +# ================================== +# Console on USB. +# For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Fubarino-SD +# +# To build the kernel, use: +# cd sys/pic32/fubarino +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "FUBARINO" # Board type +hz 100 # Rate of clock interrupt +ldscript "cfg/bootloader-max32.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISE" # for kernel activity LED... +options "LED_KERNEL_PIN=5" # ...use pin RE5 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + dumps on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# SPI ports +controller spi2 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi2 flags 0x79 # select pin RG9 +options "SD0_PORT=2" # sd0 at spi2 TODO: delete +options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags +options "SD0_CS_PIN=9" # ...use pin RA9 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 + +# GLCD driver +device glcd0 +options "GLCD_ENABLED" # TODO: delete this option diff --git a/sys/pic32/fubarino/Config-uart-sramc b/sys/pic32/fubarino/Config-uart-sramc new file mode 100644 index 0000000..f462f84 --- /dev/null +++ b/sys/pic32/fubarino/Config-uart-sramc @@ -0,0 +1,75 @@ +# +# Fubarino SD board SRAMC swap disk +# ================================= +# Console on UART2. +# Overclocked to 120MHz. +# Clock rate increased to 1000Hz. +# +# To build the kernel, use: +# cd sys/pic32/fubarino-uart-sramc +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "FUBARINO" # Board type +hz 1000 # Rate of clock interrupt +ldscript "cfg/bootloader-max32.ld" # Linker script + +# Standard system options +options "CPU_KHZ=120000" # Oscillator frequency of CPU core +options "BUS_KHZ=120000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 +options "NBUF=8" +options "NMOUNT=3" +options "NPROC=25" + +# LED +options "LED_KERNEL_PORT=TRISE" # for kernel activity LED... +options "LED_KERNEL_PIN=5" # ...use pin RE5 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + dumps on sd0b + +# Console options +options "CONSOLE_DEVICE=tty1" # Console on UART2 + +# Serial UART ports +device uart1 # Additional serial port +device uart2 # Console +options "UART1_ENABLED" # TODO: delete this option +options "UART2_ENABLED" # TODO: delete this option + +# SPI ports +controller spi2 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi2 flags 0x79 # select pin RG9 +options "SD0_PORT=2" # sd0 at spi2 TODO: delete +options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags +options "SD0_MHZ=20" # increase data speed + +# 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 + +# sramc - SRAM block device +disk sramc0 # SRAM via 4-wire CPLD interface +options "SRAMC_ENABLED" # TODO: delete this option +options "PARTITION='sramc0:sa@2048,fs@6140'" # Partition schema diff --git a/sys/pic32/fubarino/Makefile b/sys/pic32/fubarino/Makefile index 1c6771e..7534894 100644 --- a/sys/pic32/fubarino/Makefile +++ b/sys/pic32/fubarino/Makefile @@ -1,46 +1,360 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DFUBARINO +PARAM += -DPIC32MX7 +PARAM += -DGLCD_ENABLED +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=9 +PARAM += -DSD0_CS_PORT=TRISG +PARAM += -DSD0_PORT=2 +PARAM += -DSPI_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_KERNEL_PIN=5 +PARAM += -DLED_KERNEL_PORT=TRISE +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DHZ=100 +LDSCRIPT = "cfg/bootloader-max32.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=unix.map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 glcd.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 pwm.o rd_sd.o rdisk.o signal.o spi.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 = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DADC_ENABLED=YES -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGLCD_ENABLED=YES -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_KERNEL_PIN=5 -DEFS += -DLED_KERNEL_PORT=TRISE -DEFS += -DPIC32MX7 -DEFS += -DPWM_ENABLED=YES -DEFS += -DSD0_CS_PIN=9 -DEFS += -DSD0_CS_PORT=TRISG -DEFS += -DSD0_PORT=2 -DEFS += -DSPI_ENABLED=YES -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o glcd.o gpio.o machdep.o mem.o \ + pwm.o rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o \ + usb_device.o usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/glcd.c $S/pic32/gpio.c $S/pic32/machdep.c \ + $S/pic32/mem.c $S/pic32/pwm.c $S/pic32/rd_sd.c $S/pic32/signal.c \ + $S/pic32/spi.c $S/pic32/spi_bus.c $S/pic32/swap.c \ + $S/pic32/sysctl.c $S/pic32/usb_device.c \ + $S/pic32/usb_function_cdc.c $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ + $(OBJDUMP) -d -S unix.elf > unix.dis + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix.elf + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h ioconf.c swapunix.c vers.c + +reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +glcd.o: $S/pic32/glcd.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-max32.ld - -CONFIG = FUBARINO -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/maximite/devcfg.c b/sys/pic32/maximite/devcfg.c deleted file mode 100644 index ad48c89..0000000 --- a/sys/pic32/maximite/devcfg.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Chip configuration. - */ -#include "machine/pic32mx.h" - -PIC32_DEVCFG ( - DEVCFG0_DEBUG_DISABLED, /* ICE debugger enabled */ - - DEVCFG1_FNOSC_PRIPLL | /* Primary oscillator with PLL */ - DEVCFG1_POSCMOD_HS | /* HS oscillator */ - DEVCFG1_FPBDIV_1 | /* Peripheral bus clock = SYSCLK/1 */ - DEVCFG1_IESO | /* Internal-external switch over */ - DEVCFG1_WDTPS_1, /* Watchdog postscale = 1/1 */ - - DEVCFG2_FPLLIDIV_2 | /* PLL divider = 1/2 */ - DEVCFG2_FPLLMUL_20 | /* PLL multiplier = 20x */ - DEVCFG2_UPLLIDIV_2 | /* USB PLL divider = 1/2 */ - DEVCFG2_FPLLODIV_1, /* PLL postscaler = 1/1 */ - - DEVCFG3_USERID(0xffff) | /* User-defined ID */ - DEVCFG3_FSRSSEL_7 | /* Assign irq priority 7 to shadow set */ - DEVCFG3_FUSBIDIO | /* USBID pin: controlled by USB */ - DEVCFG3_FVBUSONIO | /* VBuson pin: controlled by USB */ - DEVCFG3_FCANIO | /* Default CAN pins */ - DEVCFG3_FETHIO); /* Default Ethernet i/o pins */ diff --git a/sys/pic32/retroone/.gitignore b/sys/pic32/retroone/.gitignore deleted file mode 100644 index 6a22af6..0000000 --- a/sys/pic32/retroone/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.compileversion -.deps/ -.oldversion -machine -sys -unix.bin -unix.map -usbboot.map -vers.c diff --git a/sys/pic32/retroone/Makefile b/sys/pic32/retroone/Makefile deleted file mode 100644 index c97605e..0000000 --- a/sys/pic32/retroone/Makefile +++ /dev/null @@ -1,137 +0,0 @@ -# -# Build RetroBSD kernel for PIC32 platform. -# -H = ../../include -M = .. -S = ../../kernel - -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) - -# Kernel options. -DEFS += -I. -I$(H) -DKERNEL -DPIC32MX7 -DEFS += -DGLOBAL_DEBUG - -# CPU frequency 80 MHz. -DEFS += -DCPU_KHZ=80000 -DEFS += -DBUS_KHZ=80000 -DBUS_DIV=1 - -# -# Basic pic32mx795f512l chip with internal oscillator -# =================================================== -# -# Console on UART1 with hardware handshaking -DEFS += -DCONSOLE_UART1 #-DCONSOLE_RTSCTS -# SD/MMC card driver on SPI1 -DEFS += -DSD0_PORT=1 -DSD0_MHZ=20 -# /CS0 at pin B1 -DEFS += -DSD0_CS_PORT=TRISD -DSD0_CS_PIN=9 -# LEDs at pins A0, A1, A2, A3 -DEFS += -DLED_DISK_PORT=TRISA -DLED_DISK_PIN=14 -DEFS += -DLED_KERNEL_PORT=TRISB -DLED_KERNEL_PIN=8 -DEFS += -DLED_TTY_PORT=TRISB -DLED_TTY_PIN=9 -DEFS += -DLED_AUX_PORT=TRISA -DLED_AUX_PIN=9 - -DEPFLAGS = -MT $@ -MD -MP -MF .deps/$*.dep -CFLAGS = -O $(DEFS) $(DEPFLAGS) -ASFLAGS = $(DEFS) $(DEPFLAGS) - -include ../gcc-config.mk - -CC = $(MIPS_GCC_PREFIX)gcc -EL -g -mips32r2 -CC += -nostdinc -fno-builtin -Werror -Wall -fno-dwarf2-cfi-asm -LDFLAGS = -nostdlib -T ../cfg/bare.ld -Wl,-Map=unix.map -SIZE = $(MIPS_GCC_PREFIX)size -OBJDUMP = $(MIPS_GCC_PREFIX)objdump -OBJCOPY = $(MIPS_GCC_PREFIX)objcopy - -ifneq (${MIPS_GCC_FORMAT},) - LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} -endif - -# Machine-dependent files: -# startup.o MUST be loaded first. -KERNOBJ = startup.o clock.o devsw.o cons.o sysctl.o \ - signal.o machdep.o mem.o exception.o - -# Kernel. -KERNOBJ += 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 \ - subr_log.o subr_prf.o subr_rmap.o \ - sys_generic.o sys_inode.o syscalls.o \ - sys_pipe.o sys_process.o tty.o exec_conf.o exec_subr.o \ - exec_aout.o exec_elf.o exec_script.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 vfs_vnops.o \ - vm_sched.o vm_swap.o vm_swp.o kern_glob.o swap.o spi_bus.o - -# Drivers. -KERNOBJ += rd_sd.o rdisk.o - -# Configuration-dependent files. -KERNOBJ += vers.o devcfg.o - -# Include any local specific configuration overrides --include Makefile.local - -# GPIO driver -KERNOBJ += gpio.o -DEFS += -DGPIO_ENABLED - -# ADC driver -KERNOBJ += adc.o -DEFS += -DADC_ENABLED - -# GLCD driver -KERNOBJ += glcd.o -DEFS += -DGLCD_ENABLED - -# PWM driver -KERNOBJ += pwm.o -DEFS += -DPWM_ENABLED - -all: .deps sys machine unix.elf - $(SIZE) unix.elf - -clean: - rm -rf .deps *.o *.elf *.bin *.dis *.map *.srec core \ - mklog assym.h vers.c genassym sys machine - -cleanest: clean - rm -f unix.hex - -.deps: - mkdir .deps - -sys: - ln -s ../../include $@ - -machine: - ln -s .. $@ - -unix.elf: $(KERNOBJ) ../cfg/bare.ld - $(CC) $(LDFLAGS) $(KERNOBJ) -o $@ - chmod -x $@ - $(OBJDUMP) -d -S $@ > unix.dis - $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ unix.hex - -load: unix.elf - pic32prog unix.hex - -vers.o: ../newvers.sh $(H)/*.h $(M)/*.[ch] $(S)/*.c - sh ../newvers.sh > vers.c - $(CC) -c vers.c - -.SUFFIXES: .i .srec .hex .dis .cpp .cxx .bin .elf - -.o.dis: - $(OBJDUMP) -d -z -S $< > $@ - -ifeq (.deps, $(wildcard .deps)) --include .deps/*.dep -endif diff --git a/sys/pic32/retroone/README b/sys/pic32/retroone/README deleted file mode 100644 index c648880..0000000 --- a/sys/pic32/retroone/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains an example of RetroBSD kernel build -using plain Makefile (no configsys or kconfig tools). diff --git a/sys/pic32/retroone/devcfg.c b/sys/pic32/retroone/devcfg.c deleted file mode 100644 index a955010..0000000 --- a/sys/pic32/retroone/devcfg.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Chip configuration. - */ -#include "machine/pic32mx.h" - -PIC32_DEVCFG ( - DEVCFG0_DEBUG_ENABLED, /* ICE debugger enabled */ - - DEVCFG1_FNOSC_FRCDIVPLL | /* Primary oscillator with PLL */ - DEVCFG1_POSCMOD_DISABLE | /* HS oscillator */ - DEVCFG1_OSCIOFNC | /* CLKO output active */ - DEVCFG1_FPBDIV_1 | /* Peripheral bus clock = SYSCLK/1 */ - DEVCFG1_FCKM_DISABLE | /* Fail-safe clock monitor disable */ - DEVCFG1_FCKS_DISABLE | /* Clock switching disable */ - DEVCFG1_WDTPS_1024, /* Watchdog postscale = 1/1024 */ - - DEVCFG2_FPLLIDIV_2 | /* PLL divider = 1/2 */ - DEVCFG2_FPLLMUL_20 | /* PLL multiplier = 20x */ - DEVCFG2_UPLLIDIV_2 | /* USB PLL divider = 1/2 */ - DEVCFG2_UPLLDIS | /* Disable USB PLL */ - DEVCFG2_FPLLODIV_1, /* PLL postscaler = 1/1 */ - - DEVCFG3_USERID(0xffff) | /* User-defined ID */ - DEVCFG3_FSRSSEL_7 | /* Assign irq priority 7 to shadow set */ - DEVCFG3_FETHIO); /* Default Ethernet i/o pins */ - -#include "sys/param.h" -#include "sys/conf.h" - -dev_t rootdev = makedev(0, 1); /* sd0a */ -dev_t dumpdev = makedev(0, 2); /* sd0b */ -dev_t swapdev = makedev(0, 2); /* sd0b */ From 5de76c3cf18d565570337e89fc6c5b6f83dab88f Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 23:32:35 -0700 Subject: [PATCH 15/32] Remove MEB board. --- sys/pic32/Makefile | 2 +- sys/pic32/README | 43 +- sys/pic32/meb/.gitignore | 9 - sys/pic32/meb/MEB | 17 - sys/pic32/meb/Makefile | 46 -- sys/pic32/meb/README | 5 - sys/pic32/ssd1926-sdcard.c | 854 ------------------------------------- sys/pic32/ssd1926.h | 157 ------- 8 files changed, 31 insertions(+), 1102 deletions(-) delete mode 100644 sys/pic32/meb/.gitignore delete mode 100644 sys/pic32/meb/MEB delete mode 100644 sys/pic32/meb/Makefile delete mode 100644 sys/pic32/meb/README delete mode 100644 sys/pic32/ssd1926-sdcard.c delete mode 100644 sys/pic32/ssd1926.h diff --git a/sys/pic32/Makefile b/sys/pic32/Makefile index 1ee6825..7e701f3 100644 --- a/sys/pic32/Makefile +++ b/sys/pic32/Makefile @@ -2,7 +2,7 @@ # Programs that live in subdirectories, and have makefiles of their own. # SUBDIR = baremetal duinomite duinomite-emega explorer16 \ - fubarino max32 maximite maximite-color meb mmb-mx7 \ + fubarino max32 maximite maximite-color mmb-mx7 \ picadillo pinguino-micro sdxl starter-kit ubw32 wf32 default: diff --git a/sys/pic32/README b/sys/pic32/README index e8b9cf3..c181ea2 100644 --- a/sys/pic32/README +++ b/sys/pic32/README @@ -1,22 +1,39 @@ Build directories: -max32 - chipKIT Max32 board. + 32mxsdram-uart/ - 32MXSDRAM custom board with external SDRAM + used as a volatile disk storage (swap). -ubw32 - Sparkfun UBW32 board, USB console. + baremetal/ - PIC32MX processor on a custom board. -ubw32-uart - Sparkfun UBW32 board, UART console. + duinomite/ - Olimex Duinomite or Duinomite-Mega board. -maximite - Maximite computer. + duinomite-emega/ - Olimex Duinomite-eMega board. -explorer16 - Microchip Explorer 16 board, with - PIC32 CAN-USB plug-in module and SD & MMC pictail. + explorer16/ - Microchip Explorer 16 board, + with PIC32MX plug-in module + and SD & MMC pictail. -starter-kit - Microchip PIC32 USB or Ethernet Starter Kit, - with I/O Expansion board and SD & MMC pictail. + fubarino/ - Fubarino SD board. -dip - eflightworks.net PIC32-on-DIP board. - (work in progress) + max32/ - chipKIT Max32 board. -meb - Microchip Multimedia Expansion board with - Microchip PIC32 USB or Ethernet Starter Kit. - (work in progress) + maximite/ - Maximite computer. + + maximite-color/ - The Colour Maximite computer. + + mmb-mx7/ - MikroElektronika MultiMedia Board for PIC32MX7. + + picadillo/ - 4D Systems Picadillo-35T board. + + pinguino-micro/ - Olimex Pinguino-Micro board equipped + with pic32mx795 processor. + + sdxl/ - Majenko SDXL board. + + starter-kit/ - Microchip PIC32MX USB or Ethernet Starter Kit, + with I/O Expansion board and SD & MMC pictail. + + ubw32/ - Sparkfun UBW32 board. + + wf32/ - ChipKIT WF32 board with + 2.4" LCD TFT display shield. diff --git a/sys/pic32/meb/.gitignore b/sys/pic32/meb/.gitignore deleted file mode 100644 index 6a22af6..0000000 --- a/sys/pic32/meb/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.compileversion -.deps/ -.oldversion -machine -sys -unix.bin -unix.map -usbboot.map -vers.c diff --git a/sys/pic32/meb/MEB b/sys/pic32/meb/MEB deleted file mode 100644 index 8ffeb7b..0000000 --- a/sys/pic32/meb/MEB +++ /dev/null @@ -1,17 +0,0 @@ - - -core pic32mx7 -linker bootloader -mapping generic - -device kernel cpu_khz=80000 bus_khz=80000 led=D2 - -device console device=ttyUSB0 led=D0 -device uartusb - -device rdisk led=D1 -device sd0 port=1 cs=A9 - -device gpio - -#device adc diff --git a/sys/pic32/meb/Makefile b/sys/pic32/meb/Makefile deleted file mode 100644 index e8cf681..0000000 --- a/sys/pic32/meb/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -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 = - -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=1 -DEFS += -DLED_DISK_PORT=TRISD -DEFS += -DLED_KERNEL_PIN=2 -DEFS += -DLED_KERNEL_PORT=TRISD -DEFS += -DLED_TTY_PIN=0 -DEFS += -DLED_TTY_PORT=TRISD -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=9 -DEFS += -DSD0_CS_PORT=TRISA -DEFS += -DSD0_PORT=1 -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 - - -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader.ld - -CONFIG = MEB -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/meb/README b/sys/pic32/meb/README deleted file mode 100644 index aebbad0..0000000 --- a/sys/pic32/meb/README +++ /dev/null @@ -1,5 +0,0 @@ -NOTE -==== - -This device configuration is not currently supported by the -rdisk system. A new driver is needed for the SD card chip. diff --git a/sys/pic32/ssd1926-sdcard.c b/sys/pic32/ssd1926-sdcard.c deleted file mode 100644 index a3424c1..0000000 --- a/sys/pic32/ssd1926-sdcard.c +++ /dev/null @@ -1,854 +0,0 @@ -/* - * SSD1926 hardware SD card driver - * - * Copyright (C) 2008 Microchip Technology Inc. All rights reserved. - * Microchip licenses to you the right to use, modify, copy and distribute - * Software only when embedded on a Microchip microcontroller or digital - * signal controller, which is integrated into your product or third party - * product (pursuant to the sublicense terms in the accompanying license - * agreement). - * - * You should refer to the license agreement accompanying this Software - * for additional information regarding your rights and obligations. - * - * SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY - * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR - * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR - * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, - * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT - * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, - * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, - * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY - * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), - * OR OTHER SIMILAR COSTS. - * - * Author Date Comments - * ----------------------------------------------------- - * Sean Justice 15_Sept-2008 First release - * Anton Alkhimenok 06_Jun-2009 Ported to PIC24 - */ -#include - -/* - * Helper Macros - */ -#define CheckDataInhibit() while(GetReg(0x1124) & 0x02) -#define CheckCommandInhibit() while(GetReg(0x1124) & 0x01) -#define GetDataPortReg0() GetReg(0x1120) -#define SetDataPortReg0(data) SetReg(0x1120, data) -#define SetTransferMode(mode) SetReg(0x110C, mode) - -/* - * Set graphics controller register (byte access) - */ -void SetReg(WORD index, BYTE value) -{ - DisplaySetCommand(); // set RS line to low for command - DisplayEnable(); // enable SSD1926 - - DeviceWrite(((WORD_VAL) index).v[1]); - DeviceWrite(index << 8); - - DisplaySetData(); // set RS line to high for data - - if(index & 0x0001) - DeviceWrite(value); - else - DeviceWrite(value << 8); - - DisplayDisable(); // disable SSD1926 -} - -/* - * Read graphics controller register value (byte access) - */ -BYTE GetReg(WORD index) -{ - WORD value; - - DisplaySetCommand(); // set RS line to low for command - DisplayEnable(); // enable SSD1926 - - DeviceWrite(((WORD_VAL) index).v[1]); - DeviceWrite(index << 8); - - DisplaySetData(); // set RS line to high for data - - value = DeviceRead(); - value = DeviceRead(); - - DisplayDisable(); // disable SSD1926 - - if(index & 0x0001) - value &= 0x00ff; - else - value = (value >> 8) & 0x00ff; - - return (value); -} - -/* - * Helper Functions - */ -inline void __attribute__ ((always_inline)) -SetCommandArgument(DWORD arg) -{ - SetReg(0x110B, ((DWORD_VAL) arg).v[3]); - SetReg(0x110A, ((DWORD_VAL) arg).v[2]); - SetReg(0x1109, ((DWORD_VAL) arg).v[1]); - SetReg(0x1108, ((DWORD_VAL) arg).v[0]); -} - -inline void __attribute__ ((always_inline)) -SetCommand(BYTE idx, BYTE flags) -{ - SetReg(0x110E, flags); //set response type - SetReg(0x110F, idx); //command index -} - -inline volatile DWORD __attribute__ ((always_inline)) -GetCommandResponse(BYTE idx) -{ - DWORD_VAL rsp; - - idx <<= 2; - - rsp.v[0] = GetReg(0x1110 + idx); - rsp.v[1] = GetReg(0x1111 + idx); - rsp.v[2] = GetReg(0x1112 + idx); - rsp.v[3] = GetReg(0x1113 + idx); - - return (rsp.Val); -} - -void ReadCmdResponse(DWORD *rsp, UINT size) -{ - DWORD idx; - for(idx = 0; idx < size; idx++) - { - *rsp = GetCommandResponse(idx); - rsp++; - } -} - -/* - * Global Variables - */ -DWORD finalLBA; -WORD sectorSize; -DWORD maxBusClock; -BYTE hcMode; -MEDIA_INFORMATION mediaInformation; - -/* - * Local Prototypes - */ -BYTE SDInit(void); -BYTE SDSetClock(DWORD clockMax); -BYTE SDSendCommand(BYTE cmd_idx, BYTE flags, DWORD arg); -BYTE SDSendAppCommand(BYTE cmd_idx, BYTE flags, DWORD arg1, DWORD arg2); -void SDReset(BYTE type); - -/* - * Function: - * BYTE SDSetClock(DWORD clockMax) - * Input: - * clockMax - SD card maximum frequency, - * Output: - * returns non-zero if the operation is successfull. - * Overview: - * Sets the SD card clock frequency close to clockMax - */ -BYTE SDSetClock(DWORD clockMax) -{ - DWORD mclk; - BYTE reg; - BYTE div; - - mclk = SSD_SYS_CLOCK * GetReg(SSD_REG_PLL_CONFIG1); - mclk /= (GetReg(SSD_REG_PLL_CONFIG0) & 0x1F); - mclk /= ((GetReg(SSD_REG_MCLK_CONIG) & 0x1F) + 1); - - if(GetReg(SSD_REG_MCLK_CONIG) & 0x01) - mclk /= 2; - - reg = GetReg(SSD_SDCARD_REG_CLK_CNTL); - - reg = reg &~((BYTE) SSD_SD_CLK_ENABLE); - SetReg(SSD_SDCARD_REG_CLK_CNTL, reg); - - reg |= SSD_SD_INT_CLK_ENABLE; - SetReg(SSD_SDCARD_REG_CLK_CNTL, reg); - - DelayMs(1); - if(!(GetReg(SSD_SDCARD_REG_CLK_CNTL) & SSD_SD_INT_CLK_STABLE)) - return (FALSE); - - div = 0; - while(mclk > clockMax) - { - mclk >>= 1; - div++; - } - - div = 1 << (div - 1); - - SetReg(SSD_SDCARD_REG_CLK_DIV, div); - - reg |= SSD_SD_CLK_ENABLE; - SetReg(SSD_SDCARD_REG_CLK_CNTL, reg); - - return (TRUE); -} - -/* - * Function: - * BYTE SDSendCommand(BYTE cmd_idx, BYTE flags, DWORD arg) - * Input: - * cmd_idx - command start index, - * flags - command flags, - * arg - command arguments. - * Output: - * Returns non-zero if the operation is successful - * Overview: - * Send SD card command. - */ -BYTE SDSendCommand(BYTE cmd_idx, BYTE flags, DWORD arg) -{ - DWORD timeout; - - SetReg(0x112E, 0x0E); // Data Timeout Counter Value = MCLK x 2^27 - CheckCommandInhibit(); - - // Clear interrupt flags - SetReg(0x1130, 0xff); - - // Enable command complete interrupt - SetReg(0x1134, GetReg(0x1134) | 0x01); - - // Clear error interrupt flags - SetReg(0x1132, 0xff); - SetReg(0x1133, 0xff); - - // Enable all interrupts - SetReg(0x1136, 0xff); - SetReg(0x1137, 0xff); - - SetCommandArgument(arg); - SetCommand(cmd_idx, flags); - - timeout = SD_TIMEOUT; - while(1) - { - if(GetReg(0x1130) & 0x01) - { - break; - } - - if(!timeout--) - { - return (FALSE); - } - } - - return (TRUE); -} - -/* - * Function: - * BYTE SDSendAppCommand(BYTE cmd_idx, BYTE flags, DWORD arg1, DWORD arg2) - * Input: - * cmd_idx - command start index, - * flags - command flags, - * arg1 - application command arguments 1 - * arg2 - application command arguments 2 - * Output: - * Returns non-zero if the operation is successful - * Overview: - * Send SD card application command. - */ -BYTE SDSendAppCommand(BYTE cmd_idx, BYTE flags, DWORD arg1, DWORD arg2) -{ - if(!SDSendCommand(CMD_APP_CMD, SSD_RESPONSE_48, arg1)) - return (FALSE); - - if(!SDSendCommand(cmd_idx, flags, arg2)) - return (FALSE); - - return (TRUE); -} - -/* - * Function: - * void SDReset(BYTE type) - * Input: - * type - type of reset. - * Overview: - * Resets the SD card module - */ -void SDReset(BYTE type) -{ - DWORD timeout; - - SetReg(SSD_SDCARD_REG_SW_RESET, type); - - timeout = SD_TIMEOUT; - while(1) - { - if(!timeout--) - return; - if(!(GetReg(SSD_SDCARD_REG_SW_RESET) & type)) - return; - } -} - -/* - * Function: - * void SDPower(BYTE on) - * Input: - * on - '0' means off, '1' means on. - * Overview: - * Powers on the SD card. - */ -void SDPower(BYTE on) -{ - if(on) - SetReg(SSD_SDCARD_REG_PWR_CNTL, 0x0F); - else - SetReg(SSD_SDCARD_REG_PWR_CNTL, 0x0E); -} - -/* - * Function: - * BYTE SDDetect(void) - * Output: - * TRUE - card detected, - * FALSE - no card detected. - * Overview: - * Detects if the SD card is inserted. - */ -BYTE SDDetect(void) -{ - BYTE reg; - - reg = GetReg(SSD_SDCARD_REG_PRSNT_STATE_2); - - if(!(reg & SSD_CARD_DETECT)) - return (FALSE); - - if(reg & SSD_CARD_INSERTED) - { - DWORD timeout; - - timeout = SD_TIMEOUT; - while(1) - { - if(!timeout--) - return (FALSE); - if(GetReg(SSD_SDCARD_REG_PRSNT_STATE_2) & SSD_CARD_STABLE) - break; - } - } - else - return (FALSE); - - return (TRUE); -} - -/* - * Function: - * BYTE SDWriteProtectState(void) - * Output: - * Returns the status of the "write enabled" pin. - * Overview: - * Determines if the card is write-protected. - */ -BYTE SDWriteProtectState(void) -{ - return (GetReg(SSD_SDCARD_REG_PRSNT_STATE_2) & SSD_WRITE_PROTECT); -} - -/* - * Function: - * BYTE SDInit(void) - * Output: - * Returns TRUE if media is initialized, FALSE otherwise. - * Overview: - * MediaInitialize initializes the media card and supporting variables. - */ -BYTE SDInit(void) -{ - DWORD timeout; - DWORD response; - DWORD voltage; - DWORD CSD_C_SIZE; - DWORD CSD_C_SIZE_MULT; - DWORD CSD_RD_BL_LEN; - DWORD RCA; - DWORD CSD[4]; - - if(!SDSendCommand(CMD_RESET, SSD_NO_RESPONSE, 0xFFFFFFFF)) - return (FALSE); - - - if(!SDSendCommand(CMD_SEND_IF_COND, SSD_RESPONSE_48 | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, 0x000001AA)) - return (FALSE); - - response = GetCommandResponse(0); - - if(response == 0x000001AA) - { - voltage = 0x40200000; - hcMode = 1; - }else{ - voltage = 0x00200000; - hcMode = 0; - } - - timeout = 10; - do - { - if(!timeout--) - { - return (FALSE); - } - - SDReset(SSD_RESET_DATA|SSD_RESET_CMD); - if(!SDSendAppCommand(ACMD_SEND_OCR, SSD_RESPONSE_48, 0, voltage)) - return (FALSE); // ask card send OCR back - DelayMs(150); - response = GetCommandResponse(0); - } while((response&0x80000000) == 0); - - if((response&0x40000000L) == 0){ - hcMode = 0; - } - - if(!SDSendCommand(CMD_SEND_ALL_CID, SSD_RESPONSE_136 | SSD_CMD_CRC_CHK, 0xFFFFFFFF)) - return (FALSE); - - DelayMs(150); - - if(!SDSendCommand(CMD_SEND_RCA, SSD_RESPONSE_48 | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, 0xFFFFFFFF)) - return (FALSE); - - RCA = GetCommandResponse(0); - RCA |= 0x0000ffff; - - //CMD9 - Request CSD from SD Card - if(!SDSendCommand(CMD_SEND_CSD, SSD_CMD_IDX_CHK | SSD_CMD_CRC_CHK | SSD_RESPONSE_136, RCA)) - return (FALSE); - - ReadCmdResponse(CSD, 4); - - CSD_C_SIZE = ((CSD[2] & 0x00000003) << 10) | ((CSD[1] & 0xFFC00000) >> 22); //CSD Bit[73:62] => Bit[65:54] (Deduct CRC-7 as CRC-7 is not stored in response register) - CSD_C_SIZE_MULT = ((CSD[1] & 0x00000380) >> 7); //CSD Bit[49:47] =? Bit[41:39] - CSD_RD_BL_LEN = (CSD[2] & 0x00000F00) >> 8; //CSD Bit[83:80] -> Bit[75:72] - finalLBA = (CSD_C_SIZE + 1) * (1 << (CSD_C_SIZE_MULT + 2)); - sectorSize = (1 << CSD_RD_BL_LEN); - if((CSD[3] & 0x000000FF) == 0x32) - maxBusClock = 25000000; // 25MHz - else - maxBusClock = 25000000; // 50MHz - SDReset(SSD_RESET_CMD); - - //CMD7 Select Card - if(!SDSendCommand(CMD_SELECT_CARD, SSD_RESPONSE_48_BUSY | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, RCA)) - return (FALSE); - - sectorSize = 512L; - - //CMD16 Set the block size. - if(!SDSendCommand(CMD_SET_BLKLEN, SSD_RESPONSE_48 | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, sectorSize)) - return (FALSE); - - //CMD55 + ACMD6 Set bus width = 4 Bit - if(!SDSendAppCommand(ACMD_SET_BUS_WIDTH, SSD_RESPONSE_48 | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, RCA, 0xFFFFFFFE)) - return (FALSE); - - //Data width 4bits - SetReg(0x1128, 0x02); - - return (TRUE); -} - -/* - * Function: - * INT32 SDGetStatus(void) - * Output: - * SD card status. - * Overview: - * Returns SD card status. If the returned value is -1 the there's an error. - */ -INT32 SDGetStatus(void) -{ - DWORD status; - DWORD RCA; - - SDReset(SSD_RESET_CMD); - - //Normal interrupt handling - SetReg(0x1134, GetReg(0x1134) | 0x01); //enable read interrupt - SetReg(0x1130, 0x01); //clear previous interrupt - - //Error interrupt handling - SetReg(0x1136, GetReg(0x1136) | 0x8F); //enable error interrupt - SetReg(0x1137, GetReg(0x1137) | 0x71); //enable error interrupt - SetReg(0x1132, 0x8F); //enable error interrupt - SetReg(0x1133, 0x71); //enable error interrupt - if(!SDSendCommand(CMD_SEND_RCA, SSD_RESPONSE_48 | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, 0xFFFFFFFF)) - return (DWORD) (-1); - - RCA = GetCommandResponse(0); - RCA |= 0x0000ffff; - - if(!SDSendCommand(CMD_SEND_STATUS, SSD_RESPONSE_48 | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, RCA)) - return (DWORD) (-1); - - while(!(GetReg(0x1130) & 0x01)); - - //check cmd complt int - SetReg(0x1130, 0x01); //clear previous int - while((GetReg(0x1132) & 0x8F) || (GetReg(0x1133) & 0x71)); - SetReg(0x1132, 0x8F); //enable error interrupt - SetReg(0x1133, 0x71); //enable error interrupt - ReadCmdResponse(&status, 1); - - return (status); -} - -/* - * Function: - * MEDIA_INFORMATION* SDInitialize(void) - * Output: - * Returns a pointer to the media inforamtion structure. - * Overview: - * SDInitialize initializes the media card and supporting variables. - * Sets maximum clock frequency for the SD card. - */ -MEDIA_INFORMATION *SDInitialize(void) -{ - DWORD timeout; - - SDReset(SSD_RESET_DATA | SSD_RESET_CMD | SSD_RESET_ALL); - - SDPower(TRUE); - - mediaInformation.errorCode = MEDIA_NO_ERROR; - mediaInformation.validityFlags.value = 0; - - if(!SDSetClock(SSD_SD_CLK_INIT)) - { - mediaInformation.errorCode = MEDIA_DEVICE_NOT_PRESENT; - return (&mediaInformation); - } - - timeout = 10; - while(!SDInit()) - { - if(!timeout--) - { - mediaInformation.errorCode = MEDIA_DEVICE_NOT_PRESENT; - return (&mediaInformation); - } - } - - mediaInformation.validityFlags.bits.sectorSize = 1; - mediaInformation.sectorSize = sectorSize; - - if(!SDSetClock(maxBusClock>>1)) - mediaInformation.errorCode = MEDIA_DEVICE_NOT_PRESENT; - - return (&mediaInformation); -} - -/* - * Function: BYTE SDSectorRead(DWORD sector_addr, BYTE *buffer) - * - * Input: sector_addr - Sector address - * buffer - Buffer where data will be stored, see - * 'ram_acs.h' for 'block' definition. - * 'Block' is dependent on whether internal or - * external memory is used - * - * Output: Returns TRUE if read successful, false otherwise - * - * Overview: SectorRead reads data from the card starting - * at the sector address specified by sector_addr and stores - * them in the location pointed to by 'buffer'. - * - * Note: The device expects the address field in the command packet - * to be byte address. Therefore the sector_addr must first - * be converted to byte address. - */ -BYTE SDSectorRead(DWORD sector_addr, BYTE *buffer) -{ - if(!hcMode) - { - sector_addr *= sectorSize; - } - - CheckDataInhibit(); - - SDReset(SSD_RESET_DATA); - - SetTransferMode(0x10); - - // Block size is one sector - SetReg(0x1104, ((WORD_VAL) sectorSize).v[0]); // write block size - SetReg(0x1105, ((WORD_VAL) sectorSize).v[1]); // write block size - - //Clear error interrupt flags - SetReg(0x1136, 0xff); - SetReg(0x1137, 0xff); - SetReg(0x1132, 0xff); - SetReg(0x1133, 0xff); - - // Buffer Read Ready, Transfer Complete, Command Complete interrupts enable - SetReg(0x1134, 0x23); - - // Clear previous interrupt flags - SetReg(0x1130, 0x23); - - // Send command - if - ( - !SDSendCommand - ( - CMD_RD_SINGLE, - SSD_RESPONSE_48 | SSD_DATA_PRESENT | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, - sector_addr - ) - ) return (FALSE); - - // Wait for transfer complete - while(!(GetReg(0x1130) & 0x20)); - - // Clear transfer complete flag - SetReg(0x1130, 0x20); - - // Read data - WORD counter = 0; - while(GetReg(0x1125) & 0x08) - { - if(counter < sectorSize) - *buffer++ = GetDataPortReg0(); - counter++; - } - - if(counter > sectorSize) - return (FALSE); - - return (TRUE); -} - -/* - * Function: - * BYTE SDSectorDMARead(DWORD sector_addr, DWORD dma_addr, UINT16 num_blk) - * Input: - * sector_addr - Sector address - * buffer - Buffer where data will be stored, see - * 'ram_acs.h' for 'block' definition. - * 'Block' is dependent on whether internal or - * external memory is used - * - * Output: - * Returns TRUE if read successful, false otherwise. - * Overview: SectorRead reads data from the card starting - * at the sector address specified by sector_addr and stores - * them in the location pointed to by 'buffer'. - * - * Note: The device expects the address field in the command packet - * to be byte address. Therefore the sector_addr must first - * be converted to byte address. - */ -BYTE SDSectorDMARead(DWORD sector_addr, DWORD dma_addr, UINT16 num_blk) -{ - DWORD dma_size; - BYTE boundary; - - if(!hcMode) - { - sector_addr *= sectorSize; - } - - CheckDataInhibit(); - SDReset(SSD_RESET_DATA); - - // set up the DMA address - SetReg(0x1100, ((DWORD_VAL) dma_addr).v[0]); - SetReg(0x1101, ((DWORD_VAL) dma_addr).v[1]); - SetReg(0x1102, ((DWORD_VAL) dma_addr).v[2]); - SetReg(0x1103, ((DWORD_VAL) dma_addr).v[3]); - - // set up the transefer mode (Multi-Blk, Read, Blk Cnt, DMA) - SetTransferMode(0x33); - - // set up the DMA buffer size (4k) and sector block size - dma_size = (DWORD) num_blk * sectorSize; - - dma_size >>= 12; - boundary = 0; - while(dma_size) - { - dma_size >>= 1; - boundary++; - } - - boundary <<= 4; - boundary |= ((WORD_VAL) sectorSize).v[1] & 0x0F; - - SetReg(0x1104, ((WORD_VAL) sectorSize).v[0]); // write block size - SetReg(0x1105, boundary); // write block size - - // Set the number of blocks to read - SetReg(0x1106, (BYTE) (num_blk & 0xFF)); // write block size - SetReg(0x1107, (BYTE) (num_blk >> 8)); // write block size - - // set up the normal status register 0 - SetReg(0x1134, 0x0B); // enable read interrupt - SetReg(0x1130, GetReg(0x1130) | 0x0B); // clear previous interrupt - - // set up the error status register - SetReg(0x1136, 0xFF); // clear previous interrupt - SetReg(0x1132, 0xFF); // clear previous interrupt - SetReg(0x1133, 0x01); // clear previous interrupt - SetReg(0x1130, 0x08); // clear previous interrupt - - // set the command to read multiple blocks - if - ( - !SDSendCommand - ( - CMD_RD_MULTIPLE, - SSD_RESPONSE_48 | SSD_DATA_PRESENT | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, - sector_addr - ) - ) return (FALSE); - - // wait until the dma transfer is done - while(!(GetReg(0x1130) & 0x08) && (GetReg(0x1125) & 0x02)); - SetReg(0x1130, 0x08); - - // stop the transmission - if - ( - !SDSendCommand - ( - CMD_STOP_TRANSMISSION, - SSD_CMD_TYPE_ABORT | SSD_RESPONSE_48_BUSY | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, - 0xFFFFFFFF - ) - ) return (FALSE); - SetReg(0x1130, 0x01); //clear previous interrupt - SetReg(0x1106, 0); // write block size - SetReg(0x1107, 0); // write block size - - // disable the transfer mode - SetTransferMode(0); - - return (TRUE); -} - -/* - * Function: BYTE SDSectorWrite(DWORD sector_addr, BYTE *buffer, BYTE allowWriteToZero) - * - * Input: sector_addr - Sector address - * buffer - Buffer where data will be read - * allowWriteToZero - If true, writes to the MBR will be valid - * - * Output: Returns TRUE if write successful, FALSE otherwise - * - * Overview: SectorWrite sends data from the location - * pointed to by 'buffer' to the card starting - * at the sector address specified by sector_addr. - * - * Note: The sample device expects the address field in the command packet - * to be byte address. Therefore the sector_addr must first - * be converted to byte address. - */ -BYTE SDSectorWrite(DWORD sector_addr, BYTE *buffer, BYTE allowWriteToZero) -{ - UINT16 i; - - if(!hcMode) - { - sector_addr *= sectorSize; - } - - CheckDataInhibit(); - SDReset(SSD_RESET_DATA); - SetTransferMode(0); - - SetReg(0x1104, ((WORD_VAL) sectorSize).v[0]); // write block size - SetReg(0x1105, ((WORD_VAL) sectorSize).v[1]); // write block size - - //Clear error interrupt flags - SetReg(0x1136, 0xff); - SetReg(0x1137, 0xff); - SetReg(0x1132, 0xff); - SetReg(0x1133, 0xff); - - //Normal interrupt handling - SetReg(0x1134, 0x13); //enable write interrupt - SetReg(0x1130, 0x13); //clear all type of normal interrupt - - if - ( - !SDSendCommand - ( - CMD_WR_SINGLE, - SSD_RESPONSE_48 | SSD_DATA_PRESENT | SSD_CMD_CRC_CHK | SSD_CMD_IDX_CHK, - sector_addr - ) - ) return (FALSE); - - SetReg(0x1130, 0x01); //clear previous interrupt - while(!(GetReg(0x1130)&0x10) && !(GetReg(0x1125) & 0x04)); //check Buffer write int - SetReg(0x1130, 0x10); //clear previous interrupt - - for(i = 0; i < sectorSize; i++) - { - //check if Write Enable bit set, which mean buffer is free for new data - while(!(GetReg(0x1125) & 0x04)); - //put data that need be written into SSD1928 buffers - SetDataPortReg0(*buffer++); - } - - SetReg(0x1130, 0x10); //clear previous interrupt - while(!(GetReg(0x1130)&0x02)); //check Transfer complt int - SetReg(0x1130, 0x02); // clear previous interrupt - - return (TRUE); -} - -/* - * Function: - * WORD SDReadSectorSize(void) - * PreCondition: - * MediaInitialize() is complete - * Output: - * Size of the sectors for this physical media. - * Overview: - * Returns size of the sectors for this physical media. - */ -WORD SDReadSectorSize(void) -{ - return (sectorSize); -} - -/* - * Function: - * DWORD SDReadCapacity(void) - * PreCondition: - * MediaInitialize() is complete - * Output: - * Number of sectors. - * Overview: - * Returns number of sectors. - */ -DWORD SDReadCapacity(void) -{ - return (finalLBA); -} diff --git a/sys/pic32/ssd1926.h b/sys/pic32/ssd1926.h deleted file mode 100644 index 9e4f7e5..0000000 --- a/sys/pic32/ssd1926.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * SSD1926 hardware definitions - * - * Copyright (C) 2008 Microchip Technology Inc. All rights reserved. - * Microchip licenses to you the right to use, modify, copy and distribute - * Software only when embedded on a Microchip microcontroller or digital - * signal controller, which is integrated into your product or third party - * product (pursuant to the sublicense terms in the accompanying license - * agreement). - * - * You should refer to the license agreement accompanying this Software - * for additional information regarding your rights and obligations. - * - * SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY - * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR - * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR - * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, - * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT - * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, - * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, - * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY - * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), - * OR OTHER SIMILAR COSTS. - * - * Author Date Comments - * ----------------------------------------------------- - * Sean Justice 15_Sept-2008 First release - * Anton Alkhimenok 06_Jun-2009 Ported to PIC24 - */ -#ifndef _SSD1926_H - -#define _SSD1926_H - -/* - * User Defines - */ -#define SSD_SYS_CLOCK (DWORD) (4000000) /* SSD1926 crystal frequncy */ -#define SSD_SD_CLK_INIT (DWORD) (400000) -#define SD_TIMEOUT (DWORD) (3000000) - -/* - * Registers - */ -#define SSD_REG_PLL_CONFIG0 0x0126 -#define SSD_REG_PLL_CONFIG1 0x0127 -#define SSD_REG_MCLK_CONIG 0x0004 -#define SSD_SDCARD_SD_CLK 0x1001 -#define SSD_SDCARD_REG_DMA_ADDR 0x1100 -#define SSD_SDCARD_REG_BLK_SIZE 0x1104 -#define SSD_SDCARD_REG_BLK_CNT 0x1106 -#define SSD_SDCARD_REG_ARG_32BIT 0x1108 -#define SSD_SDCARD_REG_XFR_MODE 0x110c -#define SSD_SDCARD_REG_CMD 0x110e -#define SSD_SDCARD_REG_RSP 0x1110 -#define SSD_SDCARD_REG_DATA_PORT 0x1120 -#define SSD_SDCARD_REG_RSVD1 0x1121 -#define SSD_SDCARD_REG_PRSNT_STATE_0 0x1124 -#define SSD_SDCARD_REG_PRSNT_STATE_1 0x1125 -#define SSD_SDCARD_REG_PRSNT_STATE_2 0x1126 -#define SSD_SDCARD_REG_PRSNT_STATE_3 0x1127 -#define SSD_SDCARD_REG_HST_CNTL 0x1128 -#define SSD_SDCARD_REG_PWR_CNTL 0x1129 -#define SSD_SDCARD_REG_BLK_GAP_CNTL 0x112a -#define SSD_SDCARD_REG_WKUP_CNTL 0x112b -#define SSD_SDCARD_REG_CLK_CNTL 0x112c -#define SSD_SDCARD_REG_CLK_DIV 0x112d -#define SSD_SDCARD_REG_TOUT_CNTL 0x112e -#define SSD_SDCARD_REG_SW_RESET 0x112f -#define SSD_SDCARD_REG_NRM_INTR_STATUS 0x1130 -#define SSD_SDCARD_REG_ERR_INTR_STATUS 0x1132 -#define SSD_SDCARD_REG_NRM_INTR_STATUS_EN 0x1134 -#define SSD_SDCARD_REG_ERR_INTR_STATUS_EN 0x1136 -#define SSD_SDCARD_REG_NRM_INTR_SIG_EN 0x1138 -#define SSD_SDCARD_REG_ERR_INTR_SIG_EN 0x113a -#define SSD_SDCARD_REG_ACMD12_ERR_STATUS 0x113c -#define SSD_SDCARD_REG_RSVD2 0x113e -#define SSD_SDCARD_REG_CAPABILITIES 0x1140 -#define SSD_SDCARD_REG_CAP_RSVD 0x1144 -#define SSD_SDCARD_REG_MAX_CURR_CAP 0x1148 -#define SSD_SDCARD_REG_MAX_CURR_CAP_RSVD 0x114c -#define SSD_SDCARD_REG_RSVD3 0x1150 -#define SSD_SDCARD_REG_SLOT_INTR_STATUS 0x11fc -#define SSD_SDCARD_REG_HCVER 0x11fe - -/* - * SD Commands - */ -#define CMD_RESET 0 -#define CMD_SEND_OCR 1 // used exclusively in MMC -#define CMD_SEND_ALL_CID 2 // R2: R136 -#define CMD_SEND_RCA 3 // R1 (MMC) or R6(SDMEM) -#define CMD_SET_DSR 4 -#define CMD_IO_SEND_OCR 5 // R4, unique to IO cards -#define CMD_SELECT_CARD 7 // R1, arg=rca[31..16] or 0 -#define CMD_SEND_IF_COND 8 -#define CMD_SEND_CSD 9 // R2: R136 -#define CMD_SEND_CID 10 // R2: R136 -#define CMD_STOP_TRANSMISSION 12 // R1b: arg=stuff bits -#define CMD_SEND_STATUS 13 // R1 -#define CMD_GO_INACTIVE 15 // None, arg=rca[31..16], stuff[15..0] -#define CMD_SET_BLKLEN 16 // R1, arg=block len[31..0] -#define CMD_RD_SINGLE 17 // R1, arg=block address[31..0] -#define CMD_RD_MULTIPLE 18 // R1, arg=block address[31..0] -#define CMD_WR_SINGLE 24 // R1, arg=block address[31..0] -#define CMD_WR_MULTIPLE 25 // R1, arg=block address[31..0] -#define CMD_SET_WP 28 // R1b, arg=wp address[31..0] -#define CMD_CLR_WP 29 // R1b, arg=wp address[31..0] -#define CMD_SEND_WP 30 // R1, DATA, arg=wp address[31..0] -#define CMD_ERASE_SADDR 32 // R1, arg=block address[31..0] -#define CMD_ERASE_EADDR 33 // R1, arg=block address[31..0] -#define CMD_ERASE_GRP_SADDR 35 // R1, arg=block address[31..0] -#define CMD_ERASE_GRP_EADDR 36 // R1, arg=block address[31..0] -#define CMD_ERASE 38 // R1b, arg=stuff bits[31..0] -#define CMD_IO_RW_DIRECT 52 // R5 -#define CMD_IO_RW_EXTENDED 53 // R1, data transfer -#define CMD_APP_CMD 55 // R1, arg=rca[31..16], stuff[15..0] -#define CMD_GEN_CMD 56 // R1, data, arg=stuff[31..1], RD/WR[0] -#define ACMD_SET_BUS_WIDTH 6 // R1, arg=[1..0] = bus width, [31:2] stuff bits -#define ACMD_SEND_STATUS 13 // R1, DATA, arg=stuff bits [31..0] -#define ACMD_SEND_NUM_WR_BLK 22 // R1, DATA, arg=stuff bits [31..0] -#define ACMD_SEND_OCR 41 -#define ACMD_SEND_SCR 51 // R1, arg=stuff bits[31..0] - -/* - * Flags - */ -#define SSD_SD_CLK_CTRL_ON (DWORD) 0x80000000 -#define SSD_SD_CLK_ENABLE (DWORD) 0x00000004 -#define SSD_SD_INT_CLK_STABLE (DWORD) 0x00000002 -#define SSD_SD_INT_CLK_ENABLE (DWORD) 0x00000001 -#define SSD_SD_CLK_FLAGS (SSD_SD_CLK_CTRL_ON | SSD_SD_CLK_ENABLE | SSD_SD_INT_CLK_ENABLE) -#define SSD_CMD_TYPE_ABORT 0xC0 -#define SDD_CMD_TYPE_RESUME 0x80 -#define SDD_CMD_TYPE_SUSPEND 0x40 -#define SDD_CMD_TYPE_NORMAL 0x00 -#define SSD_DATA_PRESENT 0x20 -#define SSD_CMD_IDX_CHK 0x10 -#define SSD_CMD_CRC_CHK 0x08 -#define SSD_NO_RESPONSE 0x00 -#define SSD_RESPONSE_136 0x01 -#define SSD_RESPONSE_48 0x02 -#define SSD_RESPONSE_48_BUSY 0x03 - -#define SSD_CARD_DETECT 0x04 -#define SSD_CARD_STABLE 0x02 -#define SSD_CARD_INSERTED 0x01 - -#define SSD_WRITE_PROTECT 0x08 - -#define SSD_RESET_ALL 0x01 -#define SSD_RESET_CMD 0x02 -#define SSD_RESET_DATA 0x04 - -#define WAIT_CNT (DWORD) 10000000l - -#endif /* _SSD1926_H */ From fcad15f7e67f304bcd1c576b0f60caf70252294d Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Fri, 4 Sep 2015 12:33:14 -0700 Subject: [PATCH 16/32] Generic config file updated. --- sys/pic32/Config.generic | 9 ++++----- sys/pic32/Makefile | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/pic32/Config.generic b/sys/pic32/Config.generic index 7ac93f5..5e8f464 100644 --- a/sys/pic32/Config.generic +++ b/sys/pic32/Config.generic @@ -9,10 +9,10 @@ # # For details, see http://retrobsd.org/wiki/doku.php/doc/kconfig # -machine "pic32" - -cpu "PIC32MX7" -ident CHIPKIT_MAX +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "CHIPKIT_MAX32" # Board type +hz 100 # Rate of clock interrupt # Linker script ldscript "cfg/bootloader-max32.ld" @@ -24,7 +24,6 @@ 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 "EXEC_AOUT" # Run a.out binaries options "EXEC_ELF" # Run ELF binaries diff --git a/sys/pic32/Makefile b/sys/pic32/Makefile index 1ee6825..ab1479d 100644 --- a/sys/pic32/Makefile +++ b/sys/pic32/Makefile @@ -15,6 +15,9 @@ install: clean: -for i in $(SUBDIR); do ${MAKE} -C $$i clean; done +clean-all: + -for i in $(SUBDIR); do ${MAKE} -C $$i clean-all; done + reconfig: -for i in $(SUBDIR); do ${MAKE} -C $$i reconfig; done From 9f05f511a63833133179849faf3ac7bc025c4a60 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Fri, 4 Sep 2015 18:55:56 -0700 Subject: [PATCH 17/32] Fixed issues with multiple kernel builds. --- sys/pic32/Makefile.kconf | 21 +++++++++++---------- sys/pic32/duinomite-emega/Config | 1 - sys/pic32/duinomite-emega/Config-uart | 1 - sys/pic32/duinomite-emega/Makefile | 25 ++++++++++++++----------- sys/pic32/duinomite/Config | 1 - sys/pic32/duinomite/Config-uart | 1 - sys/pic32/duinomite/Makefile | 25 ++++++++++++++----------- sys/pic32/fubarino/Config | 1 - sys/pic32/fubarino/Config-uart-sramc | 1 - sys/pic32/fubarino/Makefile | 25 ++++++++++++++----------- sys/pic32/max32/Config | 1 - sys/pic32/max32/Makefile | 25 ++++++++++++++----------- sys/pic32/picadillo/Config | 1 - sys/pic32/picadillo/Config-rambo | 1 - sys/pic32/picadillo/Makefile | 25 ++++++++++++++----------- sys/pic32/ubw32/Config | 1 - sys/pic32/ubw32/Config-uart | 1 - sys/pic32/ubw32/Makefile | 25 ++++++++++++++----------- sys/pic32/wf32/Config | 1 - sys/pic32/wf32/Makefile | 25 ++++++++++++++----------- tools/kconfig/mkmakefile.c | 3 ++- 21 files changed, 111 insertions(+), 100 deletions(-) diff --git a/sys/pic32/Makefile.kconf b/sys/pic32/Makefile.kconf index 6cac4fe..604ade9 100644 --- a/sys/pic32/Makefile.kconf +++ b/sys/pic32/Makefile.kconf @@ -9,7 +9,7 @@ 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 ../${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${LDSCRIPT} -Wl,-Map=$(basename $@).map SIZE = ${MIPS_GCC_PREFIX}size OBJCOPY = ${MIPS_GCC_PREFIX}objcopy OBJDUMP = ${MIPS_GCC_PREFIX}objdump @@ -44,14 +44,14 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ - $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ - $(OBJDUMP) -d -S unix.elf > unix.dis +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis %LOAD @@ -59,11 +59,12 @@ clean: rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h ioconf.c swapunix.c vers.c + rm -f *.h *.hex ioconf.c swap*.c vers.c -reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config $(MAKE) clean + rm -f *.hex load: unix.elf pic32prog unix.hex diff --git a/sys/pic32/duinomite-emega/Config b/sys/pic32/duinomite-emega/Config index 4a76473..cae353a 100644 --- a/sys/pic32/duinomite-emega/Config +++ b/sys/pic32/duinomite-emega/Config @@ -34,7 +34,6 @@ options "LED_DISK_PIN=1" # ...use pin RC1 # Root filesystem at /dev/sd0a, swap at /dev/sd0b config unix root on sd0a swap on sd0b - dumps on sd0b # Console options options "CONSOLE_DEVICE=ttyUSB0" # Console on USB diff --git a/sys/pic32/duinomite-emega/Config-uart b/sys/pic32/duinomite-emega/Config-uart index cee16b2..80a7fe4 100644 --- a/sys/pic32/duinomite-emega/Config-uart +++ b/sys/pic32/duinomite-emega/Config-uart @@ -34,7 +34,6 @@ options "LED_DISK_PIN=1" # ...use pin RC1 # Root filesystem at /dev/sd0a, swap at /dev/sd0b config unix root on sd0a swap on sd0b - dumps on sd0b # Console options options "CONSOLE_DEVICE=tty4" # Console on UART5 diff --git a/sys/pic32/duinomite-emega/Makefile b/sys/pic32/duinomite-emega/Makefile index 71cac18..7f9246b 100644 --- a/sys/pic32/duinomite-emega/Makefile +++ b/sys/pic32/duinomite-emega/Makefile @@ -33,7 +33,7 @@ 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 ../${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${LDSCRIPT} -Wl,-Map=$(basename $@).map SIZE = ${MIPS_GCC_PREFIX}size OBJCOPY = ${MIPS_GCC_PREFIX}objcopy OBJDUMP = ${MIPS_GCC_PREFIX}objdump @@ -106,14 +106,16 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ - $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ - $(OBJDUMP) -d -S unix.elf > unix.dis +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf unix.elf: ${SYSTEM_DEP} swapunix.o ${SYSTEM_LD_HEAD} @@ -123,17 +125,18 @@ unix.elf: ${SYSTEM_DEP} swapunix.o swapunix.o: swapunix.c ${COMPILE_C} -all: unix.elf +all: unix clean: rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h ioconf.c swapunix.c vers.c + rm -f *.h *.hex ioconf.c swap*.c vers.c -reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config $(MAKE) clean + rm -f *.hex load: unix.elf pic32prog unix.hex diff --git a/sys/pic32/duinomite/Config b/sys/pic32/duinomite/Config index dddcc1b..33998d0 100644 --- a/sys/pic32/duinomite/Config +++ b/sys/pic32/duinomite/Config @@ -33,7 +33,6 @@ options "LED_DISK_PIN=12" # ...use pin RB12 # Root filesystem at /dev/sd0a, swap at /dev/sd0b config unix root on sd0a swap on sd0b - dumps on sd0b # Console options options "CONSOLE_DEVICE=ttyUSB0" # Console on USB diff --git a/sys/pic32/duinomite/Config-uart b/sys/pic32/duinomite/Config-uart index 0940452..1347c9d 100644 --- a/sys/pic32/duinomite/Config-uart +++ b/sys/pic32/duinomite/Config-uart @@ -33,7 +33,6 @@ options "LED_DISK_PIN=12" # ...use pin RB12 # Root filesystem at /dev/sd0a, swap at /dev/sd0b config unix root on sd0a swap on sd0b - dumps on sd0b # Console options options "CONSOLE_DEVICE=tty4" # Console on UART5 diff --git a/sys/pic32/duinomite/Makefile b/sys/pic32/duinomite/Makefile index 52ca9e5..2a2a72f 100644 --- a/sys/pic32/duinomite/Makefile +++ b/sys/pic32/duinomite/Makefile @@ -33,7 +33,7 @@ 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 ../${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${LDSCRIPT} -Wl,-Map=$(basename $@).map SIZE = ${MIPS_GCC_PREFIX}size OBJCOPY = ${MIPS_GCC_PREFIX}objcopy OBJDUMP = ${MIPS_GCC_PREFIX}objdump @@ -106,14 +106,16 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ - $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ - $(OBJDUMP) -d -S unix.elf > unix.dis +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf unix.elf: ${SYSTEM_DEP} swapunix.o ${SYSTEM_LD_HEAD} @@ -123,17 +125,18 @@ unix.elf: ${SYSTEM_DEP} swapunix.o swapunix.o: swapunix.c ${COMPILE_C} -all: unix.elf +all: unix clean: rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h ioconf.c swapunix.c vers.c + rm -f *.h *.hex ioconf.c swap*.c vers.c -reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config $(MAKE) clean + rm -f *.hex load: unix.elf pic32prog unix.hex diff --git a/sys/pic32/fubarino/Config b/sys/pic32/fubarino/Config index 385e630..7602b8a 100644 --- a/sys/pic32/fubarino/Config +++ b/sys/pic32/fubarino/Config @@ -31,7 +31,6 @@ options "LED_KERNEL_PIN=5" # ...use pin RE5 # Root filesystem at /dev/sd0a, swap at /dev/sd0b config unix root on sd0a swap on sd0b - dumps on sd0b # Console options options "CONSOLE_DEVICE=ttyUSB0" # Console on USB diff --git a/sys/pic32/fubarino/Config-uart-sramc b/sys/pic32/fubarino/Config-uart-sramc index f462f84..a9ce476 100644 --- a/sys/pic32/fubarino/Config-uart-sramc +++ b/sys/pic32/fubarino/Config-uart-sramc @@ -35,7 +35,6 @@ options "LED_KERNEL_PIN=5" # ...use pin RE5 # Root filesystem at /dev/sd0a, swap at /dev/sd0b config unix root on sd0a swap on sd0b - dumps on sd0b # Console options options "CONSOLE_DEVICE=tty1" # Console on UART2 diff --git a/sys/pic32/fubarino/Makefile b/sys/pic32/fubarino/Makefile index 7534894..dee83e3 100644 --- a/sys/pic32/fubarino/Makefile +++ b/sys/pic32/fubarino/Makefile @@ -30,7 +30,7 @@ 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 ../${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${LDSCRIPT} -Wl,-Map=$(basename $@).map SIZE = ${MIPS_GCC_PREFIX}size OBJCOPY = ${MIPS_GCC_PREFIX}objcopy OBJDUMP = ${MIPS_GCC_PREFIX}objdump @@ -103,14 +103,16 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ - $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ - $(OBJDUMP) -d -S unix.elf > unix.dis +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf unix.elf: ${SYSTEM_DEP} swapunix.o ${SYSTEM_LD_HEAD} @@ -120,17 +122,18 @@ unix.elf: ${SYSTEM_DEP} swapunix.o swapunix.o: swapunix.c ${COMPILE_C} -all: unix.elf +all: unix clean: rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h ioconf.c swapunix.c vers.c + rm -f *.h *.hex ioconf.c swap*.c vers.c -reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config $(MAKE) clean + rm -f *.hex load: unix.elf pic32prog unix.hex diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index 464b2ab..c71a3f8 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -30,7 +30,6 @@ options "LED_KERNEL_PIN=3" # ...use pin RA3 # 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 diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 7266668..095f0e8 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -31,7 +31,7 @@ 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 ../${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${LDSCRIPT} -Wl,-Map=$(basename $@).map SIZE = ${MIPS_GCC_PREFIX}size OBJCOPY = ${MIPS_GCC_PREFIX}objcopy OBJDUMP = ${MIPS_GCC_PREFIX}objdump @@ -102,14 +102,16 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ - $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ - $(OBJDUMP) -d -S unix.elf > unix.dis +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf unix.elf: ${SYSTEM_DEP} swapunix.o ${SYSTEM_LD_HEAD} @@ -119,17 +121,18 @@ unix.elf: ${SYSTEM_DEP} swapunix.o swapunix.o: swapunix.c ${COMPILE_C} -all: unix.elf +all: unix clean: rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h ioconf.c swapunix.c vers.c + rm -f *.h *.hex ioconf.c swap*.c vers.c -reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config $(MAKE) clean + rm -f *.hex load: unix.elf pic32prog unix.hex diff --git a/sys/pic32/picadillo/Config b/sys/pic32/picadillo/Config index 4e4ed68..6dfdffa 100644 --- a/sys/pic32/picadillo/Config +++ b/sys/pic32/picadillo/Config @@ -27,7 +27,6 @@ options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 # 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 diff --git a/sys/pic32/picadillo/Config-rambo b/sys/pic32/picadillo/Config-rambo index 0002a6b..c4df38a 100644 --- a/sys/pic32/picadillo/Config-rambo +++ b/sys/pic32/picadillo/Config-rambo @@ -27,7 +27,6 @@ options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 # 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 diff --git a/sys/pic32/picadillo/Makefile b/sys/pic32/picadillo/Makefile index bdf929e..91f10d3 100644 --- a/sys/pic32/picadillo/Makefile +++ b/sys/pic32/picadillo/Makefile @@ -27,7 +27,7 @@ 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 ../${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${LDSCRIPT} -Wl,-Map=$(basename $@).map SIZE = ${MIPS_GCC_PREFIX}size OBJCOPY = ${MIPS_GCC_PREFIX}objcopy OBJDUMP = ${MIPS_GCC_PREFIX}objdump @@ -99,14 +99,16 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ - $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ - $(OBJDUMP) -d -S unix.elf > unix.dis +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf unix.elf: ${SYSTEM_DEP} swapunix.o ${SYSTEM_LD_HEAD} @@ -116,17 +118,18 @@ unix.elf: ${SYSTEM_DEP} swapunix.o swapunix.o: swapunix.c ${COMPILE_C} -all: unix.elf +all: unix clean: rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h ioconf.c swapunix.c vers.c + rm -f *.h *.hex ioconf.c swap*.c vers.c -reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config $(MAKE) clean + rm -f *.hex load: unix.elf pic32prog unix.hex diff --git a/sys/pic32/ubw32/Config b/sys/pic32/ubw32/Config index c0816f5..654cff1 100644 --- a/sys/pic32/ubw32/Config +++ b/sys/pic32/ubw32/Config @@ -42,7 +42,6 @@ options "LED_TTY_INVERT" # Root filesystem at /dev/sd0a, swap at /dev/sd0b config unix root on sd0a swap on sd0b - dumps on sd0b # Console options options "CONSOLE_DEVICE=ttyUSB0" # Console on USB diff --git a/sys/pic32/ubw32/Config-uart b/sys/pic32/ubw32/Config-uart index bc6d16c..6a7d6fa 100644 --- a/sys/pic32/ubw32/Config-uart +++ b/sys/pic32/ubw32/Config-uart @@ -41,7 +41,6 @@ options "LED_TTY_INVERT" # Root filesystem at /dev/sd0a, swap at /dev/sd0b config unix root on sd0a swap on sd0b - dumps on sd0b # Console options options "CONSOLE_DEVICE=tty1" # Console on UART2 diff --git a/sys/pic32/ubw32/Makefile b/sys/pic32/ubw32/Makefile index 924c12d..7263383 100644 --- a/sys/pic32/ubw32/Makefile +++ b/sys/pic32/ubw32/Makefile @@ -42,7 +42,7 @@ 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 ../${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${LDSCRIPT} -Wl,-Map=$(basename $@).map SIZE = ${MIPS_GCC_PREFIX}size OBJCOPY = ${MIPS_GCC_PREFIX}objcopy OBJDUMP = ${MIPS_GCC_PREFIX}objdump @@ -115,14 +115,16 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ - $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ - $(OBJDUMP) -d -S unix.elf > unix.dis +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf unix.elf: ${SYSTEM_DEP} swapunix.o ${SYSTEM_LD_HEAD} @@ -132,17 +134,18 @@ unix.elf: ${SYSTEM_DEP} swapunix.o swapunix.o: swapunix.c ${COMPILE_C} -all: unix.elf +all: unix clean: rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h ioconf.c swapunix.c vers.c + rm -f *.h *.hex ioconf.c swap*.c vers.c -reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config $(MAKE) clean + rm -f *.hex load: unix.elf pic32prog unix.hex diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index d6e6826..ba48c29 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -32,7 +32,6 @@ options "LED_TTY_PIN=1" # ...use pin RA1 # 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 diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index de54310..cdf5656 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -32,7 +32,7 @@ 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 ../${LDSCRIPT} -Wl,-Map=unix.map +LDFLAGS = -nostdlib -T ../${LDSCRIPT} -Wl,-Map=$(basename $@).map SIZE = ${MIPS_GCC_PREFIX}size OBJCOPY = ${MIPS_GCC_PREFIX}objcopy OBJDUMP = ${MIPS_GCC_PREFIX}objdump @@ -103,14 +103,16 @@ SYSTEM_OBJ = startup.o ${OBJS} #ioconf.o ifeq (devcfg.c,$(wildcard devcfg.c)) SYSTEM_OBJ += devcfg.o endif -SYSTEM_DEP = Makefile ioconf.c swapunix.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_DEP = Makefile ioconf.c machine sys .deps ${SYSTEM_OBJ} SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${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; \ - $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin; \ - $(OBJDUMP) -d -S unix.elf > unix.dis +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf unix.elf: ${SYSTEM_DEP} swapunix.o ${SYSTEM_LD_HEAD} @@ -120,17 +122,18 @@ unix.elf: ${SYSTEM_DEP} swapunix.o swapunix.o: swapunix.c ${COMPILE_C} -all: unix.elf +all: unix clean: rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys clean-all: clean - rm -f *.h ioconf.c swapunix.c vers.c + rm -f *.h *.hex ioconf.c swap*.c vers.c -reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig ../../../tools/kconfig/kconfig Config $(MAKE) clean + rm -f *.hex load: unix.elf pic32prog unix.hex diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index 0b52bab..95b4511 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -397,7 +397,7 @@ void do_load(f) fputs("all:", f); for (fl = conf_list; fl; fl = fl->f_next) if (fl->f_type == SYSTEMSPEC) - fprintf(f, " %s.elf", fl->f_needs); + fprintf(f, " %s", fl->f_needs); putc('\n', f); } @@ -508,6 +508,7 @@ do_systemspec(f, fl, first) register struct file_list *fl; int first; { + fprintf(f, "%s: %s.elf\n\n", fl->f_needs, fl->f_needs); fprintf(f, "%s.elf: ${SYSTEM_DEP} swap%s.o", fl->f_needs, fl->f_fn); // Don't use newvers target. From f055b45453e598d3e428e8f709a620bf40f0ac28 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Fri, 4 Sep 2015 20:53:19 -0700 Subject: [PATCH 18/32] Kconfig: remove hz keyword. --- sys/pic32/Config.generic | 2 +- sys/pic32/duinomite-emega/Config | 1 - sys/pic32/duinomite-emega/Config-uart | 1 - sys/pic32/duinomite-emega/Makefile | 1 - sys/pic32/duinomite/Config | 1 - sys/pic32/duinomite/Config-uart | 1 - sys/pic32/duinomite/Makefile | 1 - sys/pic32/fubarino/Config | 1 - sys/pic32/fubarino/Config-uart-sramc | 2 +- sys/pic32/fubarino/Makefile | 1 - sys/pic32/max32/Config | 1 - sys/pic32/max32/Makefile | 1 - sys/pic32/picadillo/Config | 1 - sys/pic32/picadillo/Config-rambo | 1 - sys/pic32/picadillo/Makefile | 1 - sys/pic32/ubw32/Config | 1 - sys/pic32/ubw32/Config-uart | 1 - sys/pic32/ubw32/Makefile | 1 - sys/pic32/wf32/Config | 1 - sys/pic32/wf32/Makefile | 1 - tools/kconfig/config.h | 1 - tools/kconfig/config.y | 3 --- tools/kconfig/lang.l | 1 - tools/kconfig/mkmakefile.c | 2 -- 24 files changed, 2 insertions(+), 27 deletions(-) diff --git a/sys/pic32/Config.generic b/sys/pic32/Config.generic index 5e8f464..9c0bc58 100644 --- a/sys/pic32/Config.generic +++ b/sys/pic32/Config.generic @@ -12,7 +12,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "CHIPKIT_MAX32" # Board type -hz 100 # Rate of clock interrupt # Linker script ldscript "cfg/bootloader-max32.ld" @@ -22,6 +21,7 @@ timezone 8 dst maxusers 2 # Standard system options +options "HZ=100" # Rate of clock interrupt options "CPU_KHZ=80000" # Oscillator frequency of CPU core options "BUS_KHZ=80000" # Frequency of peripheral bus options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 diff --git a/sys/pic32/duinomite-emega/Config b/sys/pic32/duinomite-emega/Config index cae353a..94512b3 100644 --- a/sys/pic32/duinomite-emega/Config +++ b/sys/pic32/duinomite-emega/Config @@ -17,7 +17,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "DUINOMITE" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-maximite.ld" # Linker script # Standard system options diff --git a/sys/pic32/duinomite-emega/Config-uart b/sys/pic32/duinomite-emega/Config-uart index 80a7fe4..7edff88 100644 --- a/sys/pic32/duinomite-emega/Config-uart +++ b/sys/pic32/duinomite-emega/Config-uart @@ -17,7 +17,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "DUINOMITE" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-maximite.ld" # Linker script # Standard system options diff --git a/sys/pic32/duinomite-emega/Makefile b/sys/pic32/duinomite-emega/Makefile index 7f9246b..42bab90 100644 --- a/sys/pic32/duinomite-emega/Makefile +++ b/sys/pic32/duinomite-emega/Makefile @@ -20,7 +20,6 @@ PARAM += -DLED_KERNEL_PORT=TRISB PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=40000 PARAM += -DCPU_KHZ=80000 -PARAM += -DHZ=100 LDSCRIPT = "cfg/bootloader-maximite.ld" # # Makefile for RetroBSD, pic32 target diff --git a/sys/pic32/duinomite/Config b/sys/pic32/duinomite/Config index 33998d0..4af704a 100644 --- a/sys/pic32/duinomite/Config +++ b/sys/pic32/duinomite/Config @@ -16,7 +16,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "DUINOMITE" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-maximite.ld" # Linker script # Standard system options diff --git a/sys/pic32/duinomite/Config-uart b/sys/pic32/duinomite/Config-uart index 1347c9d..5e26c54 100644 --- a/sys/pic32/duinomite/Config-uart +++ b/sys/pic32/duinomite/Config-uart @@ -16,7 +16,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "DUINOMITE" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-maximite.ld" # Linker script # Standard system options diff --git a/sys/pic32/duinomite/Makefile b/sys/pic32/duinomite/Makefile index 2a2a72f..2bf244b 100644 --- a/sys/pic32/duinomite/Makefile +++ b/sys/pic32/duinomite/Makefile @@ -20,7 +20,6 @@ PARAM += -DLED_KERNEL_PORT=TRISB PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -PARAM += -DHZ=100 LDSCRIPT = "cfg/bootloader-maximite.ld" # # Makefile for RetroBSD, pic32 target diff --git a/sys/pic32/fubarino/Config b/sys/pic32/fubarino/Config index 7602b8a..5bb1c8a 100644 --- a/sys/pic32/fubarino/Config +++ b/sys/pic32/fubarino/Config @@ -16,7 +16,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "FUBARINO" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options diff --git a/sys/pic32/fubarino/Config-uart-sramc b/sys/pic32/fubarino/Config-uart-sramc index a9ce476..976e2c6 100644 --- a/sys/pic32/fubarino/Config-uart-sramc +++ b/sys/pic32/fubarino/Config-uart-sramc @@ -17,10 +17,10 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "FUBARINO" # Board type -hz 1000 # Rate of clock interrupt ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options +options "HZ=1000" # Rate of clock interrupt options "CPU_KHZ=120000" # Oscillator frequency of CPU core options "BUS_KHZ=120000" # Frequency of peripheral bus options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 diff --git a/sys/pic32/fubarino/Makefile b/sys/pic32/fubarino/Makefile index dee83e3..d6d4f22 100644 --- a/sys/pic32/fubarino/Makefile +++ b/sys/pic32/fubarino/Makefile @@ -17,7 +17,6 @@ PARAM += -DLED_KERNEL_PORT=TRISE PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -PARAM += -DHZ=100 LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index c71a3f8..d7e6f18 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -15,7 +15,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "CHIPKIT_MAX32" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 095f0e8..14e06df 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -18,7 +18,6 @@ PARAM += -DLED_KERNEL_PORT=TRISA PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -PARAM += -DHZ=100 LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target diff --git a/sys/pic32/picadillo/Config b/sys/pic32/picadillo/Config index 6dfdffa..712b4ed 100644 --- a/sys/pic32/picadillo/Config +++ b/sys/pic32/picadillo/Config @@ -16,7 +16,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "PICADILLO_35T" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options diff --git a/sys/pic32/picadillo/Config-rambo b/sys/pic32/picadillo/Config-rambo index c4df38a..9b723dc 100644 --- a/sys/pic32/picadillo/Config-rambo +++ b/sys/pic32/picadillo/Config-rambo @@ -16,7 +16,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "PICADILLO_35T" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options diff --git a/sys/pic32/picadillo/Makefile b/sys/pic32/picadillo/Makefile index 91f10d3..d821ddc 100644 --- a/sys/pic32/picadillo/Makefile +++ b/sys/pic32/picadillo/Makefile @@ -14,7 +14,6 @@ PARAM += -DUART1_ENABLED PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -PARAM += -DHZ=100 LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target diff --git a/sys/pic32/ubw32/Config b/sys/pic32/ubw32/Config index 654cff1..6d736ce 100644 --- a/sys/pic32/ubw32/Config +++ b/sys/pic32/ubw32/Config @@ -17,7 +17,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "UBW32" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-ubw32.ld" # Linker script # Standard system options diff --git a/sys/pic32/ubw32/Config-uart b/sys/pic32/ubw32/Config-uart index 6a7d6fa..9d908ed 100644 --- a/sys/pic32/ubw32/Config-uart +++ b/sys/pic32/ubw32/Config-uart @@ -16,7 +16,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "UBW32" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-ubw32.ld" # Linker script # Standard system options diff --git a/sys/pic32/ubw32/Makefile b/sys/pic32/ubw32/Makefile index 7263383..efcd18b 100644 --- a/sys/pic32/ubw32/Makefile +++ b/sys/pic32/ubw32/Makefile @@ -29,7 +29,6 @@ PARAM += -DLED_KERNEL_PORT=TRISE PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -PARAM += -DHZ=100 LDSCRIPT = "cfg/bootloader-ubw32.ld" # # Makefile for RetroBSD, pic32 target diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index ba48c29..67c51fa 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -13,7 +13,6 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "CHIPKIT_WF32" # Board type -hz 100 # Rate of clock interrupt ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index cdf5656..7b99370 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -19,7 +19,6 @@ PARAM += -DLED_KERNEL_PORT=TRISA PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -PARAM += -DHZ=100 LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index 4192271..a6bcc15 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -162,7 +162,6 @@ struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; int zone, hadtz; int dst; -int hz; int debugging; int maxusers; diff --git a/tools/kconfig/config.y b/tools/kconfig/config.y index c97f995..cf9d1cc 100644 --- a/tools/kconfig/config.y +++ b/tools/kconfig/config.y @@ -170,9 +170,6 @@ Config_spec: | System_spec | - HZ NUMBER - = { hz = $2; } - | TIMEZONE NUMBER = { zone = 60 * $2; check_tz(); } | diff --git a/tools/kconfig/lang.l b/tools/kconfig/lang.l index ac76848..2cd9604 100644 --- a/tools/kconfig/lang.l +++ b/tools/kconfig/lang.l @@ -63,7 +63,6 @@ static struct kt key_words[] = { { "dst", DST }, { "dumps", DUMPS }, { "flags", FLAGS }, - { "hz", HZ }, { "board", BOARD }, { "ldscript", LDSCRIPT }, { "architecture", ARCHITECTURE }, diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index 95b4511..838781a 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -444,8 +444,6 @@ void makefile() } if (maxusers > 0) fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers); - if (hz > 0) - fprintf(ofp, "PARAM += -DHZ=%d\n", hz); if (ldscript) fprintf(ofp, "LDSCRIPT = \"%s\"\n", ldscript); From a73bd691b32c4eceace206c04fccbe7edfcfa0db Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Fri, 4 Sep 2015 20:55:02 -0700 Subject: [PATCH 19/32] Simplify board names for max32 and wf32. --- sys/pic32/max32/Config | 2 +- sys/pic32/max32/Makefile | 2 +- sys/pic32/wf32/Config | 2 +- sys/pic32/wf32/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index d7e6f18..be4fc24 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -14,7 +14,7 @@ # architecture "pic32" cpu "PIC32MX7" # Processor variant -board "CHIPKIT_MAX32" # Board type +board "MAX32" # Board type ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 14e06df..2862981 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -1,4 +1,4 @@ -PARAM = -DCHIPKIT_MAX32 +PARAM = -DMAX32 PARAM += -DPIC32MX7 PARAM += -DPWM_ENABLED PARAM += -DADC_ENABLED diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index 67c51fa..320d470 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -12,7 +12,7 @@ # architecture "pic32" cpu "PIC32MX7" # Processor variant -board "CHIPKIT_WF32" # Board type +board "WF32" # Board type ldscript "cfg/bootloader-max32.ld" # Linker script # Standard system options diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index 7b99370..39b85f7 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -1,4 +1,4 @@ -PARAM = -DCHIPKIT_WF32 +PARAM = -DWF32 PARAM += -DPIC32MX7 PARAM += -DPWM_ENABLED PARAM += -DADC_ENABLED From 58359c0ff4e80152b950f23a0466c6db1a962a4f Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Fri, 4 Sep 2015 21:03:54 -0700 Subject: [PATCH 20/32] Rename 32mxsdram directory. --- sys/pic32/{32mxsdram-uart => 32mxsdram}/.gitignore | 0 .../32MXSDRAM-UART => 32mxsdram/32MXSDRAM} | 0 .../32mxsdram-schematics.pdf | Bin sys/pic32/{32mxsdram-uart => 32mxsdram}/Makefile | 2 +- sys/pic32/{32mxsdram-uart => 32mxsdram}/devcfg.c | 0 sys/pic32/README | 2 +- 6 files changed, 2 insertions(+), 2 deletions(-) rename sys/pic32/{32mxsdram-uart => 32mxsdram}/.gitignore (100%) rename sys/pic32/{32mxsdram-uart/32MXSDRAM-UART => 32mxsdram/32MXSDRAM} (100%) rename sys/pic32/{32mxsdram-uart => 32mxsdram}/32mxsdram-schematics.pdf (100%) rename sys/pic32/{32mxsdram-uart => 32mxsdram}/Makefile (98%) rename sys/pic32/{32mxsdram-uart => 32mxsdram}/devcfg.c (100%) diff --git a/sys/pic32/32mxsdram-uart/.gitignore b/sys/pic32/32mxsdram/.gitignore similarity index 100% rename from sys/pic32/32mxsdram-uart/.gitignore rename to sys/pic32/32mxsdram/.gitignore diff --git a/sys/pic32/32mxsdram-uart/32MXSDRAM-UART b/sys/pic32/32mxsdram/32MXSDRAM similarity index 100% rename from sys/pic32/32mxsdram-uart/32MXSDRAM-UART rename to sys/pic32/32mxsdram/32MXSDRAM diff --git a/sys/pic32/32mxsdram-uart/32mxsdram-schematics.pdf b/sys/pic32/32mxsdram/32mxsdram-schematics.pdf similarity index 100% rename from sys/pic32/32mxsdram-uart/32mxsdram-schematics.pdf rename to sys/pic32/32mxsdram/32mxsdram-schematics.pdf diff --git a/sys/pic32/32mxsdram-uart/Makefile b/sys/pic32/32mxsdram/Makefile similarity index 98% rename from sys/pic32/32mxsdram-uart/Makefile rename to sys/pic32/32mxsdram/Makefile index 66cec62..701f915 100644 --- a/sys/pic32/32mxsdram-uart/Makefile +++ b/sys/pic32/32mxsdram/Makefile @@ -52,7 +52,7 @@ DEFS += -DUCB_METER LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-sdram.ld -CONFIG = 32MXSDRAM-UART +CONFIG = 32MXSDRAM CONFIGPATH = ../../../tools/configsys include ../../../tools/configsys/../../sys/pic32/kernel-post.mk diff --git a/sys/pic32/32mxsdram-uart/devcfg.c b/sys/pic32/32mxsdram/devcfg.c similarity index 100% rename from sys/pic32/32mxsdram-uart/devcfg.c rename to sys/pic32/32mxsdram/devcfg.c diff --git a/sys/pic32/README b/sys/pic32/README index c181ea2..e32461c 100644 --- a/sys/pic32/README +++ b/sys/pic32/README @@ -1,6 +1,6 @@ Build directories: - 32mxsdram-uart/ - 32MXSDRAM custom board with external SDRAM + 32mxsdram/ - 32MXSDRAM custom board with external SDRAM used as a volatile disk storage (swap). baremetal/ - PIC32MX processor on a custom board. From d7e7ae368d5d92810cb92d16124bd3d7a9b2d19e Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Fri, 4 Sep 2015 21:26:21 -0700 Subject: [PATCH 21/32] Delete unused file. --- sys/pic32/usb_console.c | 453 ---------------------------------------- 1 file changed, 453 deletions(-) delete mode 100644 sys/pic32/usb_console.c diff --git a/sys/pic32/usb_console.c b/sys/pic32/usb_console.c deleted file mode 100644 index c13cbb8..0000000 --- a/sys/pic32/usb_console.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Console driver via USB. - * - * Copyright (C) 2011 Serge Vakulenko, - * - * Permission to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is hereby - * granted, provided that the above copyright notice appear in all - * copies and that both that the copyright notice and this - * permission notice and warranty disclaimer appear in supporting - * documentation, and that the name of the author not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * The author disclaim all warranties with regard to this - * software, including all implied warranties of merchantability - * and fitness. In no event shall the author be liable for any - * special, indirect or consequential damages or any damages - * whatsoever resulting from loss of use, data or profits, whether - * in an action of contract, negligence or other tortious action, - * arising out of or in connection with the use or performance of - * this software. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct tty cnttys [1]; - -void cnstart (struct tty *tp); - -/* - * Initialize USB module SFRs and firmware variables to known state. - * Enable interrupts. - */ -void cninit() -{ - usb_device_init(); - IECSET(1) = 1 << (PIC32_IRQ_USB - 32); - - /* Wait for any user input. */ - while (! cdc_consume(0)) - usb_device_tasks(); -} - -void cnidentify() -{ - printf ("console: USB\n"); -} - -int cnopen (dev, flag, mode) - dev_t dev; -{ - register struct tty *tp = &cnttys[0]; - - tp->t_oproc = cnstart; - if ((tp->t_state & TS_ISOPEN) == 0) { - ttychars(tp); - tp->t_state = TS_ISOPEN | TS_CARR_ON; - tp->t_flags = ECHO | XTABS | CRMOD | CRTBS | CRTERA | CTLECH | CRTKIL; - } - if ((tp->t_state & TS_XCLUDE) && u.u_uid != 0) - return (EBUSY); - - return ttyopen (dev, tp); -} - -int cnclose (dev, flag, mode) - dev_t dev; -{ - register struct tty *tp = &cnttys[0]; - - ttywflush(tp); - ttyclose (tp); - return 0; -} - -int cnread (dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - register struct tty *tp = &cnttys[0]; - - return ttread (tp, uio, flag); -} - -int cnwrite (dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - register struct tty *tp = &cnttys[0]; - - return ttwrite (tp, uio, flag); -} - -int cnioctl (dev, cmd, addr, flag) - dev_t dev; - register u_int cmd; - caddr_t addr; -{ - register struct tty *tp = &cnttys[0]; - register int error; - - error = ttioctl (tp, cmd, addr, flag); - if (error < 0) - error = ENOTTY; - return error; -} - -int cnselect (dev, rw) - register dev_t dev; - int rw; -{ - register struct tty *tp = &cnttys[0]; - - return ttyselect (tp, rw); -} - -void cnstart (tp) - register struct tty *tp; -{ - register int s; - - s = spltty(); - if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) { -out: /* Disable transmit_interrupt. */ - led_control (LED_TTY, 0); - splx (s); - return; - } - ttyowake(tp); - if (tp->t_outq.c_cc == 0) - goto out; - if (cdc_is_tx_ready()) { - while (tp->t_outq.c_cc != 0) { - int c = getc (&tp->t_outq); - if (cdc_putc (c) == 0) - break; - } - cdc_tx_service(); - tp->t_state |= TS_BUSY; - } - led_control (LED_TTY, 1); - splx (s); -} - -/* - * Put a symbol on console terminal. - */ -void cnputc (c) - char c; -{ - register int s; - - s = spltty(); - while (! cdc_is_tx_ready()) { - usb_device_tasks(); - cdc_tx_service(); - } - led_control (LED_TTY, 1); -again: - cdc_putc (c); - cdc_tx_service(); - - while (! cdc_is_tx_ready()) { - cdc_tx_service(); - usb_device_tasks(); - } - if (c == '\n') { - c = '\r'; - goto again; - } - - led_control (LED_TTY, 0); - splx (s); -} - -static int getc_data; - -/* - * Receive a character for getc. - */ -static void store_char (int c) -{ - getc_data = (unsigned char) c; -} - -/* - * Receive a symbol from console terminal. - */ -int -cngetc () -{ - register int s; - - s = spltty(); - for (getc_data = -1; getc_data < 0; ) { - usb_device_tasks(); - cdc_consume (store_char); - cdc_tx_service(); - } - splx (s); - return getc_data; -} - -/* - * Receive a character from CDC. - */ -static void cn_rx (int c) -{ - register struct tty *tp = &cnttys[0]; - - if ((tp->t_state & TS_ISOPEN) == 0) - return; - ttyinput (c, tp); -} - -/* - * Check bus status and service USB interrupts. - */ -void cnintr (int chan) -{ - register struct tty *tp = &cnttys[0]; - - // Must call this function from interrupt or periodically. - usb_device_tasks(); - - // Check that USB connection is established. - if (usb_device_state < CONFIGURED_STATE || - (U1PWRC & PIC32_U1PWRC_USUSPEND)) - return; - - // Receive data from user. - cdc_consume (cn_rx); - - if (cdc_is_tx_ready()) { - // Transmitter empty. - led_control (LED_TTY, 0); - - if (tp->t_state & TS_BUSY) { - tp->t_state &= ~TS_BUSY; - ttstart (tp); - } - } - - // Transmit data to user. - cdc_tx_service(); -} - -/* - * USB Callback Functions - */ - -/* - * This function is called when the device becomes initialized. - * It should initialize the endpoints for the device's usage - * according to the current configuration. - */ -void usbcb_init_ep() -{ - cdc_init_ep(); -} - -/* - * Process device-specific SETUP requests. - */ -void usbcb_check_other_req() -{ - cdc_check_request(); -} - -#if 0 -/* - * Wake up a host PC. - */ -void usb_send_resume (void) -{ - /* Start RESUME signaling. */ - U1CON |= PIC32_U1CON_RESUME; - - /* Set RESUME line for 1-13 ms. */ - udelay (5000); - - U1CON &= ~PIC32_U1CON_RESUME; -} -#endif - -#ifndef CONSOLE_VID -# define CONSOLE_VID 0x04D8 // Vendor ID: Microchip -#endif -#ifndef CONSOLE_PID -# define CONSOLE_PID 0x000A // Product ID: CDC RS-232 Emulation Demo -#endif - -/* - * Device Descriptor - */ -const USB_DEVICE_DESCRIPTOR usb_device = { - sizeof(usb_device), // Size of this descriptor in bytes - USB_DESCRIPTOR_DEVICE, // DEVICE descriptor type - 0x0200, // USB Spec Release Number in BCD format - CDC_DEVICE, // Class Code - 0x00, // Subclass code - 0x00, // Protocol code - USB_EP0_BUFF_SIZE, // Max packet size for EP0, see usb_config.h - CONSOLE_VID, // Vendor ID - CONSOLE_PID, // Product ID - 0x0100, // Device release number in BCD format - 0x01, // Manufacturer string index - 0x02, // Product string index - 0x00, // Device serial number string index - 0x01 // Number of possible configurations -}; - -/* - * Configuration 1 Descriptor - */ -const unsigned char usb_config1_descriptor[] = -{ - /* Configuration Descriptor */ - 9, // sizeof(USB_CFG_DSC) - USB_DESCRIPTOR_CONFIGURATION, // CONFIGURATION descriptor type - 67, 0, // Total length of data for this cfg - 2, // Number of interfaces in this cfg - 1, // Index value of this configuration - 0, // Configuration string index - _DEFAULT | _SELF, // Attributes, see usb_device.h - 150, // Max power consumption (2X mA) - - /* Interface Descriptor */ - 9, // sizeof(USB_INTF_DSC) - USB_DESCRIPTOR_INTERFACE, // INTERFACE descriptor type - 0, // Interface Number - 0, // Alternate Setting Number - 1, // Number of endpoints in this intf - COMM_INTF, // Class code - ABSTRACT_CONTROL_MODEL, // Subclass code - V25TER, // Protocol code - 0, // Interface string index - - /* CDC Class-Specific Descriptors */ - sizeof(USB_CDC_HEADER_FN_DSC), - CS_INTERFACE, - DSC_FN_HEADER, - 0x10,0x01, - - sizeof(USB_CDC_ACM_FN_DSC), - CS_INTERFACE, - DSC_FN_ACM, - USB_CDC_ACM_FN_DSC_VAL, - - sizeof(USB_CDC_UNION_FN_DSC), - CS_INTERFACE, - DSC_FN_UNION, - CDC_COMM_INTF_ID, - CDC_DATA_INTF_ID, - - sizeof(USB_CDC_CALL_MGT_FN_DSC), - CS_INTERFACE, - DSC_FN_CALL_MGT, - 0x00, - CDC_DATA_INTF_ID, - - /* Endpoint Descriptor */ - 7, // sizeof(USB_EP_DSC) - USB_DESCRIPTOR_ENDPOINT, // Endpoint Descriptor - _EP02_IN, // EndpointAddress - _INTERRUPT, // Attributes - 0x08, 0x00, // size - 0x02, // Interval - - /* Interface Descriptor */ - 9, // sizeof(USB_INTF_DSC) - USB_DESCRIPTOR_INTERFACE, // INTERFACE descriptor type - 1, // Interface Number - 0, // Alternate Setting Number - 2, // Number of endpoints in this intf - DATA_INTF, // Class code - 0, // Subclass code - NO_PROTOCOL, // Protocol code - 0, // Interface string index - - /* Endpoint Descriptor */ - 7, // sizeof(USB_EP_DSC) - USB_DESCRIPTOR_ENDPOINT, // Endpoint Descriptor - _EP03_OUT, // EndpointAddress - _BULK, // Attributes - 0x40, 0x00, // size - 0x00, // Interval - - /* Endpoint Descriptor */ - 7, // sizeof(USB_EP_DSC) - USB_DESCRIPTOR_ENDPOINT, // Endpoint Descriptor - _EP03_IN, // EndpointAddress - _BULK, // Attributes - 0x40, 0x00, // size - 0x00, // Interval -}; - - -/* - * Language code string descriptor. - */ -static const USB_STRING_INIT(1) string0_descriptor = { - sizeof(string0_descriptor), - USB_DESCRIPTOR_STRING, - { 0x0409 } /* US English */ -}; - -/* - * Manufacturer string descriptor - */ -static const USB_STRING_INIT(25) string1_descriptor = { - sizeof(string1_descriptor), - USB_DESCRIPTOR_STRING, - { 'M','i','c','r','o','c','h','i','p',' ', - 'T','e','c','h','n','o','l','o','g','y', - ' ','I','n','c','.', }, -}; - -/* - * Product string descriptor - */ -static const USB_STRING_INIT(16) string2_descriptor = { - sizeof(string2_descriptor), - USB_DESCRIPTOR_STRING, - { 'R','e','t','r','o','B','S','D',' ','C', - 'o','n','s','o','l','e', }, -}; - -/* - * Array of configuration descriptors - */ -const unsigned char *const usb_config[] = { - (const unsigned char *const) &usb_config1_descriptor, -}; - -/* - * Array of string descriptors - */ -const unsigned char *const usb_string[USB_NUM_STRING_DESCRIPTORS] = { - (const unsigned char *const) &string0_descriptor, - (const unsigned char *const) &string1_descriptor, - (const unsigned char *const) &string2_descriptor, -}; From 496e7ac1680c481f8863b9eaf0003cd9e3fdd62b Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Sat, 5 Sep 2015 16:18:02 -0700 Subject: [PATCH 22/32] New configuration for 32mxsdram board. --- sys/pic32/32mxsdram/Config | 84 ++++++ sys/pic32/32mxsdram/Makefile | 416 ++++++++++++++++++++++++++---- sys/pic32/cfg/bootloader-sdram.ld | 10 + 3 files changed, 457 insertions(+), 53 deletions(-) create mode 100644 sys/pic32/32mxsdram/Config diff --git a/sys/pic32/32mxsdram/Config b/sys/pic32/32mxsdram/Config new file mode 100644 index 0000000..8f25410 --- /dev/null +++ b/sys/pic32/32mxsdram/Config @@ -0,0 +1,84 @@ +# +# 32MXSDRAM board PCB v1.0 with UART console +# =========================================== +# Console on UART3. +# +# To build the kernel, use: +# cd sys/pic32/32mxsdram +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "CUSTOM_32MXSDRAM" # Board type +ldscript "cfg/bootloader-sdram.ld" # Linker script + +# Standard system options +options "HZ=1000" # Rate of timer interrupt +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 +options "NPROC=20" + +# LED +options "LED_KERNEL_PORT=TRISA" # for kernel activity LED... +options "LED_KERNEL_PIN=15" # ...use pin RA15 +options "LED_DISK_PORT=TRISC" # for disk activity LED... +options "LED_DISK_PIN=13" # ...use pin RC13 +options "LED_SWAP_PORT=TRISC" # for swap activity LED... +options "LED_SWAP_PIN=14" # ...use pin RC14 +options "LED_TTY_PORT=TRISA" # for sserial activity LED... +options "LED_TTY_PIN=14" # ...use pin RA14 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + +# Serial UART ports +device uart3 +options "UART3_ENABLED" # TODO: delete this option + +# Console options +options "CONSOLE_DEVICE=tty2" # /dev/tty2 + +# SPI ports +controller spi4 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# sdcard's definition for the SPI port, sdcard's chipselect and high-side power switch +# because of a mod on the board we use power=B13, otherwise it shall be D12 +disk sd0 at spi4 flags 0x63 # select pin RF3 +options "SD0_MHZ=10" # speed 10 MHz +options "SD0_PORT=4" # at spi4 TODO: delete +options "SD0_CS_PORT=TRISF" # for chip select... TODO: use flags +options "SD0_CS_PIN=3" # ...use pin RF3 TODO: use flags +options "SD0_ENA_PORT=TRISB" # for microSD enable... TODO: use flags +options "SD0_ENA_PIN=13" # ...use pin RB13 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 + +# Use SDRAM driver for the external ramdisk +disk sdramp0 # SDRAM on external memory bus +options "SDRAMP_ENABLED" # TODO: delete this option +options "KERNEL_EXECUTABLE_RAM" # allow kernel code in RAM area + +# This defines the swap size and a fs partition size on the external ramdisk. +# When the sa@XXXX is larger than the SWAP_KBYTES, the system will use +# the swap located on the external ramdisk automatically. +# (sd@xxxx + fs@xxxx) <= ramdisk_size +options "PARTITION='sdramp0:sa@2048,fs@14000'" +options "NMOUNT=3" diff --git a/sys/pic32/32mxsdram/Makefile b/sys/pic32/32mxsdram/Makefile index 701f915..ca42007 100644 --- a/sys/pic32/32mxsdram/Makefile +++ b/sys/pic32/32mxsdram/Makefile @@ -1,58 +1,368 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DCUSTOM_32MXSDRAM +PARAM += -DPIC32MX7 +PARAM += -DNMOUNT=3 +PARAM += -DPARTITION='sdramp0:sa@2048,fs@14000' +PARAM += -DKERNEL_EXECUTABLE_RAM +PARAM += -DSDRAMP_ENABLED +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_ENA_PIN=13 +PARAM += -DSD0_ENA_PORT=TRISB +PARAM += -DSD0_CS_PIN=3 +PARAM += -DSD0_CS_PORT=TRISF +PARAM += -DSD0_PORT=4 +PARAM += -DSD0_MHZ=10 +PARAM += -DSPI_ENABLED +PARAM += -DCONSOLE_DEVICE=tty2 +PARAM += -DUART3_ENABLED +PARAM += -DLED_TTY_PIN=14 +PARAM += -DLED_TTY_PORT=TRISA +PARAM += -DLED_SWAP_PIN=14 +PARAM += -DLED_SWAP_PORT=TRISC +PARAM += -DLED_DISK_PIN=13 +PARAM += -DLED_DISK_PORT=TRISC +PARAM += -DLED_KERNEL_PIN=15 +PARAM += -DLED_KERNEL_PORT=TRISA +PARAM += -DNPROC=20 +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DHZ=1000 +LDSCRIPT = "cfg/bootloader-sdram.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 pwm.o rd_sd.o rd_sdramp.o rdisk.o sdram.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 uart.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 vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DADC_ENABLED=YES -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=tty2 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DHZ=1000 -DEFS += -DKERNEL -DEFS += -DKERNEL_EXECUTABLE_RAM -DEFS += -DLED_DISK_PIN=13 -DEFS += -DLED_DISK_PORT=TRISC -DEFS += -DLED_KERNEL_PIN=15 -DEFS += -DLED_KERNEL_PORT=TRISA -DEFS += -DLED_SWAP_PIN=14 -DEFS += -DLED_SWAP_PORT=TRISC -DEFS += -DLED_TTY_PIN=14 -DEFS += -DLED_TTY_PORT=TRISA -DEFS += -DNMOUNT=3 -DEFS += -DNPROC=20 -DEFS += -DPARTITION="sdramp0:sa@2048,fs@14000" -DEFS += -DPIC32MX7 -DEFS += -DPWM_ENABLED=YES -DEFS += -DSD0_CS_PIN=3 -DEFS += -DSD0_CS_PORT=TRISF -DEFS += -DSD0_ENA_PIN=13 -DEFS += -DSD0_ENA_PORT=TRISB -DEFS += -DSD0_MHZ=13 -DEFS += -DSD0_PORT=4 -DEFS += -DSDRAMP_ENABLED=YES -DEFS += -DUART3_BAUD=115200 -DEFS += -DUART3_ENABLED=YES -DEFS += -DUCB_METER +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o rd_sdramp.o sdram.o signal.o spi.o spi_bus.o swap.o \ + sysctl.o uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/rd_sdramp.c $S/pic32/signal.c \ + $S/pic32/spi.c $S/pic32/spi_bus.c $S/pic32/swap.c \ + $S/pic32/sysctl.c $S/pic32/uart.c swapunix.c + +# 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 ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix.elf + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +rd_sdramp.o: $S/pic32/rd_sdramp.c + ${COMPILE_C} + +sdram.o: $S/pic32/sdram.S + ${COMPILE_S} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +uart.o: $S/pic32/uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-sdram.ld - -CONFIG = 32MXSDRAM -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/cfg/bootloader-sdram.ld b/sys/pic32/cfg/bootloader-sdram.ld index c4f29e7..b9da665 100644 --- a/sys/pic32/cfg/bootloader-sdram.ld +++ b/sys/pic32/cfg/bootloader-sdram.ld @@ -14,6 +14,7 @@ MEMORY u0area (rw!x): ORIGIN = 0x800062C0, LENGTH = 3K uarea (rw!x): ORIGIN = 0x80006EC0, LENGTH = 3K keram (rwx) : ORIGIN = 0x80007AC0, LENGTH = 0x540 + devcfg (r) : ORIGIN = 0x9fc02ff0, LENGTH = 16 /* Required by Microchip C32 linker */ kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x80000 @@ -68,6 +69,15 @@ SECTIONS _edata = .; } > ram + /* Device configuration. */ + .config : + { + *(.config3) + *(.config2) + *(.config1) + *(.config0) + } > devcfg + .bss ADDR (.data) + SIZEOF (.data) (NOLOAD) : { __bss_start = .; From ac83afdde8b713041e1e79581c6cf75bac688b07 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 7 Sep 2015 15:30:41 -0700 Subject: [PATCH 23/32] New bare metal kernel configuration. --- sys/pic32/32mxsdram/.gitignore | 3 + sys/pic32/32mxsdram/Makefile | 4 +- sys/pic32/baremetal/.gitignore | 4 +- sys/pic32/baremetal/Config | 65 ++++++ sys/pic32/baremetal/Makefile | 388 +++++++++++++++++++++++++++++---- 5 files changed, 422 insertions(+), 42 deletions(-) create mode 100644 sys/pic32/baremetal/Config diff --git a/sys/pic32/32mxsdram/.gitignore b/sys/pic32/32mxsdram/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/32mxsdram/.gitignore +++ b/sys/pic32/32mxsdram/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/32mxsdram/Makefile b/sys/pic32/32mxsdram/Makefile index ca42007..9f5ba99 100644 --- a/sys/pic32/32mxsdram/Makefile +++ b/sys/pic32/32mxsdram/Makefile @@ -122,6 +122,8 @@ SYSTEM_LD_TAIL = ${SIZE} $@; \ $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ $(OBJDUMP) -d -S $@ > $(basename $@).dis +unix: unix.elf + unix.elf: ${SYSTEM_DEP} swapunix.o ${SYSTEM_LD_HEAD} ${SYSTEM_LD} swapunix.o @@ -130,7 +132,7 @@ unix.elf: ${SYSTEM_DEP} swapunix.o swapunix.o: swapunix.c ${COMPILE_C} -all: unix.elf +all: unix clean: rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys diff --git a/sys/pic32/baremetal/.gitignore b/sys/pic32/baremetal/.gitignore index 60cf8bc..7e25ca8 100644 --- a/sys/pic32/baremetal/.gitignore +++ b/sys/pic32/baremetal/.gitignore @@ -3,8 +3,10 @@ .oldversion machine sys -boot.bin unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/baremetal/Config b/sys/pic32/baremetal/Config new file mode 100644 index 0000000..d6e5987 --- /dev/null +++ b/sys/pic32/baremetal/Config @@ -0,0 +1,65 @@ +# +# Custom board with UART console +# ============================== +# Console on UART1. +# +# To build the kernel, use: +# cd sys/pic32/baremetal +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "BAREMETAL" # Board type +ldscript "cfg/bare.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISD" # for kernel activity LED... +options "LED_KERNEL_PIN=3" # ...use pin RD3 +options "LED_DISK_PORT=TRISD" # for disk activity LED... +options "LED_DISK_PIN=2" # ...use pin RD2 +options "LED_TTY_PORT=TRISD" # for sserial activity LED... +options "LED_TTY_PIN=12" # ...use pin RD12 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + +# Serial UART ports +device uart1 +options "UART1_ENABLED" # TODO: delete this option + +# Console options +options "CONSOLE_DEVICE=tty0" # /dev/tty0 + +# SPI ports +controller spi2 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# SD card +disk sd0 at spi2 flags 0x41 # select pin RD1 +options "SD0_MHZ=16" # speed 16 MHz +options "SD0_PORT=2" # at spi2 TODO: delete +options "SD0_CS_PORT=TRISD" # for chip select... TODO: use flags +options "SD0_CS_PIN=1" # ...use pin RD1 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 diff --git a/sys/pic32/baremetal/Makefile b/sys/pic32/baremetal/Makefile index 9605724..3839e7b 100644 --- a/sys/pic32/baremetal/Makefile +++ b/sys/pic32/baremetal/Makefile @@ -1,45 +1,353 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DBAREMETAL +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=1 +PARAM += -DSD0_CS_PORT=TRISD +PARAM += -DSD0_PORT=2 +PARAM += -DSD0_MHZ=16 +PARAM += -DSPI_ENABLED +PARAM += -DCONSOLE_DEVICE=tty0 +PARAM += -DUART1_ENABLED +PARAM += -DLED_TTY_PIN=12 +PARAM += -DLED_TTY_PORT=TRISD +PARAM += -DLED_DISK_PIN=2 +PARAM += -DLED_DISK_PORT=TRISD +PARAM += -DLED_KERNEL_PIN=3 +PARAM += -DLED_KERNEL_PORT=TRISD +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +LDSCRIPT = "cfg/bare.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -KERNOBJ += clock.o cons.o devsw.o exception.o exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 uart.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 vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=tty0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=2 -DEFS += -DLED_DISK_PORT=TRISD -DEFS += -DLED_KERNEL_PIN=3 -DEFS += -DLED_KERNEL_PORT=TRISD -DEFS += -DLED_TTY_PIN=12 -DEFS += -DLED_TTY_PORT=TRISD -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=1 -DEFS += -DSD0_CS_PORT=TRISD -DEFS += -DSD0_MHZ=16 -DEFS += -DSD0_PORT=2 -DEFS += -DUART1_BAUD=115200 -DEFS += -DUART1_ENABLED=YES -DEFS += -DUCB_METER +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/uart.c swapunix.c + +# 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 ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +uart.o: $S/pic32/uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bare.ld - -CONFIG = BAREMETAL -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif From f17fa5a11691a4fa1d66dca2c5c531dce084c083 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 7 Sep 2015 15:40:17 -0700 Subject: [PATCH 24/32] New kernel configuration for Explorer16 board. --- sys/pic32/32mxsdram/Config | 2 +- sys/pic32/baremetal/Config | 2 +- sys/pic32/explorer16/.gitignore | 4 +- sys/pic32/explorer16/Config | 67 ++++++ sys/pic32/explorer16/Makefile | 393 ++++++++++++++++++++++++++++---- 5 files changed, 422 insertions(+), 46 deletions(-) create mode 100644 sys/pic32/explorer16/Config diff --git a/sys/pic32/32mxsdram/Config b/sys/pic32/32mxsdram/Config index 8f25410..2a14747 100644 --- a/sys/pic32/32mxsdram/Config +++ b/sys/pic32/32mxsdram/Config @@ -31,7 +31,7 @@ options "LED_DISK_PORT=TRISC" # for disk activity LED... options "LED_DISK_PIN=13" # ...use pin RC13 options "LED_SWAP_PORT=TRISC" # for swap activity LED... options "LED_SWAP_PIN=14" # ...use pin RC14 -options "LED_TTY_PORT=TRISA" # for sserial activity LED... +options "LED_TTY_PORT=TRISA" # for serial activity LED... options "LED_TTY_PIN=14" # ...use pin RA14 # Root filesystem at /dev/sd0a, swap at /dev/sd0b diff --git a/sys/pic32/baremetal/Config b/sys/pic32/baremetal/Config index d6e5987..1b0b05d 100644 --- a/sys/pic32/baremetal/Config +++ b/sys/pic32/baremetal/Config @@ -27,7 +27,7 @@ options "LED_KERNEL_PORT=TRISD" # for kernel activity LED... options "LED_KERNEL_PIN=3" # ...use pin RD3 options "LED_DISK_PORT=TRISD" # for disk activity LED... options "LED_DISK_PIN=2" # ...use pin RD2 -options "LED_TTY_PORT=TRISD" # for sserial activity LED... +options "LED_TTY_PORT=TRISD" # for serial activity LED... options "LED_TTY_PIN=12" # ...use pin RD12 # Root filesystem at /dev/sd0a, swap at /dev/sd0b diff --git a/sys/pic32/explorer16/.gitignore b/sys/pic32/explorer16/.gitignore index 2b28c2d..7e25ca8 100644 --- a/sys/pic32/explorer16/.gitignore +++ b/sys/pic32/explorer16/.gitignore @@ -4,7 +4,9 @@ machine sys unix.bin -boot.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/explorer16/Config b/sys/pic32/explorer16/Config new file mode 100644 index 0000000..6885508 --- /dev/null +++ b/sys/pic32/explorer16/Config @@ -0,0 +1,67 @@ +# +# Microchip Explorer16 board with SD card expansion module +# ======================================================== +# Console on UART2. +# +# To build the kernel, use: +# cd sys/pic32/explorer16 +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "EXPLORER16" # Board type +ldscript "cfg/bare.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_DISK_PORT=TRISA" # for disk activity LED... +options "LED_DISK_PIN=0" # ...use pin RA0 +options "LED_KERNEL_PORT=TRISA" # for kernel activity LED... +options "LED_KERNEL_PIN=1" # ...use pin RA1 +options "LED_TTY_PORT=TRISA" # for serial activity LED... +options "LED_TTY_PIN=2" # ...use pin RA2 +options "LED_SWAP_PORT=TRISA" # for swap activity LED... +options "LED_SWAP_PIN=3" # ...use pin RA3 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + +# Serial UART ports +device uart2 +options "UART2_ENABLED" # TODO: delete this option + +# Console options +options "CONSOLE_DEVICE=tty1" # /dev/tty1 + +# SPI ports +controller spi1 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# SD card +disk sd0 at spi1 flags 0x21 # select pin RB1 +options "SD0_MHZ=10" # speed 10 MHz +options "SD0_PORT=1" # at spi1 TODO: delete +options "SD0_CS_PORT=TRISB" # for chip select... TODO: use flags +options "SD0_CS_PIN=1" # ...use pin RB1 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 diff --git a/sys/pic32/explorer16/Makefile b/sys/pic32/explorer16/Makefile index cc3b2b4..fc9516d 100644 --- a/sys/pic32/explorer16/Makefile +++ b/sys/pic32/explorer16/Makefile @@ -1,48 +1,355 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DEXPLORER16 +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=1 +PARAM += -DSD0_CS_PORT=TRISB +PARAM += -DSD0_PORT=1 +PARAM += -DSD0_MHZ=10 +PARAM += -DSPI_ENABLED +PARAM += -DCONSOLE_DEVICE=tty1 +PARAM += -DUART2_ENABLED +PARAM += -DLED_SWAP_PIN=3 +PARAM += -DLED_SWAP_PORT=TRISA +PARAM += -DLED_TTY_PIN=2 +PARAM += -DLED_TTY_PORT=TRISA +PARAM += -DLED_KERNEL_PIN=1 +PARAM += -DLED_KERNEL_PORT=TRISA +PARAM += -DLED_DISK_PIN=0 +PARAM += -DLED_DISK_PORT=TRISA +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +LDSCRIPT = "cfg/bare.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 uart.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 vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o -EXTRA_TARGETS = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=tty1 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=0 -DEFS += -DLED_DISK_PORT=TRISA -DEFS += -DLED_KERNEL_PIN=1 -DEFS += -DLED_KERNEL_PORT=TRISA -DEFS += -DLED_SWAP_PIN=3 -DEFS += -DLED_SWAP_PORT=TRISA -DEFS += -DLED_TTY_PIN=2 -DEFS += -DLED_TTY_PORT=TRISA -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=1 -DEFS += -DSD0_CS_PORT=TRISB -DEFS += -DSD0_MHZ=10 -DEFS += -DSD0_PORT=1 -DEFS += -DUART2_BAUD=115200 -DEFS += -DUART2_ENABLED=YES -DEFS += -DUCB_METER +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/uart.c swapunix.c + +# 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 ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +uart.o: $S/pic32/uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bare.ld - -CONFIG = EXPLORER16 -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif From bbaa00df52299ca8395c87cda641f17a3adb45f6 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 7 Sep 2015 15:46:13 -0700 Subject: [PATCH 25/32] New kernel configuration for starter kit board. --- sys/pic32/starter-kit/.gitignore | 3 + sys/pic32/starter-kit/Config | 65 +++++ sys/pic32/starter-kit/Makefile | 395 +++++++++++++++++++++++++++---- 3 files changed, 423 insertions(+), 40 deletions(-) create mode 100644 sys/pic32/starter-kit/Config diff --git a/sys/pic32/starter-kit/.gitignore b/sys/pic32/starter-kit/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/starter-kit/.gitignore +++ b/sys/pic32/starter-kit/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/starter-kit/Config b/sys/pic32/starter-kit/Config new file mode 100644 index 0000000..c8febc0 --- /dev/null +++ b/sys/pic32/starter-kit/Config @@ -0,0 +1,65 @@ +# +# Microchip PIC32MX Ethernet/USB Starter Kit +# with I/O Expansion board and SD card pictail module +# =================================================== +# Console on USB. +# +# To build the kernel, use: +# cd sys/pic32/explorer16 +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "STARTERKIT" # Board type +ldscript "cfg/bare.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_DISK_PORT=TRISD" # for disk activity LED... +options "LED_DISK_PIN=1" # ...use pin RD1 +options "LED_KERNEL_PORT=TRISD" # for kernel activity LED... +options "LED_KERNEL_PIN=2" # ...use pin RD2 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# SPI ports +controller spi1 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# SD card +disk sd0 at spi1 flags 0x21 # select pin RB1 +options "SD0_PORT=1" # at spi1 TODO: delete +options "SD0_CS_PORT=TRISB" # for chip select... TODO: use flags +options "SD0_CS_PIN=1" # ...use pin RB1 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 diff --git a/sys/pic32/starter-kit/Makefile b/sys/pic32/starter-kit/Makefile index ed46173..8244394 100644 --- a/sys/pic32/starter-kit/Makefile +++ b/sys/pic32/starter-kit/Makefile @@ -1,45 +1,360 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DSTARTERKIT +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=1 +PARAM += -DSD0_CS_PORT=TRISB +PARAM += -DSD0_PORT=1 +PARAM += -DSPI_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_KERNEL_PIN=2 +PARAM += -DLED_KERNEL_PORT=TRISD +PARAM += -DLED_DISK_PIN=1 +PARAM += -DLED_DISK_PORT=TRISD +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +LDSCRIPT = "cfg/bare.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 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 = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DADC_ENABLED=YES -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ='CPU_KHZ/BUS_DIV' -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ='((CRYSTAL*1000)/CPU_IDIV*CPU_MUL/CPU_ODIV)' -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=1 -DEFS += -DLED_DISK_PORT=TRISD -DEFS += -DLED_KERNEL_PIN=2 -DEFS += -DLED_KERNEL_PORT=TRISD -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=1 -DEFS += -DSD0_CS_PORT=TRISB -DEFS += -DSD0_PORT=1 -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o usb_device.o \ + usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/usb_device.c $S/pic32/usb_function_cdc.c \ + $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader.ld - -CONFIG = STARTER-KIT -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif From 6facb3f56df39c2af51d39893dbb418812fd699b Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 7 Sep 2015 16:02:39 -0700 Subject: [PATCH 26/32] New configurations for maximite and maximite-color boards. --- sys/pic32/maximite-color/.gitignore | 3 + sys/pic32/maximite-color/Config | 65 +++++ sys/pic32/maximite-color/Makefile | 396 +++++++++++++++++++++++++--- sys/pic32/maximite/.gitignore | 3 + sys/pic32/maximite/Config | 66 +++++ sys/pic32/maximite/Makefile | 396 +++++++++++++++++++++++++--- sys/pic32/maximite/kbd.h | 20 -- 7 files changed, 849 insertions(+), 100 deletions(-) create mode 100644 sys/pic32/maximite-color/Config create mode 100644 sys/pic32/maximite/Config delete mode 100644 sys/pic32/maximite/kbd.h diff --git a/sys/pic32/maximite-color/.gitignore b/sys/pic32/maximite-color/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/maximite-color/.gitignore +++ b/sys/pic32/maximite-color/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/maximite-color/Config b/sys/pic32/maximite-color/Config new file mode 100644 index 0000000..d0f6162 --- /dev/null +++ b/sys/pic32/maximite-color/Config @@ -0,0 +1,65 @@ +# +# Colour Maximite Computer +# ======================== +# Console on USB. +# +# To build the kernel, use: +# cd sys/pic32/maximite +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "MAXIMITE" # Board type +ldscript "cfg/bootloader-maxcolor.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISE" # for kernel activity LED... +options "LED_KERNEL_PIN=0" # ...use pin RE0... +options "LED_KERNEL_INVERT" # ...inverted +options "LED_DISK_PORT=TRISE" # for disk activity LED... +options "LED_DISK_PIN=1" # ...use pin RE1 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# SPI ports +controller spi4 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi4 flags 0x11 # select pin RA1 +options "SD0_PORT=4" # at spi3 TODO: delete +options "SD0_CS_PORT=TRISA" # for chip select... TODO: use flags +options "SD0_CS_PIN=1" # ...use pin RA1 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 diff --git a/sys/pic32/maximite-color/Makefile b/sys/pic32/maximite-color/Makefile index 39866d1..b8d37a3 100644 --- a/sys/pic32/maximite-color/Makefile +++ b/sys/pic32/maximite-color/Makefile @@ -1,45 +1,361 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DMAXIMITE +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=1 +PARAM += -DSD0_CS_PORT=TRISA +PARAM += -DSD0_PORT=4 +PARAM += -DSPI_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_DISK_PIN=1 +PARAM += -DLED_DISK_PORT=TRISE +PARAM += -DLED_KERNEL_INVERT +PARAM += -DLED_KERNEL_PIN=0 +PARAM += -DLED_KERNEL_PORT=TRISE +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +LDSCRIPT = "cfg/bootloader-maxcolor.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ='CPU_KHZ/BUS_DIV' -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ='((CRYSTAL*1000)/CPU_IDIV*CPU_MUL/CPU_ODIV)' -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=1 -DEFS += -DLED_DISK_PORT=TRISE -DEFS += -DLED_KERNEL_INVERT=YES -DEFS += -DLED_KERNEL_PIN=0 -DEFS += -DLED_KERNEL_PORT=TRISE -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=1 -DEFS += -DSD0_CS_PORT=TRISA -DEFS += -DSD0_PORT=4 -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o usb_device.o \ + usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/usb_device.c $S/pic32/usb_function_cdc.c \ + $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-maxcolor.ld - -CONFIG = MAXIMITE-COLOR -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/maximite/.gitignore b/sys/pic32/maximite/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/maximite/.gitignore +++ b/sys/pic32/maximite/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/maximite/Config b/sys/pic32/maximite/Config new file mode 100644 index 0000000..de10824 --- /dev/null +++ b/sys/pic32/maximite/Config @@ -0,0 +1,66 @@ +# +# Maximite Computer (Original) +# ============================ +# Console on USB. +# For details, see https://github.com/RetroBSD/retrobsd/wiki/Board-Geoffs-Maximite +# +# To build the kernel, use: +# cd sys/pic32/maximite +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "MAXIMITE" # Board type +ldscript "cfg/bootloader-maximite.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISF" # for kernel activity LED... +options "LED_KERNEL_PIN=0" # ...use pin RF0... +options "LED_KERNEL_INVERT" # ...inverted +options "LED_DISK_PORT=TRISE" # for disk activity LED... +options "LED_DISK_PIN=1" # ...use pin RE1 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# SPI ports +controller spi4 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi4 flags 0x50 # select pin RE0 +options "SD0_PORT=4" # at spi3 TODO: delete +options "SD0_CS_PORT=TRISE" # for chip select... TODO: use flags +options "SD0_CS_PIN=0" # ...use pin RE0 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 diff --git a/sys/pic32/maximite/Makefile b/sys/pic32/maximite/Makefile index dbb7a20..646fdb7 100644 --- a/sys/pic32/maximite/Makefile +++ b/sys/pic32/maximite/Makefile @@ -1,45 +1,361 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DMAXIMITE +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=0 +PARAM += -DSD0_CS_PORT=TRISE +PARAM += -DSD0_PORT=4 +PARAM += -DSPI_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_DISK_PIN=1 +PARAM += -DLED_DISK_PORT=TRISE +PARAM += -DLED_KERNEL_INVERT +PARAM += -DLED_KERNEL_PIN=0 +PARAM += -DLED_KERNEL_PORT=TRISF +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +LDSCRIPT = "cfg/bootloader-maximite.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ='CPU_KHZ/BUS_DIV' -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ='((CRYSTAL*1000)/CPU_IDIV*CPU_MUL/CPU_ODIV)' -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_DISK_PIN=1 -DEFS += -DLED_DISK_PORT=TRISE -DEFS += -DLED_KERNEL_INVERT=YES -DEFS += -DLED_KERNEL_PIN=0 -DEFS += -DLED_KERNEL_PORT=TRISF -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=0 -DEFS += -DSD0_CS_PORT=TRISE -DEFS += -DSD0_PORT=4 -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o usb_device.o \ + usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/usb_device.c $S/pic32/usb_function_cdc.c \ + $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-maximite.ld - -CONFIG = MAXIMITE -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/sys/pic32/maximite/kbd.h b/sys/pic32/maximite/kbd.h deleted file mode 100644 index ae49092..0000000 --- a/sys/pic32/maximite/kbd.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * RetroBSD - PS2 keyboard driver for the Maximite PIC32 board - * - * Copyright (C) 2011 Rob Judd - * All rights reserved. The three clause ("New" or "Modified") - * Berkeley software License Agreement specifies the terms and - * conditions for redistribution. - * - */ - -#ifndef __KBD_H__ -#define __KBD_H__ - - -extern char init_kbd(void); -extern void read_kbd(void); -extern char write_kbd(u_char data); - -#endif // __KBD_H__ From 137963240e28e4b73421ed370a2348371ccc707e Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 7 Sep 2015 16:12:00 -0700 Subject: [PATCH 27/32] New kernel configuration for SDXL board. --- sys/pic32/{maximite => }/kbd.c | 0 sys/pic32/kbd.h | 20 ++ sys/pic32/maximite-color/Config | 2 +- sys/pic32/sdxl/.gitignore | 3 + sys/pic32/sdxl/Config | 68 ++++++ sys/pic32/sdxl/Makefile | 397 ++++++++++++++++++++++++++++---- 6 files changed, 449 insertions(+), 41 deletions(-) rename sys/pic32/{maximite => }/kbd.c (100%) create mode 100644 sys/pic32/kbd.h create mode 100644 sys/pic32/sdxl/Config diff --git a/sys/pic32/maximite/kbd.c b/sys/pic32/kbd.c similarity index 100% rename from sys/pic32/maximite/kbd.c rename to sys/pic32/kbd.c diff --git a/sys/pic32/kbd.h b/sys/pic32/kbd.h new file mode 100644 index 0000000..ae49092 --- /dev/null +++ b/sys/pic32/kbd.h @@ -0,0 +1,20 @@ +/* + * + * RetroBSD - PS2 keyboard driver for the Maximite PIC32 board + * + * Copyright (C) 2011 Rob Judd + * All rights reserved. The three clause ("New" or "Modified") + * Berkeley software License Agreement specifies the terms and + * conditions for redistribution. + * + */ + +#ifndef __KBD_H__ +#define __KBD_H__ + + +extern char init_kbd(void); +extern void read_kbd(void); +extern char write_kbd(u_char data); + +#endif // __KBD_H__ diff --git a/sys/pic32/maximite-color/Config b/sys/pic32/maximite-color/Config index d0f6162..abc4a69 100644 --- a/sys/pic32/maximite-color/Config +++ b/sys/pic32/maximite-color/Config @@ -14,7 +14,7 @@ # architecture "pic32" cpu "PIC32MX7" # Processor variant -board "MAXIMITE" # Board type +board "MAXIMITE_COLOR" # Board type ldscript "cfg/bootloader-maxcolor.ld" # Linker script # Standard system options diff --git a/sys/pic32/sdxl/.gitignore b/sys/pic32/sdxl/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/sdxl/.gitignore +++ b/sys/pic32/sdxl/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/sdxl/Config b/sys/pic32/sdxl/Config new file mode 100644 index 0000000..1d67dd6 --- /dev/null +++ b/sys/pic32/sdxl/Config @@ -0,0 +1,68 @@ +# +# Majenko SDXL board +# ================== +# Ardiuno-compatible bootloader. +# Console on USB. +# LED at pin E7 (label 23). +# +# To build the kernel, use: +# cd sys/pic32/sdxl +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "SDXL" # Board type +ldscript "cfg/bootloader-max32.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISE" # for kernel activity LED... +options "LED_KERNEL_PIN=7" # ...use pin RE7 + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# SPI ports +controller spi2 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi2 flags 0x79 # select pin RG9 +options "SD0_PORT=2" # sd0 at spi2 TODO: delete +options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags +options "SD0_CS_PIN=9" # ...use pin RA9 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 + +# GLCD driver +device glcd0 +options "GLCD_ENABLED" # TODO: delete this option diff --git a/sys/pic32/sdxl/Makefile b/sys/pic32/sdxl/Makefile index 6baf2eb..37e16e0 100644 --- a/sys/pic32/sdxl/Makefile +++ b/sys/pic32/sdxl/Makefile @@ -1,45 +1,362 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DSDXL +PARAM += -DPIC32MX7 +PARAM += -DGLCD_ENABLED +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=9 +PARAM += -DSD0_CS_PORT=TRISG +PARAM += -DSD0_PORT=2 +PARAM += -DSPI_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_KERNEL_PIN=7 +PARAM += -DLED_KERNEL_PORT=TRISE +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +LDSCRIPT = "cfg/bootloader-max32.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 glcd.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 pwm.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 = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DADC_ENABLED=YES -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ=80000 -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ=80000 -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGLCD_ENABLED=YES -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_KERNEL_PIN=7 -DEFS += -DLED_KERNEL_PORT=TRISE -DEFS += -DPIC32MX7 -DEFS += -DPWM_ENABLED=YES -DEFS += -DSD0_CS_PIN=9 -DEFS += -DSD0_CS_PORT=TRISG -DEFS += -DSD0_PORT=2 -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o glcd.o gpio.o machdep.o mem.o \ + pwm.o rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o \ + usb_device.o usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/glcd.c $S/pic32/gpio.c $S/pic32/machdep.c \ + $S/pic32/mem.c $S/pic32/pwm.c $S/pic32/rd_sd.c $S/pic32/signal.c \ + $S/pic32/spi.c $S/pic32/spi_bus.c $S/pic32/swap.c \ + $S/pic32/sysctl.c $S/pic32/usb_device.c \ + $S/pic32/usb_function_cdc.c $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +glcd.o: $S/pic32/glcd.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-max32.ld - -CONFIG = SDXL -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif From 85300993b91ae8d24ebd26c10ed00c7366dc020b Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 7 Sep 2015 16:17:49 -0700 Subject: [PATCH 28/32] New configuration for Olimex Pinguino-Micro board. --- sys/pic32/pinguino-micro/.gitignore | 3 + sys/pic32/pinguino-micro/Config | 63 +++++ sys/pic32/pinguino-micro/Makefile | 393 +++++++++++++++++++++++++--- 3 files changed, 420 insertions(+), 39 deletions(-) create mode 100644 sys/pic32/pinguino-micro/Config diff --git a/sys/pic32/pinguino-micro/.gitignore b/sys/pic32/pinguino-micro/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/pinguino-micro/.gitignore +++ b/sys/pic32/pinguino-micro/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/pinguino-micro/Config b/sys/pic32/pinguino-micro/Config new file mode 100644 index 0000000..5ff9493 --- /dev/null +++ b/sys/pic32/pinguino-micro/Config @@ -0,0 +1,63 @@ +# +# Olimex Pinguino-Micro board with PIC32MX795 processor +# ===================================================== +# Console on USB. +# +# To build the kernel, use: +# cd sys/pic32/pinguino-micro +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "PINGUINO_MICRO" # Board type +ldscript "cfg/bootloader-maximite.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISD" # for kernel activity LED... +options "LED_KERNEL_PIN=1" # ...use pin RD1 +options "LED_KERNEL_INVERT" # ...inverted + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# SPI ports +controller spi2 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi2 flags 0x2d # select pin RB13 +options "SD0_PORT=2" # at spi2 TODO: delete +options "SD0_CS_PORT=TRISB" # for chip select... TODO: use flags +options "SD0_CS_PIN=13" # ...use pin RB13 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 diff --git a/sys/pic32/pinguino-micro/Makefile b/sys/pic32/pinguino-micro/Makefile index 256d658..8d35324 100644 --- a/sys/pic32/pinguino-micro/Makefile +++ b/sys/pic32/pinguino-micro/Makefile @@ -1,44 +1,359 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DPINGUINO_MICRO +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=13 +PARAM += -DSD0_CS_PORT=TRISB +PARAM += -DSD0_PORT=2 +PARAM += -DSPI_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_KERNEL_INVERT +PARAM += -DLED_KERNEL_PIN=1 +PARAM += -DLED_KERNEL_PORT=TRISD +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +LDSCRIPT = "cfg/bootloader-maximite.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 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 = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DADC_ENABLED=YES -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ='CPU_KHZ/BUS_DIV' -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ='((CRYSTAL*1000)/CPU_IDIV*CPU_MUL/CPU_ODIV)' -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_KERNEL_INVERT=YES -DEFS += -DLED_KERNEL_PIN=1 -DEFS += -DLED_KERNEL_PORT=TRISD -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=13 -DEFS += -DSD0_CS_PORT=TRISB -DEFS += -DSD0_PORT=2 -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o usb_device.o \ + usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/usb_device.c $S/pic32/usb_function_cdc.c \ + $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader-maximite.ld - -CONFIG = PINGUINO-MICRO -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif From 3678ba6aee52e7dee7278e288be7f107338754f0 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 7 Sep 2015 17:13:10 -0700 Subject: [PATCH 29/32] New configuration for MMB-MX7 board. --- sys/pic32/mmb-mx7/.gitignore | 3 + sys/pic32/mmb-mx7/Config | 76 +++++++ sys/pic32/mmb-mx7/Makefile | 416 ++++++++++++++++++++++++++++++----- 3 files changed, 446 insertions(+), 49 deletions(-) create mode 100644 sys/pic32/mmb-mx7/Config diff --git a/sys/pic32/mmb-mx7/.gitignore b/sys/pic32/mmb-mx7/.gitignore index 6a22af6..7e25ca8 100644 --- a/sys/pic32/mmb-mx7/.gitignore +++ b/sys/pic32/mmb-mx7/.gitignore @@ -7,3 +7,6 @@ unix.bin unix.map usbboot.map vers.c +*.h +ioconf.c +swapunix.c diff --git a/sys/pic32/mmb-mx7/Config b/sys/pic32/mmb-mx7/Config new file mode 100644 index 0000000..c8318bc --- /dev/null +++ b/sys/pic32/mmb-mx7/Config @@ -0,0 +1,76 @@ +# +# Board: MMB for PIC32MX7, by MikroElektronika +# ================================== +# Console on USB. +# +# To build the kernel, use: +# cd sys/pic32/mmb-mx7 +# kconfig Config +# make clean +# make +# +# Format of this file is described on page: +# http://retrobsd.org/wiki/doku.php/doc/kconfig +# +architecture "pic32" +cpu "PIC32MX7" # Processor variant +board "MMB_MX7" # Board type +ldscript "cfg/bootloader.ld" # Linker script + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "BUS_KHZ=80000" # Frequency of peripheral bus +options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 + +# LED +options "LED_KERNEL_PORT=TRISA" # for kernel activity LED... +options "LED_KERNEL_PIN=0" # ...use pin RA0... +options "LED_KERNEL_INVERT" # ...inverted +options "LED_SWAP_PORT=TRISD" # for swap activity LED... +options "LED_SWAP_PIN=9" # ...use pin RD9... +options "LED_SWAP_INVERT" # ...inverted +options "LED_TTY_PORT=TRISA" # for console activity LED... +options "LED_TTY_PIN=1" # ...use pin RA1... +options "LED_TTY_INVERT" # ...inverted + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on sd0a + swap on sd0b + +# Console options +options "CONSOLE_DEVICE=ttyUSB0" # Console on USB + +# Virtual UART on USB +pseudo-device uartusb +options "UARTUSB_ENABLED" # TODO: delete this option +options "USB_MAX_EP_NUMBER=3" +options "USB_NUM_STRING_DESCRIPTORS=3" + +# Serial UART ports +device uart1 # RS-232 port +options "UART1_ENABLED" # TODO: delete this option + +# SPI ports +controller spi1 # SD card +options "SPI_ENABLED" # TODO: delete this option + +# microSD card +disk sd0 at spi1 flags 0x19 # select pin RA9 +options "SD0_PORT=1" # sd0 at spi1 TODO: delete +options "SD0_MHZ=8" # speed 8 MHz +options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: use flags +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags + +# General purpose I/O ports +device gpio0 +options "GPIO_ENABLED" # TODO: delete this option +options "GPIO_CLEAR_PORT=TRISD" # clear on startup... +options "GPIO_CLEAR_PIN=2" # ...pin RD2 + +# ADC driver +device adc0 +options "ADC_ENABLED" # TODO: delete this option + +# PWM driver +device pwm0 +options "PWM_ENABLED" # TODO: delete this option diff --git a/sys/pic32/mmb-mx7/Makefile b/sys/pic32/mmb-mx7/Makefile index b738a62..114574e 100644 --- a/sys/pic32/mmb-mx7/Makefile +++ b/sys/pic32/mmb-mx7/Makefile @@ -1,54 +1,372 @@ -BUILDPATH = ../../../tools/configsys/../../sys/pic32 -H = ../../../tools/configsys/../../sys/include -M = ../../../tools/configsys/../../sys/pic32 -S = ../../../tools/configsys/../../sys/kernel +PARAM = -DMMB_MX7 +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_CLEAR_PIN=2 +PARAM += -DGPIO_CLEAR_PORT=TRISD +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=9 +PARAM += -DSD0_CS_PORT=TRISA +PARAM += -DSD0_MHZ=8 +PARAM += -DSD0_PORT=1 +PARAM += -DSPI_ENABLED +PARAM += -DUART1_ENABLED +PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 +PARAM += -DUSB_MAX_EP_NUMBER=3 +PARAM += -DUARTUSB_ENABLED +PARAM += -DCONSOLE_DEVICE=ttyUSB0 +PARAM += -DLED_TTY_INVERT +PARAM += -DLED_TTY_PIN=1 +PARAM += -DLED_TTY_PORT=TRISA +PARAM += -DLED_SWAP_INVERT +PARAM += -DLED_SWAP_PIN=9 +PARAM += -DLED_SWAP_PORT=TRISD +PARAM += -DLED_KERNEL_INVERT +PARAM += -DLED_KERNEL_PIN=0 +PARAM += -DLED_KERNEL_PORT=TRISA +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +LDSCRIPT = "cfg/bootloader.ld" +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) +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 ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump -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 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 uart.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 = +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif -DEFS += -DADC_ENABLED=YES -DEFS += -DBUS_DIV=1 -DEFS += -DBUS_KHZ='CPU_KHZ/BUS_DIV' -DEFS += -DCONSOLE_DEVICE=ttyUSB0 -DEFS += -DCPU_IDIV=2 -DEFS += -DCPU_KHZ='((CRYSTAL*1000)/CPU_IDIV*CPU_MUL/CPU_ODIV)' -DEFS += -DCPU_MUL=20 -DEFS += -DCPU_ODIV=1 -DEFS += -DCRYSTAL=8 -DEFS += -DEXEC_AOUT -DEFS += -DEXEC_ELF -DEFS += -DEXEC_SCRIPT -DEFS += -DGPIO_CLEAR_PIN=2 -DEFS += -DGPIO_CLEAR_PORT=TRISD -DEFS += -DGPIO_ENABLED=YES -DEFS += -DKERNEL -DEFS += -DLED_KERNEL_INVERT=YES -DEFS += -DLED_KERNEL_PIN=0 -DEFS += -DLED_KERNEL_PORT=TRISA -DEFS += -DLED_SWAP_INVERT=YES -DEFS += -DLED_SWAP_PIN=9 -DEFS += -DLED_SWAP_PORT=TRISD -DEFS += -DLED_TTY_INVERT=YES -DEFS += -DLED_TTY_PIN=1 -DEFS += -DLED_TTY_PORT=TRISA -DEFS += -DPIC32MX7 -DEFS += -DSD0_CS_PIN=9 -DEFS += -DSD0_CS_PORT=TRISA -DEFS += -DSD0_MHZ=8 -DEFS += -DSD0_PORT=1 -DEFS += -DUART1_ENABLED=YES -DEFS += -DUARTUSB_ENABLED=YES -DEFS += -DUCB_METER -DEFS += -DUSB_MAX_EP_NUMBER=3 -DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.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 rdisk.o \ + subr_prf.o subr_rmap.o sys_generic.o sys_inode.o sys_pipe.o \ + sys_process.o syscalls.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 vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o adc.o \ + clock.o cons.o devsw.o exception.o gpio.o machdep.o mem.o pwm.o \ + rd_sd.o signal.o spi.o spi_bus.o swap.o sysctl.o uart.o \ + usb_device.o usb_function_cdc.o usb_uart.o + +CFILES = $S/kernel/exec_aout.c $S/kernel/exec_conf.c $S/kernel/exec_elf.c \ + $S/kernel/exec_script.c $S/kernel/exec_subr.c \ + $S/kernel/init_main.c $S/kernel/init_sysent.c \ + $S/kernel/kern_clock.c $S/kernel/kern_descrip.c \ + $S/kernel/kern_exec.c $S/kernel/kern_exit.c \ + $S/kernel/kern_fork.c $S/kernel/kern_mman.c \ + $S/kernel/kern_proc.c $S/kernel/kern_prot.c \ + $S/kernel/kern_prot2.c $S/kernel/kern_resource.c \ + $S/kernel/kern_sig.c $S/kernel/kern_sig2.c $S/kernel/kern_subr.c \ + $S/kernel/kern_synch.c $S/kernel/kern_sysctl.c \ + $S/kernel/kern_time.c $S/kernel/rdisk.c $S/kernel/subr_prf.c \ + $S/kernel/subr_rmap.c $S/kernel/sys_generic.c \ + $S/kernel/sys_inode.c $S/kernel/sys_pipe.c \ + $S/kernel/sys_process.c $S/kernel/syscalls.c $S/kernel/tty.c \ + $S/kernel/tty_subr.c $S/kernel/tty_tty.c $S/kernel/ufs_alloc.c \ + $S/kernel/ufs_bio.c $S/kernel/ufs_bmap.c $S/kernel/ufs_dsort.c \ + $S/kernel/ufs_fio.c $S/kernel/ufs_inode.c $S/kernel/ufs_mount.c \ + $S/kernel/ufs_namei.c $S/kernel/ufs_subr.c \ + $S/kernel/ufs_syscalls.c $S/kernel/ufs_syscalls2.c \ + $S/kernel/vfs_vnops.c $S/kernel/vm_sched.c $S/kernel/vm_swap.c \ + $S/kernel/vm_swp.c $S/pic32/adc.c $S/pic32/clock.c \ + $S/pic32/cons.c $S/pic32/devsw.c $S/pic32/exception.c \ + $S/pic32/gpio.c $S/pic32/machdep.c $S/pic32/mem.c $S/pic32/pwm.c \ + $S/pic32/rd_sd.c $S/pic32/signal.c $S/pic32/spi.c \ + $S/pic32/spi_bus.c $S/pic32/swap.c $S/pic32/sysctl.c \ + $S/pic32/uart.c $S/pic32/usb_device.c \ + $S/pic32/usb_function_cdc.c $S/pic32/usb_uart.c swapunix.c + +# 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 ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +unix: unix.elf + +unix.elf: ${SYSTEM_DEP} swapunix.o + ${SYSTEM_LD_HEAD} + ${SYSTEM_LD} swapunix.o + ${SYSTEM_LD_TAIL} + +swapunix.o: swapunix.c + ${COMPILE_C} + +all: unix + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +exec_aout.o: $S/kernel/exec_aout.c + ${COMPILE_C} + +exec_conf.o: $S/kernel/exec_conf.c + ${COMPILE_C} + +exec_elf.o: $S/kernel/exec_elf.c + ${COMPILE_C} + +exec_script.o: $S/kernel/exec_script.c + ${COMPILE_C} + +exec_subr.o: $S/kernel/exec_subr.c + ${COMPILE_C} + +init_main.o: $S/kernel/init_main.c + ${COMPILE_C} + +init_sysent.o: $S/kernel/init_sysent.c + ${COMPILE_C} + +kern_clock.o: $S/kernel/kern_clock.c + ${COMPILE_C} + +kern_descrip.o: $S/kernel/kern_descrip.c + ${COMPILE_C} + +kern_exec.o: $S/kernel/kern_exec.c + ${COMPILE_C} + +kern_exit.o: $S/kernel/kern_exit.c + ${COMPILE_C} + +kern_fork.o: $S/kernel/kern_fork.c + ${COMPILE_C} + +kern_mman.o: $S/kernel/kern_mman.c + ${COMPILE_C} + +kern_proc.o: $S/kernel/kern_proc.c + ${COMPILE_C} + +kern_prot.o: $S/kernel/kern_prot.c + ${COMPILE_C} + +kern_prot2.o: $S/kernel/kern_prot2.c + ${COMPILE_C} + +kern_resource.o: $S/kernel/kern_resource.c + ${COMPILE_C} + +kern_sig.o: $S/kernel/kern_sig.c + ${COMPILE_C} + +kern_sig2.o: $S/kernel/kern_sig2.c + ${COMPILE_C} + +kern_subr.o: $S/kernel/kern_subr.c + ${COMPILE_C} + +kern_synch.o: $S/kernel/kern_synch.c + ${COMPILE_C} + +kern_sysctl.o: $S/kernel/kern_sysctl.c + ${COMPILE_C} + +kern_time.o: $S/kernel/kern_time.c + ${COMPILE_C} + +rdisk.o: $S/kernel/rdisk.c + ${COMPILE_C} + +subr_prf.o: $S/kernel/subr_prf.c + ${COMPILE_C} + +subr_rmap.o: $S/kernel/subr_rmap.c + ${COMPILE_C} + +sys_generic.o: $S/kernel/sys_generic.c + ${COMPILE_C} + +sys_inode.o: $S/kernel/sys_inode.c + ${COMPILE_C} + +sys_pipe.o: $S/kernel/sys_pipe.c + ${COMPILE_C} + +sys_process.o: $S/kernel/sys_process.c + ${COMPILE_C} + +syscalls.o: $S/kernel/syscalls.c + ${COMPILE_C} + +tty.o: $S/kernel/tty.c + ${COMPILE_C} + +tty_subr.o: $S/kernel/tty_subr.c + ${COMPILE_C} + +tty_tty.o: $S/kernel/tty_tty.c + ${COMPILE_C} + +ufs_alloc.o: $S/kernel/ufs_alloc.c + ${COMPILE_C} + +ufs_bio.o: $S/kernel/ufs_bio.c + ${COMPILE_C} + +ufs_bmap.o: $S/kernel/ufs_bmap.c + ${COMPILE_C} + +ufs_dsort.o: $S/kernel/ufs_dsort.c + ${COMPILE_C} + +ufs_fio.o: $S/kernel/ufs_fio.c + ${COMPILE_C} + +ufs_inode.o: $S/kernel/ufs_inode.c + ${COMPILE_C} + +ufs_mount.o: $S/kernel/ufs_mount.c + ${COMPILE_C} + +ufs_namei.o: $S/kernel/ufs_namei.c + ${COMPILE_C} + +ufs_subr.o: $S/kernel/ufs_subr.c + ${COMPILE_C} + +ufs_syscalls.o: $S/kernel/ufs_syscalls.c + ${COMPILE_C} + +ufs_syscalls2.o: $S/kernel/ufs_syscalls2.c + ${COMPILE_C} + +vfs_vnops.o: $S/kernel/vfs_vnops.c + ${COMPILE_C} + +vm_sched.o: $S/kernel/vm_sched.c + ${COMPILE_C} + +vm_swap.o: $S/kernel/vm_swap.c + ${COMPILE_C} + +vm_swp.o: $S/kernel/vm_swp.c + ${COMPILE_C} + +adc.o: $S/pic32/adc.c + ${COMPILE_C} + +clock.o: $S/pic32/clock.c + ${COMPILE_C} + +cons.o: $S/pic32/cons.c + ${COMPILE_C} + +devsw.o: $S/pic32/devsw.c + ${COMPILE_C} + +exception.o: $S/pic32/exception.c + ${COMPILE_C} + +gpio.o: $S/pic32/gpio.c + ${COMPILE_C} + +machdep.o: $S/pic32/machdep.c + ${COMPILE_C} + +mem.o: $S/pic32/mem.c + ${COMPILE_C} + +pwm.o: $S/pic32/pwm.c + ${COMPILE_C} + +rd_sd.o: $S/pic32/rd_sd.c + ${COMPILE_C} + +signal.o: $S/pic32/signal.c + ${COMPILE_C} + +spi.o: $S/pic32/spi.c + ${COMPILE_C} + +spi_bus.o: $S/pic32/spi_bus.c + ${COMPILE_C} + +swap.o: $S/pic32/swap.c + ${COMPILE_C} + +sysctl.o: $S/pic32/sysctl.c + ${COMPILE_C} + +uart.o: $S/pic32/uart.c + ${COMPILE_C} + +usb_device.o: $S/pic32/usb_device.c + ${COMPILE_C} + +usb_function_cdc.o: $S/pic32/usb_function_cdc.c + ${COMPILE_C} + +usb_uart.o: $S/pic32/usb_uart.c + ${COMPILE_C} -LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader.ld - -CONFIG = MMB-MX7 -CONFIGPATH = ../../../tools/configsys - -include ../../../tools/configsys/../../sys/pic32/kernel-post.mk +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif From 717ab59efd7f5ff91234ebb8fec8cef01f69008f Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 7 Sep 2015 22:22:35 -0700 Subject: [PATCH 30/32] Switch to kconfig completely. All configsys stuff moved to tools/configsys/ directory, not used anymore. --- sys/pic32/32mxsdram/Config | 2 +- sys/pic32/32mxsdram/Makefile | 2 +- .../bootloader.ld} | 0 sys/pic32/Config.generic | 2 +- sys/pic32/baremetal/Config | 2 +- sys/pic32/baremetal/Makefile | 2 +- .../{cfg/bare.ld => baremetal/script.ld} | 0 sys/pic32/duinomite-emega/Config | 2 +- sys/pic32/duinomite-emega/Config-uart | 2 +- sys/pic32/duinomite-emega/Makefile | 2 +- sys/pic32/duinomite/Config | 2 +- sys/pic32/duinomite/Config-uart | 2 +- sys/pic32/duinomite/Makefile | 2 +- sys/pic32/explorer16/Config | 2 +- sys/pic32/explorer16/Makefile | 2 +- sys/pic32/fubarino/Config | 2 +- sys/pic32/fubarino/Config-uart-sramc | 2 +- sys/pic32/fubarino/Makefile | 2 +- sys/pic32/kbd.c | 82 ++++++++++++++++++- sys/pic32/kernel-post.mk | 64 --------------- sys/pic32/max32/Config | 2 +- sys/pic32/max32/Makefile | 2 +- .../bootloader.ld} | 0 sys/pic32/maximite-color/Config | 2 +- sys/pic32/maximite-color/Makefile | 4 +- .../bootloader.ld} | 0 sys/pic32/maximite/Config | 2 +- sys/pic32/maximite/Makefile | 2 +- .../bootloader.ld} | 0 sys/pic32/maximite/russian.inc | 50 ----------- sys/pic32/maximite/usascii.inc | 50 ----------- sys/pic32/mmb-mx7/Config | 2 +- sys/pic32/mmb-mx7/Makefile | 2 +- sys/pic32/{cfg => mmb-mx7}/bootloader.ld | 0 sys/pic32/picadillo/Config | 2 +- sys/pic32/picadillo/Config-rambo | 2 +- sys/pic32/picadillo/Makefile | 2 +- sys/pic32/pinguino-micro/Config | 2 +- sys/pic32/pinguino-micro/Makefile | 2 +- sys/pic32/sdxl/Config | 2 +- sys/pic32/sdxl/Makefile | 2 +- sys/pic32/starter-kit/Config | 2 +- sys/pic32/starter-kit/Makefile | 2 +- sys/pic32/ubw32/Config | 2 +- sys/pic32/ubw32/Config-uart | 2 +- sys/pic32/ubw32/Makefile | 2 +- .../bootloader.ld} | 0 sys/pic32/wf32/Config | 2 +- sys/pic32/wf32/Makefile | 2 +- tools/Makefile | 2 +- .../configsys/board/32MXSDRAM-UART | 0 .../configsys/board}/BAREMETAL | 0 .../configsys/board}/DUINOMITE | 0 .../configsys/board/DUINOMITE-E | 0 .../configsys/board/DUINOMITE-E-UART | 0 .../configsys/board}/DUINOMITE-UART | 0 .../configsys/board}/EXPLORER16 | 0 .../configsys/board}/FUBARINO | 0 .../board}/FUBARINO-UART2CONS-UART1-SRAMC | 0 .../max32 => tools/configsys/board}/MAX32 | 0 .../configsys/board}/MAXIMITE | 0 .../configsys/board}/MAXIMITE-COLOR | 0 tools/configsys/board/MEB | 17 ++++ .../mmb-mx7 => tools/configsys/board}/MMB-MX7 | 0 .../configsys/board}/PICADILLO | 4 +- .../configsys/board}/PICADILLO-RAMBO | 4 - .../configsys/board}/PINGUINO-MICRO | 0 .../pic32/sdxl => tools/configsys/board}/SDXL | 0 .../configsys/board}/STARTER-KIT | 0 .../ubw32 => tools/configsys/board}/UBW32 | 0 .../configsys/board}/UBW32-UART | 0 tools/configsys/board/UBW32-UART-SDRAM | 18 ++++ .../pic32/wf32 => tools/configsys/board}/WF32 | 1 - .../pic32/cfg => tools/configsys/dev}/adc.dev | 0 .../cfg => tools/configsys/dev}/console.dev | 0 .../cfg => tools/configsys/dev}/devcfg.dev | 0 .../configsys/dev}/foreignbootloader.dev | 0 .../cfg => tools/configsys/dev}/glcd.dev | 0 .../cfg => tools/configsys/dev}/glob.dev | 0 .../cfg => tools/configsys/dev}/global.dev | 0 .../cfg => tools/configsys/dev}/gpio.dev | 0 .../cfg => tools/configsys/dev}/hxtft.dev | 0 .../cfg => tools/configsys/dev}/kernel.dev | 0 .../pic32/cfg => tools/configsys/dev}/log.dev | 0 .../cfg => tools/configsys/dev}/mrams.dev | 0 .../cfg => tools/configsys/dev}/picga.dev | 0 .../cfg => tools/configsys/dev}/power.dev | 0 .../pic32/cfg => tools/configsys/dev}/pty.dev | 0 .../pic32/cfg => tools/configsys/dev}/pwm.dev | 0 .../cfg => tools/configsys/dev}/rdisk.dev | 0 {sys/pic32/cfg => tools/configsys/dev}/sd.dev | 0 .../cfg => tools/configsys/dev}/sdramp.dev | 0 .../cfg => tools/configsys/dev}/skel.dev | 0 .../pic32/cfg => tools/configsys/dev}/spi.dev | 0 .../cfg => tools/configsys/dev}/spibus.dev | 0 .../cfg => tools/configsys/dev}/spirams.dev | 0 .../cfg => tools/configsys/dev}/sramc.dev | 0 .../pic32/cfg => tools/configsys/dev}/tty.dev | 0 .../cfg => tools/configsys/dev}/uart.dev | 0 .../configsys/dev}/uartconsole.dev | 0 .../cfg => tools/configsys/dev}/uartusb.dev | 0 .../pic32/cfg => tools/configsys/dev}/ufs.dev | 0 .../configsys/dev}/usbconsole.dev | 0 .../cfg => tools/configsys/map}/fubarino.map | 0 .../cfg => tools/configsys/map}/generic.map | 0 .../cfg => tools/configsys/map}/max32.map | 0 .../cfg => tools/configsys/map}/picadillo.map | 0 .../cfg => tools/configsys/map}/wf32.map | 0 108 files changed, 157 insertions(+), 213 deletions(-) rename sys/pic32/{cfg/bootloader-sdram.ld => 32mxsdram/bootloader.ld} (100%) rename sys/pic32/{cfg/bare.ld => baremetal/script.ld} (100%) delete mode 100644 sys/pic32/kernel-post.mk rename sys/pic32/{cfg/bootloader-max32.ld => max32/bootloader.ld} (100%) rename sys/pic32/{cfg/bootloader-maxcolor.ld => maximite-color/bootloader.ld} (100%) rename sys/pic32/{cfg/bootloader-maximite.ld => maximite/bootloader.ld} (100%) delete mode 100644 sys/pic32/maximite/russian.inc delete mode 100644 sys/pic32/maximite/usascii.inc rename sys/pic32/{cfg => mmb-mx7}/bootloader.ld (100%) rename sys/pic32/{cfg/bootloader-ubw32.ld => ubw32/bootloader.ld} (100%) rename sys/pic32/32mxsdram/32MXSDRAM => tools/configsys/board/32MXSDRAM-UART (100%) rename {sys/pic32/baremetal => tools/configsys/board}/BAREMETAL (100%) rename {sys/pic32/duinomite => tools/configsys/board}/DUINOMITE (100%) rename sys/pic32/duinomite-emega/DUINOMITE-EMEGA => tools/configsys/board/DUINOMITE-E (100%) rename sys/pic32/duinomite-emega/DUINOMITE-EMEGA-UART => tools/configsys/board/DUINOMITE-E-UART (100%) rename {sys/pic32/duinomite => tools/configsys/board}/DUINOMITE-UART (100%) rename {sys/pic32/explorer16 => tools/configsys/board}/EXPLORER16 (100%) rename {sys/pic32/fubarino => tools/configsys/board}/FUBARINO (100%) rename {sys/pic32/fubarino => tools/configsys/board}/FUBARINO-UART2CONS-UART1-SRAMC (100%) rename {sys/pic32/max32 => tools/configsys/board}/MAX32 (100%) rename {sys/pic32/maximite => tools/configsys/board}/MAXIMITE (100%) rename {sys/pic32/maximite-color => tools/configsys/board}/MAXIMITE-COLOR (100%) create mode 100644 tools/configsys/board/MEB rename {sys/pic32/mmb-mx7 => tools/configsys/board}/MMB-MX7 (100%) rename {sys/pic32/picadillo => tools/configsys/board}/PICADILLO (86%) rename {sys/pic32/picadillo => tools/configsys/board}/PICADILLO-RAMBO (86%) rename {sys/pic32/pinguino-micro => tools/configsys/board}/PINGUINO-MICRO (100%) rename {sys/pic32/sdxl => tools/configsys/board}/SDXL (100%) rename {sys/pic32/starter-kit => tools/configsys/board}/STARTER-KIT (100%) rename {sys/pic32/ubw32 => tools/configsys/board}/UBW32 (100%) rename {sys/pic32/ubw32 => tools/configsys/board}/UBW32-UART (100%) create mode 100644 tools/configsys/board/UBW32-UART-SDRAM rename {sys/pic32/wf32 => tools/configsys/board}/WF32 (87%) rename {sys/pic32/cfg => tools/configsys/dev}/adc.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/console.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/devcfg.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/foreignbootloader.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/glcd.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/glob.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/global.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/gpio.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/hxtft.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/kernel.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/log.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/mrams.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/picga.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/power.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/pty.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/pwm.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/rdisk.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/sd.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/sdramp.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/skel.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/spi.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/spibus.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/spirams.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/sramc.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/tty.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/uart.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/uartconsole.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/uartusb.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/ufs.dev (100%) rename {sys/pic32/cfg => tools/configsys/dev}/usbconsole.dev (100%) rename {sys/pic32/cfg => tools/configsys/map}/fubarino.map (100%) rename {sys/pic32/cfg => tools/configsys/map}/generic.map (100%) rename {sys/pic32/cfg => tools/configsys/map}/max32.map (100%) rename {sys/pic32/cfg => tools/configsys/map}/picadillo.map (100%) rename {sys/pic32/cfg => tools/configsys/map}/wf32.map (100%) diff --git a/sys/pic32/32mxsdram/Config b/sys/pic32/32mxsdram/Config index 2a14747..6cd67c5 100644 --- a/sys/pic32/32mxsdram/Config +++ b/sys/pic32/32mxsdram/Config @@ -15,7 +15,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "CUSTOM_32MXSDRAM" # Board type -ldscript "cfg/bootloader-sdram.ld" # Linker script +ldscript "32mxsdram/bootloader.ld" # Linker script # Standard system options options "HZ=1000" # Rate of timer interrupt diff --git a/sys/pic32/32mxsdram/Makefile b/sys/pic32/32mxsdram/Makefile index 9f5ba99..a591bdb 100644 --- a/sys/pic32/32mxsdram/Makefile +++ b/sys/pic32/32mxsdram/Makefile @@ -29,7 +29,7 @@ PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 PARAM += -DHZ=1000 -LDSCRIPT = "cfg/bootloader-sdram.ld" +LDSCRIPT = "32mxsdram/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/cfg/bootloader-sdram.ld b/sys/pic32/32mxsdram/bootloader.ld similarity index 100% rename from sys/pic32/cfg/bootloader-sdram.ld rename to sys/pic32/32mxsdram/bootloader.ld diff --git a/sys/pic32/Config.generic b/sys/pic32/Config.generic index 9c0bc58..d20d782 100644 --- a/sys/pic32/Config.generic +++ b/sys/pic32/Config.generic @@ -14,7 +14,7 @@ cpu "PIC32MX7" # Processor variant board "CHIPKIT_MAX32" # Board type # Linker script -ldscript "cfg/bootloader-max32.ld" +ldscript "max32/bootloader.ld" # Need to set locally timezone 8 dst diff --git a/sys/pic32/baremetal/Config b/sys/pic32/baremetal/Config index 1b0b05d..149e516 100644 --- a/sys/pic32/baremetal/Config +++ b/sys/pic32/baremetal/Config @@ -15,7 +15,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "BAREMETAL" # Board type -ldscript "cfg/bare.ld" # Linker script +ldscript "baremetal/script.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/baremetal/Makefile b/sys/pic32/baremetal/Makefile index 3839e7b..4e7a101 100644 --- a/sys/pic32/baremetal/Makefile +++ b/sys/pic32/baremetal/Makefile @@ -19,7 +19,7 @@ PARAM += -DLED_KERNEL_PORT=TRISD PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bare.ld" +LDSCRIPT = "baremetal/script.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/cfg/bare.ld b/sys/pic32/baremetal/script.ld similarity index 100% rename from sys/pic32/cfg/bare.ld rename to sys/pic32/baremetal/script.ld diff --git a/sys/pic32/duinomite-emega/Config b/sys/pic32/duinomite-emega/Config index 94512b3..9a05422 100644 --- a/sys/pic32/duinomite-emega/Config +++ b/sys/pic32/duinomite-emega/Config @@ -17,7 +17,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "DUINOMITE" # Board type -ldscript "cfg/bootloader-maximite.ld" # Linker script +ldscript "maximite/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/duinomite-emega/Config-uart b/sys/pic32/duinomite-emega/Config-uart index 7edff88..ffba897 100644 --- a/sys/pic32/duinomite-emega/Config-uart +++ b/sys/pic32/duinomite-emega/Config-uart @@ -17,7 +17,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "DUINOMITE" # Board type -ldscript "cfg/bootloader-maximite.ld" # Linker script +ldscript "maximite/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/duinomite-emega/Makefile b/sys/pic32/duinomite-emega/Makefile index 42bab90..d2acab7 100644 --- a/sys/pic32/duinomite-emega/Makefile +++ b/sys/pic32/duinomite-emega/Makefile @@ -20,7 +20,7 @@ PARAM += -DLED_KERNEL_PORT=TRISB PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=40000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-maximite.ld" +LDSCRIPT = "maximite/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/duinomite/Config b/sys/pic32/duinomite/Config index 4af704a..2d2dc3b 100644 --- a/sys/pic32/duinomite/Config +++ b/sys/pic32/duinomite/Config @@ -16,7 +16,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "DUINOMITE" # Board type -ldscript "cfg/bootloader-maximite.ld" # Linker script +ldscript "maximite/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/duinomite/Config-uart b/sys/pic32/duinomite/Config-uart index 5e26c54..57d5ee3 100644 --- a/sys/pic32/duinomite/Config-uart +++ b/sys/pic32/duinomite/Config-uart @@ -16,7 +16,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "DUINOMITE" # Board type -ldscript "cfg/bootloader-maximite.ld" # Linker script +ldscript "maximite/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/duinomite/Makefile b/sys/pic32/duinomite/Makefile index 2bf244b..12ae392 100644 --- a/sys/pic32/duinomite/Makefile +++ b/sys/pic32/duinomite/Makefile @@ -20,7 +20,7 @@ PARAM += -DLED_KERNEL_PORT=TRISB PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-maximite.ld" +LDSCRIPT = "maximite/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/explorer16/Config b/sys/pic32/explorer16/Config index 6885508..a3290ef 100644 --- a/sys/pic32/explorer16/Config +++ b/sys/pic32/explorer16/Config @@ -15,7 +15,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "EXPLORER16" # Board type -ldscript "cfg/bare.ld" # Linker script +ldscript "baremetal/script.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/explorer16/Makefile b/sys/pic32/explorer16/Makefile index fc9516d..532a5cc 100644 --- a/sys/pic32/explorer16/Makefile +++ b/sys/pic32/explorer16/Makefile @@ -21,7 +21,7 @@ PARAM += -DLED_DISK_PORT=TRISA PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bare.ld" +LDSCRIPT = "baremetal/script.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/fubarino/Config b/sys/pic32/fubarino/Config index 5bb1c8a..37b8e05 100644 --- a/sys/pic32/fubarino/Config +++ b/sys/pic32/fubarino/Config @@ -16,7 +16,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "FUBARINO" # Board type -ldscript "cfg/bootloader-max32.ld" # Linker script +ldscript "max32/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/fubarino/Config-uart-sramc b/sys/pic32/fubarino/Config-uart-sramc index 976e2c6..95319d8 100644 --- a/sys/pic32/fubarino/Config-uart-sramc +++ b/sys/pic32/fubarino/Config-uart-sramc @@ -17,7 +17,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "FUBARINO" # Board type -ldscript "cfg/bootloader-max32.ld" # Linker script +ldscript "max32/bootloader.ld" # Linker script # Standard system options options "HZ=1000" # Rate of clock interrupt diff --git a/sys/pic32/fubarino/Makefile b/sys/pic32/fubarino/Makefile index d6d4f22..11a354e 100644 --- a/sys/pic32/fubarino/Makefile +++ b/sys/pic32/fubarino/Makefile @@ -17,7 +17,7 @@ PARAM += -DLED_KERNEL_PORT=TRISE PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-max32.ld" +LDSCRIPT = "max32/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/kbd.c b/sys/pic32/kbd.c index 2d57e3c..13bdf19 100644 --- a/sys/pic32/kbd.c +++ b/sys/pic32/kbd.c @@ -85,9 +85,87 @@ int key_state, key_count, key_parity, key_timer; #define SCRL 0x7e #ifdef USASCII -#include "usascii.inc" +// +// Map of standard keyboard, US ASCII layout +// +const char lowerKey[128]={ + 0, F9, 0, F5, F3, F1, F2, F12, //00 + 0, F10, F8, F6, F4, TAB, '`', 0, //08 + 0, 0, L_SHF, 0, L_CTL, 'q', '1', 0, //10 + 0, 0, 'z', 's', 'a', 'w', '2', 0, //18 + 0, 'c', 'x', 'd', 'e', '4', '3', 0, //20 + 0, ' ', 'v', 'f', 't', 'r', '5', 0, //28 + 0, 'n', 'b', 'h', 'g', 'y', '6', 0, //30 + 0, 0, 'm', 'j', 'u', '7', '8', 0, //38 + 0, ',', 'k', 'i', 'o', '0', '9', 0, //40 + 0, '.', '/', 'l', ';', 'p', '-', 0, //48 + 0, 0, '\'', 0, '[', '=', 0, 0, //50 + CAPS, R_SHF, ENTER, ']', 0, '\\', 0, 0, //58 + 0, 0, 0, 0, 0, 0, BKSP, 0, //60 + 0, '1', 0, '4', '7', 0, 0, 0, //68 + '0', '.', '2', '5', '6', '8', ESC, NUM, //70 + F11, '+', '3', '-', '*', '9', 0, 0 //78 +}; + +const char upperKey[128] = { + 0, F9, 0, F5, F3, F1, F2, F12, //00 + 0, F10, F8, F6, F4, TAB, '~', 0, //08 + 0, 0, L_SHF, 0, L_CTL, 'Q', '!', 0, //10 + 0, 0, 'Z', 'S', 'A', 'W', '@', 0, //18 + 0, 'C', 'X', 'D', 'E', '$', '#', 0, //20 + 0, ' ', 'V', 'F', 'T', 'R', '%', 0, //28 + 0, 'N', 'B', 'H', 'G', 'Y', '^', 0, //30 + 0, 0, 'M', 'J', 'U', '&', '*', 0, //38 + 0, '<', 'K', 'I', 'O', ')', '(', 0, //40 + 0, '>', '?', 'L', ':', 'P', '_', 0, //48 + 0, 0, '\"', 0, '{', '+', 0, 0, //50 + CAPS, R_SHF, ENTER, '}', 0, '|', 0, 0, //58 + 0, 0, 0, 0, 0, 0, BKSP, 0, //60 + 0, '1', 0, '4', '7', 0, 0, 0, //68 + '0', '.', '2', '5', '6', '8', ESC, NUM, //70 + F11, '+', '3', '-', '*', '9', 0, 0 //78 +}; #elif defined RUSSIAN -#include "russian.inc" +// +// Map of standard keyboard, Russian Windows layout +// +const char lowerKey[128]={ + 0, F9, 0, F5, F3, F1, F2, F12, //00 + 0, F10, F8, F6, F4, TAB, 'ё', 0, //08 + 0, 0, L_SHF, 0, L_CTL, 'й', '1', 0, //10 + 0, 0, 'я', 'ы', 'ф', 'ц', '2', 0, //18 + 0, 'с', 'ч', 'в', 'у', '4', '3', 0, //20 + 0, ' ', 'м', 'а', 'е', 'к', '5', 0, //28 + 0, 'т', 'и', 'р', 'п', 'н', '6', 0, //30 + 0, 0, 'ь', 'о', 'г', '7', '8', 0, //38 + 0, 'б', 'л', 'ш', 'щ', '0', '9', 0, //40 + 0, 'ю', '.', 'д', 'ж', 'з', '-', 0, //48 + 0, 0, 'э', 0, 'х', '=', 0, 0, //50 + CAPS, R_SHF, ENTER, 'ъ', 0, '\\', 0, 0, //58 + 0, 0, 0, 0, 0, 0, BKSP, 0, //60 + 0, '1', 0, '4', '7', 0, 0, 0, //68 + '0', ',', '2', '5', '6', '8', ESC, NUM, //70 + F11, '+', '3', '-', '*', '9', 0, 0 //78 +}; + +const char upperKey[128] = { + 0, F9, 0, F5, F3, F1, F2, F12, //00 + 0, F10, F8, F6, F4, TAB, 'Ё', 0, //08 + 0, 0, L_SHF, 0, L_CTL, 'Й', '!', 0, //10 + 0, 0, 'Я', 'Ы', 'Ф', 'Ц', '\"', 0, //18 + 0, 'С', 'Ч', 'В', 'У', ';', '№', 0, //20 + 0, ' ', 'М', 'А', 'Е', 'К', '%', 0, //28 + 0, 'Т', 'И', 'Р', 'П', 'Н', ':', 0, //30 + 0, 0, 'Ь', 'О', 'Г', '?', '*', 0, //38 + 0, 'Б', 'Л', 'Ш', 'Щ', ')', '(', 0, //40 + 0, 'Ю', ',', 'Д', 'Ж', 'З', '_', 0, //48 + 0, 0, 'Э', 0, 'Х', '+', 0, 0, //50 + CAPS, R_SHF, ENTER, 'Ъ', 0, '/', 0, 0, //58 + 0, 0, 0, 0, 0, 0, BKSP, 0, //60 + 0, '1', 0, '4', '7', 0, 0, 0, //68 + '0', ',', '2', '5', '6', '8', ESC, NUM, //70 + F11, '+', '3', '-', '*', '9', 0, 0 //78 +}; #endif /* diff --git a/sys/pic32/kernel-post.mk b/sys/pic32/kernel-post.mk deleted file mode 100644 index 44c0c5b..0000000 --- a/sys/pic32/kernel-post.mk +++ /dev/null @@ -1,64 +0,0 @@ - -DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep -CFLAGS = -I. -I$(H) -O $(DEFS) $(DEPFLAGS) -ASFLAGS = -I. -I$(H) $(DEFS) $(DEPFLAGS) - -include $(BUILDPATH)/gcc-config.mk - -CC = $(MIPS_GCC_PREFIX)gcc -EL -g -mips32r2 -CC += -nostdinc -fno-builtin -Werror -Wall -fno-dwarf2-cfi-asm -LDFLAGS = -nostdlib -SIZE = $(MIPS_GCC_PREFIX)size -OBJDUMP = $(MIPS_GCC_PREFIX)objdump -OBJCOPY = $(MIPS_GCC_PREFIX)objcopy - -DEFS += -DCONFIG=$(CONFIG) - -ifneq (${MIPS_GCC_FORMAT},) - LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} -endif - -all: .deps sys machine unix.elf - $(SIZE) unix.elf - -clean: - rm -rf .deps *.o *.elf *.bin *.dis *.map *.srec core \ - mklog assym.h vers.c genassym sys machine - -.deps: - mkdir .deps - -sys: - ln -s $(BUILDPATH)/../include $@ - -machine: - ln -s $(BUILDPATH) $@ - -unix.elf: $(KERNOBJ) $(LDSCRIPT) - $(CC) $(LDFLAGS) -T $(LDSCRIPT) -Wl,-Map=unix.map $(KERNOBJ) -o $@ - chmod -x $@ - $(OBJDUMP) -d -S $@ > unix.dis - $(OBJCOPY) -O binary -R .boot -R .config $@ unix.bin - $(OBJCOPY) -O binary -j .boot -j .config $@ boot.bin - test -s boot.bin || rm boot.bin - $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ unix.hex - chmod -x $@ unix.bin - -load: unix.hex - pic32prog $(BLREBOOT) unix.hex - -vers.o: $(BUILDPATH)/newvers.sh $(H)/*.h $(M)/*.[ch] $(S)/*.c - sh $(BUILDPATH)/newvers.sh > vers.c - $(CC) -c vers.c - -reconfig: - ../../../tools/configsys/config $(CONFIG) - -.SUFFIXES: .i .srec .hex .dis .cpp .cxx .bin .elf - -.o.dis: - $(OBJDUMP) -d -z -S $< > $@ - -ifeq (.deps, $(wildcard .deps)) --include .deps/*.dep -endif diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index be4fc24..1d32f9e 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -15,7 +15,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "MAX32" # Board type -ldscript "cfg/bootloader-max32.ld" # Linker script +ldscript "max32/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 2862981..907db31 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -18,7 +18,7 @@ PARAM += -DLED_KERNEL_PORT=TRISA PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-max32.ld" +LDSCRIPT = "max32/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/cfg/bootloader-max32.ld b/sys/pic32/max32/bootloader.ld similarity index 100% rename from sys/pic32/cfg/bootloader-max32.ld rename to sys/pic32/max32/bootloader.ld diff --git a/sys/pic32/maximite-color/Config b/sys/pic32/maximite-color/Config index abc4a69..5822665 100644 --- a/sys/pic32/maximite-color/Config +++ b/sys/pic32/maximite-color/Config @@ -15,7 +15,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "MAXIMITE_COLOR" # Board type -ldscript "cfg/bootloader-maxcolor.ld" # Linker script +ldscript "maximite-color/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/maximite-color/Makefile b/sys/pic32/maximite-color/Makefile index b8d37a3..b1caa01 100644 --- a/sys/pic32/maximite-color/Makefile +++ b/sys/pic32/maximite-color/Makefile @@ -1,4 +1,4 @@ -PARAM = -DMAXIMITE +PARAM = -DMAXIMITE_COLOR PARAM += -DPIC32MX7 PARAM += -DPWM_ENABLED PARAM += -DADC_ENABLED @@ -19,7 +19,7 @@ PARAM += -DLED_KERNEL_PORT=TRISE PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-maxcolor.ld" +LDSCRIPT = "maximite-color/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/cfg/bootloader-maxcolor.ld b/sys/pic32/maximite-color/bootloader.ld similarity index 100% rename from sys/pic32/cfg/bootloader-maxcolor.ld rename to sys/pic32/maximite-color/bootloader.ld diff --git a/sys/pic32/maximite/Config b/sys/pic32/maximite/Config index de10824..7192dd5 100644 --- a/sys/pic32/maximite/Config +++ b/sys/pic32/maximite/Config @@ -16,7 +16,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "MAXIMITE" # Board type -ldscript "cfg/bootloader-maximite.ld" # Linker script +ldscript "maximite/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/maximite/Makefile b/sys/pic32/maximite/Makefile index 646fdb7..0822f83 100644 --- a/sys/pic32/maximite/Makefile +++ b/sys/pic32/maximite/Makefile @@ -19,7 +19,7 @@ PARAM += -DLED_KERNEL_PORT=TRISF PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-maximite.ld" +LDSCRIPT = "maximite/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/cfg/bootloader-maximite.ld b/sys/pic32/maximite/bootloader.ld similarity index 100% rename from sys/pic32/cfg/bootloader-maximite.ld rename to sys/pic32/maximite/bootloader.ld diff --git a/sys/pic32/maximite/russian.inc b/sys/pic32/maximite/russian.inc deleted file mode 100644 index 17f6a51..0000000 --- a/sys/pic32/maximite/russian.inc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * RetroBSD - PS2 keyboard driver for the Maximite PIC32 board - * - * Copyright (C) 2011 Rob Judd - * All rights reserved. The three clause ("New" or "Modified") - * Berkeley software License Agreement specifies the terms and - * conditions for redistribution. - * - */ - -// Map of standard keyboard, Russian Windows layout -const char lowerKey[128]={ - 0, F9, 0, F5, F3, F1, F2, F12, //00 - 0, F10, F8, F6, F4, TAB, 'ё', 0, //08 - 0, 0, L_SHF, 0, L_CTL, 'й', '1', 0, //10 - 0, 0, 'я', 'ы', 'ф', 'ц', '2', 0, //18 - 0, 'с', 'ч', 'в', 'у', '4', '3', 0, //20 - 0, ' ', 'м', 'а', 'е', 'к', '5', 0, //28 - 0, 'т', 'и', 'р', 'п', 'н', '6', 0, //30 - 0, 0, 'ь', 'о', 'г', '7', '8', 0, //38 - 0, 'б', 'л', 'ш', 'щ', '0', '9', 0, //40 - 0, 'ю', '.', 'д', 'ж', 'з', '-', 0, //48 - 0, 0, 'э', 0, 'х', '=', 0, 0, //50 - CAPS, R_SHF, ENTER, 'ъ', 0, '\\', 0, 0, //58 - 0, 0, 0, 0, 0, 0, BKSP, 0, //60 - 0, '1', 0, '4', '7', 0, 0, 0, //68 - '0', ',', '2', '5', '6', '8', ESC, NUM, //70 - F11, '+', '3', '-', '*', '9', 0, 0 //78 - }; - -const char upperKey[128] = { - 0, F9, 0, F5, F3, F1, F2, F12, //00 - 0, F10, F8, F6, F4, TAB, 'Ё', 0, //08 - 0, 0, L_SHF, 0, L_CTL, 'Й', '!', 0, //10 - 0, 0, 'Я', 'Ы', 'Ф', 'Ц', '\"', 0, //18 - 0, 'С', 'Ч', 'В', 'У', ';', '№', 0, //20 - 0, ' ', 'М', 'А', 'Е', 'К', '%', 0, //28 - 0, 'Т', 'И', 'Р', 'П', 'Н', ':', 0, //30 - 0, 0, 'Ь', 'О', 'Г', '?', '*', 0, //38 - 0, 'Б', 'Л', 'Ш', 'Щ', ')', '(', 0, //40 - 0, 'Ю', ',', 'Д', 'Ж', 'З', '_', 0, //48 - 0, 0, 'Э', 0, 'Х', '+', 0, 0, //50 - CAPS, R_SHF, ENTER, 'Ъ', 0, '/', 0, 0, //58 - 0, 0, 0, 0, 0, 0, BKSP, 0, //60 - 0, '1', 0, '4', '7', 0, 0, 0, //68 - '0', ',', '2', '5', '6', '8', ESC, NUM, //70 - F11, '+', '3', '-', '*', '9', 0, 0 //78 - }; - diff --git a/sys/pic32/maximite/usascii.inc b/sys/pic32/maximite/usascii.inc deleted file mode 100644 index 9bfaece..0000000 --- a/sys/pic32/maximite/usascii.inc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * RetroBSD - PS2 keyboard driver for the Maximite PIC32 board - * - * Copyright (C) 2011 Rob Judd - * All rights reserved. The three clause ("New" or "Modified") - * Berkeley software License Agreement specifies the terms and - * conditions for redistribution. - * - */ - -// Map of standard keyboard, US ASCII layout -const char lowerKey[128]={ - 0, F9, 0, F5, F3, F1, F2, F12, //00 - 0, F10, F8, F6, F4, TAB, '`', 0, //08 - 0, 0, L_SHF, 0, L_CTL, 'q', '1', 0, //10 - 0, 0, 'z', 's', 'a', 'w', '2', 0, //18 - 0, 'c', 'x', 'd', 'e', '4', '3', 0, //20 - 0, ' ', 'v', 'f', 't', 'r', '5', 0, //28 - 0, 'n', 'b', 'h', 'g', 'y', '6', 0, //30 - 0, 0, 'm', 'j', 'u', '7', '8', 0, //38 - 0, ',', 'k', 'i', 'o', '0', '9', 0, //40 - 0, '.', '/', 'l', ';', 'p', '-', 0, //48 - 0, 0, '\'', 0, '[', '=', 0, 0, //50 - CAPS, R_SHF, ENTER, ']', 0, '\\', 0, 0, //58 - 0, 0, 0, 0, 0, 0, BKSP, 0, //60 - 0, '1', 0, '4', '7', 0, 0, 0, //68 - '0', '.', '2', '5', '6', '8', ESC, NUM, //70 - F11, '+', '3', '-', '*', '9', 0, 0 //78 - }; - -const char upperKey[128] = { - 0, F9, 0, F5, F3, F1, F2, F12, //00 - 0, F10, F8, F6, F4, TAB, '~', 0, //08 - 0, 0, L_SHF, 0, L_CTL, 'Q', '!', 0, //10 - 0, 0, 'Z', 'S', 'A', 'W', '@', 0, //18 - 0, 'C', 'X', 'D', 'E', '$', '#', 0, //20 - 0, ' ', 'V', 'F', 'T', 'R', '%', 0, //28 - 0, 'N', 'B', 'H', 'G', 'Y', '^', 0, //30 - 0, 0, 'M', 'J', 'U', '&', '*', 0, //38 - 0, '<', 'K', 'I', 'O', ')', '(', 0, //40 - 0, '>', '?', 'L', ':', 'P', '_', 0, //48 - 0, 0, '\"', 0, '{', '+', 0, 0, //50 - CAPS, R_SHF, ENTER, '}', 0, '|', 0, 0, //58 - 0, 0, 0, 0, 0, 0, BKSP, 0, //60 - 0, '1', 0, '4', '7', 0, 0, 0, //68 - '0', '.', '2', '5', '6', '8', ESC, NUM, //70 - F11, '+', '3', '-', '*', '9', 0, 0 //78 - }; - diff --git a/sys/pic32/mmb-mx7/Config b/sys/pic32/mmb-mx7/Config index c8318bc..8f83a3f 100644 --- a/sys/pic32/mmb-mx7/Config +++ b/sys/pic32/mmb-mx7/Config @@ -15,7 +15,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "MMB_MX7" # Board type -ldscript "cfg/bootloader.ld" # Linker script +ldscript "mmb-mx7/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/mmb-mx7/Makefile b/sys/pic32/mmb-mx7/Makefile index 114574e..8be1bcb 100644 --- a/sys/pic32/mmb-mx7/Makefile +++ b/sys/pic32/mmb-mx7/Makefile @@ -27,7 +27,7 @@ PARAM += -DLED_KERNEL_PORT=TRISA PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader.ld" +LDSCRIPT = "mmb-mx7/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/cfg/bootloader.ld b/sys/pic32/mmb-mx7/bootloader.ld similarity index 100% rename from sys/pic32/cfg/bootloader.ld rename to sys/pic32/mmb-mx7/bootloader.ld diff --git a/sys/pic32/picadillo/Config b/sys/pic32/picadillo/Config index 712b4ed..0933e60 100644 --- a/sys/pic32/picadillo/Config +++ b/sys/pic32/picadillo/Config @@ -16,7 +16,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "PICADILLO_35T" # Board type -ldscript "cfg/bootloader-max32.ld" # Linker script +ldscript "max32/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/picadillo/Config-rambo b/sys/pic32/picadillo/Config-rambo index 9b723dc..531e6dc 100644 --- a/sys/pic32/picadillo/Config-rambo +++ b/sys/pic32/picadillo/Config-rambo @@ -16,7 +16,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "PICADILLO_35T" # Board type -ldscript "cfg/bootloader-max32.ld" # Linker script +ldscript "max32/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/picadillo/Makefile b/sys/pic32/picadillo/Makefile index d821ddc..48d69b6 100644 --- a/sys/pic32/picadillo/Makefile +++ b/sys/pic32/picadillo/Makefile @@ -14,7 +14,7 @@ PARAM += -DUART1_ENABLED PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-max32.ld" +LDSCRIPT = "max32/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/pinguino-micro/Config b/sys/pic32/pinguino-micro/Config index 5ff9493..62414d1 100644 --- a/sys/pic32/pinguino-micro/Config +++ b/sys/pic32/pinguino-micro/Config @@ -15,7 +15,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "PINGUINO_MICRO" # Board type -ldscript "cfg/bootloader-maximite.ld" # Linker script +ldscript "maximite/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/pinguino-micro/Makefile b/sys/pic32/pinguino-micro/Makefile index 8d35324..abe89fb 100644 --- a/sys/pic32/pinguino-micro/Makefile +++ b/sys/pic32/pinguino-micro/Makefile @@ -17,7 +17,7 @@ PARAM += -DLED_KERNEL_PORT=TRISD PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-maximite.ld" +LDSCRIPT = "maximite/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/sdxl/Config b/sys/pic32/sdxl/Config index 1d67dd6..aa40d50 100644 --- a/sys/pic32/sdxl/Config +++ b/sys/pic32/sdxl/Config @@ -17,7 +17,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "SDXL" # Board type -ldscript "cfg/bootloader-max32.ld" # Linker script +ldscript "max32/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/sdxl/Makefile b/sys/pic32/sdxl/Makefile index 37e16e0..5f49cd5 100644 --- a/sys/pic32/sdxl/Makefile +++ b/sys/pic32/sdxl/Makefile @@ -17,7 +17,7 @@ PARAM += -DLED_KERNEL_PORT=TRISE PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-max32.ld" +LDSCRIPT = "max32/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/starter-kit/Config b/sys/pic32/starter-kit/Config index c8febc0..e931286 100644 --- a/sys/pic32/starter-kit/Config +++ b/sys/pic32/starter-kit/Config @@ -16,7 +16,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "STARTERKIT" # Board type -ldscript "cfg/bare.ld" # Linker script +ldscript "baremetal/script.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/starter-kit/Makefile b/sys/pic32/starter-kit/Makefile index 8244394..993fbd8 100644 --- a/sys/pic32/starter-kit/Makefile +++ b/sys/pic32/starter-kit/Makefile @@ -18,7 +18,7 @@ PARAM += -DLED_DISK_PORT=TRISD PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bare.ld" +LDSCRIPT = "baremetal/script.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/ubw32/Config b/sys/pic32/ubw32/Config index 6d736ce..ce9fac0 100644 --- a/sys/pic32/ubw32/Config +++ b/sys/pic32/ubw32/Config @@ -17,7 +17,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "UBW32" # Board type -ldscript "cfg/bootloader-ubw32.ld" # Linker script +ldscript "ubw32/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/ubw32/Config-uart b/sys/pic32/ubw32/Config-uart index 9d908ed..29b3e11 100644 --- a/sys/pic32/ubw32/Config-uart +++ b/sys/pic32/ubw32/Config-uart @@ -16,7 +16,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "UBW32" # Board type -ldscript "cfg/bootloader-ubw32.ld" # Linker script +ldscript "ubw32/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/ubw32/Makefile b/sys/pic32/ubw32/Makefile index efcd18b..5ddf092 100644 --- a/sys/pic32/ubw32/Makefile +++ b/sys/pic32/ubw32/Makefile @@ -29,7 +29,7 @@ PARAM += -DLED_KERNEL_PORT=TRISE PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-ubw32.ld" +LDSCRIPT = "ubw32/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/sys/pic32/cfg/bootloader-ubw32.ld b/sys/pic32/ubw32/bootloader.ld similarity index 100% rename from sys/pic32/cfg/bootloader-ubw32.ld rename to sys/pic32/ubw32/bootloader.ld diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index 320d470..5beec81 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -13,7 +13,7 @@ architecture "pic32" cpu "PIC32MX7" # Processor variant board "WF32" # Board type -ldscript "cfg/bootloader-max32.ld" # Linker script +ldscript "max32/bootloader.ld" # Linker script # Standard system options options "CPU_KHZ=80000" # Oscillator frequency of CPU core diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index 39b85f7..50e5b89 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -19,7 +19,7 @@ PARAM += -DLED_KERNEL_PORT=TRISA PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -LDSCRIPT = "cfg/bootloader-max32.ld" +LDSCRIPT = "max32/bootloader.ld" # # Makefile for RetroBSD, pic32 target # diff --git a/tools/Makefile b/tools/Makefile index 4218b65..94d3e23 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,4 +1,4 @@ -SUBDIR = elf2aout fsutil virtualmips mkrd configsys kconfig icache +SUBDIR = elf2aout fsutil virtualmips mkrd kconfig icache all install depend: ${SUBDIR} -for i in ${SUBDIR}; do ${MAKE} -C $$i ${MFLAGS} DESTDIR=${DESTDIR} $@; done diff --git a/sys/pic32/32mxsdram/32MXSDRAM b/tools/configsys/board/32MXSDRAM-UART similarity index 100% rename from sys/pic32/32mxsdram/32MXSDRAM rename to tools/configsys/board/32MXSDRAM-UART diff --git a/sys/pic32/baremetal/BAREMETAL b/tools/configsys/board/BAREMETAL similarity index 100% rename from sys/pic32/baremetal/BAREMETAL rename to tools/configsys/board/BAREMETAL diff --git a/sys/pic32/duinomite/DUINOMITE b/tools/configsys/board/DUINOMITE similarity index 100% rename from sys/pic32/duinomite/DUINOMITE rename to tools/configsys/board/DUINOMITE diff --git a/sys/pic32/duinomite-emega/DUINOMITE-EMEGA b/tools/configsys/board/DUINOMITE-E similarity index 100% rename from sys/pic32/duinomite-emega/DUINOMITE-EMEGA rename to tools/configsys/board/DUINOMITE-E diff --git a/sys/pic32/duinomite-emega/DUINOMITE-EMEGA-UART b/tools/configsys/board/DUINOMITE-E-UART similarity index 100% rename from sys/pic32/duinomite-emega/DUINOMITE-EMEGA-UART rename to tools/configsys/board/DUINOMITE-E-UART diff --git a/sys/pic32/duinomite/DUINOMITE-UART b/tools/configsys/board/DUINOMITE-UART similarity index 100% rename from sys/pic32/duinomite/DUINOMITE-UART rename to tools/configsys/board/DUINOMITE-UART diff --git a/sys/pic32/explorer16/EXPLORER16 b/tools/configsys/board/EXPLORER16 similarity index 100% rename from sys/pic32/explorer16/EXPLORER16 rename to tools/configsys/board/EXPLORER16 diff --git a/sys/pic32/fubarino/FUBARINO b/tools/configsys/board/FUBARINO similarity index 100% rename from sys/pic32/fubarino/FUBARINO rename to tools/configsys/board/FUBARINO diff --git a/sys/pic32/fubarino/FUBARINO-UART2CONS-UART1-SRAMC b/tools/configsys/board/FUBARINO-UART2CONS-UART1-SRAMC similarity index 100% rename from sys/pic32/fubarino/FUBARINO-UART2CONS-UART1-SRAMC rename to tools/configsys/board/FUBARINO-UART2CONS-UART1-SRAMC diff --git a/sys/pic32/max32/MAX32 b/tools/configsys/board/MAX32 similarity index 100% rename from sys/pic32/max32/MAX32 rename to tools/configsys/board/MAX32 diff --git a/sys/pic32/maximite/MAXIMITE b/tools/configsys/board/MAXIMITE similarity index 100% rename from sys/pic32/maximite/MAXIMITE rename to tools/configsys/board/MAXIMITE diff --git a/sys/pic32/maximite-color/MAXIMITE-COLOR b/tools/configsys/board/MAXIMITE-COLOR similarity index 100% rename from sys/pic32/maximite-color/MAXIMITE-COLOR rename to tools/configsys/board/MAXIMITE-COLOR diff --git a/tools/configsys/board/MEB b/tools/configsys/board/MEB new file mode 100644 index 0000000..8ffeb7b --- /dev/null +++ b/tools/configsys/board/MEB @@ -0,0 +1,17 @@ + + +core pic32mx7 +linker bootloader +mapping generic + +device kernel cpu_khz=80000 bus_khz=80000 led=D2 + +device console device=ttyUSB0 led=D0 +device uartusb + +device rdisk led=D1 +device sd0 port=1 cs=A9 + +device gpio + +#device adc diff --git a/sys/pic32/mmb-mx7/MMB-MX7 b/tools/configsys/board/MMB-MX7 similarity index 100% rename from sys/pic32/mmb-mx7/MMB-MX7 rename to tools/configsys/board/MMB-MX7 diff --git a/sys/pic32/picadillo/PICADILLO b/tools/configsys/board/PICADILLO similarity index 86% rename from sys/pic32/picadillo/PICADILLO rename to tools/configsys/board/PICADILLO index e036a10..5fd32a7 100644 --- a/sys/pic32/picadillo/PICADILLO +++ b/tools/configsys/board/PICADILLO @@ -2,8 +2,8 @@ # Picadillo 35T board # =================== # -# Console on UART1. -# SD/MMC card driver on SPI2. +# Console on UART1 +# SD/MMC card driver on SPI2 core pic32mx7 mapping picadillo diff --git a/sys/pic32/picadillo/PICADILLO-RAMBO b/tools/configsys/board/PICADILLO-RAMBO similarity index 86% rename from sys/pic32/picadillo/PICADILLO-RAMBO rename to tools/configsys/board/PICADILLO-RAMBO index 66ddc86..9e8dd20 100644 --- a/sys/pic32/picadillo/PICADILLO-RAMBO +++ b/tools/configsys/board/PICADILLO-RAMBO @@ -1,10 +1,6 @@ # # Picadillo 35T board # =================== -# -# Console on TFT display. -# SD/MMC card driver on SPI2. -# SPI RAM on SPI4. core pic32mx7 mapping picadillo diff --git a/sys/pic32/pinguino-micro/PINGUINO-MICRO b/tools/configsys/board/PINGUINO-MICRO similarity index 100% rename from sys/pic32/pinguino-micro/PINGUINO-MICRO rename to tools/configsys/board/PINGUINO-MICRO diff --git a/sys/pic32/sdxl/SDXL b/tools/configsys/board/SDXL similarity index 100% rename from sys/pic32/sdxl/SDXL rename to tools/configsys/board/SDXL diff --git a/sys/pic32/starter-kit/STARTER-KIT b/tools/configsys/board/STARTER-KIT similarity index 100% rename from sys/pic32/starter-kit/STARTER-KIT rename to tools/configsys/board/STARTER-KIT diff --git a/sys/pic32/ubw32/UBW32 b/tools/configsys/board/UBW32 similarity index 100% rename from sys/pic32/ubw32/UBW32 rename to tools/configsys/board/UBW32 diff --git a/sys/pic32/ubw32/UBW32-UART b/tools/configsys/board/UBW32-UART similarity index 100% rename from sys/pic32/ubw32/UBW32-UART rename to tools/configsys/board/UBW32-UART diff --git a/tools/configsys/board/UBW32-UART-SDRAM b/tools/configsys/board/UBW32-UART-SDRAM new file mode 100644 index 0000000..6b0d452 --- /dev/null +++ b/tools/configsys/board/UBW32-UART-SDRAM @@ -0,0 +1,18 @@ +# +# UBW32 board +# =========== +# +# Console on UART2 + +core pic32mx7 +linker bootloader-sdram +mapping generic + +device kernel invled=B10 +device console invled=B11 device=tty1 +device uart2 +device rdisk invled=B9 invswap=B8 +device sd0 port=2 cs=A9 +device sdramp + +option PARTITION=sdramp0:sa@2048,fs@14000 diff --git a/sys/pic32/wf32/WF32 b/tools/configsys/board/WF32 similarity index 87% rename from sys/pic32/wf32/WF32 rename to tools/configsys/board/WF32 index 7253c86..4778b41 100644 --- a/sys/pic32/wf32/WF32 +++ b/tools/configsys/board/WF32 @@ -1,6 +1,5 @@ # # chipKIT WF32 board with microSD card on 2.4" LCD TFT display shield -# =================================================================== # # See http://misc.ws/2013/11/08/touch-screen-shield-for-arduino-uno/ # for shield information diff --git a/sys/pic32/cfg/adc.dev b/tools/configsys/dev/adc.dev similarity index 100% rename from sys/pic32/cfg/adc.dev rename to tools/configsys/dev/adc.dev diff --git a/sys/pic32/cfg/console.dev b/tools/configsys/dev/console.dev similarity index 100% rename from sys/pic32/cfg/console.dev rename to tools/configsys/dev/console.dev diff --git a/sys/pic32/cfg/devcfg.dev b/tools/configsys/dev/devcfg.dev similarity index 100% rename from sys/pic32/cfg/devcfg.dev rename to tools/configsys/dev/devcfg.dev diff --git a/sys/pic32/cfg/foreignbootloader.dev b/tools/configsys/dev/foreignbootloader.dev similarity index 100% rename from sys/pic32/cfg/foreignbootloader.dev rename to tools/configsys/dev/foreignbootloader.dev diff --git a/sys/pic32/cfg/glcd.dev b/tools/configsys/dev/glcd.dev similarity index 100% rename from sys/pic32/cfg/glcd.dev rename to tools/configsys/dev/glcd.dev diff --git a/sys/pic32/cfg/glob.dev b/tools/configsys/dev/glob.dev similarity index 100% rename from sys/pic32/cfg/glob.dev rename to tools/configsys/dev/glob.dev diff --git a/sys/pic32/cfg/global.dev b/tools/configsys/dev/global.dev similarity index 100% rename from sys/pic32/cfg/global.dev rename to tools/configsys/dev/global.dev diff --git a/sys/pic32/cfg/gpio.dev b/tools/configsys/dev/gpio.dev similarity index 100% rename from sys/pic32/cfg/gpio.dev rename to tools/configsys/dev/gpio.dev diff --git a/sys/pic32/cfg/hxtft.dev b/tools/configsys/dev/hxtft.dev similarity index 100% rename from sys/pic32/cfg/hxtft.dev rename to tools/configsys/dev/hxtft.dev diff --git a/sys/pic32/cfg/kernel.dev b/tools/configsys/dev/kernel.dev similarity index 100% rename from sys/pic32/cfg/kernel.dev rename to tools/configsys/dev/kernel.dev diff --git a/sys/pic32/cfg/log.dev b/tools/configsys/dev/log.dev similarity index 100% rename from sys/pic32/cfg/log.dev rename to tools/configsys/dev/log.dev diff --git a/sys/pic32/cfg/mrams.dev b/tools/configsys/dev/mrams.dev similarity index 100% rename from sys/pic32/cfg/mrams.dev rename to tools/configsys/dev/mrams.dev diff --git a/sys/pic32/cfg/picga.dev b/tools/configsys/dev/picga.dev similarity index 100% rename from sys/pic32/cfg/picga.dev rename to tools/configsys/dev/picga.dev diff --git a/sys/pic32/cfg/power.dev b/tools/configsys/dev/power.dev similarity index 100% rename from sys/pic32/cfg/power.dev rename to tools/configsys/dev/power.dev diff --git a/sys/pic32/cfg/pty.dev b/tools/configsys/dev/pty.dev similarity index 100% rename from sys/pic32/cfg/pty.dev rename to tools/configsys/dev/pty.dev diff --git a/sys/pic32/cfg/pwm.dev b/tools/configsys/dev/pwm.dev similarity index 100% rename from sys/pic32/cfg/pwm.dev rename to tools/configsys/dev/pwm.dev diff --git a/sys/pic32/cfg/rdisk.dev b/tools/configsys/dev/rdisk.dev similarity index 100% rename from sys/pic32/cfg/rdisk.dev rename to tools/configsys/dev/rdisk.dev diff --git a/sys/pic32/cfg/sd.dev b/tools/configsys/dev/sd.dev similarity index 100% rename from sys/pic32/cfg/sd.dev rename to tools/configsys/dev/sd.dev diff --git a/sys/pic32/cfg/sdramp.dev b/tools/configsys/dev/sdramp.dev similarity index 100% rename from sys/pic32/cfg/sdramp.dev rename to tools/configsys/dev/sdramp.dev diff --git a/sys/pic32/cfg/skel.dev b/tools/configsys/dev/skel.dev similarity index 100% rename from sys/pic32/cfg/skel.dev rename to tools/configsys/dev/skel.dev diff --git a/sys/pic32/cfg/spi.dev b/tools/configsys/dev/spi.dev similarity index 100% rename from sys/pic32/cfg/spi.dev rename to tools/configsys/dev/spi.dev diff --git a/sys/pic32/cfg/spibus.dev b/tools/configsys/dev/spibus.dev similarity index 100% rename from sys/pic32/cfg/spibus.dev rename to tools/configsys/dev/spibus.dev diff --git a/sys/pic32/cfg/spirams.dev b/tools/configsys/dev/spirams.dev similarity index 100% rename from sys/pic32/cfg/spirams.dev rename to tools/configsys/dev/spirams.dev diff --git a/sys/pic32/cfg/sramc.dev b/tools/configsys/dev/sramc.dev similarity index 100% rename from sys/pic32/cfg/sramc.dev rename to tools/configsys/dev/sramc.dev diff --git a/sys/pic32/cfg/tty.dev b/tools/configsys/dev/tty.dev similarity index 100% rename from sys/pic32/cfg/tty.dev rename to tools/configsys/dev/tty.dev diff --git a/sys/pic32/cfg/uart.dev b/tools/configsys/dev/uart.dev similarity index 100% rename from sys/pic32/cfg/uart.dev rename to tools/configsys/dev/uart.dev diff --git a/sys/pic32/cfg/uartconsole.dev b/tools/configsys/dev/uartconsole.dev similarity index 100% rename from sys/pic32/cfg/uartconsole.dev rename to tools/configsys/dev/uartconsole.dev diff --git a/sys/pic32/cfg/uartusb.dev b/tools/configsys/dev/uartusb.dev similarity index 100% rename from sys/pic32/cfg/uartusb.dev rename to tools/configsys/dev/uartusb.dev diff --git a/sys/pic32/cfg/ufs.dev b/tools/configsys/dev/ufs.dev similarity index 100% rename from sys/pic32/cfg/ufs.dev rename to tools/configsys/dev/ufs.dev diff --git a/sys/pic32/cfg/usbconsole.dev b/tools/configsys/dev/usbconsole.dev similarity index 100% rename from sys/pic32/cfg/usbconsole.dev rename to tools/configsys/dev/usbconsole.dev diff --git a/sys/pic32/cfg/fubarino.map b/tools/configsys/map/fubarino.map similarity index 100% rename from sys/pic32/cfg/fubarino.map rename to tools/configsys/map/fubarino.map diff --git a/sys/pic32/cfg/generic.map b/tools/configsys/map/generic.map similarity index 100% rename from sys/pic32/cfg/generic.map rename to tools/configsys/map/generic.map diff --git a/sys/pic32/cfg/max32.map b/tools/configsys/map/max32.map similarity index 100% rename from sys/pic32/cfg/max32.map rename to tools/configsys/map/max32.map diff --git a/sys/pic32/cfg/picadillo.map b/tools/configsys/map/picadillo.map similarity index 100% rename from sys/pic32/cfg/picadillo.map rename to tools/configsys/map/picadillo.map diff --git a/sys/pic32/cfg/wf32.map b/tools/configsys/map/wf32.map similarity index 100% rename from sys/pic32/cfg/wf32.map rename to tools/configsys/map/wf32.map From c631ae5d437cd820537639184f8c6a40616aa1ed Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Tue, 8 Sep 2015 14:25:59 -0700 Subject: [PATCH 31/32] Kconfig: generate xxx_ENABLED defines automatically. --- sys/pic32/32mxsdram/Config | 6 - sys/pic32/32mxsdram/Makefile | 13 +- sys/pic32/Config.generic | 20 --- sys/pic32/baremetal/Config | 5 - sys/pic32/baremetal/Makefile | 9 +- sys/pic32/devsw.c | 7 +- sys/pic32/duinomite-emega/Config | 5 - sys/pic32/duinomite-emega/Config-uart | 5 - sys/pic32/duinomite-emega/Makefile | 9 +- sys/pic32/duinomite/Config | 5 - sys/pic32/duinomite/Config-uart | 5 - sys/pic32/duinomite/Makefile | 9 +- sys/pic32/explorer16/Config | 5 - sys/pic32/explorer16/Makefile | 9 +- sys/pic32/fubarino/Config | 6 - sys/pic32/fubarino/Config-uart-sramc | 7 - sys/pic32/fubarino/Makefile | 11 +- sys/pic32/max32/Config | 9 -- sys/pic32/max32/Makefile | 15 +- sys/pic32/maximite-color/Config | 5 - sys/pic32/maximite-color/Makefile | 9 +- sys/pic32/maximite/Config | 5 - sys/pic32/maximite/Makefile | 9 +- sys/pic32/mmb-mx7/Config | 6 - sys/pic32/mmb-mx7/Makefile | 11 +- sys/pic32/picadillo/Config | 6 - sys/pic32/picadillo/Config-rambo | 7 - sys/pic32/picadillo/Makefile | 11 +- sys/pic32/pinguino-micro/Config | 5 - sys/pic32/pinguino-micro/Makefile | 9 +- sys/pic32/sdxl/Config | 6 - sys/pic32/sdxl/Makefile | 11 +- sys/pic32/starter-kit/Config | 5 - sys/pic32/starter-kit/Makefile | 9 +- sys/pic32/ubw32/Config | 5 - sys/pic32/ubw32/Config-uart | 5 - sys/pic32/ubw32/Makefile | 10 +- sys/pic32/wf32/Config | 5 - sys/pic32/wf32/Makefile | 9 +- tools/kconfig/Makefile | 3 +- tools/kconfig/main.c | 1 - tools/kconfig/mkheaders.c | 200 -------------------------- tools/kconfig/mkmakefile.c | 21 ++- 43 files changed, 110 insertions(+), 423 deletions(-) delete mode 100644 tools/kconfig/mkheaders.c diff --git a/sys/pic32/32mxsdram/Config b/sys/pic32/32mxsdram/Config index 6cd67c5..a2f63e6 100644 --- a/sys/pic32/32mxsdram/Config +++ b/sys/pic32/32mxsdram/Config @@ -40,14 +40,12 @@ config unix root on sd0a # Serial UART ports device uart3 -options "UART3_ENABLED" # TODO: delete this option # Console options options "CONSOLE_DEVICE=tty2" # /dev/tty2 # SPI ports controller spi4 # SD card -options "SPI_ENABLED" # TODO: delete this option # sdcard's definition for the SPI port, sdcard's chipselect and high-side power switch # because of a mod on the board we use power=B13, otherwise it shall be D12 @@ -61,19 +59,15 @@ options "SD0_ENA_PIN=13" # ...use pin RB13 TODO: use fl # 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 # Use SDRAM driver for the external ramdisk disk sdramp0 # SDRAM on external memory bus -options "SDRAMP_ENABLED" # TODO: delete this option options "KERNEL_EXECUTABLE_RAM" # allow kernel code in RAM area # This defines the swap size and a fs partition size on the external ramdisk. diff --git a/sys/pic32/32mxsdram/Makefile b/sys/pic32/32mxsdram/Makefile index a591bdb..c78572d 100644 --- a/sys/pic32/32mxsdram/Makefile +++ b/sys/pic32/32mxsdram/Makefile @@ -1,21 +1,22 @@ PARAM = -DCUSTOM_32MXSDRAM PARAM += -DPIC32MX7 +PARAM += -DUART3_ENABLED +PARAM += -DSPI4_ENABLED +PARAM += -DSD_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED +PARAM += -DSDRAMP_ENABLED PARAM += -DNMOUNT=3 PARAM += -DPARTITION='sdramp0:sa@2048,fs@14000' PARAM += -DKERNEL_EXECUTABLE_RAM -PARAM += -DSDRAMP_ENABLED -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED -PARAM += -DGPIO_ENABLED PARAM += -DSD0_ENA_PIN=13 PARAM += -DSD0_ENA_PORT=TRISB PARAM += -DSD0_CS_PIN=3 PARAM += -DSD0_CS_PORT=TRISF PARAM += -DSD0_PORT=4 PARAM += -DSD0_MHZ=10 -PARAM += -DSPI_ENABLED PARAM += -DCONSOLE_DEVICE=tty2 -PARAM += -DUART3_ENABLED PARAM += -DLED_TTY_PIN=14 PARAM += -DLED_TTY_PORT=TRISA PARAM += -DLED_SWAP_PIN=14 diff --git a/sys/pic32/Config.generic b/sys/pic32/Config.generic index d20d782..bab1bbe 100644 --- a/sys/pic32/Config.generic +++ b/sys/pic32/Config.generic @@ -63,10 +63,6 @@ device uart1 # Serial-to-USB converter device uart2 device uart3 device uart4 -options "UART1_ENABLED" # TODO: delete this option -options "UART2_ENABLED" # TODO: delete this option -options "UART3_ENABLED" # TODO: delete this option -options "UART4_ENABLED" # TODO: delete this option options "UART1_BAUD=115200" # default speed options "UART2_BAUD=115200" # default speed options "UART3_BAUD=115200" # default speed @@ -78,7 +74,6 @@ options "UART4_ENA_PIN=13" # ...use pin RB13 device uartusb # USB device mode, CDC function options "UARTUSB_BAUD=115200" # default speed options "USB_AUTOBOOT=YES" # don't wait for 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 @@ -89,7 +84,6 @@ options "CONSOLE_DEVICE=tty0" # /dev/tty0 # SPI ports controller spi2 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi2 flags 0x3e # select pin RC14 @@ -102,41 +96,32 @@ 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... @@ -150,12 +135,10 @@ options "POWER_CONTROL_PIN=5" # ...use pin RA5 # 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... @@ -168,7 +151,6 @@ 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 @@ -176,7 +158,6 @@ 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 @@ -209,7 +190,6 @@ 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 diff --git a/sys/pic32/baremetal/Config b/sys/pic32/baremetal/Config index 149e516..6316613 100644 --- a/sys/pic32/baremetal/Config +++ b/sys/pic32/baremetal/Config @@ -36,14 +36,12 @@ config unix root on sd0a # Serial UART ports device uart1 -options "UART1_ENABLED" # TODO: delete this option # Console options options "CONSOLE_DEVICE=tty0" # /dev/tty0 # SPI ports controller spi2 # SD card -options "SPI_ENABLED" # TODO: delete this option # SD card disk sd0 at spi2 flags 0x41 # select pin RD1 @@ -54,12 +52,9 @@ options "SD0_CS_PIN=1" # ...use pin RD1 TODO: use fl # 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 diff --git a/sys/pic32/baremetal/Makefile b/sys/pic32/baremetal/Makefile index 4e7a101..55d8765 100644 --- a/sys/pic32/baremetal/Makefile +++ b/sys/pic32/baremetal/Makefile @@ -1,15 +1,16 @@ PARAM = -DBAREMETAL PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUART1_ENABLED +PARAM += -DSPI2_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_CS_PIN=1 PARAM += -DSD0_CS_PORT=TRISD PARAM += -DSD0_PORT=2 PARAM += -DSD0_MHZ=16 -PARAM += -DSPI_ENABLED PARAM += -DCONSOLE_DEVICE=tty0 -PARAM += -DUART1_ENABLED PARAM += -DLED_TTY_PIN=12 PARAM += -DLED_TTY_PORT=TRISD PARAM += -DLED_DISK_PIN=2 diff --git a/sys/pic32/devsw.c b/sys/pic32/devsw.c index 1cdb59d..7dd562e 100644 --- a/sys/pic32/devsw.c +++ b/sys/pic32/devsw.c @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -31,9 +32,6 @@ extern int strcmp(char *s1, char *s2); #ifdef ADC_ENABLED # include #endif -#ifdef SPI_ENABLED -# include -#endif #ifdef GLCD_ENABLED # include #endif @@ -215,7 +213,8 @@ const struct cdevsw cdevsw[] = { #endif }, { /* 12 - spi */ -#ifdef SPI_ENABLED +#if defined(SPI1_ENABLED) || defined(SPI2_ENABLED) || \ + defined(SPI3_ENABLED) || defined(SPI4_ENABLED) spidev_open, spidev_close, spidev_read, spidev_write, spidev_ioctl, nulldev, 0, seltrue, nostrategy, 0, 0, spidevs diff --git a/sys/pic32/duinomite-emega/Config b/sys/pic32/duinomite-emega/Config index 9a05422..2c8daa9 100644 --- a/sys/pic32/duinomite-emega/Config +++ b/sys/pic32/duinomite-emega/Config @@ -39,13 +39,11 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # SPI ports controller spi3 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi3 flags 0x7c # select pin RG12 @@ -57,12 +55,9 @@ options "SD0_ENA_PIN=13" # ...use pin RG13 TODO: use fl # 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 diff --git a/sys/pic32/duinomite-emega/Config-uart b/sys/pic32/duinomite-emega/Config-uart index ffba897..e8af882 100644 --- a/sys/pic32/duinomite-emega/Config-uart +++ b/sys/pic32/duinomite-emega/Config-uart @@ -39,13 +39,11 @@ options "CONSOLE_DEVICE=tty4" # Console on UART5 # Serial UART ports device uart5 # RS-232 port -options "UART5_ENABLED" # TODO: delete this option options "UART5_ENA_PORT=TRISB" # for RS-232 enable... TODO: use flags options "UART5_ENA_PIN=13" # ...use pin RB13 TODO: use flags # SPI ports controller spi3 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi3 flags 0x7c # select pin RG12 @@ -57,12 +55,9 @@ options "SD0_ENA_PIN=13" # ...use pin RG13 TODO: use fl # 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 diff --git a/sys/pic32/duinomite-emega/Makefile b/sys/pic32/duinomite-emega/Makefile index d2acab7..a7d3454 100644 --- a/sys/pic32/duinomite-emega/Makefile +++ b/sys/pic32/duinomite-emega/Makefile @@ -1,17 +1,18 @@ PARAM = -DDUINOMITE PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DSPI3_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_ENA_PIN=13 PARAM += -DSD0_ENA_PORT=TRISG PARAM += -DSD0_CS_PIN=12 PARAM += -DSD0_CS_PORT=TRISG PARAM += -DSD0_PORT=3 -PARAM += -DSPI_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_DISK_PIN=1 PARAM += -DLED_DISK_PORT=TRISC diff --git a/sys/pic32/duinomite/Config b/sys/pic32/duinomite/Config index 2d2dc3b..436f0fe 100644 --- a/sys/pic32/duinomite/Config +++ b/sys/pic32/duinomite/Config @@ -38,13 +38,11 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # SPI ports controller spi3 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi3 flags 0x45 # select pin RD5 @@ -56,12 +54,9 @@ options "SD0_ENA_PIN=13" # ...use pin RB13 TODO: use fl # 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 diff --git a/sys/pic32/duinomite/Config-uart b/sys/pic32/duinomite/Config-uart index 57d5ee3..bc0820d 100644 --- a/sys/pic32/duinomite/Config-uart +++ b/sys/pic32/duinomite/Config-uart @@ -38,13 +38,11 @@ options "CONSOLE_DEVICE=tty4" # Console on UART5 # Serial UART ports device uart5 # RS-232 port -options "UART5_ENABLED" # TODO: delete this option options "UART5_ENA_PORT=TRISB" # for RS-232 enable... TODO: use flags options "UART5_ENA_PIN=13" # ...use pin RB13 TODO: use flags # SPI ports controller spi3 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi3 flags 0x45 # select pin RD5 @@ -56,12 +54,9 @@ options "SD0_ENA_PIN=13" # ...use pin RB13 TODO: use fl # 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 diff --git a/sys/pic32/duinomite/Makefile b/sys/pic32/duinomite/Makefile index 12ae392..3c09c0d 100644 --- a/sys/pic32/duinomite/Makefile +++ b/sys/pic32/duinomite/Makefile @@ -1,17 +1,18 @@ PARAM = -DDUINOMITE PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DSPI3_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_ENA_PIN=13 PARAM += -DSD0_ENA_PORT=TRISB PARAM += -DSD0_CS_PIN=5 PARAM += -DSD0_CS_PORT=TRISD PARAM += -DSD0_PORT=3 -PARAM += -DSPI_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_DISK_PIN=12 PARAM += -DLED_DISK_PORT=TRISB diff --git a/sys/pic32/explorer16/Config b/sys/pic32/explorer16/Config index a3290ef..b29202b 100644 --- a/sys/pic32/explorer16/Config +++ b/sys/pic32/explorer16/Config @@ -38,14 +38,12 @@ config unix root on sd0a # Serial UART ports device uart2 -options "UART2_ENABLED" # TODO: delete this option # Console options options "CONSOLE_DEVICE=tty1" # /dev/tty1 # SPI ports controller spi1 # SD card -options "SPI_ENABLED" # TODO: delete this option # SD card disk sd0 at spi1 flags 0x21 # select pin RB1 @@ -56,12 +54,9 @@ options "SD0_CS_PIN=1" # ...use pin RB1 TODO: use fl # 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 diff --git a/sys/pic32/explorer16/Makefile b/sys/pic32/explorer16/Makefile index 532a5cc..d498544 100644 --- a/sys/pic32/explorer16/Makefile +++ b/sys/pic32/explorer16/Makefile @@ -1,15 +1,16 @@ PARAM = -DEXPLORER16 PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUART2_ENABLED +PARAM += -DSPI1_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_CS_PIN=1 PARAM += -DSD0_CS_PORT=TRISB PARAM += -DSD0_PORT=1 PARAM += -DSD0_MHZ=10 -PARAM += -DSPI_ENABLED PARAM += -DCONSOLE_DEVICE=tty1 -PARAM += -DUART2_ENABLED PARAM += -DLED_SWAP_PIN=3 PARAM += -DLED_SWAP_PORT=TRISA PARAM += -DLED_TTY_PIN=2 diff --git a/sys/pic32/fubarino/Config b/sys/pic32/fubarino/Config index 37b8e05..88904ac 100644 --- a/sys/pic32/fubarino/Config +++ b/sys/pic32/fubarino/Config @@ -36,13 +36,11 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # SPI ports controller spi2 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi2 flags 0x79 # select pin RG9 @@ -52,16 +50,12 @@ options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use fl # 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 # GLCD driver device glcd0 -options "GLCD_ENABLED" # TODO: delete this option diff --git a/sys/pic32/fubarino/Config-uart-sramc b/sys/pic32/fubarino/Config-uart-sramc index 95319d8..e455e03 100644 --- a/sys/pic32/fubarino/Config-uart-sramc +++ b/sys/pic32/fubarino/Config-uart-sramc @@ -42,12 +42,9 @@ options "CONSOLE_DEVICE=tty1" # Console on UART2 # Serial UART ports device uart1 # Additional serial port device uart2 # Console -options "UART1_ENABLED" # TODO: delete this option -options "UART2_ENABLED" # TODO: delete this option # SPI ports controller spi2 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi2 flags 0x79 # select pin RG9 @@ -58,17 +55,13 @@ options "SD0_MHZ=20" # increase data speed # 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 # sramc - SRAM block device disk sramc0 # SRAM via 4-wire CPLD interface -options "SRAMC_ENABLED" # TODO: delete this option options "PARTITION='sramc0:sa@2048,fs@6140'" # Partition schema diff --git a/sys/pic32/fubarino/Makefile b/sys/pic32/fubarino/Makefile index 11a354e..6b1bdb0 100644 --- a/sys/pic32/fubarino/Makefile +++ b/sys/pic32/fubarino/Makefile @@ -1,16 +1,17 @@ PARAM = -DFUBARINO PARAM += -DPIC32MX7 -PARAM += -DGLCD_ENABLED -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DSPI2_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED +PARAM += -DGLCD_ENABLED PARAM += -DSD0_CS_PIN=9 PARAM += -DSD0_CS_PORT=TRISG PARAM += -DSD0_PORT=2 -PARAM += -DSPI_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_KERNEL_PIN=5 PARAM += -DLED_KERNEL_PORT=TRISE diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index 1d32f9e..09f9fe5 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -35,17 +35,12 @@ device uart1 # Serial-to-USB converter device uart2 device uart3 device uart4 -options "UART1_ENABLED" # TODO: delete this option -options "UART2_ENABLED" # TODO: delete this option -options "UART3_ENABLED" # TODO: delete this option -options "UART4_ENABLED" # TODO: delete this option # Console options options "CONSOLE_DEVICE=tty0" # /dev/tty0 # SPI ports controller spi2 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi2 flags 0x3e # select pin RC14 @@ -56,16 +51,12 @@ options "SD0_CS_PIN=14" # ...use pin RC14 TODO: use fl # 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 diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 907db31..d2ccf00 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -1,18 +1,19 @@ PARAM = -DMAX32 PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUART1_ENABLED +PARAM += -DUART2_ENABLED +PARAM += -DUART3_ENABLED +PARAM += -DUART4_ENABLED +PARAM += -DSPI2_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_CS_PIN=14 PARAM += -DSD0_CS_PORT=TRISC PARAM += -DSD0_PORT=2 PARAM += -DSD0_MHZ=10 -PARAM += -DSPI_ENABLED PARAM += -DCONSOLE_DEVICE=tty0 -PARAM += -DUART4_ENABLED -PARAM += -DUART3_ENABLED -PARAM += -DUART2_ENABLED -PARAM += -DUART1_ENABLED PARAM += -DLED_KERNEL_PIN=3 PARAM += -DLED_KERNEL_PORT=TRISA PARAM += -DBUS_DIV=1 diff --git a/sys/pic32/maximite-color/Config b/sys/pic32/maximite-color/Config index 5822665..cca3e8d 100644 --- a/sys/pic32/maximite-color/Config +++ b/sys/pic32/maximite-color/Config @@ -38,13 +38,11 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # SPI ports controller spi4 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi4 flags 0x11 # select pin RA1 @@ -54,12 +52,9 @@ options "SD0_CS_PIN=1" # ...use pin RA1 TODO: use fl # 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 diff --git a/sys/pic32/maximite-color/Makefile b/sys/pic32/maximite-color/Makefile index b1caa01..17f5dc3 100644 --- a/sys/pic32/maximite-color/Makefile +++ b/sys/pic32/maximite-color/Makefile @@ -1,15 +1,16 @@ PARAM = -DMAXIMITE_COLOR PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DSPI4_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_CS_PIN=1 PARAM += -DSD0_CS_PORT=TRISA PARAM += -DSD0_PORT=4 -PARAM += -DSPI_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_DISK_PIN=1 PARAM += -DLED_DISK_PORT=TRISE diff --git a/sys/pic32/maximite/Config b/sys/pic32/maximite/Config index 7192dd5..ac7a571 100644 --- a/sys/pic32/maximite/Config +++ b/sys/pic32/maximite/Config @@ -39,13 +39,11 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # SPI ports controller spi4 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi4 flags 0x50 # select pin RE0 @@ -55,12 +53,9 @@ options "SD0_CS_PIN=0" # ...use pin RE0 TODO: use fl # 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 diff --git a/sys/pic32/maximite/Makefile b/sys/pic32/maximite/Makefile index 0822f83..2282a0a 100644 --- a/sys/pic32/maximite/Makefile +++ b/sys/pic32/maximite/Makefile @@ -1,15 +1,16 @@ PARAM = -DMAXIMITE PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DSPI4_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_CS_PIN=0 PARAM += -DSD0_CS_PORT=TRISE PARAM += -DSD0_PORT=4 -PARAM += -DSPI_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_DISK_PIN=1 PARAM += -DLED_DISK_PORT=TRISE diff --git a/sys/pic32/mmb-mx7/Config b/sys/pic32/mmb-mx7/Config index 8f83a3f..8486336 100644 --- a/sys/pic32/mmb-mx7/Config +++ b/sys/pic32/mmb-mx7/Config @@ -42,17 +42,14 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # Serial UART ports device uart1 # RS-232 port -options "UART1_ENABLED" # TODO: delete this option # SPI ports controller spi1 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi1 flags 0x19 # select pin RA9 @@ -63,14 +60,11 @@ options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use fl # General purpose I/O ports device gpio0 -options "GPIO_ENABLED" # TODO: delete this option options "GPIO_CLEAR_PORT=TRISD" # clear on startup... options "GPIO_CLEAR_PIN=2" # ...pin RD2 # ADC driver device adc0 -options "ADC_ENABLED" # TODO: delete this option # PWM driver device pwm0 -options "PWM_ENABLED" # TODO: delete this option diff --git a/sys/pic32/mmb-mx7/Makefile b/sys/pic32/mmb-mx7/Makefile index 8be1bcb..38ba0b2 100644 --- a/sys/pic32/mmb-mx7/Makefile +++ b/sys/pic32/mmb-mx7/Makefile @@ -1,19 +1,20 @@ PARAM = -DMMB_MX7 PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DUART1_ENABLED +PARAM += -DSPI1_ENABLED +PARAM += -DSD_ENABLED +PARAM += -DGPIO_ENABLED PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DGPIO_CLEAR_PIN=2 PARAM += -DGPIO_CLEAR_PORT=TRISD -PARAM += -DGPIO_ENABLED PARAM += -DSD0_CS_PIN=9 PARAM += -DSD0_CS_PORT=TRISA PARAM += -DSD0_MHZ=8 PARAM += -DSD0_PORT=1 -PARAM += -DSPI_ENABLED -PARAM += -DUART1_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_TTY_INVERT PARAM += -DLED_TTY_PIN=1 diff --git a/sys/pic32/picadillo/Config b/sys/pic32/picadillo/Config index 0933e60..f5d535c 100644 --- a/sys/pic32/picadillo/Config +++ b/sys/pic32/picadillo/Config @@ -29,14 +29,12 @@ config unix root on sd0a # Serial UART ports device uart1 # Serial-to-USB converter -options "UART1_ENABLED" # TODO: delete this option # Console options options "CONSOLE_DEVICE=tty0" # /dev/tty0 # SPI ports controller spi2 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi2 flags 0x79 # select pin RG9 @@ -47,16 +45,12 @@ options "SD0_CS_PIN=9" # ...use pin RG9 TODO: use fl # 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 # HX8357 TFT display driver device hxtft0 -options "HX8357_ENABLED" # TODO: delete this option diff --git a/sys/pic32/picadillo/Config-rambo b/sys/pic32/picadillo/Config-rambo index 531e6dc..c4815ae 100644 --- a/sys/pic32/picadillo/Config-rambo +++ b/sys/pic32/picadillo/Config-rambo @@ -29,7 +29,6 @@ config unix root on sd0a # Serial UART ports device uart1 # Serial-to-USB converter -options "UART1_ENABLED" # TODO: delete this option # Console options options "CONSOLE_DEVICE=tft0" # LCD screen @@ -37,7 +36,6 @@ options "CONSOLE_DEVICE=tft0" # LCD screen # SPI ports controller spi2 # SD card controller spi4 # RAM disk: spirams -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi2 flags 0x79 # select pin RG9 @@ -48,24 +46,19 @@ options "SD0_CS_PIN=9" # ...use pin RG9 TODO: use fl # 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 # HX8357 TFT display driver device hxtft0 -options "HX8357_ENABLED" # TODO: delete this option # spirams - SPI block device disk spirams0 at spi4 options "PARTITION='spirams0:sa@2040'" # Partition schema -options "SPIRAMS_ENABLED" # TODO: delete this option options "SPIRAMS_PORT=SPI4CON" # TODO: delete this option options "SPIRAMS_CHIPSIZE=128" # chip size in kbytes options "SPIRAMS_CHIPS=16" # number of chips diff --git a/sys/pic32/picadillo/Makefile b/sys/pic32/picadillo/Makefile index 48d69b6..fb07079 100644 --- a/sys/pic32/picadillo/Makefile +++ b/sys/pic32/picadillo/Makefile @@ -1,16 +1,17 @@ PARAM = -DPICADILLO_35T PARAM += -DPIC32MX7 -PARAM += -DHX8357_ENABLED -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUART1_ENABLED +PARAM += -DSPI2_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED +PARAM += -DHXTFT_ENABLED PARAM += -DSD0_CS_PIN=9 PARAM += -DSD0_CS_PORT=TRISG PARAM += -DSD0_PORT=2 PARAM += -DSD0_MHZ=10 -PARAM += -DSPI_ENABLED PARAM += -DCONSOLE_DEVICE=tty0 -PARAM += -DUART1_ENABLED PARAM += -DBUS_DIV=1 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 diff --git a/sys/pic32/pinguino-micro/Config b/sys/pic32/pinguino-micro/Config index 62414d1..f40460b 100644 --- a/sys/pic32/pinguino-micro/Config +++ b/sys/pic32/pinguino-micro/Config @@ -36,13 +36,11 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # SPI ports controller spi2 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi2 flags 0x2d # select pin RB13 @@ -52,12 +50,9 @@ options "SD0_CS_PIN=13" # ...use pin RB13 TODO: use fl # 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 diff --git a/sys/pic32/pinguino-micro/Makefile b/sys/pic32/pinguino-micro/Makefile index abe89fb..024442a 100644 --- a/sys/pic32/pinguino-micro/Makefile +++ b/sys/pic32/pinguino-micro/Makefile @@ -1,15 +1,16 @@ PARAM = -DPINGUINO_MICRO PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DSPI2_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_CS_PIN=13 PARAM += -DSD0_CS_PORT=TRISB PARAM += -DSD0_PORT=2 -PARAM += -DSPI_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_KERNEL_INVERT PARAM += -DLED_KERNEL_PIN=1 diff --git a/sys/pic32/sdxl/Config b/sys/pic32/sdxl/Config index aa40d50..9847b05 100644 --- a/sys/pic32/sdxl/Config +++ b/sys/pic32/sdxl/Config @@ -37,13 +37,11 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # SPI ports controller spi2 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi2 flags 0x79 # select pin RG9 @@ -53,16 +51,12 @@ options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use fl # 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 # GLCD driver device glcd0 -options "GLCD_ENABLED" # TODO: delete this option diff --git a/sys/pic32/sdxl/Makefile b/sys/pic32/sdxl/Makefile index 5f49cd5..c49e37f 100644 --- a/sys/pic32/sdxl/Makefile +++ b/sys/pic32/sdxl/Makefile @@ -1,16 +1,17 @@ PARAM = -DSDXL PARAM += -DPIC32MX7 -PARAM += -DGLCD_ENABLED -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DSPI2_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED +PARAM += -DGLCD_ENABLED PARAM += -DSD0_CS_PIN=9 PARAM += -DSD0_CS_PORT=TRISG PARAM += -DSD0_PORT=2 -PARAM += -DSPI_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_KERNEL_PIN=7 PARAM += -DLED_KERNEL_PORT=TRISE diff --git a/sys/pic32/starter-kit/Config b/sys/pic32/starter-kit/Config index e931286..6d58c38 100644 --- a/sys/pic32/starter-kit/Config +++ b/sys/pic32/starter-kit/Config @@ -38,13 +38,11 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # SPI ports controller spi1 # SD card -options "SPI_ENABLED" # TODO: delete this option # SD card disk sd0 at spi1 flags 0x21 # select pin RB1 @@ -54,12 +52,9 @@ options "SD0_CS_PIN=1" # ...use pin RB1 TODO: use fl # 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 diff --git a/sys/pic32/starter-kit/Makefile b/sys/pic32/starter-kit/Makefile index 993fbd8..f381907 100644 --- a/sys/pic32/starter-kit/Makefile +++ b/sys/pic32/starter-kit/Makefile @@ -1,15 +1,16 @@ PARAM = -DSTARTERKIT PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DSPI1_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_CS_PIN=1 PARAM += -DSD0_CS_PORT=TRISB PARAM += -DSD0_PORT=1 -PARAM += -DSPI_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_KERNEL_PIN=2 PARAM += -DLED_KERNEL_PORT=TRISD diff --git a/sys/pic32/ubw32/Config b/sys/pic32/ubw32/Config index ce9fac0..4d68d71 100644 --- a/sys/pic32/ubw32/Config +++ b/sys/pic32/ubw32/Config @@ -47,13 +47,11 @@ options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB pseudo-device uartusb -options "UARTUSB_ENABLED" # TODO: delete this option options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" # SPI ports controller spi1 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi1 flags 0x19 # select pin RA9 @@ -67,12 +65,9 @@ options "SD1_CS_PIN=10" # ...use pin RA9 TODO: use fl # 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 diff --git a/sys/pic32/ubw32/Config-uart b/sys/pic32/ubw32/Config-uart index 29b3e11..195830a 100644 --- a/sys/pic32/ubw32/Config-uart +++ b/sys/pic32/ubw32/Config-uart @@ -46,11 +46,9 @@ options "CONSOLE_DEVICE=tty1" # Console on UART2 # Serial UART ports device uart2 # USB-to-serial adapter -options "UART2_ENABLED" # TODO: delete this option # SPI ports controller spi1 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi1 flags 0x19 # select pin RA9 @@ -64,12 +62,9 @@ options "SD1_CS_PIN=10" # ...use pin RA9 TODO: use fl # 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 diff --git a/sys/pic32/ubw32/Makefile b/sys/pic32/ubw32/Makefile index 5ddf092..f1bac69 100644 --- a/sys/pic32/ubw32/Makefile +++ b/sys/pic32/ubw32/Makefile @@ -1,18 +1,20 @@ PARAM = -DUBW32 PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUARTUSB_ENABLED +PARAM += -DSPI1_ENABLED +PARAM += -DSD_ENABLED +PARAM += -DSD1_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD1_CS_PIN=10 PARAM += -DSD1_CS_PORT=TRISA PARAM += -DSD1_PORT=1 PARAM += -DSD0_CS_PIN=9 PARAM += -DSD0_CS_PORT=TRISA PARAM += -DSD0_PORT=1 -PARAM += -DSPI_ENABLED PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 -PARAM += -DUARTUSB_ENABLED PARAM += -DCONSOLE_DEVICE=ttyUSB0 PARAM += -DLED_TTY_INVERT PARAM += -DLED_TTY_PIN=3 diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index 5beec81..0646681 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -34,14 +34,12 @@ config unix root on sd0a # Serial UART ports device uart1 # Serial-to-USB converter -options "UART1_ENABLED" # TODO: delete this option # Console options options "CONSOLE_DEVICE=tty0" # /dev/tty0 # SPI ports controller spi2 # SD card -options "SPI_ENABLED" # TODO: delete this option # microSD card disk sd0 at spi2 flags 0x44 # select pin RD4 @@ -52,12 +50,9 @@ options "SD0_CS_PIN=4" # ...use pin RD4 TODO: use fl # 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 diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index 50e5b89..9e37973 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -1,15 +1,16 @@ PARAM = -DWF32 PARAM += -DPIC32MX7 -PARAM += -DPWM_ENABLED -PARAM += -DADC_ENABLED +PARAM += -DUART1_ENABLED +PARAM += -DSPI2_ENABLED +PARAM += -DSD_ENABLED PARAM += -DGPIO_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DPWM_ENABLED PARAM += -DSD0_CS_PIN=4 PARAM += -DSD0_CS_PORT=TRISD PARAM += -DSD0_PORT=2 PARAM += -DSD0_MHZ=10 -PARAM += -DSPI_ENABLED PARAM += -DCONSOLE_DEVICE=tty0 -PARAM += -DUART1_ENABLED PARAM += -DLED_TTY_PIN=1 PARAM += -DLED_TTY_PORT=TRISA PARAM += -DLED_DISK_PIN=0 diff --git a/tools/kconfig/Makefile b/tools/kconfig/Makefile index 57f981f..c2cee01 100644 --- a/tools/kconfig/Makefile +++ b/tools/kconfig/Makefile @@ -2,8 +2,7 @@ CC = gcc -g CFLAGS = -O -Wall -Werror YACC = byacc -d DESTDIR = /usr/local -OBJS = config.o main.o lang.o mkioconf.o mkmakefile.o mkheaders.o \ - mkswapconf.o +OBJS = config.o main.o lang.o mkioconf.o mkmakefile.o mkswapconf.o PROG = kconfig all: $(PROG) $(PROG).0 diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index ab3f6f0..9e9465a 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -87,7 +87,6 @@ usage: fputs("usage: kconfig [-gp] sysname\n", stderr); exit(1); } makefile(); /* build Makefile */ - headers(); /* make a lot of .h files */ swapconf(); /* swap config files */ exit(0); } diff --git a/tools/kconfig/mkheaders.c b/tools/kconfig/mkheaders.c deleted file mode 100644 index 76eec47..0000000 --- a/tools/kconfig/mkheaders.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Make all the .h files for the optional entries - */ -#include -#include "config.h" -#include "y.tab.h" - -void do_header(dev, hname, count) - char *dev, *hname; - int count; -{ - char *file, *name, *inw, *toheader(), *tomacro(); - struct file_list *fl, *fl_head, *tflp; - FILE *inf, *outf; - int inc, oldcount; - - file = toheader(hname); - name = tomacro(dev); - inf = fopen(file, "r"); - oldcount = -1; - if (inf == 0) { - outf = fopen(file, "w"); - if (outf == 0) { - perror(file); - exit(1); - } - fprintf(outf, "#define %s %d\n", name, count); - (void) fclose(outf); - return; - } - fl_head = NULL; - for (;;) { - char *cp; - if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) - break; - if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) - break; - inw = strdup(inw); - cp = get_word(inf); - if (cp == 0 || cp == (char *)EOF) - break; - inc = atoi(cp); - if (eq(inw, name)) { - oldcount = inc; - inc = count; - } - cp = get_word(inf); - if (cp == (char *)EOF) - break; - fl = (struct file_list *) malloc(sizeof *fl); - bzero(fl, sizeof(*fl)); - fl->f_fn = inw; - fl->f_type = inc; - fl->f_next = fl_head; - fl_head = fl; - } - (void) fclose(inf); - if (count == oldcount) { - for (fl = fl_head; fl != NULL; fl = tflp) { - tflp = fl->f_next; - free(fl); - } - return; - } - if (oldcount == -1) { - fl = (struct file_list *) malloc(sizeof *fl); - bzero(fl, sizeof(*fl)); - fl->f_fn = name; - fl->f_type = count; - fl->f_next = fl_head; - fl_head = fl; - } - outf = fopen(file, "w"); - if (outf == 0) { - perror(file); - exit(1); - } - for (fl = fl_head; fl != NULL; fl = tflp) { - fprintf(outf, - "#define %s %u\n", fl->f_fn, count ? fl->f_type : 0); - tflp = fl->f_next; - free(fl); - } - (void) fclose(outf); -} - -/* - * count all the devices of a certain type and recurse to count - * whatever the device is connected to - */ -void do_count(dev, hname, search) - register char *dev, *hname; - int search; -{ - register struct device *dp, *mp; - register int count, hicount; - - /* - * After this loop, "count" will be the actual number of units, - * and "hicount" will be the highest unit declared. do_header() - * must use this higher of these values. - */ - for (hicount = count = 0, dp = dtab; dp != 0; dp = dp->d_next) - if (dp->d_unit != -1 && eq(dp->d_name, dev)) { - if (dp->d_type == PSEUDO_DEVICE) { - count = - dp->d_slave != UNKNOWN ? dp->d_slave : 1; - break; - } - count++; - /* - * Allow holes in unit numbering, - * assumption is unit numbering starts - * at zero. - */ - if (dp->d_unit + 1 > hicount) - hicount = dp->d_unit + 1; - if (search) { - mp = dp->d_conn; - if (mp != 0 && mp->d_conn != 0) { - do_count(mp->d_name, hname, 0); - search = 0; - } - } - } - do_header(dev, hname, count > hicount ? count : hicount); -} - -void headers() -{ - register struct file_list *fl; - - for (fl = ftab; fl != 0; fl = fl->f_next) - if (fl->f_needs != 0) - do_count(fl->f_needs, fl->f_needs, 1); -} - -/* - * convert a dev name to a .h file name - */ -char * -toheader(dev) - char *dev; -{ - static char hbuf[80]; - - (void) strcpy(hbuf, dev); - (void) strcat(hbuf, ".h"); - return (hbuf); -} - -/* - * convert a dev name to a macro name - */ -char *tomacro(dev) - register char *dev; -{ - static char mbuf[20]; - register char *cp; - - cp = mbuf; - *cp++ = 'N'; - while (*dev) - *cp++ = islower(*dev) ? toupper(*dev++) : *dev++; - *cp++ = 0; - return (mbuf); -} diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index 838781a..05ca4e7 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -410,6 +410,7 @@ void makefile() char line[BUFSIZ]; struct opt *op; struct cputype *cp; + struct device *dp; read_files(); strcpy(line, "../Makefile.kconf"); @@ -432,6 +433,12 @@ void makefile() for (cp = cputype; cp; cp = cp->cpu_next) { fprintf(ofp, "PARAM += -D%s\n", cp->cpu_name); } + for (dp = dtab; dp != 0; dp = dp->d_next) { + if (dp->d_unit <= 0) + fprintf(ofp, "PARAM += -D%s_ENABLED\n", raise(dp->d_name)); + else + fprintf(ofp, "PARAM += -D%s%d_ENABLED\n", raise(dp->d_name), dp->d_unit); + } for (op = opt; op; op = op->op_next) { if (op->op_value) fprintf(ofp, "PARAM += -D%s=\"%s\"\n", op->op_name, op->op_value); @@ -523,16 +530,20 @@ do_systemspec(f, fl, first) return (fl); } +/* + * Convert a name to uppercase. + * Return a pointer to a static buffer. + */ char * raise(str) register char *str; { - register char *cp = str; + static char buf[100]; + register char *cp = buf; while (*str) { - if (islower(*str)) - *str = toupper(*str); - str++; + *cp++ = islower(*str) ? toupper(*str++) : *str++; } - return (cp); + *cp = 0; + return buf; } From 355ad339ef0170ee6cc6bc00a335298fe2f20f5d Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Tue, 8 Sep 2015 22:17:10 -0700 Subject: [PATCH 32/32] Kconfig: use named pins for SD select and enable signals. --- sys/pic32/32mxsdram/Config | 19 +++++----- sys/pic32/Config.generic | 33 ++++++++--------- sys/pic32/baremetal/Config | 12 +++---- sys/pic32/duinomite-emega/Config | 19 +++++----- sys/pic32/duinomite-emega/Config-uart | 23 ++++++------ sys/pic32/duinomite/Config | 19 +++++----- sys/pic32/duinomite/Config-uart | 23 ++++++------ sys/pic32/explorer16/Config | 12 +++---- sys/pic32/fubarino/Config | 16 ++++----- sys/pic32/fubarino/Config-uart-sramc | 14 ++++---- sys/pic32/max32/Config | 10 +++--- sys/pic32/maximite-color/Config | 14 ++++---- sys/pic32/maximite/Config | 14 ++++---- sys/pic32/mmb-mx7/Config | 14 ++++---- sys/pic32/mmb-mx7/Makefile | 2 +- sys/pic32/picadillo/Config | 14 ++++---- sys/pic32/picadillo/Config-rambo | 16 ++++----- sys/pic32/pinguino-micro/Config | 14 ++++---- sys/pic32/sdxl/Config | 16 ++++----- sys/pic32/starter-kit/Config | 14 ++++---- sys/pic32/ubw32/Config | 20 +++++------ sys/pic32/ubw32/Config-uart | 18 +++++----- sys/pic32/wf32/Config | 12 +++---- tools/kconfig/config.h | 43 +++++++++++----------- tools/kconfig/config.y | 51 +++++++++++++-------------- tools/kconfig/lang.l | 15 +++++--- tools/kconfig/mkioconf.c | 47 +++++++++++++++--------- tools/kconfig/mkmakefile.c | 4 +-- 28 files changed, 277 insertions(+), 251 deletions(-) diff --git a/sys/pic32/32mxsdram/Config b/sys/pic32/32mxsdram/Config index a2f63e6..506aa41 100644 --- a/sys/pic32/32mxsdram/Config +++ b/sys/pic32/32mxsdram/Config @@ -49,25 +49,26 @@ controller spi4 # SD card # sdcard's definition for the SPI port, sdcard's chipselect and high-side power switch # because of a mod on the board we use power=B13, otherwise it shall be D12 -disk sd0 at spi4 flags 0x63 # select pin RF3 +device sd0 at spi4 + pins RF3, RB13 # select pin, enable pin options "SD0_MHZ=10" # speed 10 MHz options "SD0_PORT=4" # at spi4 TODO: delete -options "SD0_CS_PORT=TRISF" # for chip select... TODO: use flags -options "SD0_CS_PIN=3" # ...use pin RF3 TODO: use flags -options "SD0_ENA_PORT=TRISB" # for microSD enable... TODO: use flags -options "SD0_ENA_PIN=13" # ...use pin RB13 TODO: use flags +options "SD0_CS_PORT=TRISF" # for chip select... TODO: delete +options "SD0_CS_PIN=3" # ...use pin RF3 TODO: delete +options "SD0_ENA_PORT=TRISB" # for microSD enable... TODO: delete +options "SD0_ENA_PIN=13" # ...use pin RB13 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm # Use SDRAM driver for the external ramdisk -disk sdramp0 # SDRAM on external memory bus +device sdramp0 # SDRAM on external memory bus options "KERNEL_EXECUTABLE_RAM" # allow kernel code in RAM area # This defines the swap size and a fs partition size on the external ramdisk. diff --git a/sys/pic32/Config.generic b/sys/pic32/Config.generic index bab1bbe..9b9aef1 100644 --- a/sys/pic32/Config.generic +++ b/sys/pic32/Config.generic @@ -86,13 +86,14 @@ options "CONSOLE_DEVICE=tty0" # /dev/tty0 controller spi2 # SD card # microSD card -disk sd0 at spi2 flags 0x3e # select pin RC14 +device sd0 at spi2 + pins RC14, RA5 # select pin, enable pin 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 +options "SD0_CS_PORT=TRISC" # for chip select... TODO: delete +options "SD0_CS_PIN=14" # ...use pin RC14 TODO: delete +options "SD0_ENA_PORT=TRISA" # to enable SD card... TODO: delete +options "SD0_ENA_PIN=5" # ...use pin RA5 TODO: delete # General purpose I/O ports device gpio0 @@ -100,10 +101,10 @@ options "GPIO_CLEAR_PORT=TRISA" # clear on startup... options "GPIO_CLEAR_PIN=5" # ...pin RA5 # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm # GLCD driver device glcd @@ -112,16 +113,16 @@ device glcd device hxtft # Skeleton driver -device skel0 +device skel # Pseudo terminals -pseudo-device pty 4 +service pty 4 # System log -pseudo-device log +service log # Power control -pseudo-device power +device power options "POWER_LED_PORT=TRISA" # for power LED... options "POWER_LED_PIN=3" # ...use pin RA3 options "POWER_SWITCH_PORT=TRISA" # for power switch... @@ -134,11 +135,11 @@ options "POWER_CONTROL_PIN=5" # ...use pin RA5 # # sdramp - SDRAM block device -disk sdramp0 # SDRAM on external memory bus +device sdramp0 # SDRAM on external memory bus options "KERNEL_EXECUTABLE_RAM" # allow kernel code in RAM area # sramc - SRAM block device -disk sramc0 # SRAM via 4-wire CPLD interface +device sramc0 # SRAM via 4-wire CPLD interface options "SRAMC_DATA_PORT=TRISE" # for DATA signal... options "SRAMC_DATA_PIN=0" # ...use pin RE0 options "SRAMC_LDA_PORT=TRISC" # for LDA signal... @@ -150,14 +151,14 @@ options "SRAMC_WR_PIN=0" # ...use pin RF0 # picga - SPI block device controller spi1 # RAM disk: picga -disk picga0 at spi1 +device picga0 at spi1 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 +device mrams0 at spi1 options "MRAMS_PORT=SPI1CON" # TODO: delete this option options "MRAMS_CHIPS=6" # number of chips options "MRAMS_CHIPSIZE=512" # chip size in kbytes @@ -189,7 +190,7 @@ options "MRAMS_LED5_PIN=5" # ...use pin RF5 # spirams - SPI block device controller spi1 # RAM disk: spirams -disk spirams0 at spi1 +device spirams0 at spi1 options "SPIRAMS_PORT=SPI1CON" # TODO: delete this option options "SPIRAMS_CHIPSIZE=128" # chip size in kbytes options "SPIRAMS_CHIPS=16" # number of chips diff --git a/sys/pic32/baremetal/Config b/sys/pic32/baremetal/Config index 6316613..3f29ea9 100644 --- a/sys/pic32/baremetal/Config +++ b/sys/pic32/baremetal/Config @@ -44,17 +44,17 @@ options "CONSOLE_DEVICE=tty0" # /dev/tty0 controller spi2 # SD card # SD card -disk sd0 at spi2 flags 0x41 # select pin RD1 +device sd0 at spi2 pin RD1 # select pin options "SD0_MHZ=16" # speed 16 MHz options "SD0_PORT=2" # at spi2 TODO: delete -options "SD0_CS_PORT=TRISD" # for chip select... TODO: use flags -options "SD0_CS_PIN=1" # ...use pin RD1 TODO: use flags +options "SD0_CS_PORT=TRISD" # for chip select... TODO: delete +options "SD0_CS_PIN=1" # ...use pin RD1 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/duinomite-emega/Config b/sys/pic32/duinomite-emega/Config index 2c8daa9..c575749 100644 --- a/sys/pic32/duinomite-emega/Config +++ b/sys/pic32/duinomite-emega/Config @@ -38,7 +38,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -46,18 +46,19 @@ options "USB_NUM_STRING_DESCRIPTORS=3" controller spi3 # SD card # microSD card -disk sd0 at spi3 flags 0x7c # select pin RG12 +device sd0 at spi3 + pins RG12, RG13 # select pin, enable pin options "SD0_PORT=3" # at spi3 TODO: delete -options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags -options "SD0_CS_PIN=12" # ...use pin RG12 TODO: use flags -options "SD0_ENA_PORT=TRISG" # for SD enable... TODO: use flags -options "SD0_ENA_PIN=13" # ...use pin RG13 TODO: use flags +options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete +options "SD0_CS_PIN=12" # ...use pin RG12 TODO: delete +options "SD0_ENA_PORT=TRISG" # for SD enable... TODO: delete +options "SD0_ENA_PIN=13" # ...use pin RG13 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/duinomite-emega/Config-uart b/sys/pic32/duinomite-emega/Config-uart index e8af882..56ddaf7 100644 --- a/sys/pic32/duinomite-emega/Config-uart +++ b/sys/pic32/duinomite-emega/Config-uart @@ -38,26 +38,27 @@ config unix root on sd0a options "CONSOLE_DEVICE=tty4" # Console on UART5 # Serial UART ports -device uart5 # RS-232 port -options "UART5_ENA_PORT=TRISB" # for RS-232 enable... TODO: use flags -options "UART5_ENA_PIN=13" # ...use pin RB13 TODO: use flags +device uart5 pin RB13 # RS-232 port, enable pin +options "UART5_ENA_PORT=TRISB" # for RS-232 enable... TODO: delete +options "UART5_ENA_PIN=13" # ...use pin RB13 TODO: delete # SPI ports controller spi3 # SD card # microSD card -disk sd0 at spi3 flags 0x7c # select pin RG12 +device sd0 at spi3 + pins RG12, RG13 # select pin, enable pin options "SD0_PORT=3" # at spi3 TODO: delete -options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags -options "SD0_CS_PIN=12" # ...use pin RG12 TODO: use flags -options "SD0_ENA_PORT=TRISG" # for SD enable... TODO: use flags -options "SD0_ENA_PIN=13" # ...use pin RG13 TODO: use flags +options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete +options "SD0_CS_PIN=12" # ...use pin RG12 TODO: delete +options "SD0_ENA_PORT=TRISG" # for SD enable... TODO: delete +options "SD0_ENA_PIN=13" # ...use pin RG13 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/duinomite/Config b/sys/pic32/duinomite/Config index 436f0fe..3d35b24 100644 --- a/sys/pic32/duinomite/Config +++ b/sys/pic32/duinomite/Config @@ -37,7 +37,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb0 options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -45,18 +45,19 @@ options "USB_NUM_STRING_DESCRIPTORS=3" controller spi3 # SD card # microSD card -disk sd0 at spi3 flags 0x45 # select pin RD5 +device sd0 at spi3 + pins RD5, RB13 # select pin, enable pin options "SD0_PORT=3" # at spi3 TODO: delete -options "SD0_CS_PORT=TRISD" # for chip select... TODO: use flags -options "SD0_CS_PIN=5" # ...use pin RD5 TODO: use flags -options "SD0_ENA_PORT=TRISB" # for SD enable... TODO: use flags -options "SD0_ENA_PIN=13" # ...use pin RB13 TODO: use flags +options "SD0_CS_PORT=TRISD" # for chip select... TODO: delete +options "SD0_CS_PIN=5" # ...use pin RD5 TODO: delete +options "SD0_ENA_PORT=TRISB" # for SD enable... TODO: delete +options "SD0_ENA_PIN=13" # ...use pin RB13 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/duinomite/Config-uart b/sys/pic32/duinomite/Config-uart index bc0820d..eae416e 100644 --- a/sys/pic32/duinomite/Config-uart +++ b/sys/pic32/duinomite/Config-uart @@ -37,26 +37,27 @@ config unix root on sd0a options "CONSOLE_DEVICE=tty4" # Console on UART5 # Serial UART ports -device uart5 # RS-232 port -options "UART5_ENA_PORT=TRISB" # for RS-232 enable... TODO: use flags -options "UART5_ENA_PIN=13" # ...use pin RB13 TODO: use flags +device uart5 pin RB13 # RS-232 port, enable pin +options "UART5_ENA_PORT=TRISB" # for RS-232 enable... TODO: delete +options "UART5_ENA_PIN=13" # ...use pin RB13 TODO: delete # SPI ports controller spi3 # SD card # microSD card -disk sd0 at spi3 flags 0x45 # select pin RD5 +device sd0 at spi3 + pins RD5, RB13 # select pin, enable pin options "SD0_PORT=3" # at spi3 TODO: delete -options "SD0_CS_PORT=TRISD" # for chip select... TODO: use flags -options "SD0_CS_PIN=5" # ...use pin RD5 TODO: use flags -options "SD0_ENA_PORT=TRISB" # for SD enable... TODO: use flags -options "SD0_ENA_PIN=13" # ...use pin RB13 TODO: use flags +options "SD0_CS_PORT=TRISD" # for chip select... TODO: delete +options "SD0_CS_PIN=5" # ...use pin RD5 TODO: delete +options "SD0_ENA_PORT=TRISB" # for SD enable... TODO: delete +options "SD0_ENA_PIN=13" # ...use pin RB13 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/explorer16/Config b/sys/pic32/explorer16/Config index b29202b..a17f395 100644 --- a/sys/pic32/explorer16/Config +++ b/sys/pic32/explorer16/Config @@ -46,17 +46,17 @@ options "CONSOLE_DEVICE=tty1" # /dev/tty1 controller spi1 # SD card # SD card -disk sd0 at spi1 flags 0x21 # select pin RB1 +device sd0 at spi1 pin RB1 # select pin options "SD0_MHZ=10" # speed 10 MHz options "SD0_PORT=1" # at spi1 TODO: delete -options "SD0_CS_PORT=TRISB" # for chip select... TODO: use flags -options "SD0_CS_PIN=1" # ...use pin RB1 TODO: use flags +options "SD0_CS_PORT=TRISB" # for chip select... TODO: delete +options "SD0_CS_PIN=1" # ...use pin RB1 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/fubarino/Config b/sys/pic32/fubarino/Config index 88904ac..ab3e758 100644 --- a/sys/pic32/fubarino/Config +++ b/sys/pic32/fubarino/Config @@ -35,7 +35,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -43,19 +43,19 @@ options "USB_NUM_STRING_DESCRIPTORS=3" controller spi2 # SD card # microSD card -disk sd0 at spi2 flags 0x79 # select pin RG9 +device sd0 at spi2 pin RG9 # select pin options "SD0_PORT=2" # sd0 at spi2 TODO: delete -options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags -options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags +options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm # GLCD driver -device glcd0 +device glcd diff --git a/sys/pic32/fubarino/Config-uart-sramc b/sys/pic32/fubarino/Config-uart-sramc index e455e03..844bdc7 100644 --- a/sys/pic32/fubarino/Config-uart-sramc +++ b/sys/pic32/fubarino/Config-uart-sramc @@ -47,21 +47,21 @@ device uart2 # Console controller spi2 # SD card # microSD card -disk sd0 at spi2 flags 0x79 # select pin RG9 +device sd0 at spi2 pin RG9 # select pin options "SD0_PORT=2" # sd0 at spi2 TODO: delete -options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags -options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags +options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete options "SD0_MHZ=20" # increase data speed # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm # sramc - SRAM block device -disk sramc0 # SRAM via 4-wire CPLD interface +device sramc0 # SRAM via 4-wire CPLD interface options "PARTITION='sramc0:sa@2048,fs@6140'" # Partition schema diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index 09f9fe5..e615fa9 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -43,20 +43,20 @@ options "CONSOLE_DEVICE=tty0" # /dev/tty0 controller spi2 # SD card # microSD card -disk sd0 at spi2 flags 0x3e # select pin RC14 +device sd0 at spi2 pin RC14 # select pin 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 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm # Skeleton driver -#device skel0 +#device skel diff --git a/sys/pic32/maximite-color/Config b/sys/pic32/maximite-color/Config index cca3e8d..416585e 100644 --- a/sys/pic32/maximite-color/Config +++ b/sys/pic32/maximite-color/Config @@ -37,7 +37,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -45,16 +45,16 @@ options "USB_NUM_STRING_DESCRIPTORS=3" controller spi4 # SD card # microSD card -disk sd0 at spi4 flags 0x11 # select pin RA1 +device sd0 at spi4 pin RA1 # select pin options "SD0_PORT=4" # at spi3 TODO: delete -options "SD0_CS_PORT=TRISA" # for chip select... TODO: use flags -options "SD0_CS_PIN=1" # ...use pin RA1 TODO: use flags +options "SD0_CS_PORT=TRISA" # for chip select... TODO: delete +options "SD0_CS_PIN=1" # ...use pin RA1 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/maximite/Config b/sys/pic32/maximite/Config index ac7a571..dedd3d6 100644 --- a/sys/pic32/maximite/Config +++ b/sys/pic32/maximite/Config @@ -38,7 +38,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -46,16 +46,16 @@ options "USB_NUM_STRING_DESCRIPTORS=3" controller spi4 # SD card # microSD card -disk sd0 at spi4 flags 0x50 # select pin RE0 +device sd0 at spi4 pin RE0 # select pin options "SD0_PORT=4" # at spi3 TODO: delete -options "SD0_CS_PORT=TRISE" # for chip select... TODO: use flags -options "SD0_CS_PIN=0" # ...use pin RE0 TODO: use flags +options "SD0_CS_PORT=TRISE" # for chip select... TODO: delete +options "SD0_CS_PIN=0" # ...use pin RE0 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/mmb-mx7/Config b/sys/pic32/mmb-mx7/Config index 8486336..a44870e 100644 --- a/sys/pic32/mmb-mx7/Config +++ b/sys/pic32/mmb-mx7/Config @@ -41,7 +41,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -52,19 +52,19 @@ device uart1 # RS-232 port controller spi1 # SD card # microSD card -disk sd0 at spi1 flags 0x19 # select pin RA9 +device sd0 at spi1 pin RA9 # select pin options "SD0_PORT=1" # sd0 at spi1 TODO: delete +options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: delete +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete options "SD0_MHZ=8" # speed 8 MHz -options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: use flags -options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags # General purpose I/O ports -device gpio0 +device gpio options "GPIO_CLEAR_PORT=TRISD" # clear on startup... options "GPIO_CLEAR_PIN=2" # ...pin RD2 # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/mmb-mx7/Makefile b/sys/pic32/mmb-mx7/Makefile index 38ba0b2..f7c4ce1 100644 --- a/sys/pic32/mmb-mx7/Makefile +++ b/sys/pic32/mmb-mx7/Makefile @@ -9,9 +9,9 @@ PARAM += -DADC_ENABLED PARAM += -DPWM_ENABLED PARAM += -DGPIO_CLEAR_PIN=2 PARAM += -DGPIO_CLEAR_PORT=TRISD +PARAM += -DSD0_MHZ=8 PARAM += -DSD0_CS_PIN=9 PARAM += -DSD0_CS_PORT=TRISA -PARAM += -DSD0_MHZ=8 PARAM += -DSD0_PORT=1 PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3 PARAM += -DUSB_MAX_EP_NUMBER=3 diff --git a/sys/pic32/picadillo/Config b/sys/pic32/picadillo/Config index f5d535c..9ddb4d6 100644 --- a/sys/pic32/picadillo/Config +++ b/sys/pic32/picadillo/Config @@ -37,20 +37,20 @@ options "CONSOLE_DEVICE=tty0" # /dev/tty0 controller spi2 # SD card # microSD card -disk sd0 at spi2 flags 0x79 # select pin RG9 +device sd0 at spi2 pin RG9 # select pin options "SD0_MHZ=10" # speed 10 MHz options "SD0_PORT=2" # at spi2 TODO: delete -options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags -options "SD0_CS_PIN=9" # ...use pin RG9 TODO: use flags +options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete +options "SD0_CS_PIN=9" # ...use pin RG9 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm # HX8357 TFT display driver -device hxtft0 +device hxtft diff --git a/sys/pic32/picadillo/Config-rambo b/sys/pic32/picadillo/Config-rambo index c4815ae..f262d57 100644 --- a/sys/pic32/picadillo/Config-rambo +++ b/sys/pic32/picadillo/Config-rambo @@ -38,26 +38,26 @@ controller spi2 # SD card controller spi4 # RAM disk: spirams # microSD card -disk sd0 at spi2 flags 0x79 # select pin RG9 +device sd0 at spi2 pin RG9 # select pin options "SD0_MHZ=10" # speed 10 MHz options "SD0_PORT=2" # at spi2 TODO: delete -options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags -options "SD0_CS_PIN=9" # ...use pin RG9 TODO: use flags +options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete +options "SD0_CS_PIN=9" # ...use pin RG9 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm # HX8357 TFT display driver -device hxtft0 +device hxtft # spirams - SPI block device -disk spirams0 at spi4 +device spirams0 at spi4 options "PARTITION='spirams0:sa@2040'" # Partition schema options "SPIRAMS_PORT=SPI4CON" # TODO: delete this option options "SPIRAMS_CHIPSIZE=128" # chip size in kbytes diff --git a/sys/pic32/pinguino-micro/Config b/sys/pic32/pinguino-micro/Config index f40460b..c9766c0 100644 --- a/sys/pic32/pinguino-micro/Config +++ b/sys/pic32/pinguino-micro/Config @@ -35,7 +35,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -43,16 +43,16 @@ options "USB_NUM_STRING_DESCRIPTORS=3" controller spi2 # SD card # microSD card -disk sd0 at spi2 flags 0x2d # select pin RB13 +device sd0 at spi2 pin RB13 # select pin options "SD0_PORT=2" # at spi2 TODO: delete -options "SD0_CS_PORT=TRISB" # for chip select... TODO: use flags -options "SD0_CS_PIN=13" # ...use pin RB13 TODO: use flags +options "SD0_CS_PORT=TRISB" # for chip select... TODO: delete +options "SD0_CS_PIN=13" # ...use pin RB13 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/sdxl/Config b/sys/pic32/sdxl/Config index 9847b05..5e0ddc6 100644 --- a/sys/pic32/sdxl/Config +++ b/sys/pic32/sdxl/Config @@ -36,7 +36,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -44,19 +44,19 @@ options "USB_NUM_STRING_DESCRIPTORS=3" controller spi2 # SD card # microSD card -disk sd0 at spi2 flags 0x79 # select pin RG9 +device sd0 at spi2 pin RG9 # select pin RG9 options "SD0_PORT=2" # sd0 at spi2 TODO: delete -options "SD0_CS_PORT=TRISG" # for chip select... TODO: use flags -options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags +options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm # GLCD driver -device glcd0 +device glcd diff --git a/sys/pic32/starter-kit/Config b/sys/pic32/starter-kit/Config index 6d58c38..92c7532 100644 --- a/sys/pic32/starter-kit/Config +++ b/sys/pic32/starter-kit/Config @@ -37,7 +37,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -45,16 +45,16 @@ options "USB_NUM_STRING_DESCRIPTORS=3" controller spi1 # SD card # SD card -disk sd0 at spi1 flags 0x21 # select pin RB1 +device sd0 at spi1 pin RB1 # select pin RB1 options "SD0_PORT=1" # at spi1 TODO: delete -options "SD0_CS_PORT=TRISB" # for chip select... TODO: use flags -options "SD0_CS_PIN=1" # ...use pin RB1 TODO: use flags +options "SD0_CS_PORT=TRISB" # for chip select... TODO: delete +options "SD0_CS_PIN=1" # ...use pin RB1 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/ubw32/Config b/sys/pic32/ubw32/Config index 4d68d71..cae3fc9 100644 --- a/sys/pic32/ubw32/Config +++ b/sys/pic32/ubw32/Config @@ -46,7 +46,7 @@ config unix root on sd0a options "CONSOLE_DEVICE=ttyUSB0" # Console on USB # Virtual UART on USB -pseudo-device uartusb +device uartusb options "USB_MAX_EP_NUMBER=3" options "USB_NUM_STRING_DESCRIPTORS=3" @@ -54,20 +54,20 @@ options "USB_NUM_STRING_DESCRIPTORS=3" controller spi1 # SD card # microSD card -disk sd0 at spi1 flags 0x19 # select pin RA9 -disk sd1 at spi1 flags 0x1a # select pin RA10 +device sd0 at spi1 pin RA9 # select pin +device sd1 at spi1 pin RA10 # select pin options "SD0_PORT=1" # sd0 at spi1 TODO: delete -options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: use flags -options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags +options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: delete +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete options "SD1_PORT=1" # sd1 at spi1 TODO: delete -options "SD1_CS_PORT=TRISA" # for sd1 chip select...TODO: use flags -options "SD1_CS_PIN=10" # ...use pin RA9 TODO: use flags +options "SD1_CS_PORT=TRISA" # for sd1 chip select...TODO: delete +options "SD1_CS_PIN=10" # ...use pin RA9 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/ubw32/Config-uart b/sys/pic32/ubw32/Config-uart index 195830a..2352608 100644 --- a/sys/pic32/ubw32/Config-uart +++ b/sys/pic32/ubw32/Config-uart @@ -51,20 +51,20 @@ device uart2 # USB-to-serial adapter controller spi1 # SD card # microSD card -disk sd0 at spi1 flags 0x19 # select pin RA9 -disk sd1 at spi1 flags 0x1a # select pin RA10 +device sd0 at spi1 pin RA9 # select pin +device sd1 at spi1 pin RA10 # select pin options "SD0_PORT=1" # sd0 at spi1 TODO: delete -options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: use flags -options "SD0_CS_PIN=9" # ...use pin RA9 TODO: use flags +options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: delete +options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete options "SD1_PORT=1" # sd1 at spi1 TODO: delete -options "SD1_CS_PORT=TRISA" # for sd1 chip select...TODO: use flags -options "SD1_CS_PIN=10" # ...use pin RA9 TODO: use flags +options "SD1_CS_PORT=TRISA" # for sd1 chip select...TODO: delete +options "SD1_CS_PIN=10" # ...use pin RA9 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index 0646681..e986eb0 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -42,17 +42,17 @@ options "CONSOLE_DEVICE=tty0" # /dev/tty0 controller spi2 # SD card # microSD card -disk sd0 at spi2 flags 0x44 # select pin RD4 +device sd0 at spi2 pin RD4 # select pin RD4 options "SD0_MHZ=10" # speed 10 MHz options "SD0_PORT=2" # at spi2 TODO: delete -options "SD0_CS_PORT=TRISD" # for chip select... TODO: use flags -options "SD0_CS_PIN=4" # ...use pin RD4 TODO: use flags +options "SD0_CS_PORT=TRISD" # for chip select... TODO: delete +options "SD0_CS_PIN=4" # ...use pin RD4 TODO: delete # General purpose I/O ports -device gpio0 +device gpio # ADC driver -device adc0 +device adc # PWM driver -device pwm0 +device pwm diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index a6bcc15..23cd942 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -93,27 +93,28 @@ struct idlst { }; struct device { - int d_type; /* CONTROLLER, DEVICE, bus adaptor */ - struct device *d_conn; /* what it is connected to */ - char *d_name; /* name of device (e.g. rk11) */ - struct idlst *d_vec; /* interrupt vectors */ - int d_pri; /* interrupt priority */ - int d_addr; /* address of csr */ - int d_unit; /* unit number */ - int d_drive; /* drive number */ - int d_slave; /* slave number */ -#define QUES -1 /* -1 means '?' */ -#define UNKNOWN -2 /* -2 means not set yet */ - int d_dk; /* if init 1 set to number for iostat */ - int d_flags; /* flags for device init */ - char *d_port; /* io port base manifest constant */ - int d_portn; /* io port base (if number not manifest) */ - char *d_mask; /* interrupt mask */ - int d_maddr; /* io memory base */ - int d_msize; /* io memory size */ - int d_drq; /* DMA request */ - int d_irq; /* interrupt request */ - struct device *d_next; /* Next one in list */ + int d_type; /* CONTROLLER, DEVICE, bus adaptor */ + struct device *d_conn; /* what it is connected to */ + char *d_name; /* name of device (e.g. rk11) */ + struct idlst *d_vec; /* interrupt vectors */ + int d_pri; /* interrupt priority */ + int d_addr; /* address of csr */ + int d_unit; /* unit number */ + int d_drive; /* drive number */ + int d_slave; /* slave number */ +#define QUES -1 /* -1 means '?' */ +#define UNKNOWN -2 /* -2 means not set yet */ + int d_flags; /* flags for device init */ + char *d_port; /* io port base manifest constant */ + char *d_mask; /* interrupt mask */ + int d_maddr; /* io memory base */ + int d_msize; /* io memory size */ + int d_drq; /* DMA request */ + int d_irq; /* interrupt request */ + struct device *d_next; /* Next one in list */ +#define MAXPINS 32 /* max number of pins */ + short d_pins[MAXPINS]; /* pins assigned */ + int d_npins; /* pin count */ }; struct config { diff --git a/tools/kconfig/config.y b/tools/kconfig/config.y index cf9d1cc..fb63fc3 100644 --- a/tools/kconfig/config.y +++ b/tools/kconfig/config.y @@ -16,7 +16,6 @@ %token CPU %token CSR %token DEVICE -%token DISK %token DRIVE %token DST %token DUMPS @@ -25,20 +24,19 @@ %token HZ %token LDSCRIPT %token MAJOR -%token MASTER %token MAXUSERS %token MINOR %token MINUS %token ON %token OPTIONS %token MAKEOPTIONS +%token PINS %token PRIORITY -%token PSEUDO_DEVICE +%token SERVICE %token ROOT %token SEMICOLON %token SEQUENTIAL %token SIZE -%token SLAVE %token SWAP %token TIMEZONE %token TRACE @@ -47,6 +45,7 @@ %token ID %token NUMBER %token FPNUMBER +%token PIN %type Save_id %type Opt_value @@ -435,25 +434,19 @@ Device_spec: DEVICE Dev_name Dev_info Int_spec = { cur.d_type = DEVICE; } | - MASTER Dev_name Dev_info Int_spec - = { cur.d_type = MASTER; } - | - DISK Dev_name Dev_info Int_spec - = { cur.d_dk = 1; cur.d_type = DEVICE; } - | CONTROLLER Dev_name Dev_info Int_spec = { cur.d_type = CONTROLLER; } | - PSEUDO_DEVICE Init_dev Dev + SERVICE Init_dev Dev = { cur.d_name = $3; - cur.d_type = PSEUDO_DEVICE; + cur.d_type = SERVICE; } | - PSEUDO_DEVICE Init_dev Dev NUMBER + SERVICE Init_dev Dev NUMBER = { cur.d_name = $3; - cur.d_type = PSEUDO_DEVICE; + cur.d_type = SERVICE; cur.d_slave = $4; } ; @@ -464,6 +457,11 @@ Dev_name: cur.d_name = $2; cur.d_unit = $3; } + | + Init_dev Dev + = { + cur.d_name = $2; + } ; Init_dev: @@ -497,17 +495,10 @@ Info: DRIVE NUMBER = { cur.d_drive = $2; } | - SLAVE NUMBER - = { - if (cur.d_conn != 0 && - cur.d_conn->d_type == MASTER) - cur.d_slave = $2; - else - yyerror("can't specify slave--not to master"); - } - | FLAGS NUMBER = { cur.d_flags = $2; } + | + PINS Pin_list ; Int_spec: @@ -533,6 +524,14 @@ Id_list: a->id = $1; a->id_next = $2; $$ = a; } ; + +Pin_list: + PIN + = { cur.d_pins[cur.d_npins++] = $1; } + | + PIN COMMA Pin_list + = { cur.d_pins[cur.d_npins++] = $1; } + ; %% void yyerror(s) @@ -654,7 +653,7 @@ connect(dev, num) for (dp = dtab; dp != 0; dp = dp->d_next) { if ((num != dp->d_unit) || !eq(dev, dp->d_name)) continue; - if (dp->d_type != CONTROLLER && dp->d_type != MASTER) { + if (dp->d_type != CONTROLLER) { (void) sprintf(errbuf, "%s connected to non-controller", dev); yyerror(errbuf); @@ -736,15 +735,15 @@ void init_dev(dp) dp->d_type = DEVICE; dp->d_conn = 0; dp->d_vec = 0; - dp->d_addr = dp->d_flags = dp->d_dk = 0; + dp->d_addr = dp->d_flags; dp->d_pri = -1; dp->d_slave = dp->d_drive = dp->d_unit = UNKNOWN; dp->d_port = (char *)0; - dp->d_portn = 0; dp->d_irq = -1; dp->d_drq = -1; dp->d_maddr = 0; dp->d_msize = 0; + dp->d_npins = 0; dp->d_mask = "null"; } diff --git a/tools/kconfig/lang.l b/tools/kconfig/lang.l index 2cd9604..08be554 100644 --- a/tools/kconfig/lang.l +++ b/tools/kconfig/lang.l @@ -58,7 +58,6 @@ static struct kt key_words[] = { { "cpu", CPU }, { "csr", CSR }, { "device", DEVICE }, - { "disk", DISK }, { "drive", DRIVE }, { "dst", DST }, { "dumps", DUMPS }, @@ -68,17 +67,17 @@ static struct kt key_words[] = { { "architecture", ARCHITECTURE }, { "major", MAJOR }, { "makeoptions", MAKEOPTIONS }, - { "master", MASTER }, { "maxusers", MAXUSERS }, { "minor", MINOR }, { "on", ON }, { "options", OPTIONS }, + { "pin", PINS }, + { "pins", PINS }, { "priority", PRIORITY }, - { "pseudo-device", PSEUDO_DEVICE }, { "root", ROOT }, { "sequential", SEQUENTIAL }, + { "service", SERVICE }, { "size", SIZE }, - { "slave", SLAVE }, { "swap", SWAP }, { "tape", DEVICE }, { "timezone", TIMEZONE }, @@ -104,7 +103,14 @@ kw_lookup(word) } %} WORD [A-Za-z_][-A-Za-z_]* +PIN R[A-Z][0-9][0-9]* %% +{PIN} { + /* Pin name from RA0 to RZ255. */ + yylval.val = atoi(yytext + 2) & 0xff; + yylval.val |= (yytext[1] - 'A' + 1) << 8; + return PIN; + } {WORD} { int i; @@ -138,7 +144,6 @@ WORD [A-Za-z_][-A-Za-z_]* return NUMBER; } [0-9]"."[0-9]* { - double atof(); yylval.val = (int) (60 * atof(yytext) + 0.5); return FPNUMBER; } diff --git a/tools/kconfig/mkioconf.c b/tools/kconfig/mkioconf.c index 9071230..49acc99 100644 --- a/tools/kconfig/mkioconf.c +++ b/tools/kconfig/mkioconf.c @@ -37,19 +37,19 @@ * build the ioconf.c file */ static void -pseudo_ioconf(fp) +service_ioconf(fp) register FILE *fp; { register struct device *dp; for (dp = dtab; dp != NULL; dp = dp->d_next) - if (dp->d_type == PSEUDO_DEVICE) + if (dp->d_type == SERVICE) fprintf(fp, "extern void %sattach __P((int));\n", dp->d_name); - fprintf(fp, "\nstruct conf_pdev conf_pdinit[] = {\n"); + fprintf(fp, "\nstruct conf_pdev conf_sinit[] = {\n"); for (dp = dtab; dp != NULL; dp = dp->d_next) - if (dp->d_type == PSEUDO_DEVICE) + if (dp->d_type == SERVICE) fprintf(fp, " { %sattach, %d },\n", dp->d_name, dp->d_slave > 0 ? dp->d_slave : 1); @@ -70,6 +70,7 @@ void pic32_ioconf() { register struct device *dp, *mp; FILE *fp; + int i; fp = fopen("ioconf.c", "w"); if (fp == 0) { @@ -83,17 +84,17 @@ void pic32_ioconf() /* print controller initialization structures */ for (dp = dtab; dp != 0; dp = dp->d_next) { - if (dp->d_type == PSEUDO_DEVICE) + if (dp->d_type == SERVICE) continue; fprintf(fp, "extern struct driver %sdriver;\n", dp->d_name); } fprintf(fp, "\nstruct conf_ctlr conf_cinit[] = {\n"); fprintf(fp, " /* driver,\t\tunit,\taddr,\t\tpri,\tflags */\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { - if (dp->d_type != CONTROLLER && dp->d_type != MASTER) + if (dp->d_type != CONTROLLER) continue; - if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { - printf("can't specify drive/slave for %s%s\n", + if (dp->d_drive != UNKNOWN) { + printf("can't specify drive for %s%s\n", dp->d_name, wnum(dp->d_unit)); continue; } @@ -109,10 +110,9 @@ void pic32_ioconf() /* print devices connected to other controllers */ fprintf(fp, "\nstruct conf_device conf_dinit[] = {\n"); fprintf(fp, - " /* driver,\t\tctlr driver,\tunit,\tctlr,\tdrive,\tslave,\tdk,\tflags */\n"); + " /* driver,\t\tctlr driver,\tunit,\tctlr,\tdrive,\tflags,\tpins */\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { - if (dp->d_type == CONTROLLER || dp->d_type == MASTER || - dp->d_type == PSEUDO_DEVICE) + if (dp->d_type == CONTROLLER || dp->d_type == SERVICE) continue; mp = dp->d_conn; @@ -121,14 +121,29 @@ void pic32_ioconf() fprintf(fp, "&%sdriver,\t%d,\t%d,\t", mp->d_name, dp->d_unit, mp->d_unit); } else { - fprintf(fp, "0,\t\t%d,\t0,\t", - dp->d_unit); + fprintf(fp, "0,\t\t%d,\t0,\t", dp->d_unit); } - fprintf(fp, "%d,\t%d,\t%d,\t0x%x },\n", - dp->d_drive, dp->d_slave, dp->d_dk, dp->d_flags); + fprintf(fp, "%d,\t0x%x,\t", dp->d_drive, dp->d_flags); + if (dp->d_npins > 0) { + fprintf(fp, "{"); + for (i=dp->d_npins-1; i>=0; i--) { + int bit = dp->d_pins[i] & 0xff; + int port = dp->d_pins[i] >> 8; + if (bit > 15 || port < 1 || port > 7) { + printf("R%c%u: invalid pin name\n", 'A'+port-1, bit); + exit(1); + } + fprintf(fp, "0x%x%x", port, bit); + if (i > 0) + fprintf(fp, ","); + } + fprintf(fp, "}"); + } else + fprintf(fp, "{0}"); + fprintf(fp, " },\n"); } fprintf(fp, " { 0 }\n};\n"); - pseudo_ioconf(fp); + service_ioconf(fp); fclose(fp); } #endif diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index 05ca4e7..de6f0e6 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -212,7 +212,7 @@ nextparam: goto invis; for (dp = dtab; dp != 0; save_dp = dp, dp = dp->d_next) if (eq(dp->d_name, wd)) { - if (std && dp->d_type == PSEUDO_DEVICE && + if (std && dp->d_type == SERVICE && dp->d_slave <= 0) dp->d_slave = 1; goto nextparam; @@ -221,7 +221,7 @@ nextparam: dp = (struct device *) malloc(sizeof *dp); init_dev(dp); dp->d_name = strdup(wd); - dp->d_type = PSEUDO_DEVICE; + dp->d_type = SERVICE; dp->d_slave = 1; if (save_dp) save_dp->d_next = dp;