Using EMC on LPC1788

I am using LPC1788 and have successfully written EMC code. H57V2562GTR (SDRAM 16Mx16) is interfaced with the controller. Two ICs are used in parallel to write 32Bytes (16MSB in one chip and 16LSB in other).
I have tested the code and it works fine (The read and write operations).

I know that by using __attribute__((at(address))) i can define variables at specific memory address.

Will i have to initialize the EMC before defining the variables in the external memory area?

Parents
  • Will i have to initialize the EMC before defining the variables in the external memory area?

    That question really makes no sense, because there is no such quality as "before defining the variables" --- at least none that initializing the EMC could possibly, ever have. You define variable before you run the compiler, but you only initialize the EMC at run time, which is forcibly later.

    What you have to do is initialize your memory subsystem to a workable state before your code accesses those variables in any way --- and because the first such access is likely the initialization performed by the startup code, that tends to mean you have to do that inside the startup code. The alternative is to mark those variables as "not to be initialized by start-up code" and delay the initial write until you're done initializing the memory subsystem.

Reply
  • Will i have to initialize the EMC before defining the variables in the external memory area?

    That question really makes no sense, because there is no such quality as "before defining the variables" --- at least none that initializing the EMC could possibly, ever have. You define variable before you run the compiler, but you only initialize the EMC at run time, which is forcibly later.

    What you have to do is initialize your memory subsystem to a workable state before your code accesses those variables in any way --- and because the first such access is likely the initialization performed by the startup code, that tends to mean you have to do that inside the startup code. The alternative is to mark those variables as "not to be initialized by start-up code" and delay the initial write until you're done initializing the memory subsystem.

Children
More questions in this forum