Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - LDmicro interpreter memory gaps

(you are viewing a thread; or go back to list of threads)

LDmicro interpreter memory gaps (by Sven Schlender)
Hi,

I plan to embedded ldmicro code into my Netzer project. This a tiny ethernet gateway platform based on PIC18.
The ldmicro code shall be deployed via the web interface. For security reasons only the interpretable version shall be uploadable - no native hex code.

I have taken a glance at the ldmicro code and the interpreter formats. To my suprprise I have found some spaces in the memory layout. And the gapped regions are used in the bytecode. After a closer look to the ldmicro code I have found variables which are starting with '$' (private members?) like $mcr which lead to the memory spaces.

Is it possible to build the interpreter without knowledge about this private variables (especially for memory allocations)? Or, if I find some anonymous variables in bytecode shall I simply allocate space for such variables?

And also unclear to me is if such private variables (i.e. master clear) should also be controlled by external signals.

Thanks for any hints or suggestions!

Best regards,

Sven
Wed Jan 4 2012, 10:52:13
(no subject) (by Jonathan Westhues)
The symbols beginning with $ are indeed internal variables. They're used by the compiler to represent certain internal results; for example, $mcr is the state of the master control relay.

Your interpreter must reserve space for them, as it would for any user variable. Aside from that, you can ignore them, and the generated code will set and use them with no external intervention.
Wed Jan 4 2012, 12:17:27
Bug found... (by Sven Schlender)
Hi Jonathan,

thanks for your reply. I am currently working on a python module which reads in the interpreter code. If anybody is interested in I can post the results here.

While implementing I have found a bug in the sample interpreter code (ldinterpret.cpp). The first opcodes have wrong number defines. They starting with 0 but should start with 1.

Best regards,

Sven
Tue Jan 10 2012, 07:21:15
(no subject) (by Jonathan Westhues)
Can you clarify the bug? The only file that I distribute is ldinterpret.c, not .cpp, and the opcodes there are defined in the included file intcode.h. That's the same file used by the compiler, so it should be correct by definition.
Tue Jan 10 2012, 12:35:25
an own bug... (by Sven Schlender)
Yeah, cool. Must be some code I have written by myself some months before. :( Please don't mind!
Tue Jan 10 2012, 16:31:14
(no subject) (by Jonathan Westhues)
Excellent. Let me know if you have any other questions.
Wed Jan 11 2012, 00:56:28
(no subject) (by Sven Schlender)
See attached the promised python module for reading in interpretable byte code from LDmicro projects.

Simple unpack and run setup.py install. At least Python 2.6 is required.

Any suggestions and improvements are very welcome!
Wed Jan 11 2012, 14:02:44, download attachment ldparser-0.1.zip
is there a working interpreter in python ? (by Zbigniew Zasieczny)
Sven, did you get the interpreter written in python to work or do you have some examples how to use your parser to execute the bytecode in python ? Thanks for your effort!
Mon Aug 13 2012, 08:06:33
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):