How to reduce footprint and size of applications in Zephyr


Yie
 

Hi,

I read that Zephyr allows small footprint of a few KBs. However, the sample hello world application already takes up 8MB of memory and has a size of 3.8MB. I am not sure if I am running this right.

I would appreciate if I can get any help on this or someone to point me at the right direction.

Cheers,
Yie


Thiago Silveira
 

Hi Yie,

That definitely isn't right. In which environment are you running Zephyr, and how are you measuring this?

Try 'make rom_report' and 'make ram_report' to get a nice report of how much each function is consuming.

Best regards,
Thiago



2017-09-20 13:00 GMT-03:00 Hui Yie Teh <hteh703@...>:

Hi,

I read that Zephyr allows small footprint of a few KBs. However, the sample hello world application already takes up 8MB of memory and has a size of 3.8MB. I am not sure if I am running this right.

I would appreciate if I can get any help on this or someone to point me at the right direction.

Cheers,
Yie

_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel



Yie
 

Hi Thiago,

Thank you so much for the reply. I am running Zephyr on Linux and building the hello_world app on ARM using qemu_cortex_m3. 

I've got the numbers from the following:
  • The 8MB of memory is measured using the system monitor

    Inline images 2
  • The 3.8MB is seen by clicking properties of the folder created after building the hello_world app. I am assuming that the folder in ../outdir/BOARD will be the folder that is going to be installed on the board itself. Am I understanding this correctly? 

    Inline images 3
I'm not sure if those are the right numbers to get, sorry if this is a stupid question. 


Also, may I know what these numbers from' make ram_report' and 'make rom_report' mean? 
  • ram_report

    Inline images 8
  • rom_report
    Inline images 9
Any help would be really appreciated. Thanks!

Cheers,
Yie




On 21 September 2017 at 06:15, Thiago Silveira <thiago@...> wrote:
Hi Yie,

That definitely isn't right. In which environment are you running Zephyr, and how are you measuring this?

Try 'make rom_report' and 'make ram_report' to get a nice report of how much each function is consuming.

Best regards,
Thiago



2017-09-20 13:00 GMT-03:00 Hui Yie Teh <hteh703@...>:
Hi,

I read that Zephyr allows small footprint of a few KBs. However, the sample hello world application already takes up 8MB of memory and has a size of 3.8MB. I am not sure if I am running this right.

I would appreciate if I can get any help on this or someone to point me at the right direction.

Cheers,
Yie

_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel




Maciek Borzecki <maciek.borzecki@...>
 

On Thu, Sep 21, 2017 at 7:57 AM, Hui Yie Teh <hteh703@aucklanduni.ac.nz> wrote:

Hi Thiago,

Thank you so much for the reply. I am running Zephyr on Linux and building the hello_world app on ARM using qemu_cortex_m3.

I've got the numbers from the following:

The 8MB of memory is measured using the system monitor


The 3.8MB is seen by clicking properties of the folder created after building the hello_world app. I am assuming that the folder in ../outdir/BOARD will be the folder that is going to be installed on the board itself. Am I understanding this correctly?


I'm not sure if those are the right numbers to get, sorry if this is a stupid question.


Also, may I know what these numbers from' make ram_report' and 'make rom_report' mean?

ram_report


rom_report

Any help would be really appreciated. Thanks!

qemu-system-arm is just a VM that can emulate, among others, Cortex-M
MCUs. `qemu_cortext_m3` board is in fact emulated by qemu. Memory
usage of a running Qemu process does not directly (or otherwise
easily) translate to the memory usage in the target system.

Haven't looked at the reports for some time, but `ram_report` is
likely a listing statically allocated data that would normally be
copied into RAM during system initialization. `rom_report` likely
lists the size of each symbol (i.e. non-inlined function in the code).
So, you're more realistically looking at ~4kB of RAM and ~7kB of
flash.


Cheers,
Yie




On 21 September 2017 at 06:15, Thiago Silveira <thiago@exati.com.br> wrote:

Hi Yie,

