file dump received from Steven Hirsch...includes wiring info

This commit is contained in:
2018-01-31 10:29:27 -08:00
parent cff2e5e031
commit c8474ff9e9
132 changed files with 26327 additions and 0 deletions

View File

Binary file not shown.

View File

File diff suppressed because one or more lines are too long

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

Binary file not shown.

View File

@@ -0,0 +1,56 @@
Path: border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!d37g2000prg.googlegroups.com!not-for-mail
From: Robert Justice <rjustice@internode.on.net>
Newsgroups: comp.sys.apple2
Subject: Re: IIc + SmartPort behavior
Date: Tue, 22 Nov 2011 23:43:38 -0800 (PST)
Organization: http://groups.google.com
Lines: 29
Message-ID: <861d5b09-3888-400b-8276-0d1e904462d7@d37g2000prg.googlegroups.com>
References: <j9bn33$2f2s$1@adenine.netfront.net> <1942330805342484387.926134mjmahon-aol.com@news.giganews.com>
<VNCdnXzdFY5W5SfTnZ2dnUVZ_rWdnZ2d@giganews.com> <4ebce965$0$15933$426a74cc@news.free.fr>
<1N2dnaoCR8QlgCDTnZ2dnUVZ_u2dnZ2d@giganews.com> <j9kpk80dsf@news4.newsguy.com>
<HNudnV4Bb5pfDCPTnZ2dnUVZ_g6dnZ2d@giganews.com>
NNTP-Posting-Host: 118.209.14.165
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1322034219 14760 127.0.0.1 (23 Nov 2011 07:43:39 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 23 Nov 2011 07:43:39 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: d37g2000prg.googlegroups.com; posting-host=118.209.14.165; posting-account=mHS5KQkAAAC9Ql45Hz5pjmU-BTGMyhJ-
User-Agent: G2/1.0
X-Google-Web-Client: true
X-Google-Header-Order: HUALESNKRC
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.0; rv:8.0) Gecko/20100101 Firefox/8.0,gzip(gfe)
Bytes: 2594
Xref: number.nntp.dca.giganews.com comp.sys.apple2:194727
I have had play with my smartport cf adapter connected to my recently
acquired iic+. There is some interesting behavior. It seems that with
up to 4 drives connected, they will all map ok. (i used p8 2.0.3 for
my tests) but when you go over that limit it seems to be a little
strange.
If i set my number of partitions to 3, then i get the internal disk,
plus the 3 external disks on the smartport cf adapter mapped ok and
usable.
If i set it to 4 partitions then i only see the internal disk plus
three of the external disks. The 4th is never mapped, and cannot be
accessed.
If i set it to 5 partitions, then i see the internal disk plus 4 of
the external disks. All 4 can be accessed ok.
and so on. (i only tested with the partitions set to 6 max)
I can see that all of the partitions are allocated sp bus id's, just
that the last one is never used once it has been initialised.
So it seems that for some reason the last partition is not mapped to a
slot and drive once you go over the limit of 4. This seems like a bug,
perhaps in the iic+ firmware.
It would be interesting Steven, to see if Cedric's spvhd behaves the
same on your iic+.

View File

Binary file not shown.

View File

@@ -0,0 +1,136 @@
I expected to deliver the first serie of assembled device two months
ago, but thinking about future options for the device, I realized that
some small adjustments were required. The decision to update the
design and delay (again) the release was not easy to take, but I can't
deliver a product knowing it will need some changes, especially for a
fully assembled device. I will send a technical note to all owners of
kits shipped before april 2012 to let them know how to update their
device.
As I don't given news for a while, here is what was done:
SmartportVHD:
- updated design to be ready for 5.25 floppy drive remapping and
emulation (work in progress)
- updated design to support the SmartportRTC module
- added internal connectors for future modules
- compatibility test with DuoDisk passed on the Apple IIe, failed on
the Apple IIgs (the IIgs disable all smartport residents if a
Duodisk is detected)
SmartportRTC module:
- real time clock for any Apple II compatible with the SmartportVHD
- SmartportRTC driver replacing the original Prodos 8 clock driver
- files are time stamped transparently
- date and time is available for all applications based on Prodos 8
date and time
SmartportVHD Manager:
- allow easy management of virtual devices directly from the Apple II
- select the disk images to be presented to the Apple II and how they
are accessed
- support for the SmartportRTC to adjust date and time
- support for the SmartportRTC driver to replace Prodos 8 clock driver
- developped using Plasma from David Schmenk
Another factor of the delay, is the time required to achieve a fully
assembled device. I expected to get unmolded parts directly usables
with small tooling overhead...and I heavilly underestimated the task,
as you can see here after...
Custom parts:
- Upper hull:
- Mold and unmold: 15 minutes
- Tool for joint plane in two pass: 20 minutes
- Tool wave guide seat: 10 minutes
- Tool the rear connector window on the internal wall: 5 minutes
- Tool the rear connector window on the external wall: 5 minutes
- Drill four closed holes for screws: 10 minutes
- Total: 1 hour 5 minutes
- Lower hull:
- Mold and unmold: 15 minutes
- Tool for joint plane in one pass: 10 minutes
- Groove external walls: 5 minutes
- Tool lateral windows for wave guide: 5 minutes
- Tool front windows for wave guide: 5 minutes
- Tool wave guide seats: 10 minutes
- Tool four head screw seats: 10 minutes
- Tool the rear connector window on the internal wall: 10 minutes
- Tool the rear connector window on the external wall: 10 minutes
- Tool walls for the rear cable passage: 5 minutes
- Drill the holes to fasten the rear connector: 5 minutes
- Drill two holes to fasten the micropendous board: 5 minutes
- Drill two holes to access micropendous board buttons: 5 minutes
- Drill four open holes for screws: 10 minutes
- Tool four screw seats: 10 minutes
- Total: 2 hours
Free connector and jack screws:
- Solder cable: 40 minutes
- Prepare connector and shield it: 10 minutes
- Cut jack screws to size: 5 minutes
- Mold and unmold: 20 minutes
- Tool the back face: 10 minutes
- Drill holes for jack screws: 10 minutes
- Total: 1 hour 35 minutes
Left and right wave guides:
- Mold and unmold: 10 minutes
- Correction: 5 minutes
- Total: 15 minutes
Soft feets:
- Cut to size: 5 minutes
- Groove guides: 5 minutes
- Total: 10 minutes
Total time to make parts: 4 hours 5 minutes
Assembly:
- Basic tests of the Micropendous board: 10 minutes
- Firmware update: 5 minutes
- Solder the rear connector: 40 minutes
- Solder the Micropendous board: 30 minutes
- Solder the USB connector and fasten wires to the
micropendous board: 10 minutes
- Solder the leds: 5 minutes
- Shield the lower hull: 15 minutes
- Make the upper shield: 15 minutes
- Fasten the rear connector: 5 minutes
- Fasten the Micropendous board: 10 minutes
- Fasten the leds with wave guides: 10 minutes
- Fasten the USB connector to front wall: 5 minutes
- Shield the USB wires: 5 minutes
- Glue soft foots: 5 minutes
- Final test: 15 minutes
- Total: 3 hours 5 minutes
Total assembly time:
- 7 hours 10 minutes...
...plus 15 minutes to package the thing ready to ship.
I wanted a cheap solution, and a nice product...I think I reached both
goals but as I can't offer so much of my time, I have to increase the
price of the product up to 75 euros for the assembled device. I think
it's still a very good price for such a product, especially
considering the time spent, but I could anderstand the disapointment
of requesters. I know that some requesters are only concerned by
features, not design, so I will check for an enclosure from the market
to provide a cheaper solution.

