I am moving from a simple project on the KL05 Freedom board to my own target. If I start with an absolute bare bones PE project with just a "while(1)" for the main, It locks up in PE_DEBUGHALT() long before I ever get to the main routine.
What I found is that the RAM zero routine "zero_fill_bss()" in startup.c seems to be trying to write to RAM starting at the wrong address. __START_BSS[] which comes from the PE init file seems to point to the start of RAM at 0x1FFFFE00 which for this part seems wrong. The very first write to this address in zero_fill_bss() causes the DEBUGHALT.
I'm not sure I can patch the PE init file (ProcessorExpert.ld). The problem seems to be right at the top of this file in the MEMORY section under "m_data" where it defines the start of RAM and size.
The reference manual seems to imply for this 1K RAM part, the start should be at 0x1FFFFF00, and end at 0x200002FF with 1/4 - 3/4 split.
And yes, I am using the latest KDS version 1.1.0
Comments?
Dave
Hi Dave,
indeed, that memory map is wrong :-(
I have submitted tickets on this issue (PEXMCU-347 and KDS-8).
As a workaround, you can fix the linker file on your side.
Go to the Inspector for the CPU component. In the Build Options, Generate Linker file you can change the memory map:
In case you would like to do other changes to your linker file, you can completely disable the linker file generation. Details about this (and more on this subject): Disable my Code Generation | MCU on Eclipse
I hope this helps, and I appologize for that bug,
Erich
PS: as a tip, I suggest to enable Own Handler for every (see Oh my! An Interrupt… | MCU on Eclipse):
Erich,
OK, no worries. I figured out how to fix it not too long after my initial post. Thanks for the quick reply.
It would be nice to know if this is a singular issue for that only affects this particular part number or is this a larger concern.
Regards,
Dave
Hi Dave,
I believe it is an issue only with this part, it worked for me on the 32KByte FLASH (FRDM version).
Regards,
Erich
Hi Erich,
Actually, I've had this same problem on the KL02Z8 (another 8 KB part) while the 32 KB version worked just fine. The Processor Expert also sets the RAM incorrectly at 0x1FFFFE00 (size 0x500) instead of the correct 0x1FFFFF00 (size 0x400).
(In KDS, the error presents itself as a Hard Fault at __copy_rom_sections_to_ram(); in startup.c. In CodeWarrior, it happens at the DeviceDataPrv->UserDataPtr = UserDataPtr; line in the initialization of the first PE component.)
Thanks,
Simone
Hi Simone,
Ok, I will report this one too.
Thanks for reporting,
Erich