Giter Club home page Giter Club logo

openrabbit's Introduction

What is OpenRabbit?

A free portable replacement for the Digi Rabbit Field Utility and an on-target debugger. This allows Rabbit development on OSes other than Windows. The on-target debugger currently only works with programs created using the non-free Dynamic C (which can be run .e.g via wine).

A free inital loader (coldload.bin) and secondary loader (pilot.bin) are included in OpenRabbit, but it will also work with loader binary blobs from Dynamic C 8 or 9.

See BUILD for how to build it.

Use:

OpenRabbit supports two modes:

* Rabbit Field utility mode, invoke as "openrabbitfu". Flashing only. Works with files from any source, including SDCC and Dynamic C.
* OpenRabbit mode, invoke as "openrabbit". Debugging support. Requires files from Dynamic C.

Example:

    openrabbitfu --dc8pilot coldload.bin pilot.bin user.bin /dev/ttyUSB0

Will upload the user program user.bin onto the target via cable attached to /dev/ttyUSB0 and using initial loader coldload.bin, secondary loader pilot.bin (with the secondary loader in Dynamic C 8 format).

Options:

--help       Showusage information summary.
--verbose    Increase verbosity (this option can be used up to 3 times, with each additional use increasing verbosity).
--slow       Workaround for tcdrain() driver bugs (see below for details).
--run        Run program immediately after programming.
--serialout  Display data from serial line at 38400 baud until EOT

Serial cable with USB-to-serial convverter:

The use of a serial cable with an external USB-to-serial converter can be problematic. Most, but not all of them work when using the --slow option.

History:

OpenRabbit was initially developed and maintained by Lourens Rozema. His latest release was 0.1.1.
The original homepage can be found at http://www.lourensrozema.nl/index.php/openrabbit.inc

This repository has been created by Philipp Klaus Krause (with endorsement by Lourens Rozema) to continue development.

openrabbit's People

Contributors

spth avatar tomlogic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tomlogic stahta01

openrabbit's Issues

Improve speed

Faster loading of programs would allow faster development cycles for users.

  • The current waiting-based method to ensure dta has been written could be replaced by tcdrain / sp_drain use.
  • A higher speed could be used to upload the user program (we now use pilot.bin from DC9, which allows faster speeds than the one from DC8).
  • A minimmal (no debugging, just loading replacement for pilot.bin) could be used in rfu mode.

Cold-boot only mode?

Currently, OpenRabbit does

  1. Use cold-boot mode (slow - 2400 bps, load to RAM, lower 64 KB only) to load coldboot.bin (a binary blob from dynamic C that implements a medium-speed (57.6 bps or 19.2 bps) loader)
  2. Use the medium-speed loader to load pilot.bin (a binary blob that implements a fast loader)

The main disadvantage of this process is the requirement for the two binary blobs (free MPL v2 source code is available, but they need the non-free Dynamic C compiler to compile) .

Exposing a cold-boot only functionality could allow to write a program onto the Rabbit without needing any binary blob.

Out-of-tree build fails

Trying to build out-of-tree fails:

philipp@notebook6:/tmp/OpenRabbit/build$ LANG=C make
make  all-recursive
make[1]: Entering directory '/tmp/OpenRabbit/build'
Making all in src
make[2]: Entering directory '/tmp/OpenRabbit/build/src'
make[2]: *** No rule to make target 'openrabbitfu', needed by 'all-am'.  Stop.
make[2]: Leaving directory '/tmp/OpenRabbit/build/src'
make[1]: *** [Makefile:456: all-recursive] Error 1
make[1]: Leaving directory '/tmp/OpenRabbit/build'
make: *** [Makefile:367: all] Error 2
philipp@notebook6:/tmp/OpenRabbit/build$

Integrate build of coldload.bin

Openrabbit now has its initial loader, coldload.bin.
However, the build process it not integrated with the rest of the build (requires manual invokation of make in coldboot directory).

This should be integrated:

  • top-level make should trigger a make in coldboot
  • configure should check for presence of needed sdasrab and sdcc
  • make distcheck should include relevant files in distribution tarball

(configure) option for DC8 mode?