That definitely isn't right. In which environment are you running Zephyr, and how are you measuring this?

Try 'make rom_report' and 'make ram_report' to get a nice report of how much each function is consuming.

Best regards,
Thiago



2017-09-20 13:00 GMT-03:00 Hui Yie Teh <hteh703@aucklanduni.ac.nz>:

Hi,

I read that Zephyr allows small footprint of a few KBs. However, the sample hello world application already takes up 8MB of memory and has a size of 3.8MB. I am not sure if I am running this right.

I would appreciate if I can get any help on this or someone to point me at the right direction.

Cheers,
Yie

_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel

_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel


--
Maciek Borzecki


Yie
 

I see. That makes a lot of sense. Thank you Maciek! 

I have another question, if you dont mind. 

I have an app that's taking about ~5MB of RAM and ~5.6MB of ROM judging from the 'ram_report' and 'rom_report'. Is there a way to reduce the size of those? It is much bigger because I've included other functionalities such as multi-threading and networking. Do I remove functionalities I don't need using 'make menuconfig'?

Cheers,
Yie

On 21 September 2017 at 18:28, Maciek Borzecki <maciek.borzecki@...> wrote:
On Thu, Sep 21, 2017 at 7:57 AM, Hui Yie Teh <hteh703@...> wrote:
>
> Hi Thiago,
>
> Thank you so much for the reply. I am running Zephyr on Linux and building the hello_world app on ARM using qemu_cortex_m3.
>
> I've got the numbers from the following:
>
> The 8MB of memory is measured using the system monitor
>
>
> The 3.8MB is seen by clicking properties of the folder created after building the hello_world app. I am assuming that the folder in ../outdir/BOARD will be the folder that is going to be installed on the board itself. Am I understanding this correctly?
>
>
> I'm not sure if those are the right numbers to get, sorry if this is a stupid question.
>
>
> Also, may I know what these numbers from' make ram_report' and 'make rom_report' mean?
>
> ram_report
>
>
> rom_report
>
> Any help would be really appreciated. Thanks!


qemu-system-arm is just a VM that can emulate, among others, Cortex-M
MCUs. `qemu_cortext_m3` board is in fact emulated by qemu. Memory
usage of a running Qemu process does not directly (or otherwise
easily) translate to the memory usage in the target system.

Haven't looked at the reports for some time, but `ram_report` is
likely a listing statically allocated data that would normally be
copied into RAM during system initialization. `rom_report` likely
lists the size of each symbol (i.e. non-inlined function in the code).
So, you're more realistically looking at ~4kB of RAM and ~7kB of
flash.

>
> Cheers,
> Yie
>
>
>
>
> On 21 September 2017 at 06:15, Thiago Silveira <thiago@...> wrote:
>>
>> Hi Yie,
>>
>> That definitely isn't right. In which environment are you running Zephyr, and how are you measuring this?
>>
>> Try 'make rom_report' and 'make ram_report' to get a nice report of how much each function is consuming.
>>
>> Best regards,
>> Thiago
>>
>>
>>
>> 2017-09-20 13:00 GMT-03:00 Hui Yie Teh <hteh703@...>:
>>>
>>> Hi,
>>>
>>> I read that Zephyr allows small footprint of a few KBs. However, the sample hello world application already takes up 8MB of memory and has a size of 3.8MB. I am not sure if I am running this right.
>>>
>>> I would appreciate if I can get any help on this or someone to point me at the right direction.
>>>
>>> Cheers,
>>> Yie
>>>
>>> _______________________________________________
>>> Zephyr-devel mailing list
>>> Zephyr-devel@lists.zephyrproject.org
>>> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>>>
>>
>
>
> _______________________________________________
> Zephyr-devel mailing list
> Zephyr-devel@lists.zephyrproject.org
> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>



--
Maciek Borzecki


Thiago Silveira
 

Hi Yie,

That seems really weird. Could you attach the output of ram_report and rom_report in a pastebin/gist/attachment?
And if that's not a problem, please provide your .config file. You can find it inside your build's output folder.

