Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ESP8266: Compiler displays wrong flash size (Read 4253 times)
Red Baron
Member
***
Offline


Posts: 106
Location: Germany
Joined: Jul 29th, 2015
ESP8266: Compiler displays wrong flash size
Oct 26th, 2016 at 2:29pm
Print Post  
Hi,

I hope it's only a problem of the program that shows the statistics!

Board options are
- (NodeMCU 1.0, ESP-12) 
- Flash Size 4MB (1 MB SPIFFS)

When compiling a program for an ESP8266 I get the following output:
      Program size: 221.995 bytes (used 21% of a 1.044.464 byte maximum)
It is an empty program, only an empty setup and an empty loop function is definied.

I think maximum should be 3.133.392.

Im using version 1.1609.4 with visual studio 2015. The build paramters are:
Board Properties
Code
Select All
name=NodeMCU 1.0 (ESP-12E Module)
upload.tool=esptool
upload.speed=115200
upload.resetmethod=nodemcu
upload.maximum_size=1044464
upload.maximum_data_size=81920
upload.wait_for_upload_port=true
serial.disableDTR=true
serial.disableRTS=true
build.mcu=esp8266
build.f_cpu=80000000L
build.board=ESP8266_NODEMCU
build.core=esp8266
build.variant=nodemcu
build.flash_mode=dio
build.flash_size=4M
build.flash_freq=40
build.debug_port=
build.debug_level=
menu.CpuFrequency.80=80 MHz
menu.CpuFrequency.80.build.f_cpu=80000000L
menu.CpuFrequency.160=160 MHz
menu.CpuFrequency.160.build.f_cpu=160000000L
menu.UploadSpeed.115200=115200
menu.UploadSpeed.115200.upload.speed=115200
menu.UploadSpeed.9600=9600
menu.UploadSpeed.9600.upload.speed=9600
menu.UploadSpeed.57600=57600
menu.UploadSpeed.57600.upload.speed=57600
menu.UploadSpeed.256000.windows=256000
menu.UploadSpeed.256000.upload.speed=256000
menu.UploadSpeed.230400.linux=230400
menu.UploadSpeed.230400.macosx=230400
menu.UploadSpeed.230400.upload.speed=230400
menu.UploadSpeed.460800.linux=460800
menu.UploadSpeed.460800.macosx=460800
menu.UploadSpeed.460800.upload.speed=460800
menu.UploadSpeed.512000.windows=512000
menu.UploadSpeed.512000.upload.speed=512000
menu.UploadSpeed.921600=921600
menu.UploadSpeed.921600.upload.speed=921600
menu.FlashSize.4M3M=4M (3M SPIFFS)
menu.FlashSize.4M3M.build.flash_size=4M
menu.FlashSize.4M3M.build.flash_ld=eagle.flash.4m.ld
menu.FlashSize.4M3M.build.spiffs_start=0x100000
menu.FlashSize.4M3M.build.spiffs_end=0x3FB000
menu.FlashSize.4M3M.build.spiffs_blocksize=8192
menu.FlashSize.4M3M.build.spiffs_pagesize=256
menu.FlashSize.4M1M=4M (1M SPIFFS)
menu.FlashSize.4M1M.build.flash_size=4M
menu.FlashSize.4M1M.build.flash_ld=eagle.flash.4m1m.ld
menu.FlashSize.4M1M.build.spiffs_start=0x300000
menu.FlashSize.4M1M.build.spiffs_end=0x3FB000
menu.FlashSize.4M1M.build.spiffs_blocksize=8192
menu.FlashSize.4M1M.build.spiffs_pagesize=256
menu.UploadSpeed.256000=256000
menu.UploadSpeed.512000=512000
runtime.ide.path=C:\Program Files (x86)\Arduino
runtime.os=windows
e\esp8266\2.3.0\system
runtime.ide.version=106012
target_package=esp8266
target_platform=esp8266
dware\esp8266
originalid=nodemcuv2
intellisense.tools.path={compiler.toolchain.path}
a-lx106-elf\4.8.2\include;{runtime.platform.path}\tools\sdk\include
tools.wwwfiles.name=ESP8266 Sketch Data Upload
tools.wwwfiles.ssh=false
tools.wwwfiles.cmd.windows=ESP8266FSUpload.exe
recipe.wwwfiles.upload.pattern="{vm.path}/{tools.wwwfiles.cmd}" -serial.port={serial.port} -build.path="{build.path}" -target_platform="{target_platform}" -runtime.tools.mkspiffs.path="{runtime.tools.mkspiffs.path}" -board.name="{name}" -upload.verbose={upload.verbose} -upload.resetmethod={upload.resetmethod} -upload.speed={upload.speed}  -platform.path="{platform.path}" -project.name="{project.name}" -project.path="{project.path}" -tools.esptool.cmd="{tools.esptool.cmd}" -runtime.tools.esptool.path="{runtime.tools.esptool.path}" -compiler.path="{compiler.path}" -build.spiffs_start="{build.spiffs_start}" -build.spiffs_end="{build.spiffs_end}" -build.spiffs_pagesize="{build.spiffs_pagesize}" -build.spiffs_blocksize="{build.spiffs_blocksize}" -network.password={network.password} -network.auth_upload={network.auth_upload} -network.port={network.port}
tools.wwwfiles.cmd=ESP8266FSUpload.exe
version=2.2.0
compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
build.lwip_lib=-llwip_gcc
build.lwip_flags=-DLWIP_OPEN_SRC
compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/
compiler.sdk.path={runtime.platform.path}/tools/sdk
compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/lwip/include" "-I{build.path}/core"
compiler.c.cmd=xtensa-lx106-elf-gcc
compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections
compiler.S.cmd=xtensa-lx106-elf-gcc
compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls
compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy
compiler.c.elf.cmd=xtensa-lx106-elf-gcc
compiler.c.elf.libs=-lm -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lcrypto -lmain -lwps -laxtls -lsmartconfig -lmesh -lwpa2 {build.lwip_lib} -lstdc++
compiler.cpp.cmd=xtensa-lx106-elf-g++
compiler.cpp.flags=-c {compiler.warning_flags} -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections
compiler.as.cmd=xtensa-lx106-elf-as
compiler.ar.cmd=xtensa-lx106-elf-ar
compiler.ar.flags=cru
compiler.elf2hex.cmd=esptool
compiler.elf2hex.flags=
compiler.size.cmd=xtensa-lx106-elf-size
compiler.esptool.cmd=esptool.exe
compiler.esptool.cmd.windows=esptool.exe
build.extra_flags=-DESP8266
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.S.extra_flags=
compiler.cpp.extra_flags=
compiler.ar.extra_flags=
compiler.objcopy.eep.extra_flags=
compiler.elf2hex.extra_flags=
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{build.path}/{archive_file}" {compiler.c.elf.libs} -Wl,--end-group  "-L{build.path}"
 

