Hello Bernhard,
I have found now a working configuration for my application using the LPC4357 with the mentioned external 32 MB-SDRAM ( 256 Mbits ).
I am using a scatter-loading description-file, this is recommended in case the application is more complex.
( The scatter-file will be found under "Options for Target -> Linker" in uVision, using this feature requires a full-version ).
For my application this file actualy looks like this:
( The decimal-point is only for better readability )
LR_IROM1 0x1A00.0000 0x0008.0000 {
ER_IROM1 0x1A00.0000 0x0008.0000 {
*.o (RESET, +FIRST)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 0x1000.0000 0x0000.8000 {
system_lpc43xx.o (+RW )
}
RW_IRAM2 0x2000.0000 0x0001.0000 {
startup_lpc43xx.o (+RW +ZI)
}
RW_RAM1 0x2800.0000 0x01F0.0000 {
.ANY (+RW +ZI)
}
}
The Framepointer required for LCD-output ( if used ) is located at 0x29F0.0000 using the last 1 MB of the available SDRAM.
( working well for my aplication, however the demand on RAM is not clarified ).
In general, the problem using the LPC4357 is that the SDRAM needs to be initialized before it can be used for the application.
The initialisation is done in startup_lpc43xx.s together with system_lpc43xx.c and execution must be done in internal RAM.
For applications with large demands on heap-space the internal RAM is usualy not big enough, external RAM must be used.
It is possible to assign system_lpc43xx.o and startup_lpc43xx.o to 2 different internal RAM-regions like shown in the example.
This has the advantage of having nearly 64 K of stack-space available within IRAM2 in case this is required ( like in my application ).
In most cases it should be sufficient to place both files only in 1 IRAM-region and leave the other empty.
Inside startup_lpc43xx.s I have assigned now for heap and stack:
Stack_Size EQU 0x0000.F000
Heap_Size EQU 0x0000.0400
The stack is defined here with 60 K, nearly the limit of what is possible.
The critical point now is, that all this is still not working until there will be placed a command for initialising the heap.
This command I have added to the end of system_LPC43xx.c, after the external memory-Controller will be configured:
...
/* Configure External memory Controller */
SystemInit_ExtMemCtl ();
/* Configure external heap */
_init_alloc(0x2880.1000, 0x29F0.0000); // allocation of heap inside region RW_RAM1 ( base, top ).
This range spans nearly 24 MB heap in my application but all may need to be adjusted according to the requirements.
The first 8 MB inside RW_RAM1 is reserved for program-data ( this is the range from 0x2800.0000 to 0x2880.0000 ).
It is important not to start with heap-allocation directly at the boundary ( 0x2880.0000 ), this fails for my application.
Therefore the heap starts at 0x2880.1000 ( as an example ).
Of course to make all this working it is required to have working files for system_lpc43xx.c and startup_lpc43xx.s available,
Esspecialy the timing-setup for the SDRAM in use must be in order of course.
For the 32 MB-SDRAM in use I made 1 additional change inside the configuration:
LPC_EMC->DYNAMICCONFIG0 = (0x05)<<7;
My application ( a modern chess-engine ) using nearly the 32 MB RAM available ( mainly for hash-tables ) has proved to be working very well now.
However, the recommended way to define stack and heap is using the region-model and not using "_init_alloc()".