Best regards,
Thiago

2017-09-21 3:42 GMT-03:00 Hui Yie Teh <hteh703@...>:

I see. That makes a lot of sense. Thank you Maciek! 

I have another question, if you dont mind. 

I have an app that's taking about ~5MB of RAM and ~5.6MB of ROM judging from the 'ram_report' and 'rom_report'. Is there a way to reduce the size of those? It is much bigger because I've included other functionalities such as multi-threading and networking. Do I remove functionalities I don't need using 'make menuconfig'?

Cheers,
Yie

On 21 September 2017 at 18:28, Maciek Borzecki <maciek.borzecki@...> wrote:
On Thu, Sep 21, 2017 at 7:57 AM, Hui Yie Teh <hteh703@...> wrote:
>
> Hi Thiago,
>
> Thank you so much for the reply. I am running Zephyr on Linux and building the hello_world app on ARM using qemu_cortex_m3.
>
> I've got the numbers from the following:
>
> The 8MB of memory is measured using the system monitor
>
>
> The 3.8MB is seen by clicking properties of the folder created after building the hello_world app. I am assuming that the folder in ../outdir/BOARD will be the folder that is going to be installed on the board itself. Am I understanding this correctly?
>
>
> I'm not sure if those are the right numbers to get, sorry if this is a stupid question.
>
>
> Also, may I know what these numbers from' make ram_report' and 'make rom_report' mean?
>
> ram_report
>
>
> rom_report
>
> Any help would be really appreciated. Thanks!


qemu-system-arm is just a VM that can emulate, among others, Cortex-M
MCUs. `qemu_cortext_m3` board is in fact emulated by qemu. Memory
usage of a running Qemu process does not directly (or otherwise
easily) translate to the memory usage in the target system.

Haven't looked at the reports for some time, but `ram_report` is
likely a listing statically allocated data that would normally be
copied into RAM during system initialization. `rom_report` likely
lists the size of each symbol (i.e. non-inlined function in the code).
So, you're more realistically looking at ~4kB of RAM and ~7kB of
flash.

>
> Cheers,
> Yie
>
>
>
>
> On 21 September 2017 at 06:15, Thiago Silveira <thiago@...> wrote:
>>
>> Hi Yie,
>>
>> That definitely isn't right. In which environment are you running Zephyr, and how are you measuring this?
>>
>> Try 'make rom_report' and 'make ram_report' to get a nice report of how much each function is consuming.
>>
>> Best regards,
>> Thiago
>>
>>
>>
>> 2017-09-20 13:00 GMT-03:00 Hui Yie Teh <hteh703@...>:
>>>
>>> Hi,
>>>
>>> I read that Zephyr allows small footprint of a few KBs. However, the sample hello world application already takes up 8MB of memory and has a size of 3.8MB. I am not sure if I am running this right.
>>>
>>> I would appreciate if I can get any help on this or someone to point me at the right direction.
>>>
>>> Cheers,
>>> Yie
>>>
>>> _______________________________________________
>>> Zephyr-devel mailing list
>>> Zephyr-devel@...ct.org
>>> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>>>
>>
>
>
> _______________________________________________
> Zephyr-devel mailing list
> Zephyr-devel@...ct.org
> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>



--
Maciek Borzecki



Yie
 

Hi Thiago,

Do you require the attachments of my app or the hello_world sample?

Here's the pastebin of the reports and config file for my app:

Here's the pastebin of the reports for the hello_world sample:


On 22 September 2017 at 18:03, Thiago Silveira <thiago@...> wrote:
Hi Yie,

That seems really weird. Could you attach the output of ram_report and rom_report in a pastebin/gist/attachment?
And if that's not a problem, please provide your .config file. You can find it inside your build's output folder.

Best regards,
Thiago

2017-09-21 3:42 GMT-03:00 Hui Yie Teh <hteh703@...>:
I see. That makes a lot of sense. Thank you Maciek! 

I have another question, if you dont mind. 

