This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/PROCESSOR-SDK-AM335X: DDR size reduction

Part Number: PROCESSOR-SDK-AM335X

Tool/software: Linux

Hello,

I am experimentiing with beaglebone black rev #c,

with the default configuration it everything works fine, but I want to reduce the DRAM size from 512Mib to 64Mib,

Please provide any patch or steps to change the configurations of the DRAM in u-boot and kernel to resuce the size of DRAM(64Mib)

thanks,

Amit

  • What Linux version are you using?
  • I am using u-boot V(2017.01) and Linux - kernel V4.9 with yocto environment on ubuntu 16.04 LTS
  • Hi Amit,

    u-boot 2017.01 is implementing DRAM size auto-detection procedure. u-boot 2017.01 will autodetect the actual RAM size you have on board, there is no single parameter to change from 512MiB to 64MiB. In older versions of u-boot we have this single parameter called PHYS_DRAM_1_SIZE.

    For more info regarding u-boot DRAM size auto-detection, refer to the below e2e threads:

    e2e.ti.com/.../1837559
    e2e.ti.com/.../1857605
    e2e.ti.com/.../1866822

    Regards,
    Pavel

  • You can try to change the DRAM max size parameter. AM335x EMIF support up to 1GB DRAM, you can try to change that to 64MiB

    u-boot-2017.01/include/configs/ti_am335x_common.h

    #define CONFIG_MAX_RAM_BANK_SIZE (1024 << 20) /* 1GB */
  • Hello,

    I have done some experiment and able to limit the RAM size to 256MB out of 512MB on beaglebone, and when I see the /proc/meminfo

    I can see It for 256MB,

    BUT when I configured it to 64MB, Kernel is not loading. it is working fine with memory limit 256M but not working with 128M or 64M memory limit,

    do I need to change other parameter in u-boot or kernel ?

    currently I am just changing macro " CONFIG_ENV_SIZE" for 256
    i.g (CONFIG_ENV_SIZE (256<< 10)) and everything works on 256MB

    but this setting not working for 128M or 64M i.g (CONFIG_ENV_SIZE (64<< 10)), Kernel image in not loading.

    thanks,
    Amit
  • Amit,

    Amit Gondaliya said:
    BUT when I configured it to 64MB, Kernel is not loading. it is working fine with memory limit 256M but not working with 128M or 64M memory limit,

    do I need to change other parameter in u-boot or kernel ?

    Please provide full console boot up log for analysis.

    Regards,
    Pavel

  • Hello,

    Please findthe below console log,

    ==================================================
    U-Boot 2017.01 (Mar 07 2018 - 18:03:23 +0530)

    CPU : AM335X-GP rev 2.1
    I2C: ready
    DRAM: 128 MiB
    MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
    ** First descriptor is NOT a primary desc on 1:1 **
    <ethaddr> not set. Validating first E-fuse MAC
    Net: Could not get PHY for cpsw: addr 0
    cpsw, usb_ether
    Press SPACE To abort autoboot in 2 seconds
    switch to partitions #0, OK
    mmc0 is current device
    micro SD card found
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    reading uEnv.txt
    ** Unable to read file uEnv.txt **
    4051160 bytes read in 282 ms (13.7 MiB/s)
    34304 bytes read in 26 ms (1.3 MiB/s)
    Booting from mmc...
    ## Booting kernel from Legacy Image at 82000000 ...
    Image Name: Linux-4.9.0
    Created: 2018-03-06 13:43:23 UTC
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 4051096 Bytes = 3.9 MiB
    Load Address: 80008000
    Entry Point: 80008000
    Verifying Checksum ... OK
    ## Flattened Device Tree blob at 88000000
    Booting using the fdt blob at 0x88000000
    Loading Kernel Image ... OK
    Loading Device Tree to 8fff4000, end 8ffff5ff ... OK

    Starting kernel ...
    ===============================================

    Kernel image is not loading after this pring just it hangs on Starting kernel.. and again board get reboot.

    thanks
    Amit

  • Hello,

    I chaged (CONFIG_MAX_RAM_BANK_SIZE  (128 << 20)) for 128 MiB and for  64MiB (CONFIG_MAX_RAM_BANK_SIZE  (64 << 20)) but I stucked with same above log and kernel is not loading.

    I have identify  "DEFAULT_LINUX_BOOT_ENV" macro which contains Kernel and Device tree load addresses in "include/configs/ti_armv7_common.h" file. Can you suggest that do I need to change this addresses or it should be taken care by u-boot it self?

    Regards,

    Amit

  • Amit Gondaliya said:
    currently I am just changing macro " CONFIG_ENV_SIZE" for 256
    i.g (CONFIG_ENV_SIZE (256<< 10)) and everything works on 256MB

    but this setting not working for 128M or 64M i.g (CONFIG_ENV_SIZE (64<< 10)), Kernel image in not loading.

    This CONFIG_ENV_SIZE macro defines the u-boot environment data size, I do NOT see how this is related to DRAM size. By default AM335x EVM setup this macro to 128KiB (not 128MiB):

    u-boot-2017.01/include/configs/am335x_evm.h

    /* Always 128 KiB env size */
    #define CONFIG_ENV_SIZE            (128 << 10)

    #elif defined(CONFIG_EMMC_BOOT)

    #define CONFIG_ENV_OFFSET        0x0
    #define CONFIG_ENV_OFFSET_REDUND    (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)

  • When you have 256MiB DRAM, you have these addresses available: 0x80000000 to 0x8FFFFFFF

    When you have 128MiB DRAM, you have these addresses available: 0x80000000 to 0x87FFFFFF

    Amit Gondaliya said:
    ## Flattened Device Tree blob at 88000000
    Booting using the fdt blob at 0x88000000
    Loading Kernel Image ... OK
    Loading Device Tree to 8fff4000, end 8ffff5ff ... OK

    These addresses (0x88000000, 0x8FFF4000, 0x8FFFF5FF) looks out of 128MiB DRAM range. You can try to adjust DTB load address for 128MiB DRAM map. Check below e2e threads for more info:

    Regards,
    Pavel

  • Hello

    I  have changed the setting for address as below for 64MiB DRAM.

    "loadaddr=0x82000000\0" \
    "kernel_addr_r=0x82000000\0" \
    "fdtaddr=0x8007ffff\0" \
    "fdt_addr_r=0x8007ffff\0" \
    "rdaddr=0x88080000\0" \
    "ramdisk_addr_r=0x88080000\0" \
    "scriptaddr=0x80000000\0" \
    "pxefile_addr_r=0x80100000\0" \
    "bootm_size=0x10000000\0" \
    "boot_fdt=try\0"

    BUT it gives me below error where, I am miss calculating, would please you suggest me?

    ====================================================
    ** Unable to read file uEnv.txt **
    4051160 bytes read in 282 ms (13.7 MiB/s)
    data abort
    pc : [<83f6d40c>] lr : [<83f53891>]
    reloc pc : [<8081b40c>] lr : [<80801891>]
    sp : 81f31630 ip : 00000000 fp : 00000fb8
    r10: 00000200 r9 : 81f31ed8 r8 : 00000200
    r7 : 8007ffff r6 : 00000020 r5 : 00008600 r4 : 48060100
    r3 : 800801ff r2 : edfe0dd0 r1 : 00200000 r0 : 00000000
    Flags: Nzcv IRQs off FIQs on Mode SVC_32
    Resetting CPU ...
    ======================================================
    regards,
    Amit

  • Amit Gondaliya said:
    I  have changed the setting for address as below for 64MiB DRAM.

    Amit Gondaliya said:
    "rdaddr=0x88080000\0" \
    "ramdisk_addr_r=0x88080000\0" \

    64MiB DRAM range is 0x80000000 to 0x83FFFFFF

    Regards,
    Pavel

  • Hello,

    I have make the beloe changes, but it wont work, do I need to take all the address into range of 0x80000000 to 0x83FFFFFF? including scriptaddr, pexfile_addr_r?

    "loadaddr=0x82000000\0" \
    "kernel_addr_r=0x82000000\0" \
    "fdtaddr=0x82FF5FFF\0" \
    "fdt_addr_r=0x82FF5FFF\0" \
    "rdaddr=0x88080000\0" \
    "ramdisk_addr_r=0x88080000\0" \
    "scriptaddr=0x80000000\0" \
    "pxefile_addr_r=0x80100000\0" \
    "bootm_size=0x10000000\0" \
    "boot_fdt=try\0"
  • Amit Gondaliya said:
    "rdaddr=0x88080000\0" \
    "ramdisk_addr_r=0x88080000\0" \

    These are out of 64MiB range

  • Hello,

    I have changed address range, as below for 128MiB of memory as below,

    #define DEFAULT_LINUX_BOOT_ENV \
        "loadaddr=0x82000000\0" \
        "kernel_addr_r=0x82000000\0" \
        "fdtaddr=0x86000000\0" \
        "fdt_addr_r=0x86000000\0" \
        "rdaddr=0x87000000\0" \
        "ramdisk_addr_r=0x87000000\0" \
        "scriptaddr=0x80000000\0" \
        "pxefile_addr_r=0x80100000\0" \
        "bootm_size=0x10000000\0" \
        "boot_fdt=try\0"

    but still I am not able to load the kernel Image It stuck at the log "Starting Kernel"

    current there are just two changes.

    1. New address all are below 0x87FFFFFFas mentioned above

    2. MACRO, #define CONFIG_MAX_RAM_BANK_SIZE    (128 << 20)

    do I need to change anything else?, would you suggest any further modification in address?

    below are the console logs.

    ==============================================

    ## Booting kernel from Legacy Image at 82000000 ...
       Image Name:   Linux-4.9.0-ossdn-oasis
       Created:      2018-03-09   6:53:37 UTC
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    4051096 Bytes = 3.9 MiB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... OK
    ## Flattened Device Tree blob at 86000000
       Booting using the fdt blob at 0x86000000
       Loading Kernel Image ... OK
       Loading Device Tree to 8fff4000, end 8ffff5ff ... OK
    =============================================

    Regards,

    Amit

  • Amit,

    Amit Gondaliya said:

    I have changed address range, as below for 128MiB of memory as below,

    #define DEFAULT_LINUX_BOOT_ENV \
        "loadaddr=0x82000000\0" \
        "kernel_addr_r=0x82000000\0" \
        "fdtaddr=0x86000000\0" \
        "fdt_addr_r=0x86000000\0" \
        "rdaddr=0x87000000\0" \
        "ramdisk_addr_r=0x87000000\0" \
        "scriptaddr=0x80000000\0" \
        "pxefile_addr_r=0x80100000\0" \
        "bootm_size=0x10000000\0" \
        "boot_fdt=try\0"

    Are you able to boot your board with these settings and 256MiB DRAM?

    Amit Gondaliya said:
    do I need to change anything else?, would you suggest any further modification in address?

    Try also the below DTS files update:

    u-boot/arch/arm/dts/am335x-bone-common.dtsi

    memory {
            device_type = "memory";
           - reg = <0x80000000 0x10000000>; /* 256 MB */

           + reg = <0x80000000 0x08000000>; /* 128 MB */
        };

    linux-kernel/arch/arm/boot/dts/am335x-bone-common.dtsi

    memory@80000000 {
            device_type = "memory";
            - reg = <0x80000000 0x10000000>; /* 256 MB */

            + reg = <0x80000000 0x08000000>; /* 128 MB */      
        };

    Regards,
    Pavel

  • Note also that AM335x Draco board comes with 128MiB DRAM memory. You can explore how this board in setup in u-boot.

    lists.denx.de/.../216785.html

    u-boot/ board/siemens/draco/
    u-boot/include/configs/draco.h
    u-boot/include/configs/siemens-am33x-common.h
    u-boot/arch/arm/dts/am335x-draco.dtsi

    Regards,
    Pavel
  • Hello,

    suggested changes work fine for 256MiB DRAM,

    for 128MiB DRAM i have introduced environment variable fdt_high = 0x86000000 (same as fdt_addr_r) and it works,

    and yes I did all the above setting previously, just I have not introduced "fdt_high" environment variable.

    regards,
    Amit
  • Amit,

    Thanks for sharing the solution.

    Just for additional info, we have fdt_high explained in the below e2e thread:

    e2e.ti.com/.../1883545

    Regards,
    Pavel