BIN
spvhd/doc/assembly.pdf Normal file
View File

Binary file not shown.

BIN
spvhd/doc/diskport.txt Normal file
View File

Binary file not shown.

54
spvhd/doc/spvhd.setup Normal file
View File

@@ -0,0 +1,54 @@
From pcedric@hotmail.com Mon Oct 31 09:29:05 2011
Date: Mon, 31 Oct 2011 13:27:46 +0000
From: PELTIER Cédric <pcedric@hotmail.com>
To: snhirsch@gmail.com
Subject: RE: SmartPortVHD, DIY assembly
Hi Steven,
Simply make a folder named "spvhd" at the root of your usb stick. The
device will look inside this folder to enumerate disk images named
from "drive0.img" up to "drive9.img". So, copy your image(s) inside
this folder and you are ready to go. Disk images can be Prodos,
Pascal, GEOS, or GS/OS volumes, and they can be boot volume. As a
first try, I recommend to use a well know disk image that is working
for an emulator.
Note 1: At startup the device is waiting indefinitively an usb
stick. If no usb stick is present, the Apple II will not see any daisy
chained device connected to the spvhd. I should change this in a future
update of the firmware.
Note 2: During usb enumeration, the device can't manage any access
from to daisy chained devices connected to him. If your Apple II is
booting quicker than spvhd enumerate disk images, the computer will
not see these daisy chained devices, nor it will see the virtual
drives. In such a case, a simple three fingers salute is required.
On the Apple IIc this should not arise as the usb enumeration will be
done during IIc interval drive checking. But on the IIe and IIgs, it
depend on the configuration of the computer.
The worst case is when usb enumeration end while the computer is
trying to access daisy chained 5.25 floppy drive: in such a case, the
floppy will emit large noiy 'klang klang klang...'. This is not
destructive for the floppy but such situation should be avoided by
changing boot order in the control pannel of the IIgs.
Note 3:
The green LED is turned on at the end of disk image enumeration. The
yellow LED is turned on when the computer try to access any
'intelligent resident'.
The red LED is turned on at each virtual drive access. If a problem
is detected, the LEDs are switched on and off to repeat a pattern
indefinitely.
I'm really curious to see your work :-) From what I know, you are the
first to do the assembly out there !!! (I'm still waiting some news
from other ones...)
Regards,
Cedric

182
spvhd/doc/spvhd.txt Normal file
View File

