An interface to Motorola® Coldfire processors' Background Debug Interface (BDM) using an Arduino.
pip install arduino-coldfire-bdm
After running pip install arduino-coldfire-bdm
on a machine with a working Python 3 installation, use the arduino-coldfire-bdm
command-line program:
usage: arduino-coldfire-bdm [-h] [--dry-run] [--show-commands] [--serial-port SERIAL_PORT] [--baud-rate BAUD_RATE] {dump_memory,trace_execution,load_flash,sram_test} ...
Communicate with an attached Coldfire V3 board (and maybe other versions too) to act as a simple debugger, via an Arduino serial connection.
options:
-h, --help show this help message and exit
--dry-run If passed, don't actually connect to a serial port; just queue up commands that would have otherwise been sent to an attached Arduino.
--show-commands If passed, print out a listing of every command sent to the Arduino.
--serial-port SERIAL_PORT
The file path of the serial port to connect to.
--baud-rate BAUD_RATE
The baud rate to use when connecting to the Arduino over serial. Must match what the Arduino expects.
commands:
{dump_memory,trace_execution,load_flash,sram_test}
dump_memory Dump memory.
trace_execution Begin execution and print out the program counter and registers before every instruction.
load_flash Erase an attached Flash chip and load in new contents from a file.
sram_test Test SRAM attached to the Coldfire. Expects exactly 1MB of RAM, attached via chip-select port 1, mapped at 0x00200000.
A long long time ago (the mid-1990s), Motorola created a series of CPUs derived from the 68k architecture, called the Coldfire. These processors are largely obsolete today, but are still found in certain industrial equipment and embedded devices released around that time; including some vintage synthesizers, like the Alesis A6 Andromeda.
This repository contains two things:
- an Arduino sketch, which allows connecting pretty much any Arduino to a Coldfire processor's Background Debug Mode (BDM) port to send and receive data
- a Python library to connect to an Arduino over USB serial, to allow running high-level debugging commands, like:
- tracing execution (i.e.: like GDB or LLDB)
- dumping the contents of memory to a file
- erasing and re-flashing an attached flash memory chip
- testing attached RAM chips
- whatever else you want; it's Python! You can script it.
This library, when paired with an Arduino, performs many of the same functions as PEMicro's Multilink debugging probes. This library is free, runs wherever you can run an Arduino and Python code (rather than just on Windows), and requires no drivers. However, this library is way slower, is missing a ton of functions, and has no IDE support.
I bought a broken Alesis A6 Andromeda, and wanted to try fixing it by re-flashing its firmware without doing any soldering, because I'm bad at soldering. Read about that journey on my blog.
I read the MCF5307 data sheet (484 pages) very carefully. It documents how to connect to a Coldfire BDM port from first principles.
See the top of arduino-coldfire-bdm.ino to figure out which pins to connect between the Arduino and your Coldfire's debug port.
Probably. There are certain assumptions made (especially around interfacing with Flash or RAM) that apply only to the Andromeda, and may not be useful for other devices. Pull requests to make this code more generic would be welcomed.
Here's the license; I take no responsibility if this software is misused. You should probably read the software carefully first.
Also; I tested this with a 5V Arduino on a 3.3V Coldfire CPU. It seemed to work just fine. That might fry your device; your mileage may vary.
Copyright (c) 2022 Peter Sobot
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.