Advertisement

Microcontroller Angelscript Project

Started by October 13, 2012 01:55 PM
2 comments, last by WitchLord 11 years, 11 months ago
I have been playing around with embedding Angelscript in a microcontroller recently. It is working pretty good (but just a mash up of code to prove it out). There is a web gui front end that lets you edit script code in the browser then transfer it to the microntroller where it is compiled and executed. Some details of the project can be found here http://forum.embeddedethernet.com/viewtopic.php?f=5&t=1448 . There is a lot of work left to be done. One of the things I was looking for assistance with is the platform specific code. Currently I am registering all generic functions. It would be nice if native functions could be registered. I think this would provide a performance boost as well. If anyone has the time to pitch in, the controller it is running on can be found here http://www.netburner.com/products/core_modules/mod54415.html . Netburner sells the development kit for $99. I have no association with them. I'm only interested in embedding scripting. I've done some work with Angelscript in the past. I was able to compile the Anglescript library fairly easily with the Eclipse IDE that Netburner provides so I added the web GUI and ended up with a pretty fun little gadget to play with.
This looks quite interesting.

Is there an ABI specification for the Freescale Coldfire CPU? It's easier to get the native calling convention to work if there is.

Ability to disassembling code is also pretty much a must in order to figure out the assembler instructions needed to prepare the arguments for the function call.

In the test_feature project I have several tests designed to help determine how the native calling convention behaves.

I'll help guiding you on this attempt if you need it.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Andreas,

Thanks for your support. I haven't found the actual ABI but I did find this post http://osdir.com/ml/hardware.motorola.microcontrollers.coldfire/2003-08/msg00082.html that discusses it. The cross compiler that is shipped with the development kit is gcc based using the gcc-m68k derivative. The Coldfire is a derivative of the Motorola 68000 chips. Does this provide enough info for you to point me in the right direction?

Thanks,
Tony
Yes, that article indicates that the System V ABI for Motorola 68000 can be used as the base for understanding the calling convention used by the Coldfire. Whether or not it is an exact match remains to be seen with tests.

The first step would now be to figure out how an global function is called with Motorola assembler routines.

Start by creating a new file to hold this implementation, e.g. as_callfunc_m68k_gcc.cpp (you can probably use as_callfunc_x86.cpp as the base). Hopefully you will be able to use inline assembler so you don't have to write a separate assembler file too.

Then modify the as_config.h to add specific configurations for your platform, that will tell the compiler to include the code in the new as_callfunc_m68k_gcc.cpp file.

Once you have that much working, it is pretty much just a matter of an iterative process with testing and coding to add support for function arguments, return values, and class methods.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement