Hi,
am using eclipse(oxyzen.3A) ide,how i can find the code size like RAM ROM which is used by project.
thanks in advance
How to find code size like RAM ROM in eclipse ide
-
- Posts: 51
- Joined: Sat Mar 17, 2018 4:49 am
Re: How to find code size like RAM ROM in eclipse ide
hiningappa BS wrote: ↑Mon Aug 05, 2019 8:00 amHi,
am using eclipse(oxyzen.3A) ide,how i can find the code size like RAM ROM which is used by project.
thanks in advance
good
question
the info can reflected by esptool ( Makefile )
also showed in eclipse (example in console).
best wishes
rudi
edit:
example:
create a new target "size"
use it for your reference
example simpy "make size" / run build target "size"
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
-
- Posts: 51
- Joined: Sat Mar 17, 2018 4:49 am
Re: How to find code size like RAM ROM in eclipse ide
but did not understand these two lines, where it will store is it in ROM or flash?
Flash code: 833726 bytes
Flash rodata: 210176 bytes
thank you rudi, thanks for the response.
Flash code: 833726 bytes
Flash rodata: 210176 bytes
thank you rudi, thanks for the response.
Re: How to find code size like RAM ROM in eclipse ide
hiningappa BS wrote: ↑Tue Aug 06, 2019 9:37 ambut did not understand these two lines, where it will store is it in ROM or flash?
Flash code: 833726 bytes
Flash rodata: 210176 bytes
thank you rudi, thanks for the response.
there is a good description what .text, .data, .bss, stack and heap do or be.
also where each of these segments would reside in a microcontroller memory:
.text
The .text segment contains the actual code, and is programmed into Flash memory for microcontrollers. There may be more than one text segment when there are multiple, non-contiguous blocks of Flash memory; e.g. a start vector and interrupt vectors located at the top of memory, and code starting at 0; or separate sections for a bootstrap and main program.
.bss and .data
There are three types of data that can be allocated external to a function or procedure; the first is uninitialized data (historically called .bss, which also includes the 0 initialized data), and the second is initialized (non-bss), or .data. The name "bss" historically comes from "Block Started by Symbol", used in an assembler some 60 years ago. Both of these areas areas are located in RAM.
As a program is compiled, variables will be allocated to one of these two general areas. During the linking stage, all of the data items will be collected together. All variables which need to be initialized will have a portion of the program memory set aside to hold the initial values, and just before main() is called, the variables will be initialized, typically by a module called crt0. The bss section is initialized to all zeros by the same startup code.
With a few microcontrollers, there are shorter instructions that allow access to the first page (first 256 locations, sometime called page 0) of RAM. The compiler for these processors may reserve a keyword like near to designate variables to be placed there. Similarly, there are also microcontrollers that can only reference certain areas via a pointer register (requiring extra instructions), and such variables are designated far. Finally, some processors can address a section of memory bit by bit and the compiler will have a way to specify that (such as the keyword bit).
So there might be additional segments like .nearbss and .neardata, etc., where these variables are collected.
.rodata
The third type of data external to a function or procedure is like the initialized variables, except it is read-only and cannot be modified by the program. In the C language, these variables are denoted using the const keyword. They are usually stored as part of the program flash memory. Sometimes they are identified as part of a .rodata (read-only data) segment. On microcontrollers using the Harvard architecture, the compiler must use special instructions to access these variables.
stack and heap
The stack and heap are both placed in RAM. Depending on the architecture of the processor, the stack may grow up, or grow down. If it grows up, it will be placed at the bottom of RAM. If it grows down, it will be placed at the end of RAM. The heap will use the remaining RAM not allocated to variables, and grow the opposite direction of the stack. The maximum size of the stack and heap can usually be specified as linker parameters.
Variables placed on the stack are any variables defined within a function or procedure without the keyword static. They were once called automatic variables (auto keyword), but that keyword is not needed. Historically, auto exists because it was part of the B language which preceded C, and there it was needed. Function parameters are also placed on the stack.
Credit for the text SRC and further info
the ESP32 memory map you find example in the ESP32 Datasheet Section 3.1.4
also you can study the ESP32 technical reference Section 1 System and Memory
hope this helps
best wishes
rudi
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
-
- Posts: 9759
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to find code size like RAM ROM in eclipse ide
ningappa BS wrote: ↑Tue Aug 06, 2019 9:37 ambut did not understand these two lines, where it will store is it in ROM or flash?
Not sure if that's a typo/thinko, but none of the code you compile yourself is stored in ROM, as it is, as the name implies, read-only and cannot be programmed.
Who is online
Users browsing this forum: No registered users and 130 guests