External Links

Creative Science Centre

 

Plugin2

Plug in C functions are designed to add non-existent functionality to ByPic or to speed up some functionality. The most flexible way of doing this is to use plugin1 which is just a constant containing numbers that can be added anywhere into a program.

Plugin1 has some limitations such as it can only contain one function and must not call subroutines. Another more serious limitation is that it can only work with integers as any casting '(int)float' does actually call a system functions, or several.

To work round this limitation, plugin2 is available, however this is much more strict in the install as it needs to be compiled and loaded to an exact location. Also it may take up much more space.

Procedure

Plugin2 zip file

1) Use the template to create a C program, this is written using the MPLAB X IDE and XC32 compiler, both are free up to a point.

2) On the device it is intended for use sys to get the User Start address

In this example it is 9d026764

TIP: use flclear(0) first so that the plug in you compile will always be in the same place, at the very start of the user space.

3) Adjust the address to the next 1k (0x100) boundary e.g. 9d026800. If it is already on a boundary leave it there.

4) Add 0x24 e.g. 9d026824 this is the compile address

5) Back in MPLAB X alter the linker file to compile at this address

Line 107

6) Compile the program, there may be errors but it must compile successfully.

7) Edit the create.cmd file (Linux users my do this differently). The command file needs to contain your main function and this compile address e.g.

python plugin1.py dis.txt p_test

The main function here is called p_test, as you can see it calls a python program to do the work.

8) The file created in this case will be called p_test.bas. This is just a single constant which is the machine code for the compiled C.

9) download and save this file in the usual way (F4, flsave(""))

10) To run the plugin, the offset is needed, this is indicated at the top of the p_test.bas file something like:

call(?p_test(0)+688,?tester(0)))

Where 688 is the offset to the p_test function in bytes.