@@ -0,0 +1,182 @@
WARNING: In this document, we assume that the reader have the required
knowledge about electronic assembly. The author can't give ANY
WARRANTY, and isn't responsible of the results of a bad manipulation.
Step A: preparations
Step B: preparing the board
Step C: connecting both DB19 connectors
Step D: connecting the DB19 male to the board
Step E: connecting the DB19 female to the board
Step F: connecting indicators to the board
Step G: grounding
Final step
Licenses
Donation
Step A: preparations
The packages should contain the following:
* 1x Micropendous-A board with usb receptacle connector
* 1x red led
* 1x yellow led
* 1x green led
* 3x 220 ohms resistors
* 2x diodes 1N4448
* 8x heatshrinks (2 for the diodes, and 6 for the leds)
To be ready for the following steps, some things must be prepared to
stay focused on the right thing at the right time. Here is the list:
* Prepare a ground point, where you will solder all the ground
wires together. This is required as the board allow only two
ground wires to be connected and we have much more to connect.
* Prepare 19 heatshrinks for the DB19 male (host), not included
* Prepare 19 heatshrinks for the DB19 female (daisy chain), not
included
* Prepare 2 heatshrinks for the diodes 1N4448, included
* Prepare 6 heatshrinks for the leds, included
* Prepare a soldering iron (preferably around 15 Watts) to solder
the DB19 connectors and the board
* Prepare a soldering iron (preferably around 30 Watts) to solder
the ground point and shields wires
* Prepare some soldering tin with lead
* Prepare a small lighter to shrink heatshrinks by the end of the
assembly
The soldering iron preference are only indicative, its depend widely
from experience and habits of the reader in soldering. You could also
take a look at the wiring diagram to have an overview of the work to
do.
Step B: preparing the board
In this step, you have to solder the diodes on the board. Theses
diodes adapt the output of the board to a compatible open collector
behaviour required by the bus.
* Solder the first diode 1N4448 on D0, the black stripe side
turned to the board, left the free pin unsoldered
* Solder the second diode 1N4448 on B7, the black stripe side
turned to the board, left the free pin unsoldered
Step C: connecting both DB19 connectors togethere
Most of the work will be done now. Prepare and place heatshrink on
each wire you will solder during this step, but don't heat them
because more soldering will be required during the following
steps. Solder the following pins from the DB19 male (host) to the DB19
female (daisy chain):
On the upper row:
* Pin 1 to pin 1 (GND)
* Pin 2 to pin 2 (GND)
* Pin 3 to pin 3 (GND)
* Pin 4 to pin 4 (SEL35 to host)
* Pin 5 to pin 5 (-12V)
* Pin 6 to pin 6 (+5V)
* Pin 7 to pin 7 (+12V)
* Pin 8 to pin 8 (+12V)
* Pin 9 to pin 9 (/INT)
* Pin 10 to pin 10 (ACK)
On the lower row:
* Pin 11 to pin 11 (CA0, REQ)
* Pin 12 to pin 12 (CA1)
* Pin 13 to pin 13 (CA2)
* Pin 14 is left unsoldered for this step
* Pin 15 to pin 15 (/WREQ)
* Pin 16 to pin 3 (grounded DEVRES to host), this allow the
detection of the spvhd by the host
[note: pin 16 could be soldered to the pin 1, 2 or 3 of the DB19
male (host) instead of pin 3 of the DB19 female if it's more
convenient]
[note: pin 16 could be soldered to the ground point instead of
the pin 3 if it's more convenient]
* Pin 17 is left unsoldered for this step
* Pin 18 to pin 18 (RD)
* Pin 19 to pin 19 (WR)
Step D: connecting the DB19 male to the board
Not too much to do here. Solder the following wires from the DB19 male
(host) to the board:
On the lower row:
* Pin 14 to F3 (LSTRB from host)
* Pin 17 to D5 (DR2 from host)
Step E: connecting the DB19 female to the board
Solder the following wires from the DB19 female (daisy chain) to the
board, don't forget to pass the wires into the already placed
heatshrinks from the step C.
On the upper row:
* Pin 6 to VCC on the board (+5V)
* Pin 4 to D7 (SEL35 from devices)
* Pin 10 (ACK) to the free pin of the diode soldered on D0, don't
forget the heatshrink
On the lower row:
* Pin 11 to F0 (CA0, REQ)
* Pin 12 to F1 (CA1)
* Pin 13 to F2 (CA2)
* Pin 14 to B5 (LSTRB to devices)
* Pin 16 to D6 (DEVRES from device)
* Pin 17 to B6 (/DR2)
* Pin 18 (RD) to the free pin of the diode soldered on B7, don't
forget the heatshrink
* Pin 19 to D4 (WR)
Step F: connecting indicators to the board
These indicators will be the only way for the spvhd to let you know
what's happen, so it's better to take some time for them ! Connect the
leds to the board, don't forget to place heatshrinks:
* Solder the green led to E3 using a wire on the longer pin of the led
* Solder the red led to E4 using a wire on the longer pin of the led
* Solder the yellow led to E5 using a wire on the longer pin of the led
* Solder a 220 ohms resistor on the free pin of each leds
All the grounding will be done during the following step.
Step G: grounding
You are near to the end. Connect the grounds:
* Solder the free leads of the three resistors to the ground point
using a wire, don't forget the heatshrinks !
* Solder pins 1 and 2 (and 3 if you want, but NOT pin 4 !) of the
DB19 female to the ground point
* Solder the GND of the board to the ground point (the central GND
should be better, but if you plan to use JTAG feature for
developpements, use the corner GND)
* If pin 16 of the DB19 male (host) was not already grounded,
solder pin 16 of the DB19 male to the ground point

BIN
spvhd/doc/spvhd1.jpg Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 KiB

BIN
spvhd/doc/spvhd2.jpg Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@@ -0,0 +1,84 @@
From pcedric@hotmail.com Fri Nov 11 14:16:57 2011
Date: Fri, 11 Nov 2011 20:11:50 +0100
From: Cédric Peltier <pcedric@hotmail.com>
To: Steven Hirsch <snhirsch@gmail.com>
Subject: SPVHD, New firmware :-)
Hi Steven,
I think I have very good news, let's try the attached firmware!
Under ubuntu, you need to install "make", "dfu-programmer" and maybe
"dfu-utils".
Unpack the attached archive, and open a terminal into the newly
created folder (it's named "spvhd").
Disconnect the board from the Apple II environnement, and connect it to your
computer using your home made usb male-male cable.
=> I checked my usb male-male dongle and it's CROSSED !
...that's explain why I burned an usb stick by making an uncrossed dongle...
(NOTE: Cedric is referring to the fact that the wiring _physically_
crosses itself when the connectors are opposite-facing. In terms of
pinout, the cable is "straight through" - Pin 1-->1, 2-->2, etc.)
Once connected, look at the board for the two buttons:
- press and keep pressed the RESET button
- press and keep pressed the HWB button
- release the RESET button
- release the HWB button
The board is now waiting for a new firmware.
Type "make dfu" within the previously opened terminal, you should end
up with something like:
[IMAGE]
Except you have a 1247 instead of a 647.
Once you get back to the prompt, you can disconnect the board and try
it on your Apple 2.
Here is the draft of the changelog:
2011-11-11, PC, 0.99.2
Revised all the startup sequence.
The smartport bus is no more locked by the spvhd during boot in order
to allow the computer to access Apple 3.5 and 5.25 drives.
USB initialisation and disk image enumeration are now delayed until
the computer start the smartport initialisation. This allow the spvhd
to hold the computer until the USB layer is ready and disk images are
enumerated, avoiding the insane three finger salute after a cold
boot. Doing so allow to use the computer as usual even if no usb
device are connected to the spvhd. In such a case, a phantom device is
still visible by the computer, named "No usb device", but the computer
can still access all physical drives, even daisy chained Unidsk 3.5
and 5.25 drives.
If a usb device is connected, but no usable filesystem is found on it,
the phantom device is named "No file system".
If the file system is ok but no disk image are found, the phantom
device is named "No disk image".
The block caching system is disabled for now.
The smartboot software from zonker programming could be usefull on the
Apple IIgs to boot from the spvhd with Apple 3.5 drive installed.
Take care to not use Applesoft basic 1.0 to setup smartboot, wich will
lead to a truncated prodos file after saving parameters.
Regards,
Cedric.

831
spvhd/firmware/v0/makefile Normal file
View File

@@ -0,0 +1,831 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, J<>rg Wunsch, et al.
# >> Modified for use with the LUFA project. <<
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
# Carlos Lamas
# Dean Camera
# Opendous Inc.
# Denver Gingerich
# Cedric Peltier
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
# have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
# have Atmel FLIP installed).
#
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
# (must have dfu-programmer installed).
#
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
# (must have Atmel FLIP installed).
#
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
#---------------- Hardware Options, start
# MCU name - uncomment _ONE_ of the following
#MCU = at90usb162
#MCU = atmega32u4
#MCU = at90usb646
#MCU = at90usb647
MCU = at90usb1287
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
# Typical values are:
# F_CPU = 8000000
# F_CPU = 16000000
F_CPU = 16000000
# Input clock frequency.
# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_CLOCK = $(F_CPU)
#---------------- Hardware Options, end
#---------------- LUFA Options, start
# Target board (see library "Board Types" documentation, NONE for projects not requiring
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USER
# Path to the LUFA library
LUFA_PATH = ./Lib/LUFA
AVRLIB_PATH = ./Lib/avrlib
# LUFA library compile-time options
#LUFA_OPTS = -D USB_DEVICE_ONLY
LUFA_OPTS += -D USB_HOST_ONLY
#LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USB_STREAM_TIMEOUT_MS=2000
LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
#LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
#---------------- LUFA Options, end
#---------------- External Memory Options, start
# 64 KB of external SRAM, starting after internal RAM used for variables (.data/.bss) and heap (malloc())
# for the ATmega128 and AT90USB647 with their 4KB of SRAM, external addresses start at 0x1100
# 0xFFFF(65535) - 0x1100(4352) = 0xEEFF(61183) --> 60KB of available external SRAM
# EXTMEMOPTS += -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# EXTMEMOPTS += -Wl,-Tdata=0x80100,--defsym=__heap_end=0x8010ff
# same thing using 4 banks of 32KB instead of 2 banks of 60KB
# EXTMEMOPTS += -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x8090ff
# for the AT90USB1287 with its 8KB of SRAM, external addresses start at 0x2100
# 0xFFFF(65535) - 0x2100(8448) = 0xDEFF(57087) --> 58KB of available external SRAM
# SAFEST OPTION:
# EXTMEMOPTS += -Wl,-Tdata=0x802100,--defsym=__heap_end=0x80ffff
# Selectable options:
# 647
#EXTMEMOPTS += -Wl,--section-start,.data=0x800100,--defsym=__heap_end=0x8010ff
# 1287
EXTMEMOPTS += -Wl,--section-start,.data=0x800100,--defsym=__heap_end=0x8020ff
#---------------- External Memory Options, end
#---------------- SmartportVHD/USB options, start
# DEBUG options
# Used to debug the smartport protocol interactively trough USB
#PROJECT_OPTS += -D CFG_DEBUG_USB=1
# Used to store activity trace in a ring buffer
#PROJECT_OPTS += -D CFG_DEBUG_PUSH=1
# Used to debug the usb layer trough the serial port
#PROJECT_OPTS += -D CFG_DEBUG_SERIAL=1
# Do a memset(0) for all buffer before using it
#PROJECT_OPTS += -D MEMSET_BUFFER=1
# ESRAM options
# Enable =1 or disable =0 external sram
PROJECT_OPTS += -D CFG_XRAM=0
# Could be 2 banks of 60KB or 4 banks of 32KB
PROJECT_OPTS += -D SRAM_BANKS=2
# Enable or disable initial external sram test
#PROJECT_OPTS += -D SRAM_TEST=1
# CACHE options
# Enable in external ram = 2, Enable in internal ram =1, or disable =0 the memory cache
PROJECT_OPTS += -D CFG_CACHE=0
# Enable the read ahead cache memory
PROJECT_OPTS += -D CFG_READ_AHEAD=0
# ISR options
# Four methods to manage the context to accomodate the application:
# use the stack to save register from isr as usual
# consume 18 cycles to save and restore the context
PROJECT_OPTS += -D CFG_SP_ISR_USE_STACK=1
# take advantage of the GPIOR0/1/2 to save register from isr
# consume 12 cycles to save and restore the context
#PROJECT_OPTS += -D CFG_SP_ISR_USE_GPIOR=1
# take advantage of OCR0A/B and TCNT0 to save register from isr
# consume 12 cycles to save and restore the context
#PROJECT_OPTS += -D CFG_SP_ISR_USE_TIMER0=1
# take advantage of GPIOR0/1/2 and OCR0B to save register from isr
# consume 10 cycles to save and restore the context
#PROJECT_OPTS += -D CFG_SP_ISR_USE_IOR=1
# no register save as we make them dedicated
#PROJECT_OPTS += -D CFG_SP_ISR_USE_DEDICATED=1
# SmartportVHD/USB options
# Maximum number of emulated drives
PROJECT_OPTS += -D SP_MAX_DRIVE=10
#---------------- SmartportVHD/USB options, end
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = spvhd
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
OBJDIR = ../obj
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
extsram.c \
protocol_rcv.c \
protocol_rcv_isr.c \
protocol_snd.c \
protocol.c \
usb_storage.c \
usb_storage_desc.c \
cache.c \
Lib/MassStoreCommands.c \
Lib/FATFs/diskio.c \
Lib/FATFs/ff.c \
$(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c \
$(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c
# Lib/FATFs/option/ccsbcs.c \
# $(LUFA_SRC_USB) \
# $(LUFA_SRC_SERIAL) \
# $(LUFA_SRC_SERIALSTREAM)
# $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
# $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
# usb_serial.c \
# usb_serial_desc.c \
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC = protocol_snd_isr.S
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = 2
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS = $(LUFA_PATH)/ $(AVRLIB_PATH)/
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS) $(PROJECT_OPTS)
# Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU) $(PROJECT_OPTS)
# Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL
#CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS
#---------------- Compiler Options C ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
##CFLAGS += -ffunction-sections
#CFLAGS += -fno-inline-small-functions
CFLAGS += -mcall-prologues
#CFLAGS += -mint8
CFLAGS += -fpack-struct
CFLAGS += -fshort-enums
CFLAGS += -finline-limit=100000
CFLAGS += -finline-functions-called-once
CFLAGS += -fomit-frame-pointer
CFLAGS += -fearly-inlining
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wundef
#CFLAGS += -fno-unit-at-a-time
#CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#CFLAGS += --combine -fwhole-program
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CPPFLAGS = -g$(DEBUG)
CPPFLAGS += $(CPPDEFS)
CPPFLAGS += -O$(OPT)
CPPFLAGS += -funsigned-char
CPPFLAGS += -funsigned-bitfields
CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums
CPPFLAGS += -fno-exceptions
CPPFLAGS += -Wall
CPPFLAGS += -Wundef
#CPPFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes
#CPPFLAGS += -Wunreachable-code
#CPPFLAGS += -Wsign-compare
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
#SCANF_LIB =
SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
# List any extra directories to look for libraries here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRALIBDIRS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--print-gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#LDFLAGS += -T linker_script.x
#---------------- Programming Options (avrdude) ----------------
# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
# to get a full listing.
#
AVRDUDE_PROGRAMMER = jtagmkII
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = usb
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
AR = avr-ar rcs
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
REMOVEDIR = rm -rf
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling C:
MSG_COMPILING_CPP = Compiling C++:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
#all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
all: begin gccversion sizebefore build showliboptions showtarget sizeafter end
# Change the build target to build a HEX file or a library.
build: elf hex eep lss sym
#build: lib
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
LIBNAME=lib$(TARGET).a
lib: $(LIBNAME)
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi
$(LUFA_PATH)/LUFA/LUFA_Events.lst:
@make -C $(LUFA_PATH)/LUFA/LUFA_Events.lst
checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
@echo
@echo Checking for invalid events...
@$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
@sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
@if test -s InvalidEvents.tmp; then exit 1; fi
showliboptions:
@echo
@echo ---- Compile Time Library Options ----
@for i in $(LUFA_OPTS:-D%=%); do \
echo $$i; \
done
@echo --------------------------------------
showtarget:
@echo
@echo --------- Target Information ---------
@echo AVR Model: $(MCU)
@echo Board: $(BOARD)
@echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
@echo --------------------------------------
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
flip: $(TARGET).hex
batchisp -hardware usb -device $(MCU) -operation erase f
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
dfu: $(TARGET).hex
dfu-programmer $(MCU) erase
dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
dfu-programmer $(MCU) reset
flip-ee: $(TARGET).hex $(TARGET).eep
$(COPY) $(TARGET).eep $(TARGET)eep.hex
batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
$(REMOVE) $(TARGET)eep.hex
dfu-ee: $(TARGET).hex $(TARGET).eep
dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
dfu-programmer $(MCU) reset
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT = $(OBJCOPY) --debugging
COFFCONVERT += --change-section-address .data-0x800000
COFFCONVERT += --change-section-address .bss-0x800000
COFFCONVERT += --change-section-address .noinit-0x800000
COFFCONVERT += --change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -z -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Create library from object files.
.SECONDARY : $(TARGET).a
.PRECIOUS : $(OBJ)
%.a: $(OBJ)
@echo
@echo $(MSG_CREATING_LIBRARY) $@
$(AR) $@ $(OBJ)
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C++ source files.
%.s : %.cpp
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
$(OBJDIR)/%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list clean_binary end
clean_binary:
$(REMOVE) $(TARGET).hex
clean_list:
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET)eep.hex
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) $(SRC:.c=.i)
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.o)
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.lst)
$(REMOVE) InvalidEvents.tmp
$(REMOVEDIR) .dep
doxygen:
@echo Generating Project Documentation...
@doxygen Doxygen.conf
@echo Documentation Generation Complete.
clean_doxygen:
rm -rf Documentation
# Create object files directory
$(shell mkdir $(OBJDIR) 2>/dev/null)
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all checkinvalidevents showliboptions \
showtarget begin finish end sizebefore sizeafter \
gccversion build elf hex eep lss sym coff extcoff \
program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen

