cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
redglass
Observer
Observer
2,486 Views
Registered: ‎06-10-2018

How to change the memory size with linux

Hi, All Some times, I need reduce ddr memory to 512MB for hardware cost down, and sometimes need to change to like 4GB for some products.

 

How can I change Linux code for adapt for different memory size?

 

thanks!

0 Kudos
6 Replies
sandeepg
Moderator
Moderator
2,448 Views
Registered: ‎04-24-2017

Hi @redglass,

 

If you are using petalinux then current petalinux doesn’t work when you change the memory configurations and it doesn’t update the memory node in device-tree property. Also selecting Only upper 2GB also doesn’t work we have a CR on this one as well.

 

Only way you can to modify the memory nodes in <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi or your dts nodes if you are using OSL flow as show below.

 

Below are some examples.

 

==========================
memory config device-tree:
==========================
/* 4.0GB configurations */
/ {
     memory {
           device_type = "memory";
           reg = <0x0 0x0 0x0 0x80000000>, <0x8 0x0 0x0 0x80000000>;
     };
}

/* 3.5GB configurations */
/ {
     memory {
           device_type = "memory";
           reg = <0x0 0x0 0x0 0x60000000>, <0x8 0x0 0x0 0x80000000>;
     };
}

/* 3.0GB configurations */
/ {
     memory {
           device_type = "memory";
           reg = <0x0 0x0 0x0 0x60000000>, <0x8 0x0 0x0 0x60000000>;
     };
}

/* 2.0GB configurations */ - THIS DOESN’T WORK IN CURRENT RELEASE
/ {
     memory {
           device_type = "memory";
           reg = <0x8 0x0 0x0 0x80000000>;
     };
}

 

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
thiruparan
Visitor
Visitor
2,294 Views
Registered: ‎11-09-2018

were you able to reduce the ram size used by linux...

i am trying to do the same i have 4 GB available, I want to reduce ram available for linux to 1 GB 

 

0 Kudos
jrhtech
Voyager
Voyager
1,792 Views
Registered: ‎10-04-2017

@sandeepg Is this true in 2018.3?  I have an ultra96 with freeRTOS on RPU0 and have changed the linker scripts to be the top 256M of mem.  I have Linux on APU0 and have changed the sizes of ddr in the petalinux config.

  However I keep get strange crashes frequently but not always when I load numpy in python and the R5 has been loaded via the SDK.

I will try adding a memory node to my dt tomorrow but this seems like it could cause a problem if linux is not actually restricting the memory size.

thanks

jeff

rhabraken
Observer
Observer
1,393 Views
Registered: ‎07-14-2017

Any update on this? Using petalinux 2018.3 and following the steps detailed in https://wiki.analog.com/resources/tools-software/linux-build/generic/Petalinux I come across the same problem when I change the memory size in the petalinux config menu. Changes done on the memory size don't seem to be reflected in the device tree.
0 Kudos
jrhtech
Voyager
Voyager
1,366 Views
Registered: ‎10-04-2017

After adding a node to my devicetree my memory size was correctly changed and my crashes went away.  So I. 2018.3 you must add the memory node.

 

jeff

dxsdxs
Visitor
Visitor
980 Views
Registered: ‎12-13-2018

Is it possible to have the 2 GB configuration (for using the upper DDR only) in petalinux 2019.2?

I have tried to add the section from your example to the device tree and set the the psu_ddr_1 entry in the petalinux-config memory menu, but the system won't boot.

Is this configuration supported in PL 2019.2? Do I have to set some other entries?

KR Daniel

0 Kudos