I'm trying to control (bit-bang) a pin (port A, pin 25, make it GPIO, make it output, make it HIGH) on a K61 device in the earliest stages of processor boot.
I am using MQX for an OS, building in IAR (all fully updated)
The right place for the code appears to be in bsp_cm.c, at the top of __pe_initialize_hardware().
However, when I try to add ANY code to that function - code to perform my bit-banging - although I can get it to build and download, I cannot get the code to run very far. Using "Run to main" simply never stops at main. Clicking the "red hand" causes the IDE to basically crash.
Setting a (earlier) breakpoint at (or performing a "Run to") the top of __pe_initialize_hardware "works" - I mean it runs to and stops there successfully - but at that point I cannot perform a go or stepover or stepinto (it gets lost just like before) . In addition, the assembly code looks like total gibberish - nothing like it looks when I don't add my bit-banging code.
Here's the one line of code I can add that causes it to crash.
PORTA_PCR25 = PORT_PCR_MUX(0x01);