To add to all of this, it would be great to come up with a system that works for both 16bit and 32bit ecus. I had been talking to NSFW about realtime tuning and he had a good idea that I would like to expand on.
I think a "lookup table" similar to the SSM lookup should be put in place. Each realtime tunable table would have a specific index number (similar to ssm parameter index numbers). The lookup table would exist in ram and the first byte of the LUT would be the "individual index size" (amount of bytes per index, this would allow flexibility between 16bit and 32bit). Each index would have a byte that contains bitflags that are set/cleared to enable/disable the use of each realtime table, and then a couple bytes that point to the address at which its particular table exists in ram. Then the PC gui would determine where to place each table based on the available ram space and write the table locations to the lookup table indexes. The rom would take the table address from the lookup table based on its index (this table address would be the ram address) and then check its "index bitflag" which would determine if the RAM or ROM table is used. So realtime tuning "definitions" could be added to the ecudefs, they would simply need the lookup table start address, the available ram space for each rom, and the size of each table including x and y axis data. Then the PC software would take this definition file and use it to determine where to place tables in ram and where to write the address of each table in the lookup table. The indexes would be determined beforehand and would be the same between 32bit and 16bit, the same way SSM indexes are.
An example lookup table would look like this in a 16bit rom.
Code:
03 ;Lookup table start, this determines index size (3 bytes per index here).
00 ;First index (lets say MAF Scaling), this byte hold bit flags to determine if the realtime tuning is active for this table (and/or other things).
65 ;This byte and the next are used for the table location in RAM
00 ;So the RAM location for Maf Scaling would be 6500h, or 026500h absolute because the tables are indexed in 16bit roms
00 ;Second index (lets say base timing), this byte hold bit flags to determine if the realtime tuning is active for this table (and/or other things).
68 ;This byte and the next are used for the table location in RAM
70 ;So the RAM location for base timing would be 6870h, or 026870h absolute because the tables are indexed in 16bit roms
....
...
..
.
The bit flag byte could also contain a bit flag that determines if the system is "ready".
The rom would never have to copy tables to ram, the PC software could do this and then set the "ready bit".
Then we would just have to agree on what "index number" each table would be, some may not be used in some roms but those indexes would still exist in the rom they just wouldn't be used.
What do you guys think about this system?