There have been a few comments on the forums about scripting languages recently. Netburner has indicated that they are working on a port of Lua. I recently purchased a MOD54415 to experiment with scripting in general and have a very rough hack of AngelScript running on it. I have used AngelScript on an x86 based machine for a previous project and know that is works well. I have exported an archive from the Eclipse IDE and posted a small blurb on the Wiki http://wiki.embeddedethernet.com/AngelScript. The project is basically a direct port of the tutorial to work on the Netburner module. The performance is fairly good. I need to add support for reading the script from a file so that it can updated remotely. I haven't used the Netburners for some time so I'm brushing out the spider webs from upstairs.
Angelscript is based on C/C++ and the basic syntax is identical. If you are working on Netburners it should be and ideal scripting language since you don't need to learn anything new other than how to integrate the scripting engine.
Cheers,
Tony
AngelScript Scripting on the MOD54415
Re: AngelScript Scripting on the MOD54415
AngelScript is now functional to a point where it is very useful. I have integrated strings and array as well as a print function that sends output to the console. Have fun!!! Most of the remaining work is going to be integrating the Netburner API and the completion of the GUI. I modified the example script to demonstrate how strings, concatenation and printing work.
- Attachments
-
- Netburner Angelscript Jquery IDE with String and Array Support.zip
- (1.61 MiB) Downloaded 337 times
Re: AngelScript Scripting on the MOD54415
I've added a little more functionality to this project. You now get dynamic feedback when a saved script has errors. There is also a file explorer that lets you traverse directories on an SD card. You can't open the file yet. This is will be my next addition. On the scripting side I have added the following functions
setPin(pinNum) -> turn on digital output (I was use this to fire the LEDs on the DEV board)
resetPin(pinNum) ->turn off digital output
OSTimeDly(ticks) -> pause script (resolution is system tick time)
hrOSTimeDly(seconds) -> pause script using high resolution timer (I was able to get millisecond performance, but would need to adjust the time to account for the function call for precision)
I'm in the process of cleaning up the code and putting things in the proper place. This is a screen shot of the latest front end. I attached the latest code for anyone interested.
setPin(pinNum) -> turn on digital output (I was use this to fire the LEDs on the DEV board)
resetPin(pinNum) ->turn off digital output
OSTimeDly(ticks) -> pause script (resolution is system tick time)
hrOSTimeDly(seconds) -> pause script using high resolution timer (I was able to get millisecond performance, but would need to adjust the time to account for the function call for precision)
I'm in the process of cleaning up the code and putting things in the proper place. This is a screen shot of the latest front end. I attached the latest code for anyone interested.
- Attachments
-
- Netburner Angelscript Jquery IDE with SD File Explorer and Error Feedback.zip
- (1.05 MiB) Downloaded 326 times
Re: AngelScript Scripting on the MOD54415
Tony, how a about a little walk through on what to download and how to set it all up to get it working.
Re: AngelScript Scripting on the MOD54415
All of the code is included in the zip file. I will put together some details of how to get it going on the wiki. Basically you need to import the projects into Eclipse, compile the Angelscript library and then compile the Postfile project. I should change the project name... I started with the Netburner demo project that shows how to post a file. If you have any specific questions until I get the how to together let me know. It's a pretty fun little gadget when you get it going. The instant gratification of editing and executing is what interests me the most. There are a lot of different ways to apply it. I'm still working on the boilerplate code to get the basic front end working. There is some links in the main.cpp file that point to some of the open source projects used.
Tony
Tony
Re: AngelScript Scripting on the MOD54415
I have posted some brief instructions that explain how to get the Angelscript demo running on the Netburner wiki http://wiki.embeddedethernet.com/AngelScript . I am also going to post some info on how the application works and is structured for those who are interested in using or extending it. I am probably going to move the project to GIT hub once I get it cleaned up enough. If anyone has any questions or ideas let me know. I have a lot of ideas but not enough time to implement them all.
Re: AngelScript Scripting on the MOD54415
I just gave it a try, its very cool.
Great Job!
Great Job!
Re: AngelScript Scripting on the MOD54415
It's great to hear you were able to get it running. It will be interesting to see if anyone does something interesting with this. When I get the front end completed I'm going to plug away at the Netburner API. You can easily register these functions yourself. Take a look in the folder scriptnetburner for examples of how to add functions to the script engine. I'm guessing that most anyone that uses one of these devices will be able to benefit from the ability to dynamically update code. Even if you don't use AngelScript in a final product it makes it easier to test things out without needing to flash the device over and over again. Since AngelScript is pretty much C/C++, your code can easily be copied back into the compiled application if needed.
There are many different ways to make use of the scripting ability as well. In the demo I have called a function One_Hz repetitively. You could just call a single function much like Init() is called in the demo to configure some registers or something like that. A bunch of scripts that you commonly use would then be stored on the SD card and then loaded as needed.
Since you call script functions by name you can also create a scripted state machine very easily (I have done this with AngelScript in the past). For example if you are in state 1 you call the function State1, if you are in state 2 you call the function State2. The state is an integer that can be incremented in either your script or application code. The string for the function name is then just a concatenation of "State" and the number of the current state. This is great for machines that perform testing. Each state basically configures the parameters for the test.
You could also use the script to dynamically generate web page content by calling a script function from the Netburner specific tags <!--FUNCTIONCALL Foo -->. This would be pretty much be equivalent to server side scripting used in modern web servers (PHP, ASP...etc). There is also no limit to the file types you could edit either. For example if you are loading your html files from the SD card then you edit them as well................ etc.
This is just a small set of ideas. You can also register variables and classes as well. You could create variables that the script modifies which make changes to the compiled variable directly. There is a variable named value in the demo to show how something like this might be done.
Best of all, you can do all of the editing from your shiny new tablet..........while on a beach in Mexico.
Cheers,
Tony
There are many different ways to make use of the scripting ability as well. In the demo I have called a function One_Hz repetitively. You could just call a single function much like Init() is called in the demo to configure some registers or something like that. A bunch of scripts that you commonly use would then be stored on the SD card and then loaded as needed.
Since you call script functions by name you can also create a scripted state machine very easily (I have done this with AngelScript in the past). For example if you are in state 1 you call the function State1, if you are in state 2 you call the function State2. The state is an integer that can be incremented in either your script or application code. The string for the function name is then just a concatenation of "State" and the number of the current state. This is great for machines that perform testing. Each state basically configures the parameters for the test.
You could also use the script to dynamically generate web page content by calling a script function from the Netburner specific tags <!--FUNCTIONCALL Foo -->. This would be pretty much be equivalent to server side scripting used in modern web servers (PHP, ASP...etc). There is also no limit to the file types you could edit either. For example if you are loading your html files from the SD card then you edit them as well................ etc.
This is just a small set of ideas. You can also register variables and classes as well. You could create variables that the script modifies which make changes to the compiled variable directly. There is a variable named value in the demo to show how something like this might be done.
Best of all, you can do all of the editing from your shiny new tablet..........while on a beach in Mexico.
Cheers,
Tony