
Hi Chris,
in message OF5B21F0A5.A3EF40B7-ON85256E13.0056838C@nanometrics.ca you wrote:
Your problem with dram_size() may be that it tests memory beyond the maxsize given.
No. His max value as defined in the board config file was 64 MB, with an actual 16 MB of RAM. Accesses at 64 MB and 32 MB (= non-existend addresses) worked, but when accessing existing RAM at 16 MB he crashed.
The reason it usually works is that most boards make the AM (address mask) in the OR (option register) of the memory controller specify more memory than they actually need.
Let's put this right: the board config file is required to define SDRAM_MAX_SIZE greater than or equal to the maximum RAM size of the system.
This may be the easy way to fix it, however I would say the correct way would be to change the lines
This is not how the memory sizing algorithm is intended to work.
Unfortunately it appears in many board specific versions.
Not much longer. I will clean this up within the next few hours (or days).
While I'm at it, the entire function should be moved to a file in the common directory and the function definition changed to long int dram_size (long int *base, long int maxsize)
That's what I'll do.
Best regards,
Wolfgang Denk