2018-01-31 11:24 PM
How can I perform unconditional jump to random address in flash? I know about goto statement but I read that its not a good way to achieve this. So how can I do it?
#nucleo-stmSolved! Go to Solution.
2018-02-01 05:49 AM
Use a function pointer, assign is a random value (of the right range) and then call that function pointer.
Something like this is routinely done by people who sell encrypted commercial software. Once the software detects tampering, it fly's off.
2018-02-01 05:31 AM
The micro-controller can transfer control to wherever, in C you can use things line function pointers (see qsort)
The more important question is WHAT are you trying to achieve or solve by doing this? Perhaps there is a better approach.
2018-02-01 05:49 AM
Use a function pointer, assign is a random value (of the right range) and then call that function pointer.
Something like this is routinely done by people who sell encrypted commercial software. Once the software detects tampering, it fly's off.
2018-02-04 11:57 PM
Hi CliveOne,
Actually I am trying to perform IAP(in application programming) to achieve OTA via Wifi. So I have decided to map memory and after programming jump to new code memory, for this I was thinking of implementing a check to know where to jump, hence was thinking how do I perform unconditional jump..
2018-02-05 04:19 AM
'
how do I perform unconditional jump.. '
that's different from performing a random jump.
take a look at the start-up file as it may give you a hint - it is fairly easy.
2018-02-05 07:05 AM
Typically with IAP the secondary app image contains a full vector table so you have access to interrupts, etc. Normally one enters through the Reset_Handler, as jumping to main() directly causes issue with the statics not being correctly initialized.