From: Thomas Chen (tchen@on-go.com)
Date: Sun Sep 15 2002 - 23:05:42 EDT
sent a few messages over the weekend regarding the memory allocation problem i ran into
i kind of figure it out, and the following is what i found out... but please
correct me if my understanding is off base somewhat...
-------------------
there are two sets of definitions
DRAM_BASE and DRAM_SIZE
and
TEXTADDR (which is the same as PHYS_OFFSET) is where the start
of the kernel load
this is where the DRAM is... and somehow i get the impression that uClinux
is EXPECTING the kernel code to be PART of the DRAM (ie TEXTADDR
has to be between DRAM_BASE and DRAM_BASE+DRAM_SIZE... in fact,
in arch/armnommu/mm/init.c, the reserve_bootmem_node code clearly
expect the code and data to be PART of the DRAM.....
so my first attempt to define DRAM BEHIND the kernel load did not work because
of the kernel DEDUCTs the text and data size AGAIN... therefore making available
memory much smaller
however, my DRAM is 0x000000 to 0x03FFFFF..... because the vecotrs
are in location 0 and also the trap handlers are HARDCODED at 0x200
(in arch/armnommu/kernel/entry_armv.S... i got burned for setting TEXTADDR
to overlap this area)... i set my TEXTADDR to 0x10000...
BUT.... the memory allocation somehow MISTAKENLY think that since
the _stext starts from 0x10000, everything from 0 to 0xFFFF is actually AVAILABLE!!!
so it tried to allocate memory from there....(not a good idea!!!)
on top of that, the first block available starts from location 0... looks like a NULL,
so when the block is returned from memory allocation, init/main.c complains that there is
NO MEMORY... (0 == NULL)
the end of the story is that in arch/armnommu/mm/init.c, instead of
reserve_bootmem_node (pgdat, __pa(&_stext), &_end - &_stext);
i changed it to
rserve_bootmem_node(pgdat, 0, &_end);
and then it works fine.....
after i get this to work, i want to look at whether uClinux can be RUN from FLASH
(therefore some of these memory space calculation may need to be adjusted)
This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/
This archive was generated by hypermail 2.1.4 : Thu Sep 19 2002 - 13:21:52 EDT