Conversation
…the TBYB version from getting rebotted every 16 seconds
|
Thanks for the fix to write partition bytes! I've verified that the writing actually works \o/ @QuackWifHat |
| // <--- the following doesn't work at all ---> | ||
| // // Read vector table from partition 1 using NON-CACHED XIP | ||
| // uint32_t *vector_table = (uint32_t *)0x1C042000; | ||
| uint32_t target_offset = 0x42000; |
There was a problem hiding this comment.
@QuackWifHat This is a static memory offset to the partition 1 starting address? So assuming we change the partition table, it would no longer work?
There was a problem hiding this comment.
See comment below, we can also extract this using a combination of rom_get_partition_table_info and rom_get_b_partition calls.
There was a problem hiding this comment.
Yes that is correct, it would stop working if we change the partition table. It would be better to move this to a more dynamic call, like rom_get_partition_table_info, I will try allocating some cycles to get on this soon.
|
We could also potentially extract the b_partition address offset dynamically: Not an issue if we never commit to a newer version with explicity_buy, but might become an issue when we do. |
build and flashing sequence:
Load the partition table
First build the 'main' version of the code that will call reboot into the second partition
Then build the new version of the code that will have Try-Before-You-Buy (TBYB) flag set
Now you can reboot which will start the code executing in partition 0 for ~6s (with led turned on constantly)
At the end of ~6s it will call rom_reboot into partition 1 (with led blinking) for around 17s (watchdog timer). Since we never call explicit_buy, this software watchdog timer will reboot us back into partition 0!