I have an app that's taking about ~5MB of RAM and ~5.6MB of ROM judging from the 'ram_report' and 'rom_report'. Is there a way to reduce the size of those? It is much bigger because I've included other functionalities such as multi-threading and networking. Do I remove functionalities I don't need using 'make menuconfig'?

Cheers,
Yie

On 21 September 2017 at 18:28, Maciek Borzecki <maciek.borzecki@...> wrote:
On Thu, Sep 21, 2017 at 7:57 AM, Hui Yie Teh <hteh703@...> wrote:
>
> Hi Thiago,
>
> Thank you so much for the reply. I am running Zephyr on Linux and building the hello_world app on ARM using qemu_cortex_m3.
>
> I've got the numbers from the following:
>
> The 8MB of memory is measured using the system monitor
>
>
> The 3.8MB is seen by clicking properties of the folder created after building the hello_world app. I am assuming that the folder in ../outdir/BOARD will be the folder that is going to be installed on the board itself. Am I understanding this correctly?
>
>
> I'm not sure if those are the right numbers to get, sorry if this is a stupid question.
>
>
> Also, may I know what these numbers from' make ram_report' and 'make rom_report' mean?
>
> ram_report
>
>
> rom_report
>
> Any help would be really appreciated. Thanks!


qemu-system-arm is just a VM that can emulate, among others, Cortex-M
MCUs. `qemu_cortext_m3` board is in fact emulated by qemu. Memory
usage of a running Qemu process does not directly (or otherwise
easily) translate to the memory usage in the target system.

Haven't looked at the reports for some time, but `ram_report` is
likely a listing statically allocated data that would normally be
copied into RAM during system initialization. `rom_report` likely
lists the size of each symbol (i.e. non-inlined function in the code).
So, you're more realistically looking at ~4kB of RAM and ~7kB of
flash.

>
> Cheers,
> Yie
>
>
>
>
> On 21 September 2017 at 06:15, Thiago Silveira <thiago@...> wrote:
>>
>> Hi Yie,
>>
>> That definitely isn't right. In which environment are you running Zephyr, and how are you measuring this?
>>
>> Try 'make rom_report' and 'make ram_report' to get a nice report of how much each function is consuming.
>>
>> Best regards,
>> Thiago
>>
>>
>>
>> 2017-09-20 13:00 GMT-03:00 Hui Yie Teh <hteh703@...>:
>>>
>>> Hi,
>>>
>>> I read that Zephyr allows small footprint of a few KBs. However, the sample hello world application already takes up 8MB of memory and has a size of 3.8MB. I am not sure if I am running this right.
>>>
>>> I would appreciate if I can get any help on this or someone to point me at the right direction.
>>>
>>> Cheers,
>>> Yie
>>>
>>> _______________________________________________
>>> Zephyr-devel mailing list
>>> Zephyr-devel@...ct.org
>>> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>>>
>>
>
>
> _______________________________________________
> Zephyr-devel mailing list
> Zephyr-devel@...ct.org
> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>



--
Maciek Borzecki




Nashif, Anas
 

The reports show correct numbers, those are not MBs, those are read in bytes, so your RAM usage is round 50k, not 5Mb. Where did you read the 5Mb number?

 

 

Anas

 

From: zephyr-devel-bounces@... [mailto:zephyr-devel-bounces@...] On Behalf Of Hui Yie Teh
Sent: Friday, September 22, 2017 1:00 PM
To: Thiago Silveira <thiago@...>
Cc: zephyr-devel@...
Subject: Re: [Zephyr-devel] How to reduce footprint and size of applications in Zephyr

 

Hi Thiago,

Do you require the attachments of my app or the hello_world sample?

 

Here's the pastebin of the reports and config file for my app:

 

Here's the pastebin of the reports for the hello_world sample:

 

 

On 22 September 2017 at 18:03, Thiago Silveira <thiago@...> wrote:

Hi Yie,

That seems really weird. Could you attach the output of ram_report and rom_report in a pastebin/gist/attachment?

