Hi All,
Please see the one-file program below. What would make this not even get to
the line of the function call?
Execution gets through when the code is moved out of the function into main().
It is very odd.
I have IAR ver. 6.60.1.5104.
In addition to upgrading to the latest EWARM, and the latest pod firmware (v4):
In Project - Options:
- General Options - Target, I set the Device to "TexasInstruments am3359";
and the Core was automatically set to Cortex-A8.
- Debugger - Setup: I changed the Driver to "I-jet/JTAGjet".
- Debugger - Plugins: deselect "Code Coverage".
- Debugger - Use macro file: Disable_WDT.mac (see the .zip).
I can't run from main() to just before the function call to
GPIO0ModuleClkConfig(); it never gets there and I have to stop it manually.
It works when the GPIO0ModuleClkConfig() code is moved into main.
A difference is that there is this PUSH {R7, LR} instruction before the
function call that doesn't seem to be there when the code is simply in
main(), that can be seen when debugging.
This is almost the same one-file program that I was asking about previously,
in which it wasn't getting through the last "while" wait. The answer to that
was that I was not even debugging, but simulating, and the above changes
got me debugging, with the help of IAR tech support. IAR is stumped on
this problem, however. It gets to the function call in simulation, so there
must be something about debugging on a new board. Any ideas? I think
I have enough stack; it's only trying to push two registers before the
function call.
----------------------------------------------------
#define HWREG(x) (*((volatile unsigned int*)(x)))
#define PRCM_REGS (0x44E00000)
#define SOC_CM_WKUP_REGS (PRCM_REGS + 0x400)
#define CM_WKUP_CLKSTCTRL (0x0)
#define CM_WKUP_GPIO0_CLKCTRL (0x8) /* For GPIO0 */
/* CLKSTCTRL */
#define CM_WKUP_CLKSTCTRL_CLKACTIVITY_GPIO0_GDBCLK (0x00000100u) /* For GPIO0 */
/* GPIO0_CLKCTRL */
#define CM_WKUP_GPIO0_CLKCTRL_IDLEST (0x00030000u) /* For GPIO0 */
#define CM_WKUP_GPIO0_CLKCTRL_IDLEST_SHIFT (0x00000010u) /* For GPIO0 */
#define CM_WKUP_GPIO0_CLKCTRL_IDLEST_FUNC (0x0u) /* For GPIO0 */
#define CM_WKUP_GPIO0_CLKCTRL_MODULEMODE (0x00000003u)
#define CM_WKUP_GPIO0_CLKCTRL_MODULEMODE_ENABLE (0x2u) /* For GPIO0 */
#define CM_WKUP_GPIO0_CLKCTRL_OPTFCLKEN_GPIO0_GDBCLK (0x00040000u) /* For GPIO0 */
void GPIO0ModuleClkConfig(void)
//int main()
{
/* Writing to MODULEMODE field of CM_WKUP_GPIO0_CLKCTRL register. */
HWREG(SOC_CM_WKUP_REGS + CM_WKUP_GPIO0_CLKCTRL) |=
CM_WKUP_GPIO0_CLKCTRL_MODULEMODE_ENABLE;
/* Waiting for MODULEMODE field to reflect the written value. */
while(CM_WKUP_GPIO0_CLKCTRL_MODULEMODE_ENABLE !=
(HWREG(SOC_CM_WKUP_REGS + CM_WKUP_GPIO0_CLKCTRL) &
CM_WKUP_GPIO0_CLKCTRL_MODULEMODE));
/*
** Writing to OPTFCLKEN_GPIO0_GDBCLK field of CM_WKUP_GPIO0_CLKCTRL
** register.
*/
HWREG(SOC_CM_WKUP_REGS + CM_WKUP_GPIO0_CLKCTRL) |=
CM_WKUP_GPIO0_CLKCTRL_OPTFCLKEN_GPIO0_GDBCLK;
/* Waiting for OPTFCLKEN_GPIO0_GDBCLK field to reflect the written value. */
while(CM_WKUP_GPIO0_CLKCTRL_OPTFCLKEN_GPIO0_GDBCLK !=
(HWREG(SOC_CM_WKUP_REGS + CM_WKUP_GPIO0_CLKCTRL) &
CM_WKUP_GPIO0_CLKCTRL_OPTFCLKEN_GPIO0_GDBCLK));
/* Writing to IDLEST field in CM_WKUP_GPIO0_CLKCTRL register. */
while((CM_WKUP_GPIO0_CLKCTRL_IDLEST_FUNC <<
CM_WKUP_GPIO0_CLKCTRL_IDLEST_SHIFT) !=
(HWREG(SOC_CM_WKUP_REGS + CM_WKUP_GPIO0_CLKCTRL) &
CM_WKUP_GPIO0_CLKCTRL_IDLEST));
/*
** Waiting for CLKACTIVITY_GPIO0_GDBCLK field in CM_WKUP_GPIO0_CLKCTRL
** register to attain desired value.
*/
while(CM_WKUP_CLKSTCTRL_CLKACTIVITY_GPIO0_GDBCLK !=
(HWREG(SOC_CM_WKUP_REGS + CM_WKUP_CLKSTCTRL) &
CM_WKUP_CLKSTCTRL_CLKACTIVITY_GPIO0_GDBCLK));
// return 0;
}
int main() /* Establish only GPIO0ModuleClkConfig */
{
GPIO0ModuleClkConfig();
return 0;
}
----------------------------------------------------