2196
spvhd/firmware/v0/spvhd.hex Normal file
View File

File diff suppressed because it is too large Load Diff

BIN
spvhd/firmware/v0/spvhd.tgz Normal file
View File

Binary file not shown.

831
spvhd/firmware/v1/makefile Normal file
View File

@@ -0,0 +1,831 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, J<>rg Wunsch, et al.
# >> Modified for use with the LUFA project. <<
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
# Carlos Lamas
# Dean Camera
# Opendous Inc.
# Denver Gingerich
# Cedric Peltier
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
# have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
# have Atmel FLIP installed).
#
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
# (must have dfu-programmer installed).
#
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
# (must have Atmel FLIP installed).
#
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
#---------------- Hardware Options, start
# MCU name - uncomment _ONE_ of the following
#MCU = at90usb162
#MCU = atmega32u4
#MCU = at90usb646
#MCU = at90usb647
MCU = at90usb1287
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
# Typical values are:
# F_CPU = 8000000
# F_CPU = 16000000
F_CPU = 16000000
# Input clock frequency.
# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_CLOCK = $(F_CPU)
#---------------- Hardware Options, end
#---------------- LUFA Options, start
# Target board (see library "Board Types" documentation, NONE for projects not requiring
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USER
# Path to the LUFA library
LUFA_PATH = ./Lib/LUFA
AVRLIB_PATH = ./Lib/avrlib
# LUFA library compile-time options
#LUFA_OPTS = -D USB_DEVICE_ONLY
LUFA_OPTS += -D USB_HOST_ONLY
#LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USB_STREAM_TIMEOUT_MS=2000
LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
#LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
#---------------- LUFA Options, end
#---------------- External Memory Options, start
# 64 KB of external SRAM, starting after internal RAM used for variables (.data/.bss) and heap (malloc())
# for the ATmega128 and AT90USB647 with their 4KB of SRAM, external addresses start at 0x1100
# 0xFFFF(65535) - 0x1100(4352) = 0xEEFF(61183) --> 60KB of available external SRAM
# EXTMEMOPTS += -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# EXTMEMOPTS += -Wl,-Tdata=0x80100,--defsym=__heap_end=0x8010ff
# same thing using 4 banks of 32KB instead of 2 banks of 60KB
# EXTMEMOPTS += -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x8090ff
# for the AT90USB1287 with its 8KB of SRAM, external addresses start at 0x2100
# 0xFFFF(65535) - 0x2100(8448) = 0xDEFF(57087) --> 58KB of available external SRAM
# SAFEST OPTION:
# EXTMEMOPTS += -Wl,-Tdata=0x802100,--defsym=__heap_end=0x80ffff
# Selectable options:
# 647
#EXTMEMOPTS += -Wl,--section-start,.data=0x800100,--defsym=__heap_end=0x8010ff
# 1287
EXTMEMOPTS += -Wl,--section-start,.data=0x800100,--defsym=__heap_end=0x8020ff
#---------------- External Memory Options, end
#---------------- SmartportVHD/USB options, start
# DEBUG options
# Used to debug the smartport protocol interactively trough USB
#PROJECT_OPTS += -D CFG_DEBUG_USB=1
# Used to store activity trace in a ring buffer
#PROJECT_OPTS += -D CFG_DEBUG_PUSH=1
# Used to debug the usb layer trough the serial port
#PROJECT_OPTS += -D CFG_DEBUG_SERIAL=1
# Do a memset(0) for all buffer before using it
#PROJECT_OPTS += -D MEMSET_BUFFER=1
# ESRAM options
# Enable =1 or disable =0 external sram
PROJECT_OPTS += -D CFG_XRAM=0
# Could be 2 banks of 60KB or 4 banks of 32KB
PROJECT_OPTS += -D SRAM_BANKS=2
# Enable or disable initial external sram test
#PROJECT_OPTS += -D SRAM_TEST=1
# CACHE options
# Enable in external ram = 2, Enable in internal ram =1, or disable =0 the memory cache
PROJECT_OPTS += -D CFG_CACHE=0
# Enable the read ahead cache memory
PROJECT_OPTS += -D CFG_READ_AHEAD=0
# ISR options
# Four methods to manage the context to accomodate the application:
# use the stack to save register from isr as usual
# consume 18 cycles to save and restore the context
PROJECT_OPTS += -D CFG_SP_ISR_USE_STACK=1
# take advantage of the GPIOR0/1/2 to save register from isr
# consume 12 cycles to save and restore the context
#PROJECT_OPTS += -D CFG_SP_ISR_USE_GPIOR=1
# take advantage of OCR0A/B and TCNT0 to save register from isr
# consume 12 cycles to save and restore the context
#PROJECT_OPTS += -D CFG_SP_ISR_USE_TIMER0=1
# take advantage of GPIOR0/1/2 and OCR0B to save register from isr
# consume 10 cycles to save and restore the context
#PROJECT_OPTS += -D CFG_SP_ISR_USE_IOR=1
# no register save as we make them dedicated
#PROJECT_OPTS += -D CFG_SP_ISR_USE_DEDICATED=1
# SmartportVHD/USB options
# Maximum number of emulated drives
PROJECT_OPTS += -D SP_MAX_DRIVE=10
#---------------- SmartportVHD/USB options, end
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = spvhd
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
OBJDIR = ../obj
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
extsram.c \
protocol_rcv.c \
protocol_rcv_isr.c \
protocol_snd.c \
protocol.c \
usb_storage.c \
usb_storage_desc.c \
cache.c \
Lib/MassStoreCommands.c \
Lib/FATFs/diskio.c \
Lib/FATFs/ff.c \
$(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c \
$(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c
# Lib/FATFs/option/ccsbcs.c \
# $(LUFA_SRC_USB) \
# $(LUFA_SRC_SERIAL) \
# $(LUFA_SRC_SERIALSTREAM)
# $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
# $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
# usb_serial.c \
# usb_serial_desc.c \
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC = protocol_snd_isr.S
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = 2
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS = $(LUFA_PATH)/ $(AVRLIB_PATH)/
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS) $(PROJECT_OPTS)
# Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU) $(PROJECT_OPTS)
# Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL
#CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS
#---------------- Compiler Options C ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
##CFLAGS += -ffunction-sections
#CFLAGS += -fno-inline-small-functions
CFLAGS += -mcall-prologues
#CFLAGS += -mint8
CFLAGS += -fpack-struct
CFLAGS += -fshort-enums
CFLAGS += -finline-limit=100000
CFLAGS += -finline-functions-called-once
CFLAGS += -fomit-frame-pointer
CFLAGS += -fearly-inlining
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wundef
#CFLAGS += -fno-unit-at-a-time
#CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#CFLAGS += --combine -fwhole-program
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CPPFLAGS = -g$(DEBUG)
CPPFLAGS += $(CPPDEFS)
CPPFLAGS += -O$(OPT)
CPPFLAGS += -funsigned-char
CPPFLAGS += -funsigned-bitfields
CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums
CPPFLAGS += -fno-exceptions
CPPFLAGS += -Wall
CPPFLAGS += -Wundef
#CPPFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes
#CPPFLAGS += -Wunreachable-code
#CPPFLAGS += -Wsign-compare
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
#SCANF_LIB =
SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
# List any extra directories to look for libraries here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRALIBDIRS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--print-gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#LDFLAGS += -T linker_script.x
#---------------- Programming Options (avrdude) ----------------
# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
# to get a full listing.
#
AVRDUDE_PROGRAMMER = jtagmkII
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = usb
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
AR = avr-ar rcs
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
REMOVEDIR = rm -rf
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling C:
MSG_COMPILING_CPP = Compiling C++:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
#all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
all: begin gccversion sizebefore build showliboptions showtarget sizeafter end
# Change the build target to build a HEX file or a library.
build: elf hex eep lss sym
#build: lib
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
LIBNAME=lib$(TARGET).a
lib: $(LIBNAME)
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi
$(LUFA_PATH)/LUFA/LUFA_Events.lst:
@make -C $(LUFA_PATH)/LUFA/LUFA_Events.lst
checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
@echo
@echo Checking for invalid events...
@$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
@sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
@if test -s InvalidEvents.tmp; then exit 1; fi
showliboptions:
@echo
@echo ---- Compile Time Library Options ----
@for i in $(LUFA_OPTS:-D%=%); do \
echo $$i; \
done
@echo --------------------------------------
showtarget:
@echo
@echo --------- Target Information ---------
@echo AVR Model: $(MCU)
@echo Board: $(BOARD)
@echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
@echo --------------------------------------
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
flip: $(TARGET).hex
batchisp -hardware usb -device $(MCU) -operation erase f
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
dfu: $(TARGET).hex
dfu-programmer $(MCU) erase
dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
dfu-programmer $(MCU) reset
flip-ee: $(TARGET).hex $(TARGET).eep
$(COPY) $(TARGET).eep $(TARGET)eep.hex
batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
$(REMOVE) $(TARGET)eep.hex
dfu-ee: $(TARGET).hex $(TARGET).eep
dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
dfu-programmer $(MCU) reset
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT = $(OBJCOPY) --debugging
COFFCONVERT += --change-section-address .data-0x800000
COFFCONVERT += --change-section-address .bss-0x800000
COFFCONVERT += --change-section-address .noinit-0x800000
COFFCONVERT += --change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -z -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Create library from object files.
.SECONDARY : $(TARGET).a
.PRECIOUS : $(OBJ)
%.a: $(OBJ)
@echo
@echo $(MSG_CREATING_LIBRARY) $@
$(AR) $@ $(OBJ)
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C++ source files.
%.s : %.cpp
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
$(OBJDIR)/%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list clean_binary end
clean_binary:
$(REMOVE) $(TARGET).hex
clean_list:
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET)eep.hex
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) $(SRC:.c=.i)
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.o)
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.lst)
$(REMOVE) InvalidEvents.tmp
$(REMOVEDIR) .dep
doxygen:
@echo Generating Project Documentation...
@doxygen Doxygen.conf
@echo Documentation Generation Complete.
clean_doxygen:
rm -rf Documentation
# Create object files directory
$(shell mkdir $(OBJDIR) 2>/dev/null)
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all checkinvalidevents showliboptions \
showtarget begin finish end sizebefore sizeafter \
gccversion build elf hex eep lss sym coff extcoff \
program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen

