dacharyzoo
Member
Since programming the Teensy is only possible via USB (as I understand it) I would like to create a side loader for loading compiled WS2812 patterns via bluetooth (or any wireless) serial. I envision it as such:
1. Load the side loader onto the Teensy via USB
2. Write a C function that draws the LED array and compile it with a special compiler
3. Compile the C function to machine code and send to the side loader on the Teensy via serial
With this, a simple $10 Bluetooth Serial module would give countless LED projects wireless reprogramming.
The C function "pattern" might take three arguments:
1. The LED byte array to modify
2. The length of the LED byte array
3. An integer parameter incremented by one before every call (to provide state if the LED byte array itself is not the state)
The side loader might look like this:
1. A timer interrupt that checks the serial link for a new pattern (perhaps a "start sideload" command followed by length of data to read from serial.) The data read from serial overwrites the previous pattern in memory and/or flash.
2. A loop that calls the pattern drawing function repeatedly
The pattern compiler might look like this:
1. Take a C code file with pattern function (but no main()) and compile it to machine code
2. Write the machine code over the serial link to the Teensy
The part I don't quite understand is compiling a function to machine code, copying it over the serial link, and invoking it on the Teensy. I believe it's possible as it's not unlike a simplified boot loader or even a computer virus.
Can anybody point me in the right direction?
1. Load the side loader onto the Teensy via USB
2. Write a C function that draws the LED array and compile it with a special compiler
3. Compile the C function to machine code and send to the side loader on the Teensy via serial
With this, a simple $10 Bluetooth Serial module would give countless LED projects wireless reprogramming.
The C function "pattern" might take three arguments:
1. The LED byte array to modify
2. The length of the LED byte array
3. An integer parameter incremented by one before every call (to provide state if the LED byte array itself is not the state)
The side loader might look like this:
1. A timer interrupt that checks the serial link for a new pattern (perhaps a "start sideload" command followed by length of data to read from serial.) The data read from serial overwrites the previous pattern in memory and/or flash.
2. A loop that calls the pattern drawing function repeatedly
The pattern compiler might look like this:
1. Take a C code file with pattern function (but no main()) and compile it to machine code
2. Write the machine code over the serial link to the Teensy
The part I don't quite understand is compiling a function to machine code, copying it over the serial link, and invoking it on the Teensy. I believe it's possible as it's not unlike a simplified boot loader or even a computer virus.
Can anybody point me in the right direction?