I am attempting to debug startup code on a bare metal MK66 application that I am porting from a MK62 working example. I am running the code on a FRDM K66F dev board. I am debugging by single stepping the code using a J-Link debugger as I do not have an IDE for the bare metal application code.
The app starts from the reset vector location, and runs without issues while it is reading flash and reading / writing sram memory. It sets up the stacks, However, once it accesses memory outside that range (embedded device registers and IO), it crashes back to address 0x202 and simply loops. Is there anything I'm missing in the CPU initialization that would cause this type of fault?
Hi Malcolm Bugler,
I suggest you run the official code for your FRDM-K66, check the startup code, then compare it with your own start up code.
The official SDK code for FRDM-K66 can be downloaded from this link:
Welcome | MCUXpresso SDK Builder
If you still have question about it, please let us know more details, eg, you can post your startup code, and the debug result.
Wish it helps you!
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Malcolm
The most common startup problems are:
- accessing a peripheral without first enabling clocks to it
- FPU accesses being used without/before enabling the FPU
- taking too long to configure or disable the watchdog (the watchdog gives you 256 clock cycles to do it after a reset) - don't try stepping code before the watchdog has been configured/disabled
- is 0x202 the address of a fault handler being called due to a bad access?
Regards
Mark
Complete Kinetis K66 solutions for professionals, training and support: http://www.utasker.com/kinetis.html
Kinetis K66:
- http://www.utasker.com/kinetis/TWR-K65F180M.html
- http://www.utasker.com/kinetis/FRDM-K66F.html
- http://www.utasker.com/kinetis/TEENSY_3.6.html