NefMoto

Technical => Tuning => Topic started by: elRey on March 19, 2011, 04:56:30 PM



Title: Where are the SY_* values stored?
Post by: elRey on March 19, 2011, 04:56:30 PM
Where are the SY_* values stored?

SY_NWS
SY_TURBO

etc.


Thanks,
Rey


Title: Re: Where are the SY_* values stored?
Post by: Rick on March 21, 2011, 05:03:42 AM
Are you talking about the system constants?  If so I don't think they are stored in the ecu.  They are selected at compile stage, and then the hex is generated to suit.  If only we had the source code!

Rick


Title: Re: Where are the SY_* values stored?
Post by: Tony@NefMoto on March 21, 2011, 10:47:17 AM
One really tricky thing about modifying tuned ECUs, is all of the constants are compiled into the code. If we had the source code we could change a ton of stuff.


Title: Re: Where are the SY_* values stored?
Post by: elRey on March 21, 2011, 05:26:02 PM
I don't understand. Aren't the other maps values (1D maps) also 'complied'? But we can find the byte or bytes to modify them. What's difference with the system constants? Are there not bytes in the bin that corresponds to them?


Title: Re: Where are the SY_* values stored?
Post by: Tony@NefMoto on March 21, 2011, 06:42:28 PM
Some constants defined in code compiled in and removed by the compiler. If there is a constant in the code, then the compiler will "hard code" the value into the compiled code instead of storing it at an address in memory.


Title: Re: Where are the SY_* values stored?
Post by: elRey on April 08, 2011, 09:35:17 AM
Some constants defined in code compiled in and removed by the compiler. If there is a constant in the code, then the compiler will "hard code" the value into the compiled code instead of storing it at an address in memory.

Meaning if I look at the function that compares the SYS constant to 00 I will see something like
cmp 00, 00  #each value is hard coded right there
instead of
cmp 00, some_ref_to_address
?

Thanks,
Rey


Title: Re: Where are the SY_* values stored?
Post by: ArgDub on April 08, 2011, 01:11:50 PM
No, comparing a constant with 00 makes no sense, because the result of that comparison never changes (both are constants)


Title: Re: Where are the SY_* values stored?
Post by: elRey on April 08, 2011, 01:16:53 PM
OK, then the alternative (according to Tony's comment) would be a complete function rewrite depending on the SY_* constant.

i.e.
SY_* = 0
then complile
function X is hard coded one way

else

SY_* = 1
the complie
function X is hard coded a completely different way.


Title: Re: Where are the SY_* values stored?
Post by: ArgDub on April 09, 2011, 05:26:37 AM
yes, changing a sys_constant generates a different binary.


Title: Re: Where are the SY_* values stored?
Post by: elRey on April 09, 2011, 07:45:46 AM
Because the complier recongizes that with a SY_* constant set one way, parts of the function will never be used, so it never writes those parts to the bin?


Title: Re: Where are the SY_* values stored?
Post by: Tony@NefMoto on April 11, 2011, 04:11:03 PM
The compiler is free to remove code that is unreachable. So it is entirely possible that the code you want to enable has already been removed from the binary.