In MQX 3.8.1 the file mqx/source/bsp/twrk60f120m/cw/intflash.lcf incorrectly places the flash configuration data at 0x410 instead of 0x400. The actual configuration field ends up being filled with zeros, which results in a secured CPU (debug is disabled). CodeWarrior's flash programmer hides the issue by making sure the flash configuration is valid. Using other firmware loader tools or methods (e.g. over-the-air programming), which program the image verbatim, will be affected by the bug and may end up with undesirable security settings.
The fix is trivial, see the diff output below:
@@ -1,7 +1,7 @@
- vectorrom (RX): ORIGIN = 0x00000000, LENGTH = 0x00000410
- cfmprotrom (RX): ORIGIN = 0x00000410, LENGTH = 0x00000010
+ vectorrom (RX): ORIGIN = 0x00000000, LENGTH = 0x00000400
+ cfmprotrom (R): ORIGIN = 0x00000400, LENGTH = 0x00000020
rom (RX): ORIGIN = 0x00000420, LENGTH = 0x0007FBE0 # Code + Const data
ram (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00020000 # SRAM - RW data
Hello Andras Lipoth,
thank you for reporting the bug. I can confirm this is valid for twrk60f120. Vector table size should really be 0x400 and flash configuration data located at 0x400.
We will fix this linker command file :smileywink: