Created Compiling firmware (markdown)

David Banks 2016-07-15 11:18:59 +01:00
parent 8969255c05
commit 65e31031bf

74
Compiling-firmware.md Normal file

@ -0,0 +1,74 @@
### Compiling the Xilinx bitstream
Each target is a separate Xilinx project:
* ICE-T65 - AtomCpuMon.xise
* ICE-T80 - Z80CpuMon.xise
* ICE-6809 - MC6809ECpuMon.xise
In addition, there are two further 6502 projects that are experimental:
* AtomBusMon.xise - a simpler bus monitor that works against a soldered-in 6502
* AtomFast6502.xise - a version of ICE-T65 that uses PLL clock synchronization; this will only work if the target system has a continuous clock. It will not work in the BBC Micro where the CPU clock varies between 1 and 2 MHz. This design will reliably run a 4MHz in the Acorn Atom.
To compile a single target, you can use load the project into Xilinx ISE 14.7, and drive this interactively.
There are two Linux scripts available which will clean and compile all targets:
* ise_clean.tcl
* ise_build.tcl
The result of compiling the target's Xilinx project should be a identically names .bit file in working/
It will not work if you program one of these .bit files, because the latest AVR C code needs to be compiled and patched in.
### Compiling the AVR C code
To compile ICE-T65:
```
cd firmware
make -f Makefile.6502cpu
```
The result is a .bit file in firmware/ called avr6502cpu.bit.
To compile ICE-T80:
```
cd firmware
make -f Makefile.z80cpu
```
The result is a .bit file in firmware/ called avrz80cpu.bit.
To compile ICE-6809:
```
cd firmware
make -f Makefile.6809cpu
```
The result is a .bit file in firmware/ called avr6809cpu.bit
To convert the .bit file into a .mcs file that can be programmed with Xilinx iMPACT:
```
. /opt/Xilinx/14.7/ISE_DS/settings*.sh
promgen -u 0 avr6502cpu.bit -o avr6502cpu.mcs -p mcs -w -spi -s 8192
```
### Target specific customizations
The firmware for each of ICE targets is build from the same source file:
https://github.com/hoglet67/AtomBusMon/blob/master/firmware/AtomBusMon.c
There is some use of conditional compilation to build a specific target:
**#ifdef CPUEMBEDDED**
By undefining CPUEMBEDDED it is possible to build a passive bus monitor that would work with a processor that was not socketed. This has only been done so far for the 6502. The Xilinx project is AtomBusMon.xise. The Makefile is Makefile.6502mon.
The functionality that is dropped in this mode is:
* Access to the processor registers (regs)
* Access to host memory (dis, fill, crc, mem, rdm, wrm, test)
**#ifdef LCD**
This includes extra code to display the current value of the address bus on an LCD. That functionality is not currently enabled in the Xilinx VHDL designs.
**#if (CPU == 6502 | Z80 | 6809)**
This makes customization specific to a target, for example:
* Setting the emulator name
* Enabling the IO specific commands for the Z80