Hi Magnus Lundell,
I think you modify the wrong address, because from your defination:
const KINETIS_FLASH_CONFIGURATION __attribute__((section(".f_config"))) __flash_config
= {
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,
| 0xff,0xff,0xff,0xff, |
| 0xff, |
| 0xff, |
| 0b11110011, //disable nmi and reset |
| 0b11111110 //unsecure |
};
Do you mean your .f_config is from 0x400? then your 0b11110011, //disable nmi and reset actually is 0X40E, not 0x40D, please take care!
I create a barebone KDS project, I can modify the 0X40D successfully!

The attachment is my test project, you can refer to it!
After you modify it, you can generate a .hex file to check your 0X40D, whether you have modified it successfully!
Wish it helps you!
If you still have question, please contact me!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------