contiki/cpu/6502/README.md
Oliver Schmidt c2a71ee62b Updated several aspects regarding Ethernet drivers.
I. Build Ethernet drivers individually for each target.

After all the Ethernet cards/carts are different enough to ask for customized drivers. Building the drivers individually opens the option to use .ifdef's to customize them.

II. Removed Ethernet driver I/O base.

So far the base address of the Ethernet chip was a general property of all Ethernet drivers. It served two purposes:
1. Allowing to use a single Ethernet driver for a certain Ethernet chip, no matter what machine was connected to the chip.
2. Allowing use an Ethernet card in all Apple II slots.

However, we now use customized Ethernet drivers for the individual machines so 1.) isn't relevant anymore. In fact one wants to omit the overhead of a runtime-adjustable base address where it isn't needed.

So only the Apple II slots are left. But this should rather be a driver-internal approach then. We should just hand the driver the slot number the user wants to use and have the driver do its thing.

III. With per-target Ethernet drivers we can have per-target MAC addresses.

IV. Added support for RR-Net MK3 unique MAC addresses.

The RR-Net MK3 can be operated in two modes:

- In cartrigde mode it has a startup-ROM that sets the CS8900A MAC address to the unique MAC address.
- In clockport mode the driver has to read the two lowest MAC address bytes from the EEPROM and combine them with 28:CD:4C:FF.

See http://wiki.icomp.de/wiki/RR-Net#Detecting_MK3 for details.

The driver first checks if the current CS8900A MAC address starts with 28:CD:4C:FF. If it does, it overwrites its built in default MAC address with the CS8900A MAC address.

If the CS8900A MAC address didn't start with 28:CD:4C:FF, it checks if there are two valid MAC address bytes in the EEPROM. If they are there, it overwrites its built in default MAC address with a combination of 28:CD:4C:FF and those two bytes.

V. Added support for the upcoming 'Dracarys' Ethernet PBI for the ATARI.

See http://atariage.com/forums/topic/287376-preannouncement-dragon-cart-ii/ for details on Dracarys.

So far there was only one Ethernet solution for the ATARI. Therefore the relevant driver was loaded statically. With now having two solutions we have to load the corresponding driver dynamically (like on the other machines). Fortunately this doesn't mean significant additional overhead as there are several mouse drivers for the ATARI asking for dynamic mouse driver loading. Therefore the dynamic driver loading infrastructure was linked already.

Another aspect of more than one Ethernet solution is that the Ethernet config program becomes necessary on the ATARI to select the correct driver. Although that program is pretty simple and therefore rather small it means that now only one "major" program fits on a 130kB disk. So we need now 5(!) 130kB disk images instead 3 so far.
2019-05-08 16:46:47 +02:00

3.3 KiB

6502

The cpu/6502/ directory is used for targeting 6502-based machines using the cc65 compiler http://cc65.github.io/cc65/.

The Contiki network configuration for 6502-based targets is loaded from a binary configuration file (by default named contiki.cfg). It has the following format for Ethernet:

  • Bytes 1 - 4: IP Address (HiByte first)
  • Bytes 5 - 8: Subnet Mask (HiByte first)
  • Bytes 9 - 12: Default Router (HiByte first)
  • Bytes 13 - 16: DNS Server (HiByte first)
  • Bytes 17 - 18: Ethernet card driver param (LoByte first !)
  • Bytes 19 - xx: Ethernet card driver name (ASCII / PETSCII)

It has the following format for SLIP (based on RS232 driver coming with cc65):

  • Bytes 1 - 4: IP Address (HiByte first)
  • Bytes 5 - 8: Subnet Mask (HiByte first)
  • Bytes 9 - 12: Default Router (HiByte first)
  • Bytes 13 - 16: DNS Server (HiByte first)
  • Bytes 17 - 21: struct ser_params (see cc65 serial.h)

The build for 6502-based machines includes the 'disk' make goal which creates a bootable floppy disk image containing the project binary, a sample configuration file and the Ethernet card drivers.

The build for 6502-based machines supports so-called high-level configuration macros which allow to customize Contiki on a per-project basis. They are set in form of a comma-separated list as value of the make variable DEFINES on the make command line. The value of DEFINES can be saved with the 'savedefines' make goal. The values of the high-level configuration macros are not tracked by the build so a manual rebuild is necessary on any change. The following high-level configuration macros may be set:

  • WITH_SLIP

    • Default: 0
    • Purpose: Use SLIP (based on RS232 driver coming with cc65) instead of Ethernet.
  • MTU_SIZE

    • Default: 1500
    • Purpose: Set the Maximum Transfer Unit size.
  • CONNECTIONS

    • Default: 2
    • Purpose: Set the maximum number of concurrent TCP connections.
  • STATIC_DRIVER

    • Default: N/A
    • Purpose: Link device driver statically instead of loading it dynamically using the network configuration file.
  • WITH_LOGGING

    • Default: 0
    • Purpose: Have log_message() and UIP_LOG() write messages to the screen.
  • WITH_BOOST

    • Default: 0
    • Purpose: Significantly improve troughput on sending full sized packets by splitting them thus workarounding the "delayed acknowledge".
  • WITH_FORWARDING

    • Default: 0
    • Purpose: Enable support for the 'IP forwarding' packet driver.
  • WITH_CLIENT

    • Default: 0
    • Purpose: Enable support for outgoing TCP connections.
  • WITH_DNS

    • Default: 0
    • Purpose: Enable UDP support and initialize resolver process on startup.
  • WITH_80COL

    • Default: 0
    • Purpose: Enable 80 column screen.
  • WITH_GUI

    • Default: 0
    • Purpose: Initialize the CTK process on startup.
  • WITH_MOUSE

    • Default: 0
    • Purpose: Enable CTK mouse support and load a mouse driver.
  • STATIC_MOUSE

    • Default: N/A
    • Purpose: Link mouse driver statically instead of loading it dynamically.
  • WITH_ARGS

    • Default: 0
    • Purpose: Enable support for contiki_argc / contiki_argv.
  • WITH_PFS

    • Default: 0
    • Purpose: Implement the CFS interface with a Platform-specific File System instead of the POSIX file system.