Add tools/build directory.

This commit is contained in:
Serge Vakulenko
2015-08-22 00:51:53 -07:00
parent 00279386d7
commit d6164dd82b
9 changed files with 304 additions and 1 deletions

View File

@@ -104,7 +104,7 @@ cleanall: clean
rm -f share/re.help share/emg.keys share/misc/more.help
rm -f etc/termcap etc/remote etc/phones
rm -f tools/configsys/.depend
rm -f var/log/aculog
rm -f var/log/aculog sdcard.img
rm -rf var/lock share/unixbench
installfs:

4
tools/build/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
build-*.log
retrobsd-*.zip
sdcard-*.zip
retrobsd-*-????-??-??

65
tools/build/Makefile Normal file
View File

@@ -0,0 +1,65 @@
BOARD_LIST = duinomite fubarino max32 maximite maximite-color picadillo sdxl
SKEL_SCRATCH = skeleton/linux32/pic32prog \
skeleton/linux64/pic32prog \
skeleton/macosx/pic32prog \
skeleton/pic32prog.exe \
skeleton/sdcard.img \
skeleton/unix.dis \
skeleton/unix.hex
PIC32PROG = https://raw.githubusercontent.com/sergev/pic32prog/master
DATE := $(shell date +'%Y-%m-%d')
all: sdcard-$(DATE).zip
for b in $(BOARD_LIST); do \
$(MAKE) retrobsd-$$b-$(DATE).zip TARGET=$$b; \
done
clean:
rm -rf *.zip $(wildcard retrobsd-*-????-??-??)
clean-all:
rm -f $(SKEL_SCRATCH) build-$(DATE).log
build: build-$(DATE).log
sdcard-$(DATE).zip: ../../sdcard.img
zip -jq $@ ../../sdcard.img
retrobsd-$(TARGET)-$(DATE).zip: update-skeleton
@rm -rf retrobsd-$(TARGET)-$(DATE) $@
cp -rp skeleton retrobsd-$(TARGET)-$(DATE)
ln ../../sdcard.img retrobsd-$(TARGET)-$(DATE)/sdcard.img
ln ../../sys/pic32/$(TARGET)/unix.hex retrobsd-$(TARGET)-$(DATE)/unix.hex
ln ../../sys/pic32/$(TARGET)/unix.dis retrobsd-$(TARGET)-$(DATE)/unix.dis
zip -rq $@ retrobsd-$(TARGET)-$(DATE)
build-$(DATE).log:
make -C ../.. cleanall
(echo === RetroBSD Build Revision $(shell git rev-list HEAD --count) ===; \
make -C ../../tools; \
make -C ../../lib; \
make -C ../../src install; \
make -C ../../sys/pic32 all; \
make -C ../.. fs) 2>&1 > build-$(DATE).log
update-skeleton: skeleton/linux32/pic32prog skeleton/linux64/pic32prog \
skeleton/macosx/pic32prog skeleton/pic32prog.exe \
skeleton/linux32/pic32prog:
(cd skeleton/linux32 && \
curl -o pic32prog $(PIC32PROG)/linux32/pic32prog)
skeleton/linux64/pic32prog:
(cd skeleton/linux64 && \
curl -o pic32prog $(PIC32PROG)/linux64/pic32prog)
skeleton/macosx/pic32prog:
(cd skeleton/macosx && \
curl -o pic32prog $(PIC32PROG)/macosx/pic32prog)
skeleton/pic32prog.exe:
(cd skeleton && \
curl -o pic32prog.exe $(PIC32PROG)/pic32prog.exe)

7
tools/build/skeleton/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
pic32prog.exe
sdcard.img
unix.dis
unix.hex
linux32/pic32prog
linux64/pic32prog
macosx/pic32prog

View File