OpenRabbit 0.2.0 requires pilot.bin from DC9 (included), but there still is a macro to allow the use of pilot.bin from DC8 instead.
Maybe this should be exposed as a configure option? Or maybe even a runtime option?

SDCC-compileable replacements for coldboot.bin and pilot.bin?

OpenRabbit currently depends on the coldboot.bin and pilot.bin binary blobs from Dynamic C.

While the source code for both is free (MPLv2), the non-free Dynamic C is required to compile them.

It would be good to have replacements that compile with free SDCC.

Not working with PL2303 USB-serial adapter

When using a serial programming cable attached via an PL2303 USB-to-serial adapter, OpenRabbit fails:

Error: Status line should be high after sending initial loader.

By reverting the tcdrain() approach in rabbit_triplet() back to the old usleep() one, we get a bit further, but then fail at the pilot checksum:

loaded 5517 bytes from ../coldboot/pilot.bin
sending 5517 pilot
csumR 0xfd69 != csumU 0xd469

Doesn't really work with DC 9.62A pilot.bin

When using the pilot.bin from DC9.62A (which is shipped with OpenRabbit), openrabbitrfu does not give any error messages, but apparently, the user program is not written or not written correctly. I found this by using simple pin-setting examples (pe7 to 1, pe1 to 0 or the other way round):
When using OpenRabbit with DC9.62A pilot.bin, the pins still have the same state as before.

However, the very same programs work fine when either written using the RFU from DC 9.62A on Windows 10 or OpenRabbit with the pilot.bin from DC 8.61 (requires setting dc8pilot to true in rabbit.c).

Intel hex support

OpenRabbit should support the use of Intel hex (.ihx, .hex) files. It should try to detect if a supplied file is Intel hex vs. binary (maybe just checking the filename like other software does would be enough).

Intel hex is a common format. It is also the default output format of the Small Device C Compiler (SDCC), the main alternative to Dynamic C for Rabbit development.

pilot.csum 0x4a != csum 0x00 on second try

When trying to use OpenRabbit a second time I usually see the following problem:

pilot.csum 0x4a != csum 0x00

pilot.csum of course depends on pilot.bin (the above is for the one from Dynamic C 8.61), but the error is always the same.

My setup is an RCM2200 supplied with 5 V from a lab power supply and connected to a USB programming cable from Diig. This hardware setup works on Windows 10 with the RFU from Dynamic C 9.62A, on the first and further tries. And using the coldload.bin and pilot.bin from Dynamic C 8.61 it works on the first try on Debian GNU/Linux. But not on subsequent ones.

So far the only workaround is to disconnect the RCM2200 from the power supply and programming cable and wait a few minutes. Waiting just one or two minute isn't enough.

Segfault running openrabbitfu without any parameters

With a build on my Mac, ran into this:

[tom@tbc-mbp src]$ ./openrabbitfu
Segmentation fault: 11

Without looking at the code, I'm guessing it's checking argv[] without looking at argc.

Help works:

[tom@tbc-mbp src]$ ./openrabbitfu -?
Usage: openrabbitfu [dc8pilot] <coldload.bin> <pilot.bin> <project.bin> <cable device>
Usage: openrabbit [dc8pilot] <coldload.bin> <pilot.bin> <project.bin> <project.brk> <drive> <mount> <cable device>

But I'm having some serial port troubles so I'm going to switch over to Windows and try building/testing there (using MSYS2).

stdcbench fails self-test in c90lib-lnlc.c

I've ported stdcbench to the RCM2200.
But I get an error from the stdcbench self-test. Unfortunately, I wasn't able to create a small reproducer yet. The error happens no matter is I #undef C90BASE (reducing the code size), or change compilation options to remove -opt-code-speed or --max-allocs-per-node.
But when I just put use c90lib-lnlc.c by itself with a thin main()-wrapper, I can no longer reproduce the issue.

See https://sourceforge.net/p/stdcbench/code/HEAD/tree/trunk/stdcbench/, compile using make -f examples/Makefile.SDCC-R2K

Make crt0 use a configuration that is likely to work well with many programs

I'd suggest large root and stack segments, since SDCC by default just uses a linear 64Kb address space.

For normal code and constants (CODE, INITALIZER areas) we will want to use the root segment in flash.
For later banked code we would use the xpc segment (since it works with the lcall, lret, ljp instructions) in flash.
That leaves the data and stack segments. We'd use one for normal data (i.e. stack, DATA and INITALIZED areas), the other for named address spaces.

I think we want at least 32KB for the root segment (the stdcbench benchmark needs 25 KB in there).
We'd want at least 8 KB for the segment that holds DATA area and the stack (both the Dhrystone and Coremark benchmarks need about 5 to 6 KB in there).

For the other segment in ram, and the for the xpc segment, we'll want at least 4 KB each, so that reasonably-large objects fit.

That leaves 16 KB of the address space that we could assign whereever we think it will be most useful. And we need to decide if the stack and the DATA and INITALIZEDarea will go into the stack segment vs. the data segment.

Create "build" directories for building and then add to .gitignore

I'm having to sort through lots of files in my git client, and it's hard to tell what needs to be added to the repository and what is just a configure/build artifact. It would be great to have configuration and building take place in separate directories. This would be for both building openrabbitfu and coldload.bin.

Auto-detect secondary loader format

OpenRabbit currently has the --dc8pilot option for the use of a DC8-style secondary loader.

It could make sense to instead auto-detect the secondary loader style, so the user doesn't have to specify this explicitly.

program start by RFU?

Currently, for a program using serial port A, I have to:

  • Unplug diagnostics port of cable, plug programming port
  • Load program via RFU
  • Switch off power
  • Unplug programming port of cable, plug diagnostics port
  • Start a terminal program
  • switch on power

Could this be simplified? Could the RFU start the program at the end (maybe depending on commandline option), soI don't need to power-cycle? Could the RFU leave the cable in a state that allows serial I/O by a terminal program on the programming port, without requiring the use of the diagnostics port?

Hangs on reading pilot checksum

I got a Digi 2 mm USB programing cable (says "This programming cable requires Dynamic C v 9.62 or later" on it).
Since I don't have the prototyping board, I just connect the RCM2200 to a lab power supply to supply and the programming cable.

I use the coldboot.bin and pilot.bin from Dynamic C 9.62.
I invoke Openrabbit via:

./rfu /home/philipp/OpenRabbit/coldboot/coldload.bin
/home/philipp/OpenRabbit/coldboot/pilot.bin test test test test /dev/ttyUSB2

But both in my (here) and the unchanged code from the latest release (01.1.), it hangs when trying to read the pilot checksum. I verified this by enabling #ifdef DEBUG_COMM in myio.c:

sending 46477 pilot
writing 46477 bytes
reading 2 bytes

OpenRabbit never proceeds beyond that last line.

At this point, there are multiple potential underlying issues: A bug in OpenRabbit, and incompatibility with the cable, an incompability with the pilot.bin.

Low Dhrystone performance

On the RCM2200, which has a Rabbit 2000@22 MHz, I see 2755 Dhrystones/s using the example code with current SDCC.

For comparison, current SDCC gets about 6000 Dhrystones/s on a C8051@96 MHz, and over 10000 Dhrystones/s on a STM8AF@24 MHz.

make distcheck broken

make distcheck can be used to generate useable tarballs, but:

  1. It only works if normal make has been invoked first, otherwise it fails complaining that there is no rule to generate openrabbitfu.
  2. It deosn't find coldboot.s.
  3. It creates a directory openrabbit-0.1.2 (or whatever the release is) that cannot be removed even by rm -rf by the user. I always use su to get rid of it.

Make a release

The current trunk compiles well on current GNU/Linux systems, which is an advantage over the 0.1.1 release.
It would make sense to make a 0.1.2 release from trunk after some testing.

Not working with CH340G USB-serial adapter

I've tried with a CH340G USB-to-serial adapter and the serial programming cable.

However, this fails:

Reset Rabbit.
loaded 831 bytes from ../coldboot/coldload.bin
Sending initial loader.
Warning: Processor verification sequence failed!
sending 276 initial loader triplets
Error: Status line should be high after sending initial loader.

The error is the same no matter if the new tcdrain() or old usleep() approach is used in rabbit.c

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.