And if that's not a problem, please provide your .config file. You can find it inside your build's output folder.

Best regards,
Thiago

 

2017-09-21 3:42 GMT-03:00 Hui Yie Teh <hteh703@...>:

I see. That makes a lot of sense. Thank you Maciek! 

 

I have another question, if you dont mind. 

I have an app that's taking about ~5MB of RAM and ~5.6MB of ROM judging from the 'ram_report' and 'rom_report'. Is there a way to reduce the size of those? It is much bigger because I've included other functionalities such as multi-threading and networking. Do I remove functionalities I don't need using 'make menuconfig'?

Cheers,
Yie

 

On 21 September 2017 at 18:28, Maciek Borzecki <maciek.borzecki@...> wrote:

On Thu, Sep 21, 2017 at 7:57 AM, Hui Yie Teh <hteh703@...> wrote:
>
> Hi Thiago,
>
> Thank you so much for the reply. I am running Zephyr on Linux and building the hello_world app on ARM using qemu_cortex_m3.
>
> I've got the numbers from the following:
>
> The 8MB of memory is measured using the system monitor
>
>
> The 3.8MB is seen by clicking properties of the folder created after building the hello_world app. I am assuming that the folder in ../outdir/BOARD will be the folder that is going to be installed on the board itself. Am I understanding this correctly?
>
>
> I'm not sure if those are the right numbers to get, sorry if this is a stupid question.
>
>
> Also, may I know what these numbers from' make ram_report' and 'make rom_report' mean?
>
> ram_report
>
>
> rom_report
>
> Any help would be really appreciated. Thanks!


qemu-system-arm is just a VM that can emulate, among others, Cortex-M
MCUs. `qemu_cortext_m3` board is in fact emulated by qemu. Memory
usage of a running Qemu process does not directly (or otherwise
easily) translate to the memory usage in the target system.

Haven't looked at the reports for some time, but `ram_report` is
likely a listing statically allocated data that would normally be
copied into RAM during system initialization. `rom_report` likely
lists the size of each symbol (i.e. non-inlined function in the code).
So, you're more realistically looking at ~4kB of RAM and ~7kB of
flash.


>
> Cheers,
> Yie
>
>
>
>
> On 21 September 2017 at 06:15, Thiago Silveira <thiago@...> wrote:
>>
>> Hi Yie,
>>
>> That definitely isn't right. In which environment are you running Zephyr, and how are you measuring this?
>>
>> Try 'make rom_report' and 'make ram_report' to get a nice report of how much each function is consuming.
>>
>> Best regards,
>> Thiago
>>
>>
>>
>> 2017-09-20 13:00 GMT-03:00 Hui Yie Teh <hteh703@...>:
>>>
>>> Hi,
>>>
>>> I read that Zephyr allows small footprint of a few KBs. However, the sample hello world application already takes up 8MB of memory and has a size of 3.8MB. I am not sure if I am running this right.
>>>
>>> I would appreciate if I can get any help on this or someone to point me at the right direction.
>>>
>>> Cheers,
>>> Yie
>>>
>>> _______________________________________________
>>> Zephyr-devel mailing list
>>> Zephyr-devel@...
>>> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>>>
>>
>
>
> _______________________________________________
> Zephyr-devel mailing list
> Zephyr-devel@...
> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>


--
Maciek Borzecki

 

 

 


Yie
 

I'm so sorry. I don't know how I made such a stupid mistake. Must've been the all-nighers I'm pulling.

Thank you guys so much for your help! :) 

On 23 September 2017 at 07:24, Nashif, Anas <anas.nashif@...> wrote:

The reports show correct numbers, those are not MBs, those are read in bytes, so your RAM usage is round 50k, not 5Mb. Where did you read the 5Mb number?

 

 

Anas

 

From: zephyr-devel-bounces@lists.zephyrproject.org [mailto:zephyr-devel-bounces@lists.zephyrproject.org] On Behalf Of Hui Yie Teh
Sent: Friday, September 22, 2017 1:00 PM
To: Thiago Silveira <thiago@...>
Cc: zephyr-devel@lists.zephyrproject.org
Subject: Re: [Zephyr-devel] How to reduce footprint and size of applications in Zephyr

 

