Init SDRAM before in startup code

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

Init SDRAM before in startup code

636 Views
peterruesch
Contributor IV

Hi,

 

I want to use external RAM as heap storage.

It needs to be initialized before the copy section.

How can I make Processor Expert generate such Code ?

Labels (1)
0 Kudos
2 Replies

333 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Peter,

Unfortunately, PEx will not do this for you. In this case you need to do this manually but you can use the help of PEx to initialize the peripheral that you will use to communicate with external memory. The required steps are the following:

1) Edit linker file

     - Go to your project folder > Project Settings > linker Files and open .ld file.

     - Create a new memory segment according to the external memory address range you will use. Please refer to the following document for information about editing linker file: Relocating Code and Data Using the KDS GCC Linker File for Kinetis

     - In linker file locate label __heap_size and set the desired size.

     - Also locate section ._user_heap_stack : and change the memory segment where it is going to be located. In this case it is the new segment you created in previous step. You can refer also to the same document Relocating Code and Data Using the KDS GCC Linker File for Kinetis

2) Initialize external interface

     - Use PEx to generate the initialization code of the peripheral you will use to communicate with external memory.

     - Copy this code in __init_hardware() function located in Cpu.c inside project folder > Generated Code

    

If you want to debug this part of the application go to menu Run > debug Configurations > select debug interface to be sued> Startup tab > and write __init_hardware in 'Set breakpoint at:' box.

I hope this helps.

Best regards,

Carlos

0 Kudos

333 Views
peterruesch
Contributor IV

thank you very much!

I will have a try!

with my project, there is no "__init_hardware()"...

Does it only get generated by special circumstances ?

0 Kudos