« Last Edit: Oct 26th, 2016 at 2:53pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP8266: Compiler displays wrong flash size
Reply #1 - Oct 26th, 2016 at 2:52pm
Print Post  
Hi,

The final program size is worked out using a regex expression and call to esp tools both of which are provided by each hardware definition. So you are right that this is not directly connected to compilation and not a problem.

I have noticed recently that some boards use a slightly different regex method so in some cases the calculation of memory used might not be correct.

However in this case it looks okay. The esp core takes a certain amount of memory which is probably 221,995. The amount of free memory is provided by the esp definition which you can see in the output you have posted. I have highlighted the esp max memory property below and that is what Visual Micro is using to display the "max available". 

When compiling a program for an ESP8266 I get the following output:
      Program size: 221.995 bytes (used 21% of a 1.044.464 byte maximum)
It is an empty program, only an empty setup and an empty loop function is definied.

Board Properties
name=NodeMCU 1.0 (ESP-12E Module)
upload.tool=esptool
upload.speed=115200
upload.resetmethod=nodemcu
upload.maximum_size=1044464
upload.maximum_data_size=81920

You shouldn't worry about how much memory the base esp core takes because it doesn't use more when you, for example, use Serial in your code. Arduino works the opposite way where it starts with very little memory usage but ramps up much faster when you use commands such as Serial.

Does this make sense and answer the question?

Thanks
« Last Edit: Oct 26th, 2016 at 2:55pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Red Baron
Member
***
Offline


Posts: 106
Location: Germany
Joined: Jul 29th, 2015
Re: ESP8266: Compiler displays wrong flash size
Reply #2 - Oct 26th, 2016 at 4:14pm
Print Post  
Hi Tim,

thanks for the fast reponse. In deed, there is currently no problem. Even lager programs rarely have more than 300 KB. 

I found "upload.maximum_size=1044464" at "boards.txt". I think the reason for the problem is there. I tried it with the Arduino IDE, there is the same behavior.

Which program else uses paramter "upload.maximum_size"? Is there any serious problem if a ESP program passes this limit? 

Kind regards
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP8266: Compiler displays wrong flash size
Reply #3 - Oct 26th, 2016 at 4:31pm
Print Post  
Sorry I don't know the answer to that. It's best to ask in the sp8266.com forum.

Thanks
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint