I'm currently facing the problem to create a flexible database within EEPROM memory that should not waste any space because there isn't much available. Basically, I need two tables that will be interlinked.
Table 1 / Modules, up to 4096 entries
-modType (4 Bit)
-pkgSize (8 Bit)
-current Data (1-128 Byte, usually 2-5 Byte)
Table 2 / Module Groups, should be at least 100 entries
-internal ID (min. 8 Bit)
-module adresses (min. 10x = 120 Bit)
-preset 1 (all data for all member modules - much)
-preset 2 (~)
-preset 3 (~)
EEPROM space of any AVR won't be enough, so I'll add some I2C-EEPROMS to extend memory. I'll also have to add external SRAM I guess to hold all these values during operation. Much writing to EEPROM kills it too quickly. Values are only written back on power-down.
Now my question: how would you create this database in assembler?
I thought of creating fixed-size tables which - in worst-case - waste a lot of space. I thought of creating two more tables like a FAT pointing to the start of each entry, which will soon cause fragmentation and forces me to make the FAT bigger to find all the fragments OR again have "holes" that I can't use. I thought of creating fixed-size tables with different sizes of entries, some logic should then choose the right one for each entry.
But after all, there is still no good solution that comes without adding way too much external storage and SRAM and leaving most of it empty.
For the µC, I'd use an ATmega16 unless there are good reasons to use something else.
My bus system controller (the master module) reads and writes data from/to all connected modules (up to 4096), has to store it *somewhere* and has to know what to do when for example a button is pressed. The above is maybe 1/2 to 2/3 of the total database, the part I thought of yet ;-)
I just don't want to attach a constantly-running computer with Linux/MySQL etc. because that's total overkill and unneccessary.
Any ideas? I'm stuck...