[ISSUE] WorkBench compile APP_FLASH overflow


#1

VSCode Version: 1.27.2
OS Version: Windows 10

Issue: but when compiling in VSCode using Workbench, I get the following errors:

c:/users/bbeardmore/.particle/toolchains/gcc-arm/5.3.1/bin/…/lib/gcc/arm-none-eabi/5.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/PelletPirateC++_WB.elf section .text' will not fit in regionAPP_FLASH’
c:/users/bbeardmore/.particle/toolchains/gcc-arm/5.3.1/bin/…/lib/gcc/arm-none-eabi/5.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: region `APP_FLASH’ overflowed by 26468 bytes
collect2.exe: error: ld returned 1 exit status
make[1]: *** […/build/module.mk:225: c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/PelletPirateC++_WB.elf] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/main’
make: *** [C:\Users\bbeardmore.particle\toolchains\buildscripts\1.0.0\Makefile:34: compile-user] Error 2
The terminal process terminated with exit code: 2

Press any key to close the terminal.

here’s my .code-workspace settings

{
    "settings": {
        "extensions.ignoreRecommendations": true,
        "C_Cpp.default.configurationProvider": "particle.particle-vscode-core",
        "files.associations": {
            "*.ino": "cpp"
        },
        "particle.targetPlatform": "photon"
    },
    "folders": [
        {
            "path": "."
        }
    ]
}

same exact code in the Web IDE compiles fine, no errors.

any help on figuring this one out would be appreciated.


#2

Have you set the target version on Web IDE and Workbench the same?
Workbench is obviousely targeting v0.7.0

What happens if you do a cloud build from Workbench?


#3

Cloud Build from Workbench - I get a message in VSCode:

compiled firmware for platform: photon...

and I get a .bin file so cloud works.


#4

Is there any other setting I can try to avoid this false overflow issue when compiling locally? It seems the local compiler does not know the particle Photon build/size constraints.


#5

Did you try a clean? There might be some old files lying around adding to the size of the build. Terminal > Run Tasks… from the menu and select Particle: Clean application (local).


#6

tried clean, no luck. I still get the error. I can compile fine to the cloud and I can compile in the WEB IDE. Web IDE says my code has plenty of headroom.

Output of arm-none-eabi-size:

text	data	bss	dec	hex
54924	484	3200	58608	NaN

In a nutshell:
Flash used	55408 / 110592	50.1 %
RAM used	3684 / 20480	18.0 %

so I’m sure its’ something in my local settings… It seems like there is some setting where my local compile does not know the photon capacity… is there some tasks.json, settings.json or project.properties that I need to make sure is set correctly?

here’s the local compile error I get when I compile:

> Executing task in folder PelletPirateC++_WB: make -f 'C:\Users\bbeardmore\.particle\toolchains\buildscripts\1.0.0\Makefile' compile-user <
> 
> cd "C:/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/main" && make all
> make[1]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/main'
> make -C ../newlib_nano
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/newlib_nano'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/newlib_nano'
> make -C ../user
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/user'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/user'
> make -C ../wiring
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/wiring'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/wiring'
> make -C ../hal
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/hal'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/hal'
> make -C ../system
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/system'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/system'
> make -C ../services
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/services'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/services'
> make -C ../communication
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/communication'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/communication'
> make -C ../platform
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/platform'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/platform'
> make -C ../wiring_globals
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/wiring_globals'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/wiring_globals'
> make -C ../crypto
> make[2]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/crypto'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/crypto'
> Building target: c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/PelletPirateC++_WB.elf
> Invoking: ARM GCC C++ Linker
> mkdir -p c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/
> arm-none-eabi-g++ -DSTM32_DEVICE -DSTM32F10X_MD -DPLATFORM_THREADING=0 -DPLATFORM_ID=0 -DPLATFORM_NAME=core -DUSBD_VID_SPARK=0x1D50 -DUSBD_PID_DFU=0x607F -DUSBD_PID_CDC=0x607D -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -flto -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=0 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DMBEDTLS_CONFIG_FILE="<mbedtls_config.h>" -DSYSTEM_VERSION_STRING=0.7.0 -DRELEASE_BUILD -Werror -I../user/inc -I../wiring/inc -I../hal/inc -I../hal/shared -I../hal/src/core -I../hal/src/stm32 -I../system/inc -I../services/inc -I../communication/src -I../platform/shared/inc -I../platform/MCU/STM32F1xx/CMSIS/Include -I../platform/MCU/STM32F1xx/CMSIS/Device/ST/Include -I../platform/MCU/STM32F1xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F1xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F1xx/STM32_StdPeriph_Driver/inc -I../platform/NET/CC3000/CC3000_Host_Driver -I../crypto/inc -I../crypto/mbedtls/include -I../dynalib/inc -I. -MD -MP -MF c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/PelletPirateC++_WB.elf.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1
> -DPARTICLE=1 -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DMODULE_VERSION=207 -DMODULE_FUNCTION=3 -DMODULE_DEPENDENCY=0,0,0 -DMODULE_DEPENDENCY2=0,0,0 -D_WINSOCK_H -D_GNU_SOURCE c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/obj/./src/module_info.o
>  c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/obj/startup/startup_stm32f10x_md.o --output c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/PelletPirateC++_WB.elf -nostartfiles -Xlinker --gc-sections -flto -Os -fuse-linker-plugin -Tlinker_stm32f10x_md_dfu.ld -L../build/arm/linker --specs=nano.specs -lc -lnosys -u _printf_float -Wl,-Map,c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/PelletPirateC++_WB.map  -L../build/target/user/platform-0-lto/PelletPirateC++_WB/ -L../build/target/wiring/platform-0-lto/ -L../build/target/system/platform-0-lto/ -L../build/target/services/platform-0-lto/ -L../build/target/communication/platform-0-lto-prod-0/ -L../build/target/hal/platform-0-lto/ -L../build/target/platform/platform-0-lto/ -L../build/target/wiring_globals/platform-0-lto/ -L../build/target/crypto/platform-0-lto/ -L../build/target/newlib_nano/platform-0-lto -L../build/arm/linker -Wl,--whole-archive -lnewlib_nano -luser -lwiring -lhal -lsystem -lservices -lcommunication -lplatform -lwiring_globals -lcrypto -Wl,--no-whole-archive
> c:/users/bbeardmore/.particle/toolchains/gcc-arm/5.3.1/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/PelletPirateC++_WB.elf section `.text' will not fit in region `APP_FLASH'
> c:/users/bbeardmore/.particle/toolchains/gcc-arm/5.3.1/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/bin/ld.exe: region `APP_FLASH' overflowed by 26468 bytes
> collect2.exe: error: ld returned 1 exit status
> make[1]: *** [../build/module.mk:225: c:/Users/bbeardmore/Dropbox/PelletPirate/PelletPirateC++_WB/target/PelletPirateC++_WB.elf] Error 1
> make[1]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/main'
> make: *** [C:\Users\bbeardmore\.particle\toolchains\buildscripts\1.0.0\Makefile:34: compile-user] Error 2
> The terminal process terminated with exit code: 2
> 
> Press any key to close the terminal.

#7

Oh I see - your local gcc-arm build is incorrectly targeting Core, which is why the code doesn’t fit. Your cloud build was targeting Photon.

Try doing particle set target device again.


[ISSUE] WorkBench Intellisense "No Storage Class"
#8

thanks @rickkas7, I run the command and I get the message that it’s successfully set, but when I compile locally, I still see
-DPLATFORM_NAME=core
where is this being pulled from? Can I edit it directly? Isn’t this pulled from my workspace file?

{
    "settings": {
        "extensions.ignoreRecommendations": true,
        "C_Cpp.default.configurationProvider": "particle.particle-vscode-core",
        "files.associations": {
            "*.ino": "cpp"
        },
        "particle.targetPlatform": "photon",
        "particle.firmwareVersion": "0.7.0",
        "particle.targetDevice": "photon",
    },
    "folders": [
        {
            "path": "."
        }
    ]
}

#9

Can you start a new test project with a default *.ino? From there, set the targetPlatform to Photon & firmwareVersion to 0.7.0 and try to compile the full Device OS and the App. If that works then we can try to triage your current setup.


#10

I’m not sure I follow you on default *.ino? do you mean create to NEW workspace and copy my project over into it and compile full Device OS and the App?

also, is “Photon” or “photon” case sensitive for the targetPlatform?


#11

Sorry about that. I meant to say create a new project and do not copy any of your project over, just use the generated *.ino, which should only have an empty setup() and loop().

Case shouldn’t matter. targetPlatform should technically be lower case, which is what is set from the command, but we also convert it to lowercase before applying it.


#12

ok kept it clean new project… none of my code… I set the platform to photon (selected it from the dropdown) and then did a full Device OS and the App compile and got this error:

> Executing task in folder TestProject1: make -f 'C:\Users\bbeardmore\.particle\toolchains\buildscripts\1.0.0\Makefile' compile-all <

"C:/Users/bbeardmore/.vscode/extensions/particle.particle-vscode-core-1.0.0-alpha.3/src/cli/bin/windows/amd64/particle.exe" preprocess c:/Users/bbeardmore/Desktop/TestProject/TestProject1/src/TestProject1.ino
cd "C:/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/modules" && make all
make[1]: Entering directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/modules'
makefile:20: *** "Platform 'core' does not support dynamic modules".  Stop.
make[1]: Leaving directory '/cygdrive/c/Users/bbeardmore/.particle/toolchains/deviceOS/0.7.0/firmware-0.7.0/modules'
make: *** [C:\Users\bbeardmore\.particle\toolchains\buildscripts\1.0.0\Makefile:38: compile-all] Error 2
The terminal process terminated with exit code: 2

Press any key to close the terminal.

It’s still STUCK on platform 'core'


#13

@bbeardmore can you launch a powershell instance and run the following: Get-ChildItem Env: then post the non-confidential results here? i’m wondering if you have any Particle-related items set (e.g. PLATFORM)


#14

I had all sorts of issues with VSCode and the Particle extensions, many related to permissions. I am running with Win 10 and I ended up removing the VSCode install I had and reinstalled it with “run as adminstrator” privileges. I then setup the desktop shortcut to “run as adminstrator” as well. Then I installed the extensions as instructed and all my problems had disappeared. Hope this helps!


#15

@peekay123 when I run as Admin, the 64-bit install tells me it’s not set to run as admin… do I want to continue… so I continued. then I right click and run VSCode as admin… but when I compile my empty program locally with just a setup and loop in it… I get the same error message as above, terminate with exit code: 2

@m_m I did the env dump… I see nothing in here that looks like a PLATFORM setting… but here’s the whole listing… I did not see anything 'sensitive" in here… so let me know if I goofed!

Name                           Value
----                           -----
ALLUSERSPROFILE                C:\ProgramData
APPDATA                        C:\Users\bbeardmore\AppData\Roaming
asl.log                        Destination=file
CommonProgramFiles             C:\Program Files\Common Files
CommonProgramFiles(x86)        C:\Program Files (x86)\Common Files
CommonProgramW6432             C:\Program Files\Common Files
COMPUTERNAME                   DADS-DESKTOP
ComSpec                        C:\WINDOWS\system32\cmd.exe
DriverData                     C:\Windows\System32\Drivers\DriverData
FP_NO_HOST_CHECK               NO
FPPUILang                      en-US
HOMEDRIVE                      C:
HOMEPATH                       \Users\bbeardmore
LOCALAPPDATA                   C:\Users\bbeardmore\AppData\Local
LOGONSERVER                    \\DADS-DESKTOP
NUMBER_OF_PROCESSORS           8
OneDrive                       C:\Users\bbeardmore\OneDrive
OnlineServices                 Online Services
OOBEUILang                     en-US
OPENSSL_CONF                   C:\OpenSSL-Win32\bin\openssl.cfg
OS                             Windows_NT
Path                           C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Common Files\Microsoft Shared\Wi...
PATHEXT                        .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
PCBRAND                        Pavilion
Platform                       HPD
PROCESSOR_ARCHITECTURE         AMD64
PROCESSOR_IDENTIFIER           Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
PROCESSOR_LEVEL                6
PROCESSOR_REVISION             3a09
ProgramData                    C:\ProgramData
ProgramFiles                   C:\Program Files
ProgramFiles(x86)              C:\Program Files (x86)
ProgramW6432                   C:\Program Files
PSModulePath                   C:\Users\bbeardmore\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPower...
PUBLIC                         C:\Users\Public
PY_HOME                        C:\Python27
PYTHONPATH                     C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\site-packages;C:\Python27\Lib\lib-tk
SystemDrive                    C:
SystemRoot                     C:\WINDOWS
TEMP                           C:\Users\BBEARD~1\AppData\Local\Temp
TMP                            C:\Users\BBEARD~1\AppData\Local\Temp
USERDOMAIN                     DADS-DESKTOP
USERDOMAIN_ROAMINGPROFILE      DADS-DESKTOP
USERNAME                       bbeardmore
USERPROFILE                    C:\Users\bbeardmore
VS110COMNTOOLS                 C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
windir                         C:\WINDOWS
windows_tracing_flags          3
windows_tracing_logfile        C:\BVTBin\Tests\installpackage\csilogfile.log

#16

@bbeardmore, like I said, I uninstalled everything including VSC and started fresh. All I can think of is that a) You have an older version of VSC or b) VSC is not able to write to wherever the device type is stored in a file.


#17

still no luck. very frustrating. I uninstalled everything, VSCode, blew away .particle folder, uninstalled particle extension, THEN reinstalled vscode as admin, set to load as admin, installed extensions, prompted to install compiler again, did that… still stuck on “core” platform.

I guess I’ll ask the question again… where is PLATFORM being pulled from? can I just hard code it?


#18

@bbeardmore sorry for the frustration! fwiw, your feedback is super-helpful as we polish this product up as it deserves. obviously this is still a preview release so i would strongly recommend staying away if you are not comfortable managing a few bumps and annoyances.

if you are up for it, try deleting the Platform environment variable:

  • using powershell, i think you can just run Remove-Item Env:\Platform
  • otherwise, you can use the GUI as described here

i’m pretty sure windows env vars are case-insensitive. if so, you are likely getting a name collision and since we don’t recognize HPD our build scripts are defaulting to targeting a core. once you confirm Platform is deleted (running Get-ChildItem Env: should no longer include it), try our build tasks again.

once that’s all done, you can re-add the Platform env var with the original value of HPD unless you are sure you no longer need it :+1:


#19

@m_m SUCCESS! … just one glitch that I worked around…I tried the PowerShell command line option you mentioned above and verified it was removed with Get-ChildItem Env: … tried to compile and it failed… so then I looked at the GUI and saw it was still there… so I used your other method (thanks!) and did the following steps to get SUCCESS!:

  1. removed env variable Platform from GUI environment variable tool in windows per your link
  2. closed VSCode, reopened it to my project
  3. did a full clean via: Terminal --> Run Task --> Particle: Clean application & DeviceOS (local)
  4. deleted the target folder in my project workspace.
  5. did a full compile via: CTRL-SHIFT-B --> Particle: Compile application & DeviceOS (local)

I’m not sure all these steps are required but it worked for me! I am compiling locally! Much thanks for your help @m_m and all the rest on this thread! I hope this solution will help others!

Carpe Diem!
Brian