On Mon, 19 May 2014 01:30:06 +0200 Henrik Nordström <[email protected]> wrote:
> sön 2014-05-18 klockan 23:59 +0300 skrev Siarhei Siamashka: > > My question was whether you possibly know the exact SRAM memory layout > > in the FEL mode and the areas possibly reserved by BROM. If you don't > > really know, then we always have the BROM disassembly listings if > > somebody is really curious. > > This is the memory map as I know it from my A10 BROM/FEL analysis: > > https://github.com/hno/Allwinner-Info/blob/master/FEL-usb/USB-protocol.txt > (at end of document) > > I have not looked in detail what the address map looks like on A20 > however. Maybe it differs a bit? Thanks a lot. That's exactly the information I was looking for. > > I'm glad to know that there is plenty of space left there for *you*. > > But just like described in the quoted paragraph above, *I* am adding > > a lot of *new* code there. And *I* am getting very close to the > > available SRAM size limit. > > All I asked was why. > > > You can check the fel lds script yourself: > > > > https://github.com/linux-sunxi/u-boot-sunxi/blob/44b53fd3928f/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds > > It does not use the MEMORY command to describe the size limits. > > Right. Sorry about that. Should be fixed. > > > But now consider the following. The FEL SPL binary is loaded at the > > address 0x2000 (which is also the entry point), and the stack pointer > > is set to 0x5E00 on A20 right at the start. > > In u-boot-FEL or BROM? 0x5E00 is the value in the SP register at the start of the 's_init()' function. It pretty much agrees with your SRAM memory map. Maybe just a little bit off. I need to check it also on the A10 and A13 hardware and pick the lowest value. > There is no need for a separate u-boot-FEL stack. > I know I did not set up a stack for u-boot-FEL on A10/A13 at least, only > reusing the stack already set up by the boot rom. I would say that it might be a good idea to update the fel linker script to set the memory area "0x2000-0x5cff Free for program use" for the code/data/bss. Then add a special FEL entry point, which would initialize bss (have it set to zero for the strict C language purists) and move the stack pointer to "0x8000-0xbfff Free for program use". That is if anyone wants more SRAM for the FEL SPL before DRAM is initialized. Thanks for all the hints. > The FEL BOOT ROM (A10) uses 0x2000 as IRQ stack and 0x7000 as normal SVC > stack. > > > This gives us around 15872 > > bytes for everything (code, data, bss and stack). And also have a look > > here to see how much of it is already used up: > > https://www.mail-archive.com/[email protected]/msg04883.html > > If the compiled FEL SPL binary is too large, the stack is starting to > > overwrite the useful data, causing all kind of bugs. > > > > Again, the question is whether it is safe to use SRAM below 0x2000 > > and/or above 0x5E00. Maybe the stack can be relocated somewhere else? > > But regardless of where the stack is located, not using Thumb2 is > > too generous and wasteful. > > 0x2000 is the IRQ stack. > > > In any case, it has been already agreed that this patch is not > > going into the u-boot-sunxi repository. For the time being, I can > > use it in my own fork perfectly fine. So you have nothing to worry > > about :-) > > Agreed by whom? By me, Hans and Ian. The need for increasing the available SRAM space for the FEL SPL is rather exotic, unless somebody is fooling around with the DRAM controller. This does not belong to the u-boot-sunxi stable branch. -- Best regards, Siarhei Siamashka -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
