IAR makes it relatively easy to locate an initialized variable in flash. One use-case of this might be to set the Debug Lock Word (DLW) in the lock bits page to lock debug access to the device.
To locate a variable in IAR, you can use the @ sign.
uint32_t myVar @ 0x2000000;
Only 'const' variables can be located and initialized however:
uint32_t const myVar @ 0x00001000 = 0x0000AABB;
Finally, in order to keep variables that will otherwise be unused, they must be declared as '__root'. So, to clear the debug lock word purely with a global variable statement:
__root uint32_t const DLW @ (LOCKBITS_BASE + (127*4)) = 0xFFFFFFF0;
Make sure that, after flashing the device, the device is reset appropriately to engage the debug lock.
To clear the debug lock word from executing code, see the following example: https://github.com/SiliconLabs/peripheral_examples/tree/master/series1/msc/debug_lock