Hi Thiago,

Do you require the attachments of my app or the hello_world sample?

 

Here's the pastebin of the reports and config file for my app:

 

Here's the pastebin of the reports for the hello_world sample:

 

 

On 22 September 2017 at 18:03, Thiago Silveira <thiago@...> wrote:

Hi Yie,

That seems really weird. Could you attach the output of ram_report and rom_report in a pastebin/gist/attachment?

And if that's not a problem, please provide your .config file. You can find it inside your build's output folder.

Best regards,
Thiago

 

2017-09-21 3:42 GMT-03:00 Hui Yie Teh <hteh703@...>:

I see. That makes a lot of sense. Thank you Maciek! 

 

I have another question, if you dont mind. 

I have an app that's taking about ~5MB of RAM and ~5.6MB of ROM judging from the 'ram_report' and 'rom_report'. Is there a way to reduce the size of those? It is much bigger because I've included other functionalities such as multi-threading and networking. Do I remove functionalities I don't need using 'make menuconfig'?

Cheers,
Yie

 

On 21 September 2017 at 18:28, Maciek Borzecki <maciek.borzecki@...> wrote:

On Thu, Sep 21, 2017 at 7:57 AM, Hui Yie Teh <hteh703@...> wrote:
>
> Hi Thiago,
>
> Thank you so much for the reply. I am running Zephyr on Linux and building the hello_world app on ARM using qemu_cortex_m3.
>
> I've got the numbers from the following:
>
> The 8MB of memory is measured using the system monitor
>
>
> The 3.8MB is seen by clicking properties of the folder created after building the hello_world app. I am assuming that the folder in ../outdir/BOARD will be the folder that is going to be installed on the board itself. Am I understanding this correctly?
>
>
> I'm not sure if those are the right numbers to get, sorry if this is a stupid question.
>
>
> Also, may I know what these numbers from' make ram_report' and 'make rom_report' mean?
>
> ram_report
>
>
> rom_report
>
> Any help would be really appreciated. Thanks!


qemu-system-arm is just a VM that can emulate, among others, Cortex-M
MCUs. `qemu_cortext_m3` board is in fact emulated by qemu. Memory
usage of a running Qemu process does not directly (or otherwise
easily) translate to the memory usage in the target system.

Haven't looked at the reports for some time, but `ram_report` is
likely a listing statically allocated data that would normally be
copied into RAM during system initialization. `rom_report` likely
lists the size of each symbol (i.e. non-inlined function in the code).
So, you're more realistically looking at ~4kB of RAM and ~7kB of
flash.


>
> Cheers,
> Yie
>
>
>
>
> On 21 September 2017 at 06:15, Thiago Silveira <thiago@...> wrote:
>>
>> Hi Yie,
>>
>> That definitely isn't right. In which environment are you running Zephyr, and how are you measuring this?
>>
>> Try 'make rom_report' and 'make ram_report' to get a nice report of how much each function is consuming.
>>
>> Best regards,
>> Thiago
>>
>>
>>
>> 2017-09-20 13:00 GMT-03:00 Hui Yie Teh <hteh703@...>:
>>>
>>> Hi,
>>>
>>> I read that Zephyr allows small footprint of a few KBs. However, the sample hello world application already takes up 8MB of memory and has a size of 3.8MB. I am not sure if I am running this right.
>>>
>>> I would appreciate if I can get any help on this or someone to point me at the right direction.
>>>
>>> Cheers,
>>> Yie
>>>
>>> _______________________________________________
>>> Zephyr-devel mailing list
>>> Zephyr-devel@lists.zephyrproject.org
>>> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>>>
>>
>
>
> _______________________________________________
> Zephyr-devel mailing list
> Zephyr-devel@lists.zephyrproject.org
> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>


--
Maciek Borzecki