HI all,
long time no see
sorry to bother you again
I am using maaxboard yocto mickledore version https://github.com/Avnet/meta-maaxboard/tree/mickledore ,
and after enable optee, the kernel changes memory size from 2G to 3G wrongly , so if I run : du -sh, find .. such as recursive commands, it will be out of memory, the kernel will be crashed .
My Qz:
1.how to fix it in kernel for adding patches
2. if can not fix in kernel ;or how to forcefully set memory to 2G in /boot/uEnv.txt
thank you so much.
Solved! Go to Solution.
finally, I fixed the issue,please see the patches.
I want to know 1. optee how to pass optee start address to atf-imx?
2. atf-imx how to pass memory size and optee start address to u-boot. ?
currently I found u-boot read the optee start address from rom_pointer[0] (original assemly x1 registor??) . rom_pointer[0] got a wrong start adress: 0xfe000000. and use 0xfe000000 - xxxx = memory wrong size 0xbe000000(3G) . the correct size should be 0x7e000000(2G).
but I fixed to set rom_pointer[0] to 0xbe000000 but it can make uboot show memory size is correct 0x7e000000(2G) and it can load kernel ,but kernel crash!
what I Did:
but:
1.
I read the code, change changed -CFG_DDR_SIZE ?= 0xc0000000(3G) to
+CFG_DDR_SIZE ?= 0x80000000(2G)
and
2.
aft code:
-BL32_BASE ?= 0xfe000000
to
+BL32_BASE ?= 0xbe000000
it completely no uboot running. I compared with maaxboard mini, I changed almost same as maaxboard-mini, maaxboard-mini works well, maaxboard can not.
I do know where(atf ??) to set optee start address and make sure it can pass the address to uboot's
rom_pointer[0]?
can you show me the data pass flow chat ?????
Thanks
I want to know
1. optee how to pass optee start address to atf-imx?
2. atf-imx how to pass memory size and optee start address to u-boot. ?
currently I found u-boot read the optee start address from rom_pointer[0] (original assemly x1 registor??) . rom_pointer[0] got a wrong start adress: 0xfe000000. and use 0xfe000000 - xxxx = memory wrong size 0xbe000000(3G) . the correct size should be 0x7e000000(2G).
but I fix toe set rom_pointer[0] to e 0xbe000000 but it can make uboot show memory size is correct 0x7e000000(2G) and it can load kernel ,but kernel crash!
but:
I read the code, change changed -CFG_DDR_SIZE ?= 0xc0000000(3G) to
+CFG_DDR_SIZE ?= 0x80000000(2G)
and
aft code:
-BL32_BASE ?= 0xfe000000
to
+BL32_BASE ?= 0xbe000000
it completely no uboot running. I compared with maaxboard mini, I changed almost same as maaxboard-mini, maaxboard-mini works well, maaxboard can not.
I do know where(atf ??) to set optee start address and make sure it can pass the address to uboot's
rom_pointer[0]?
can you show to the data pass flow chat ?????
Thanks
I traced the arch/arm/mach-imx/imx8m/soc.c
the gd->bd->bi_dram[bank].size = optee_start - gd->bd->bi_dram[bank].start;
the optee_start value is 0xfe00000000 ,
I think is wrong, but I fix changed it to 0xbe000000.
It seems I can not boot up , crashed in uboot
I post this issue here too, and @igorpadykov too @Bio_TICFSL
https://community.nxp.com/t5/i-MX-Processors/u-boot-DDR-size/m-p/1268393/highlight/false#M173229
I am reading u-boot code careful and
1. changed ddr4_timing.c from embest compay the sumo version that working well . the old ddr4_timing.c works, that means the issue is not here. I think the issue in in uboot code somewhere!
2. I changed PHYS_SDRAM_SIZE from 0x80000000(correct code 2G) to 0xc0000000 (wrong,3G), the issues are same wrong size with bdinfo: 0xbe000000 and linux can bootup as original code
3. and then I changed to 0x40000000(wrong ,1G) the bdinfo is still 0xbe000000!!!! uboot can boot, but linux kernel can NOT bootup! that mean, uboot uses TWO places PHYS_SDRAM_SIZE ( memory value) not only from PHYS_SDRAM_SIZE!!!!! so where is another place for memory size setting????
I am debugging .... good lucky to me.
Thank you for your help
somebody posted here before, but no solution:
https://community.nxp.com/t5/i-MX-Processors/u-boot-DDR-size/m-p/1268147
I enable optee in meta-maaxboard/conf/machine/maaxboard.conf
MACHINE_FEATURES += " wifi bluetooth bcm43455"
anybody know why make this issue. I did in sumo version, no this issuebefore
correct iomem before enabling optee: correct the size =2G:40000000-bfffffff : System RAM
cat /proc/iomem
00100000-00107fff : 30900000.crypto caam-sm@100000
30050000-3005ffff : 30050000.sai sai@30050000
30200000-3020ffff : 30200000.gpio gpio@30200000
30210000-3021ffff : 30210000.gpio gpio@30210000
30220000-3022ffff : 30220000.gpio gpio@30220000
30230000-3023ffff : 30230000.gpio gpio@30230000
30240000-3024ffff : 30240000.gpio gpio@30240000
30260000-3026ffff : 30260000.tmu tmu@30260000
30280000-3028ffff : 30280000.watchdog watchdog@30280000
302c0000-302cffff : 302c0000.dma-controller dma-controller@302c0000
30330000-3033ffff : 30330000.pinctrl pinctrl@30330000
30350000-3035ffff : 30350000.efuse efuse@30350000
30380000-3038ffff : 30380000.clock-controller clock-controller@30380000
303a0000-303affff : 303a0000.gpc gpc@303a0000
30660000-3066ffff : 30660000.pwm pwm@30660000
30820000-3082ffff : 30820000.spi spi@30820000
30860000-3086ffff : 30860000.serial serial@30860000
30900000-3093ffff : 30900000.crypto crypto@30900000
30a00300-30a003ff : 30a00300.dphy dphy@30a00300
30a20000-30a2ffff : 30a20000.i2c i2c@30a20000
30a60000-30a6ffff : 30a60000.serial serial@30a60000
30aa0000-30aaffff : 30aa0000.mailbox mailbox@30aa0000
30b40000-30b4ffff : 30b40000.mmc mmc@30b40000
30b50000-30b5ffff : 30b50000.mmc mmc@30b50000
30bd0000-30bdffff : 30bd0000.dma-controller dma-controller@30bd0000
30be0000-30beffff : 30be0000.ethernet ethernet@30be0000
32e2d000-32e2dfff : 32e2d000.interrupt-controller interrupt-controller@32e2d000
33000000-33001fff : 33000000.dma-apbh dma-apbh@33000000
38000000-3803ffff : galcore register region
381f0040-381f007f : 381f0040.usb-phy usb-phy@381f0040
38200000-38207fff : usb@38200000
38200000-38207fff : xhci-hcd.3.auto usb@38200000
3820c100-3820ffff : 38200000.usb usb@38200000
382f0040-382f007f : 382f0040.usb-phy usb-phy@382f0040
38300000-38300423 : hantrodec0
38310000-38310423 : hantrodec0
38800000-3880ffff : GICD
38880000-3893ffff : GICR
3d800000-3dbfffff : 3d800000.ddr-pmu ddr-pmu@3d800000
40000000-bfffffff : System RAM
40410000-41dcffff : Kernel code
41dd0000-4210ffff : reserved
42110000-4234ffff : Kernel data
43000000-4300dfff : reserved
44000000-7fffffff : reserved
bd800000-bf9fffff : reserved
bfa58000-bfb58fff : reserved
bfb59000-bfba8fff : reserved
bfbab000-bfbacfff : reserved
bfbad000-bfbadfff : reserved
bfbae000-bfbc1fff : reserved
bfbc2000-bfffffff : reserved
--
but after enabling optee the size is 3G
cat /proc/iomem | grep System
40000000-fdffffff : System RAM
root@maaxboard:~# cat /proc/iomem
00100000-00107fff : 30900000.crypto caam-sm@100000
30050000-3005ffff : 30050000.sai sai@30050000
30200000-3020ffff : 30200000.gpio gpio@30200000
30210000-3021ffff : 30210000.gpio gpio@30210000
30220000-3022ffff : 30220000.gpio gpio@30220000
30230000-3023ffff : 30230000.gpio gpio@30230000
30240000-3024ffff : 30240000.gpio gpio@30240000
30260000-3026ffff : 30260000.tmu tmu@30260000
30280000-3028ffff : 30280000.watchdog watchdog@30280000
302c0000-302cffff : 302c0000.dma-controller dma-controller@302c0000
30330000-3033ffff : 30330000.pinctrl pinctrl@30330000
30350000-3035ffff : 30350000.efuse efuse@30350000
30380000-3038ffff : 30380000.clock-controller clock-controller@30380000
303a0000-303affff : 303a0000.gpc gpc@303a0000
30660000-3066ffff : 30660000.pwm pwm@30660000
30820000-3082ffff : 30820000.spi spi@30820000
30860000-3086ffff : 30860000.serial serial@30860000
30900000-3093ffff : 30900000.crypto crypto@30900000
30a00300-30a003ff : 30a00300.dphy dphy@30a00300
30a20000-30a2ffff : 30a20000.i2c i2c@30a20000
30a60000-30a6ffff : 30a60000.serial serial@30a60000
30aa0000-30aaffff : 30aa0000.mailbox mailbox@30aa0000
30b40000-30b4ffff : 30b40000.mmc mmc@30b40000
30b50000-30b5ffff : 30b50000.mmc mmc@30b50000
30bd0000-30bdffff : 30bd0000.dma-controller dma-controller@30bd0000
30be0000-30beffff : 30be0000.ethernet ethernet@30be0000
32e2d000-32e2dfff : 32e2d000.interrupt-controller interrupt-controller@32e2d000
33000000-33001fff : 33000000.dma-apbh dma-apbh@33000000
38000000-3803ffff : galcore register region
381f0040-381f007f : 381f0040.usb-phy usb-phy@381f0040
38200000-38207fff : usb@38200000
38200000-38207fff : xhci-hcd.3.auto usb@38200000
3820c100-3820ffff : 38200000.usb usb@38200000
382f0040-382f007f : 382f0040.usb-phy usb-phy@382f0040
38300000-38300423 : hantrodec0
38310000-38310423 : hantrodec0
38800000-3880ffff : GICD
38880000-3893ffff : GICR
3d800000-3dbfffff : 3d800000.ddr-pmu ddr-pmu@3d800000
40000000-fdffffff : System RAM
40410000-41dcffff : Kernel code
41dd0000-4210ffff : reserved
42110000-4234ffff : Kernel data
43000000-4300dfff : reserved
44000000-7fffffff : reserved
fa200000-fd7fffff : reserved
fd966000-fd966fff : reserved
fd967000-fd9b6fff : reserved
fd9b9000-fd9bafff : reserved
fd9bb000-fd9cffff : reserved
fd9d0000-fd9d0fff : reserved
fd9d1000-fdffffff : reserved
so how to fix it in device tree. eg: maaxboard.dtsi ???
in boot command line , bdinfo output: memory size is wrong: size = 0x00000000be000000 (3G) should be 2G 0x80000000 I am going to find where makes it wrong
bdinfo
boot_params = 0x0000000000000000
DRAM bank = 0x0000000000000000
-> start = 0x0000000040000000
-> size = 0x00000000be000000
flashstart = 0x0000000000000000
flashsize = 0x0000000000000000
flashoffset = 0x0000000000000000
baudrate = 115200 bps
relocaddr = 0x00000000bfef1000
reloc off = 0x000000007fcf1000
Build = 64-bit
current eth = ethernet@30be0000
ethaddr = 3a:c9:9f:b9:c6:9f
IP addr = <NULL>
fdt_blob = 0x00000000bdee5110
new_fdt = 0x00000000bdee5110
fdt_size = 0x000000000000bc80
lmb_dump_all:
memory.cnt = 0x1
memory[0] [0x40000000-0xfdffffff], 0xbe000000 bytes flags: 0
reserved.cnt = 0x2
reserved[0] [0xbcedb000-0xfdffffff], 0x41125000 bytes flags: 0
reserved[1] [0xbdee0af0-0xbfffffff], 0x0211f510 bytes flags: 0
devicetree = separate
arch_number = 0x0000000000000000
TLB addr = 0x00000000bfff0000
irq_sp = 0x00000000bdee5100
sp start = 0x00000000bdee5100
Early malloc usage: bae0 / 10000
free -h
total used free shared buff/cache available
Mem: 2.9Gi 622Mi 2.3Gi 17Mi 154Mi 2.3Gi
--
the total size should be 2G, but it shows 3G
Hello,
Yes, that mean that you have not changes the memory map of your uboot that the reason it need 3GB.
regards
any help?
I changed and checked dtb , ,imx-boot, optee, u-boot , almost I changed every thing that suggestions from the internet and chatgpt. but I can not make the memory size correct 2G. It always set to 3G.
where is the issue?
maaxboard from yocto version zues to currectly lastest version all are wrong. but maaxboard-mini is correct! I almost compareed the code. it seems the source code is wrong, but in my older sumo version ,it works well. anyway, I changed the seems wrong but, but it still can not fix it and kernel totally can not startup ! the the code from zuse is almost same as sumo, but usmo work well, the updated code NOT.
it's wired
Thank you where to change it in yocto source ? or where I can force to set 2G. why before enabling optee, it is correct in uboot for 2G, aftte enabling optee, it was change to 3G?
please give me some tips, long tile I have not touched uboot code
I posted the issue in optee too
https://github.com/OP-TEE/optee_os/issues/7388
one question:
I want to know if the update optee work well in imx8mq_evk too? only after avnet porting to maaxboard and make it wrong?
because I did it worked well porting from imx8mq_evk t to maaxboard in sumo time a few year ago.
so I want to know that how about update optee code if working well in imx8mq_evk?
Thank you so much.
see my copying info question from optee :
HI ,
I posted this issue here:
Avnet/meta-maaxboard#12
but a few years ago, I ported by myself from imx8mq_evk nxp source code to yocto sumo , at that time, avnet no yocto source code at all and the optee was older version too. the optee no this issue.
but now I need to update update kernel, I tried all version from zeus to mickledor , after enabling optee, all version have the same issue, if no optee, it is well. I think the optee function never work well in maaxboard at all.
but the maaxboard-mini in all version works well.
I compared imx-boot(mkimage) imx-atf, ...including some source code of uboot,kernel dtb tree, I can not fix the issue and it seems imx-boot(mkimage) imx-atf hve no big differences with my worked well sumo code that I made it work well.
now I am digging uboot code, it seems after enabling , the uboot in somewhere set the meomory size wrong!
any help?
I want to know if the update optee work well in imx8mq_evk too?
Thank you so much.
here is my porting tips 5 years ago in sumo yocto, at that time, the maaxboard was embedded test company in SHENGZHEN,China not in avnet and no yocto source code.
I ported, and added kernel , uboot, mkimage from embeddedtest and imx8mq_evk to yocto sumo. it worked well. but now all version in avnet ycoto never work well. it is funny the maaxboard-mini works well
after avnet taking it, the maaxboard optee never worked well from maaxboard!
https://github.com/gitgonewithwind/imx-yocto-bsp-maaxboard?tab=readme-ov-file
it look like the issue is not in optee. because maaxboard-mini in same source code works well after enabling optee.
before 6,7 years ago, I ported by myself not avnet in sumo version. it worked well, but now, from avnet's sumo version to the latest version NOT work well, uboot with bdinfo always show the size is 3G -32M!!
I asked windsurf it seems I need to generate ddr4_timing.c!!!!!!
the high probability is in UBoot code, in uboot code, I used command: in uboot
fdt addr ${fdt_addr}
fdt print /memory
the memory size is correct, that means the maaxboard.dts in uboot is correct! I think the maaxboard.dts in kernel is correct too!
I think the nxp source code never correct, so avnet is not correct too, please debug it for me!
thank you so much.
but I do not know why my ported by myself sumo source was correct. because there was not avnet yocto source code at that time. I ported from the board imx8mq_evk! directly!!!!
I think I was the first one to use optee and yocto source code at time (I directly add kernel source code and uboot code and mkimage ... in yocto), it worked! well. but I need new kernel to support new type screen.
at my old yocto code I ported by myself. it supported X11, but correct the avent does not support x11, only weston! I do not why my code supports X11 too. it's funny. I do know why I made it work long time ago, but I can not fix it now! my skills become worse after more work experience. it's interesting.
if use the following tool, how to do? it is hard to use?
mscale_ddr_tool_v3.31_setup.exe.zip
MSCALE_DDR_Tool_User_Guide.pdf