Mega-Micro's
Microcomputer projects new & old
Mega-Micros Home
12 Edgefield Close
Redditch B98 7WB
ENGLAND
 
+44 (0)7973 265572
info@mega-micros.co.uk
68000 68030 CPLD FPGA ARM
SHOP        
Systems
68000 CPU
68000 CPU-2
68000 CPU-2.1
Backplane
Backplane-2
Memory
Memory-2
Memory-3
Memory-3.1
Hex Display
Dual 6850
Dual 6850-2
68681
68230
68230-2
ACRTC
IDE
IDE-2
Protoboard
Other Boards
Software
Programming
  EASy68K
  CP/M-68K
  GCC
 
  +CP/M-68K
Documents
Datasheets
Quick Tips
Blog
 
 
Programming with GCC
Here you will find short example programs designed to help with programming the Mega-68000 and Mega-68030 Computer Systems using GCC.
 
The GNU Compiler Collection (GCC) is an Assembler, C Compiler, Linker, and an Object Copy tool produced by the GNU Project team, add to this the GNU Make utility and one has a development environment that is far more capable than Easy68K.
 
To successfully build example1 and example2 (below) the GNU Compiler Collection (GCC) must be preinstalled. Installation of the the GNU Make utility is optional as alternative script files are provided, however it is highly recommended that you install both - future example programs will require GNU Make.
 
GCC installation instructions can be found here:
Software/GCC
 
GNU Make installation instructions can be found here:
Software/Make
 
Getting started
 

Follow the instructions below to create a very simple executable program that can be downloaded to a Mega-680x0 Computer System and run from RAM using the built-in Monitor program. The source code can be used as a GCC template for writing more complex programs that will run on any Mega-680x0 Computer System. The example presented here simply displays "12340000" shortly followed by "00005678" on the Hex Display Board.

 
1. Download the following ZIP file:
  gcc_example1
2. Extract the contents of the ZIP file to a new folder
  Remember the name and location of the folder,
  this will be referred to as the project folder
  Tip: it is convenient to keep the path to the project folder short,
  here we will use c:\gcc
3. Check the contents of the project folder - there should be 4 files:
 
example1.s GCC Source File
makefile GNU Make File
build.sh Script File
clean.sh Script File
4. Sign in to Linux
5. Type: cd /mnt/c/gcc
6. Type: ls
  Linux OS will list the 4 files - confirm before continuing
7. Option1 - Type: make
  Option2 - Type: 'dot'+'slash'+'build.sh' i.e. ./build.sh
  In the Windows project folder there will now be a an example1.srec file
8. Open the example1.srec file using Windows Notepad
9. Copy ALL the text to the Windows Clipboard
10. Start the Mega-680x0 Computer System
11. At the SYS> prompt type: LO
12. Paste the copied text into the Console Window
  The Mega-680x0 receives and processes the S-Record formatted binary file,
  when reception is complete, the Mega-680x0 will accept the next command
13. At the SYS> prompt type: G1 or GD 100000 to run the program
 
Another GCC coding example
 
Hex Display Board functional test - cycles through 0-F on each digit in turn.
Download the ZIP file: gcc_example2
 
Script Files
 

Each GCC example ZIP file contains two Linux Script Files. These scripts are a quick and dirty first attempt at making the command line driven GNU Compiler Collection (GCC) no more difficult to use than the simple Windows based EASy68K IDE (Integrated Development Environment).

 
./build.sh

This script requires no input from the user whatsoever while invoking the GCC Compiler/Assembler, Linker, and Object Copy tool to generate a Motorola S-Record formatted Mega-680x0 compatible binary file plus a raw binary for good measure.

Tip: If you have GNU Make installed it is easier to type: make
 
./clean.sh

This script deletes all files generated by the build.sh script or 'make' command.

Tip: If you have GNU Make installed it is easier to type: make clean
 
IMPORTANT

The V1.0 Script Files are unique to each example, therefore you cannot use the Script Files from example1 with example2 or vice-versa.

 
 
Disclaimer
All hardware designs, software, and information shared on this website is provided "as is"
without warranty of any kind and strictly for personal non-commercial use only.
 
 
Website V0.97 (C) 2021 Mega-Micros
Status: under construction
Mega-Micros Home
12 Edgefield Close
Redditch B98 7WB
ENGLAND
 
+44 (0)7973 265572
info@mega-micros.co.uk