2196
spvhd/firmware/v1/spvhd.hex Normal file
View File

File diff suppressed because it is too large Load Diff

View File

Binary file not shown.

2395
spvhd/firmware/v2/spvhd.hex Normal file
View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
batchisp -hardware usb -device at90usb1287 -operation erase f
batchisp -hardware usb -device at90usb1287 -operation loadbuffer spvhd.hex program
batchisp -hardware usb -device at90usb1287 -operation start reset 0
pause

6
spvhd/firmware/v2/upgrade.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
dfu-programmer at90usb1287 erase
dfu-programmer at90usb1287 flash --debug 2 ./spvhd.hex
dfu-programmer at90usb1287 reset

View File

Binary file not shown.

BIN
spvhd/manager/manager Normal file
View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -0,0 +1,192 @@
Smartport Virtual Hard Disk, version 0.99.0 (beta), 2010-05-14
1) DISCLAIMER
The information is provided by the author and while he endeavour to keep the
information up to date and correct, the author make no representations or
warranties of any kind, express or implied, about the completeness, accuracy,
reliability, suitability or availability with respect to this project or the
information, products, services, or related graphics contained in this project
for any purpose. Any reliance you place on such information is therefore
strictly at your own risk.
In no event will the author be liable for any loss or damage including without
limitation, indirect or consequential loss or damage, or any loss or damage
whatsoever arising from loss of data or profits arising out of, or in connection
with, the use of this project.
2) PREAMBLE
What apple 2c owner have never did this dream ? No more floppy swaping ! All is
in the hard drive ! This was my first motivation to develop this project.
But I must warn you, this software is in an earlier stage, ie beta version,
always keep a backup of your data !
This software is free and I'm happy to share it at no cost, but if you are so
happy that you would like to support my efforts :) you can credit my paypal
account (pcedric@hotmail.com).
3) GOAL OF THE PROJECT
It emulate a smartport device for your apple 2, reusing an old PC. A smartport
device is a mass storage up to 8GBytes size. Nevetheless, the maximum size
usable by Prodos is 32MBytes. Other operating system could require some tricks
to use such mass storage.
4) HOW IT'S WORKING
At this stage of the developpement, the emulation is done on a PC, wich is
connected to the apple 2's smartport trough the parallel port using a specific
cable. The apple 2 see a smartport device and is able to read, write, format and
even boot from it. Many improvements are planned, look at the end of this
document.
4) REQUIREMENTS
Hardware:
- a PC powered by from Pentium to Pentium 4 or equivalent processor
- the cpu frequency must not change during the emulation
- an hard disk formated with FAT16, that could host the 32MB image file
- the specific cable connecting the apple 2 smartport to the PC parallel port
Software:
- the operating system must be DOS, like FreeDOS
- no TSR are supported (smartdrive, mouse drivers, and so on,
your config.sys and autoexec.bat must be nearly empty)
- this software will not work in a virtual machine
The software was tested succesfully on the following processors:
- Pentium 120
- Pentium 200MMX
- Athlon XP 2000
The test failed with the following processor:
- Core2duo E6400
3) SPECIFIC CABLE
Within the doc folder, you will find schema to make the cable. The type A cable
is the easier to do, but your apple 2 will not boot until the PC is powered on,
and it could damage your hardware as the parallel port could have totem pole
ouputs and the smarport require open collector output. The type B cable take
care of this but require additionnal electronic.
It's possible to use the cable of an existing 3.5 drive and add needed change,
it's what I did for the prototype.
4) QUICK START
a) Make your home made specific cable and connect your old PC to the apple 2.
b) Get the floppy image and write to a floppy disk using raw write under windows,
or dd under linux.
c) Boot the old PC with the newly created floppy disk
d) At the command prompt, type vhd f=<your cpu frequency>
e) Boot your apple 2 with mousedesk or your prefered prodos disk utilities
f) format the new drive, should be located in slot 5 drive 1
g) copy your softwares on the newly formated prodos volume
h) remove all floppy disk from the apple 2 and reboot it !
5) USAGE
Simply start vhd.com with the parameter f=<your cpu frequency>.
For example, if the PC your would use is equiped with a Pentium III 500, type
the following: vhd f=500
Beware that some CPU don't run at the expected frequency, for example, the
Athlon XP 2000 is running at 1666MHz, so for this cpu the command line become
vhd f=1666
The frequency parameter could be altered as motherboard don't provide an exact
frequency. So, you could try a value decreased or increased by 1 or 2 MHz if it
don't work as expected.
It will create a new image file, named hd1.img, if it doesn't already exist,
then it will take control of the parallel port to decode and respond to all
smartport request from the apple 2.
During emulation, the screen will be filled with stranges codes. This allow to
follow activities and see what happen if something goes wrong.
Displayed codes are:
R. Succesfully received a read request
W. Succesfully received a write request
D. Succesfully received a data packet
S. Succesfully received a status request
Ss Succesfully received a device status request
Sc Succesfully received a device conrol block request
Si Succesfully received a device information block request
F. Succesfully received a format request
R: Error when receiving a read request
W: Error when receiving a write request
D: Error when receiving a data packet
P: Error when when seeking within the disk image
?: Undefined error
C: Crc error when decoding a packet
#: Buffer overflow
T: Timeout waiting a packet
@: Packet format error
When the apple 2 is down, it's normal to see T: displayed continuously.
When the apple 2 is booting, the message 'Got id' should be displayed, if this
is not the case, reset the apple 2 to get this message displayed. If this
message is never displayed, something is wrong with the cable, or the frequency
given as parameter is wrong.
If you start VHD from the floppy drive, it could be necessary to reboot the
apple 2 because an access to the floppy will be done after the start, wich could
break a data exchange with the apple 2.
At any time, you could hit the escape key of the PC to stop the emulation.
Better to do this after the shutdown of your apple 2 to avoid data losses.
6) ISSUES
Q) The PC freeze
A) Smartport VHD is not compatible with your hardware, please report it at
pcedric@hotmail.com.
Q) The apple 2 freeze accessing the smartport VHD
A) This could arise if you started smartport VHD from the floppy disk, or if you
stroke some keys on the PC keyboard. Reboot the apple 2.
Q) The PC display a lot of C: and @: symbols
A) There is a synchronisation problem, retry by reducing or increasing the
frequency given on the command line by step of 1Mhz. When the synchronisation is
perfect, the PC should not display any C: nor @: symbols.
Q) The PC display continuously the symbols T:
A) This is the normal operation, showing the smartport VHD is running and
waiting requests from the apple 2.
Q) An external phantom drive appear in slot 6 drive 2
R) Smartport VHD don't handle all functions of the external floppy connector at
the current stage. It will be fixed in a futur release but require some changes
in the specific cable.
7) ASSEMBLING FROM SOURCE
NASM 2.xx must be installed and in the path. Start make.bat or make.sh to
assemble the software from the sources. A vhd.com file must be created at the
end of the process. If you would like to be involved in the project, or simply
get my own documentation to help you in your smartbus project, contact me at
pcedric@hotmail.com.
6) PLANNED AND POSSIBLE EVOLUTIONS
- update the 486 version to get it working again
- add support for daisy chain
- add floppy emulation
- add emulation of more than one hard disk
- add a bootstrap allowing to select the boot device directly from the apple 2
- add support for extended smartport protocol
- create a smartport to parallel port bridge (apple 2 <-> PC)
- create a smartport to usb bridge (apple 2 <-> PC)
- create a usb to smartport bridge (apple 2 <-> usb card reader, usb harddisk)
- create a standalone smartport mass storage

BIN
spvhd/smartporthd.zip Normal file
View File

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

View File

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 828 B

View File

View File

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 679 B

Some files were not shown because too many files have changed in this diff Show More