Module System
I've been taking a break from AHDK.
One of the things I've wanted to devise is some kind of
module system. I've already gotten a lot figured out already, such as stable platform independent
code, and jumping to allocated code. Now, I just have to figure out how to read an ELF file...
TODO:
- Implement module system
- Revert build system
- Finish
ashpcli
Some notes:
Elf format might not be a great idea. AHDK is sort of limited on memory.
#include <stdio.h>
#include <stdint.h>
// TODO: use uint8_t
typedef int _gpio(void);
_gpio* gpio = (_gpio*)0xdeadbeef;
struct AhdkModule {
// This will never change
unsigned int version;
// Use {0, 0} as the function list
// null-terminator
struct Function {
char *name;
unsigned int addr;
}funcs[];
};
struct AhdkModule asd = {
1,
{
{"gpio", 0xa1e8},
{0, 0}
}
};
int main() {
gpio = (_gpio*)((unsigned long)asd.funcs[0].addr);
}
Could do a task system like in an rtos. Pie code that you could could inject and call like a task with ways to start/stop that particular code from running.
Could do a task system like in an rtos. Pie code that you could could inject and call like a task with ways to start/stop that particular code from running.
As far as I know, that should be possible.
Current spec: https://petabyt.dev/blog/tiny-embedded-module-system-spec
Project put on hold until I can fix my Ambarella camera, and when I'm not busy