AnsweredAssumed Answered

Initial PC address for KL25 does not match?

Question asked by Antonio Quevedo on Jul 19, 2013
Latest reply on Jul 20, 2013 by Antonio Quevedo

I am using the FRDM-KL25 board as a tool for teaching basic software in an engineering course. As I am creating experiments, and executing them myself, I found something strange.


At Reset, Kinetis L processors first fetch the initial SP address at 0x00000000 position. Then, it fetchse initial PC address at 0x00000004 position. When I created a project in CodeWarrior 10.4, I used Debugger Shell to read memory contents, and found the following values (corrected for endianess):


SP: 0x20003000; PC: 0x0000085D


Strange, PC address does not seem to be aligned in a 4-byte boundary. And when I look in the assembly code, at the Disassembly window, I see startup code (label __thumb_startup) at 0x0000085C address.


Can someone explain why CodeWarrior generates a code that commands CPU to fetch one memory position after the one it should? And why the program runs OK even with this supposed error? I expect to comment that on my course.


Thanks in advance,


Antonio Quevedo