Using uLisp with current MCUDude core for ATmega1284


#1

My apologies for posting a somewhat retro question, but I’m trying to put some old ATMEGA 1284 boards to good use with uLisp. Sadly, the uLisp AVR version does not compile with MCDude’s core anymore since that one is using the “Urboot” bootloader now, whereas uLisp AVR wants to use functions of the older “Optiboot” core.
I tried to get around that problem using the old “maniacbug” Mighty 1284P core, but it seems “optiboot.h” isn’t included there as well.
I couldn’t figure out which includes and calls would be necessary to invoke the Flash writing capabilities using “Urboot”, but theoretically it might be compatible in some way since “Urboot” has its roots in “Optiboot”.

Apologies again - I’m not familiar with the low level use of Arduino bootloaders at all. Still, it would be great to save the 1284 boards from rotting in the drawer by putting uLisp onto them. (The boards in question are the ingenious “UNO*Pro” piggyback PCBs available from “hobbytronics” several years ago. They replaced the original 328P on the Arduino UNO boards while preserving pin compatibility.)

Thanks for any help!


#2

I would expect Urboot to be backwards compatible with Optiboot, but you could try loading an earlier version of MightyCore; I have 2.1.1 installed and I think that uses Optiboot.

The problem may be that you have to use Burn Bootloader to install the bootloader and make the flash writing code available. You then need to upload uLisp via Serial, using the bootloader you have just installed. The procedure is described in the installation instructions for the Lisp Badge on Technoblogy: Lisp Badge

By the way, I tried compiling the AVR version of uLisp, Release 4.8a, with MightyCore 2.1.1 and it revealed a few compile errors. Here’s how to fix them:

  • Rename the function sleep () to gosleep ().

  • In the function doze () change the call from sleep() to gosleep().

Change the line:

pstream_ptr_t streamfunction = pgm_read_ptr(&streamtable(n?0:1)[n?nstream:nstream-USERSTREAMS].pfunptr);

to:

pstream_ptr_t streamfunction = (pstream_ptr_t)pgm_read_ptr(&streamtable(n?0:1)[n?nstream:nstream-USERSTREAMS].pfunptr);

Change the line:

gstream_ptr_t streamfunction = pgm_read_ptr(&streamtable(n?0:1)[n?nstream:nstream-USERSTREAMS].gfunptr);

to:

gstream_ptr_t streamfunction = (gstream_ptr_t)pgm_read_ptr(&streamtable(n?0:1)[n?nstream:nstream-USERSTREAMS].gfunptr);

Let me know how you get on,
David


#3

Thank you, David - with MightyCore 2.1.1 the installation of uLisp worked (with the newer 2.2.2 there were other complaints again).
For use with the aforementioned UNO*Pro boards one just needs to select “1284” as the processor variant (as opposed to “1284P”), therefore line 52 in ulisp-avr.ino must be changed to

#elif defined(__AVR_ATmega1284__)

Bottom line: Using MightyCore 2.1.1 everything worked pretty much as expected. Thanks a lot for looking into it!


#4

FYI concerning the “Uno*Pro” piggyback boards:

  • The “Mighty” core is not fully pin compatible with them, even with “Bobuino” pin layout activated (recommended). Several pins work out of the box, though; for others, one needs to figure out which Arduino pin number corresponds to what “Uno*Pro” pin. A little annoying, but feasible.
  • Surprisingly, not each and every “Uno*Pro” board is equipped with the same processor variant. Some apparently have the 1284P installed, others 1284 processors without “P” - one needs to adapt the uLisp AVM core code accordingly (and switch the “Mighty” core to the right variant in the IDE before uploading).

That said, I’m happy uLisp still works with these old boards!