117x SDK examples initialise memory in main(), not in SystemInitHook()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

117x SDK examples initialise memory in main(), not in SystemInitHook()

Jump to solution
2,789 Views
eamonnheffernan
Contributor III

Is there a reason that SDK examples perform memory initialization in main(), rather than in SystemInitHook()?

My understanding is that all memory systems should be initialized in SystemInitHook, so that they are ready for the scatter-load which takes place after SystemInitHook. It seems to me that memory systems that are initialized in main() will not follow the directions of the linker script. E.g. if SDRAM is initialized in main() after the scatter-load, then an initialized constant declared in SDRAM space will not be properly initialized, or worse again, the scatter-loader will try to copy constant data from flash into an uninitialized SDRAM.

Thanks.

Eamonn

0 Kudos
Reply
1 Solution
2,772 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) Is there a reason that SDK examples perform memory initialization in main(), rather than in SystemInitHook()?
-- Firstly, the SDK demos won't initialize the SDRAM in the front part of the main() function if the stack and heap section resides in the SDRAM, the i.MX RT MCU will take advantage of DCD to initialize the SDRAM prior to executing the application code and you can learn detailed information about the DCD mechanism via referring to the RM.
Next, suppose the SDK demos don't use the SDRAM, it also doesn't initialize SP, BSS section in the main() function, the kind of work is finished in the ResetISR() prior to jumping to the main() function.
Hope this is clear.

Have a great day.
TIC

-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
5 Replies
2,754 Views
eamonnheffernan
Contributor III

1170 Reference Manual Section 10.8 External Memory Configuration Data (XMCD).

Looks like an improved type of DCD targeting external memory.


"The XMCD offers a simplified FlexSPI RAM configuration option block which can meet
the typical usage of the HyperRAM or APMemory devices.
However, the user application may need to enable the advanced features of the external
RAM which cannot be configured by the simplified configuration option. In this case, the
XMCD also offers the complete 512-bytes FlexSPI RAM configuration block which
supports flexible configuration."

0 Kudos
Reply
2,727 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply and clarification.
The XMCD is a new feature for RT11xx series MCU, like RT117x, RT116x, etc.
Until now, the MCUXpresso config tool doesn't support it.
Have a great day.
TIC

-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------

2,767 Views
eamonnheffernan
Contributor III

Thanks Jeremy.

Is DCD/XMCD the preferred way to initialize external memory (e.g. SDRAM, HyperRAM, HyperFlash)?
If the ROM bootloader does the initialization, then the memory device will be available as a destination for the scatter-loader called in ResetISR. The alternative is to use a code function in SystemInitHook.

McuXpresso 11.4.1 can create DCD blocks in the Config tool. Can it also do XMCD?

Thanks very much - Eamonn

0 Kudos
Reply
2,758 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) Is DCD/XMCD the preferred way to initialize external memory (e.g. SDRAM, HyperRAM, HyperFlash)?
-- The DCD is the recommended way to initialize the external SDRAM device and I don't think it's fit either HyperFlash or HyperRAM.
Last, I'm not clear with the meaning of XMCD, please explain it.
Have a great day.
TIC

-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------

0 Kudos
Reply
2,773 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) Is there a reason that SDK examples perform memory initialization in main(), rather than in SystemInitHook()?
-- Firstly, the SDK demos won't initialize the SDRAM in the front part of the main() function if the stack and heap section resides in the SDRAM, the i.MX RT MCU will take advantage of DCD to initialize the SDRAM prior to executing the application code and you can learn detailed information about the DCD mechanism via referring to the RM.
Next, suppose the SDK demos don't use the SDRAM, it also doesn't initialize SP, BSS section in the main() function, the kind of work is finished in the ResetISR() prior to jumping to the main() function.
Hope this is clear.

Have a great day.
TIC

-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------

0 Kudos
Reply