@@ -0,0 +1,133 @@
RetroBSD is a version of 2.11BSD Unix for microcontrollers.
It can run on PIC32 in only 128 kbytes of RAM. The operating
system includes not only a set of basic Unix utilities, but also
a C compiler, assembler, linker, libraries and include files
sufficient to develop user applications directly on the target
processor. Cross-compile is possible as well.
Files in this package:
unix.hex - Unix kernel image
unix.dis - Disassembly of the kernel image, for debugging
sdcard.img - Root filesystem image
pic32prog.exe - PIC32 programmer utility for Windows
linux32/pic32prog - PIC32 programmer utility for 32-bit Linux
linux64/pic32prog - PIC32 programmer utility for 64-bit Linux
macos/pic32prog - PIC32 programmer utility for Mac OS X
pic32prog.txt - Brief description of pic32prog utility
README.txt - This file
The installation of RetroBSD to your board consists of
three steps:
(1) Transfer the Unix kernel to the board
(2) Put the filesystem image on to a SD card
(3) Connect to the console port and start RetroBSD
Transfer the Unix kernel on to the board
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect the board via microUSB cable to your computer. To enter
a bootloader mode, press the PRG key first, hold it, then press
the RESET key. The LED will now flash and your board is ready
to accept new code. Use pic32prog utility to program the flash
code. The bootloader can appear as a HID device, or as a virtual
serial port (COM port) on your computer, depending on your
board type.
Boards which use HID bootloader: Maximite, Color Maximite,
Duinomite, CGMMSTICK1. For these boards you do not need to
specify the -d option and device name.
Boards which use a virtual serial port for bootloader: Fubarino
SD, chipKIT Max32, Picadillo 35T, Majenko SDXL. For these
boards you need to know the exact device name to specify for
pic32prog (typically /dev/ACM0 on Linux, something like COM12
on Windows, /dev/tty.usbmodemfa131 on Mac OS X).
Use proper pic32prog binary for your operating system:
pic32prog.exe - for Windows
linux32/pic32prog - for 32-bit Linux
linux64/pic32prog - for 64-bit Linux
macos/pic32prog - for Mac OS X
Unpack the package and run command (say, for 64-bit Linux):
linux64/pic32prog -d /dev/ttyACM0 unix.hex
For Windows, it should be like:
pic32prog -d COM12 unix.hex
On Mac OS X:
macosx/pic32prog -d /dev/tty.usbmodemfa131 unix.hex
You should see:
Programmer for Microchip PIC32 microcontrollers, Version 1.112
Copyright: (C) 2011-2014 Serge Vakulenko
Adapter: STK500v2 Bootloader
Program area: 1d000000-1d07ffff
Processor: Bootloader
Flash memory: 512 kbytes
Data: 153384 bytes
Erase: done
Program flash: ###################################### done
Verify flash: ###################################### done
Rate: 9307 bytes per second
Put the filesystem image on to a SD card
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use any USB-to-SD card reader to attach the SD card to your PC.
On Windows, use Win32DiskImager utility. On Linux or Mac OS X,
run:
sudo dd bs=32k if=sdcard.img of=/dev/XYZ
where XYZ is a name of SD card on your computer (use lsblk or
"diskutil list" to obtain).
Once that is done remove the SD card from card reader and plug
it into SD slot on your board. The RetroBSD system is ready
to run.
Connect to the console port and start RetroBSD
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect USB cable to the board and to your computer. The RetroBSD
console will appear as a virtual COM port on your computer. Use
any terminal emulation program (like putty on Windows or
minicom on Linux) to connect to this virtual COM port at baud
rate 115200. Press <Enter> to start RetroBSD. On Login prompt,
enter "root". Password is empty:
2.11 BSD Unix for PIC32, revision G226 build 1:
Compiled 2015-05-19 by vak@tundra.local:
/Users/vak/retrobsd-github/sys/pic32/fubarino
cpu: 795F512H 80 MHz, bus 80 MHz
oscillator: HS crystal, PLL div 1:2 mult x20
console: ttyUSB0 (5,0)
sd0: port SPI2, select pin G9
sd0: type SDHC, size 3914752 kbytes, speed 13 Mbit/sec
phys mem = 128 kbytes
user mem = 96 kbytes
root dev = rd0a (0,1)
root size = 102400 kbytes
swap dev = rd0b (0,2)
swap size = 2048 kbytes
/dev/rd0a: 690 files, 10880 used, 91119 free
Starting daemons: update cron
2.11 BSD UNIX (pic32) (console)
login: root
Password:
Welcome to RetroBSD!
erase, kill ^U, intr ^C
# _

View File

@@ -0,0 +1 @@
This directory contains a pic32prog binary for 32bit Ubuntu Linux.

View File

@@ -0,0 +1 @@
This directory contains a pic32prog binary for 64bit Ubuntu Linux.

View File

@@ -0,0 +1 @@
This directory contains a pic32prog binary for Mac OS X.

View File

@@ -0,0 +1,91 @@
Pic32prog is a utility for loading data into a flash memory of Microchip PIC32
microcontrollers. Supported adapters and bootloaders:
* Microchip PICkit2
* Microchip PICkit3 with scripting firmware
* Olimex ARM-USB-Tiny (not finished yet)
* Olimex ARM-USB-Tiny, ARM-USB-Tiny-H and ARM-USB-OCH-H JTAG adapters
* Olimex MIPS-USB-OCH-H JTAG adapter
* Bus Blaster v2 JTAG adapter from Dangerous Prototypes
* Flyswatter JTAG adapter from TinCanTools
* AN1388 HID bootloader
* Legacy FS_USB HID bootloader
=== Usage ===
When called without parameters, pic32prog utility detects a type of microcontroller
and device configuration. For example:
% pic32prog
Programmer for Microchip PIC32 microcontrollers, Version 1.0
Copyright: (C) 2011 Serge Vakulenko
Adapter: PICkit2 Version 2.32.0
Processor: 795F512L (id 04307053)
Flash memory: 512 kbytes
Configuration:
DEVCFG0 = 7ffffffd
1 Debugger enabled
8 Use PGC2/PGD2
DEVCFG1 = ff6afd5b
3 Primary oscillator with PLL
1 Primary oscillator: XT
4 CLKO output active
3 Peripheral bus clock: SYSCLK / 8
4 Fail-safe clock monitor disable
8 Clock switching disable
a Watchdog postscale: 1/1024
DEVCFG2 = fff8f9d9
1 PLL divider: 1/2
5 PLL multiplier: 20x
1 USB PLL divider: 1/2
8 Disable USB PLL
Enable USB PLL
0 PLL postscaler: 1/1
DEVCFG3 = 3affffff
7 Assign irq priority 7 to shadow set
Ethernet RMII enabled
2 Default Ethernet i/o pins
Alternate CAN i/o pins
USBID pin: controlled by port
VBuson pin: controlled by port
Writing to flash memory:
pic32prog [-v] file.srec
pic32prog [-v] file.hex
Reading memory to file:
pic32prog -r file.bin address length
Parameters:
file.srec - file with firmware in SREC format
file.srec - file with firmware in Intel HEX format
file.bin - binary file
address - address in memory
-v - verify only (no write)
-r - read mode
Input file should have format SREC or Intel HEX.
You can convert ELF format (also COFF or A.OUT) to SREC using objcopy utility,
for example:
objcopy -O srec firmware.elf firmware.srec
=== Sources ===
Sources are distributed under the terms of GPL.
You can download sources using Git:
git clone https://github.com/sergev/pic32prog.git
To build it on Ubuntu, a few additional packages need
to be installed:
sudo apt-get install libusb-dev libusb-1.0-0-dev libudev-dev
___
Regards,
Serge Vakulenko