Processor Expert seems not to call Clock Init function in KDS(KSDK)

キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Processor Expert seems not to call Clock Init function in KDS(KSDK)

ソリューションへジャンプ
721件の閲覧回数
MAPC
Senior Contributor I

Hello,

 

I noticed that Processor Expert doesn't generate a call to Clock System Initialization function inside "hardware_init" function. So, my question is, where is this called? Or it is not called anywhere and I must drag and drop into my code (what wouldn't make any sense to me, since it should be a Processor Expert role)?

 

When I place the mouse over "HW Initialization", KDS tells me the initialization of clock system is automatic and is performed via CMSIS startup, but where is this startup file, where is the call for a Clock Initialization function?

 

117174_117174.pngpastedImage_0.png

 

"hardware_init" and "PEX_components_init" functions are in grey, although "CPU_HARDWARE_INIT" and "PEX_COMPONENTS_INIT" macros are enabled:

 

117175_117175.pngpastedImage_1.png

The same ocurrs for "Components_Init" function, which doesn't have anything inside it:

 

117182_117182.pngpastedImage_2.png

 

#if CPU_COMPONENTS_INIT

void Components_Init(void)

{

 

 

}

 

As you can see bellow, "hardware_init" function doesn't call any Clock System Initialization function, what should be the expected.

 

void hardware_init(void) {

 

 

  /* Enable clock for PORTs */

  SIM_HAL_EnableClock(SIM,kSimClockGatePortA);

 

 

  /* Setup board clock source. */

  g_xtal0ClkFreq = 8000000U;            /* Value of the external crystal or oscillator clock frequency of the system oscillator (OSC) in Hz */

  g_xtalRtcClkFreq = 32768U;            /* Value of the external 32k crystal or oscillator clock frequency of the RTC in Hz */

 

  init_jtag_pins(JTAG_IDX);

  init_osc_pins(OSC_IDX);

  init_tpiu_pins(TPIU_IDX);

}

 

My Project is using bare metal, KDS and KSDK 1.3.0. And the MCU is MK22FN256.

 

I tested with a new project with MK22FX512, and the functions, this time, are not in grey, unlike with MK222FN256. But I also can't see any reference to a Clock Initialization function. Should it be a Processor Expert bug?

 

 

Thanks,

 

Marco Coelho

Applications Engineer

Siletec Eletronica

ラベル(1)
1 解決策
309件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Marco:

From my side it does not appear grayed out. It may be that the Eclipse indexer is having issues in your case. See if the next post by Erich helps you resolve it:

Fixing the Eclipse Index | MCU on Eclipse

So, I do not always trust in the grayed or not-grayed out code. Instead open a debug session and see what code is actually executed, or visually inspect the macros to see what code is valid.

Regards!

Jorge Gonzalez

元の投稿で解決策を見る

0 件の賞賛
5 返答(返信)
309件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Marco Aurelio:

Clock initialization is made in the function SystemInit() from the file system_<device>.c. This function uses the macro definitions from the header file system_<device>.h.

System clock is initialized before reaching main. The initial configuration used is the one you select from the fsl_clock_manager component. See below an example:

K64_Clock_configs.png

In this case there are 6 clock configurations and the configuration 1 is used for the CMSIS startup code.

To dynamically change between clock configurations in your project, then you can use the Clock System APIs. See the next discussion in the community about this subject with an example project:

Change between clock configurations


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
309件の閲覧回数
MAPC
Senior Contributor I

SystemInit function is all in grey. What should I do?

pastedImage_0.png

Have attached my code.

Thanks!

Marco Coelho

Applications Engineer

Siletec Eletronica

0 件の賞賛
310件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Marco:

From my side it does not appear grayed out. It may be that the Eclipse indexer is having issues in your case. See if the next post by Erich helps you resolve it:

Fixing the Eclipse Index | MCU on Eclipse

So, I do not always trust in the grayed or not-grayed out code. Instead open a debug session and see what code is actually executed, or visually inspect the macros to see what code is valid.

Regards!

Jorge Gonzalez

0 件の賞賛
309件の閲覧回数
MAPC
Senior Contributor I

Hello, Jorge

Yes! You hit the bull's eye!

After following Erich's tutorial, the grayed out areas became white. But, as you said, that is not an issue, since the code is executed in a debug session, even when it is in gray. What really matters is if the macro above the code is enabled or not.

Thank you Jorge and Erich very much for your efective support once again.

Best regards,

Marco Coelho

Applications Engineer

Siletec Eletronica

309件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Good to know you fixed it, you are very welcome Marco!

Regards!
Jorge Gonzalez

0 件の賞賛