Building Debug Builds Error. 'doc topic - Debugging with Eclipse'

G’day Boffins,

I’m attempting to follow the guide for Debugging with Eclipse.
https://docs.particle.io/faq/particle-tools/eclipse-debug/electron/#building-debug-builds

And have come unstuck at the section: Building Debug Builds.

I enter the commands

cd firmware/main
make clean all program-dfu PLATFORM=photon MODULAR=n DEBUG_BUILD=y USE_SWD_JTAG=y APPDIR=…/…/tinkerbreak

*using the appropriate local directory

terminal buzzes away happily until it starts to build the target Tinkerbreak.elf
I get about 5 inches of building text before this:

…/build/target/hal/platform-10//libhal.a(cellular_hal.o):/Users/billwatson/Documents/Particle/src/firmware/hal/src/electron/cellular_hal.cpp:22: first defined here
collect2: error: ld returned 1 exit status
make: *** [/Users/billwatson/Documents/Particle/src/Tinkerbreak/target/Tinkerbreak.elf] Error 1

Any ideas what might be going on?

-Bill

It looks like you might have bits of an Electron build lying around. Try removing the target directory in the tinkerbreak directory:

cd tinkerbreak
rm -rf target

If that doesn’t work, try deleting firmware/build/target

1 Like

Gah! I forgot to mention that I’m doing an electron build.
I have been moving the target folder to trash in between attempts, but I haven’t emptied it, might be worth a shot when I’m back in the saddle. Thank you :slight_smile:

If you’re building for Election, the command should be:

make clean all program-dfu PLATFORM=electron MODULAR=n DEBUG_BUILD=y USE_SWD_JTAG=y 

Definitely delete the target directory in tinkerbreak if you change the PLATFORM from photon to electron in the make command line. The other one probably won’t be necessary under normal circumstances.

1 Like

I did change that to electron when I tried the build, I just quickly copy pasted the above for the post without realising.
Sorry again! Well I guess I’ll never get another chance to use this excuse, but it’s my first post :stuck_out_tongue:

1 Like

Thanks @rickkas7!

Thanks for your brain power rikkas7, and thanks for checking in Kyle.

Unfortunately the issue still exists.

Here’s what I’ve done

Removed the tinkerbreak/target and firmware/build/target folders.

Then from firmware/main entering

sudo make clean all program-dfu PLATFORM=electron MODULAR=n DEBUG_BUILD=y USE_SWD_JTAG=y APPDIR=../mydirectories/Tinkerbreak

Which returns:

../build/target/hal/platform-10//libhal.a(cellular_hal.o):/Users/billwatson/Documents/Particle/src/firmware/hal/src/electron/cellular_hal.cpp:22: first defined here
collect2: error: ld returned 1 exit status
make: *** [/Users/billwatson/Documents/Particle/src/Tinkerbreak/target/Tinkerbreak.elf] Error 1

Without the root command I get the following. not sure if this is related.

rm: ../build/target/newlib_nano/platform-10/./src/mallocr.o: Permission denied
rm: ../build/target/newlib_nano/platform-10/./src/mallocr.o.d: Permission denied
rm: ../build/target/newlib_nano/platform-10/libnewlib_nano.a: Permission denied
make[1]: *** [clean] Error 1
make: *** [clean_newlib_nano] Error 2

Any ideas?

I’m not sure why it’s failing. I’ve never seen that error.

  • Which branch of firmware did you check out from github?
  • What operating system are you building on (presumably Mac OS X)?
  • Which version of the gcc-arm toolchain did you install?

Hi Rick,

hope you had a great Easter.

Here’s that info you requested

For the firmware I used this from the guide

git clone https://github.com/spark/firmware.git
cd firmware
git checkout release/stable

I had been running with El Capitan but have upgraded to Sierra now. I get the same error with Sierra.

By using arm-none-eabi-gcc --version I get the following.

...4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 227977]...

I just realised this is THE $ Rick :smiley: !

I’m just reading through the guide again and found a step where I needed external clarification. I remember mentally flagging it as a step where I may have messed up.

In the ‘build using local keychain’ section the following step was a bit confusing to me as I couldn’t find the ~./profile file.

Edit ~/.profile and add this:

# gcc-arm toolchain                                                             
export PATH=$PATH:/usr/local/gcc-arm/bin

The info I found was that ~/ means my user folder - e.g. /users/bill
There’s a .profile file in there that has that line in there.

The other /.profile file in my /etc folder has

# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
	eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
	[ -r /etc/bashrc ] && . /etc/bashrc
fi

any help?

I also thought it might be a good idea to copy over some of the text before the error

Building target: /Users/billwatson/Documents/Particle/src/Tinkerbreak/target/Tinkerbreak.elf
Invoking: ARM GCC C++ Linker
mkdir -p /Users/billwatson/Documents/Particle/src/Tinkerbreak/target/
arm-none-eabi-g++ -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=10 -DPLATFORM_NAME=electron -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00A -DUSBD_PID_CDC=0xC00A -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=10 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DUSE_SWD_JTAG -DPARTICLE_NO_ARDUINO_COMPATIBILITY=0 -DSYSTEM_VERSION_STRING=0.6.1 -DDEBUG_BUILD -Werror -I../user/inc -I../wiring/inc -I../hal/inc -I../hal/shared -I/rtos/FreeRTOSv8.2.2/FreeRTOS/Source/include -I/rtos/FreeRTOSv8.2.2/FreeRTOS/Source/portable/GCC/ARM_CM3 -I../hal/src/electron -I../hal/src/stm32f2xx -I../hal/src/stm32 -I../system/inc -I../services/inc -I../communication/src -I../platform/shared/inc -I../platform/MCU/STM32F2xx/CMSIS/Include -I../platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I../platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I../dynalib/inc -I. -MD -MP -MF /Users/billwatson/Documents/Particle/src/Tinkerbreak/target/Tinkerbreak.elf.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DMODULE_VERSION=0 -DMODULE_FUNCTION=3 -DMODULE_DEPENDENCY=0,0,0 -D_WINSOCK_H -D_GNU_SOURCE /Users/billwatson/Documents/Particle/src/Tinkerbreak/target/obj/./src/module_info.o  /Users/billwatson/Documents/Particle/src/Tinkerbreak/target/obj/startup/startup_stm32f2xx.o --output /Users/billwatson/Documents/Particle/src/Tinkerbreak/target/Tinkerbreak.elf -nostartfiles -Xlinker --gc-sections -L../build/arm/linker/stm32f2xx --specs=nano.specs --specs=../newlib_nano/src/custom-nano.specs -T../hal/src/electron/app_no_bootloader.ld -Wl,--defsym,__STACKSIZE__=1400 -L../hal/src/electron -u _printf_float -Wl,-Map,/Users/billwatson/Documents/Particle/src/Tinkerbreak/target/Tinkerbreak.map -u uxTopUsedPriority  -L../build/target/user/platform-10/Tinkerbreak/ -L../build/target/wiring/platform-10/ -L../build/target/system/platform-10/ -L../build/target/services/platform-10/ -L../build/target/communication/platform-10-prod-10/ -L../build/target/hal/platform-10/ -L../build/target/platform/platform-10/ -L../build/target/wiring_globals/platform-10/ -L../build/target/newlib_nano/platform-10 -L../build/arm/linker -Wl,--whole-archive -lnewlib_nano -luser -lwiring -lhal -lsystem -lservices -lcommunication -lplatform -lwiring_globals -Wl,--no-whole-archive
../build/target/system/platform-10//libsystem.a(system_network.o): In function `HAL_NET_notify_can_shutdown':
/Users/billwatson/Documents/Particle/src/firmware/system/src/system_network_internal.h:550: multiple definition of `HAL_NET_notify_can_shutdown'
../build/target/hal/platform-10//libhal.a(cellular_hal.o):/Users/billwatson/Documents/Particle/src/firmware/hal/src/electron/cellular_hal.cpp:36: first defined here
../build/target/system/platform-10//libsystem.a(system_network.o): In function `HAL_NET_notify_connected':
system_network.cpp:(.text.HAL_NET_notify_connected+0x0): multiple definition of `HAL_NET_notify_connected'
../build/target/hal/platform-10//libhal.a(cellular_hal.o):/Users/billwatson/Documents/Particle/src/firmware/hal/src/electron/cellular_hal.cpp:15: first defined here
../build/target/system/platform-10//libsystem.a(system_network.o): In function `HAL_NET_notify_dhcp':
system_network.cpp:(.text.HAL_NET_notify_dhcp+0x0): multiple definition of `HAL_NET_notify_dhcp'
../build/target/hal/platform-10//libhal.a(cellular_hal.o):/Users/billwatson/Documents/Particle/src/firmware/hal/src/electron/cellular_hal.cpp:29: first defined here
../build/target/system/platform-10//libsystem.a(system_network.o): In function `HAL_NET_notify_disconnected':
system_network.cpp:(.text.HAL_NET_notify_disconnected+0x0): multiple definition of `HAL_NET_notify_disconnected'
../build/target/hal/platform-10//libhal.a(cellular_hal.o):/Users/billwatson/Documents/Particle/src/firmware/hal/src/electron/cellular_hal.cpp:22: first defined here
collect2: error: ld returned 1 exit status
make: *** [/Users/billwatson/Documents/Particle/src/Tinkerbreak/target/Tinkerbreak.elf] Error 1

I also can’t figure out the instruction:

Edit ~/.profile and add this:
# gcc-arm toolchain
export PATH=$PATH:/usr/local/gcc-arm/bin

Update: I created a .profile, since I guess the newer OSX don’t include this.

Make sure the file you create doesn’t have a .txt extension or anything at the end.

G’day Rick,

I was wondering if you had any more ideas ?

I haven’t seen that specific error, however when random weird stuff like that happens I usually manually delete:

  • If using the APPDIR (as is done in the tutorial), delete the target directory in that directory (tinkerbreak, for example).
  • In the firmware directory, delete build/target.

Usually that fixes the problem.

I am experiencing the same problem as @billyboy. When building for PLATFORM=electron, all builds with any combination of MODULAR=n and/or DEBUG_BUILD=y are failing with the same error messages:

…/build/target/system/platform-10//libsystem.a(system_network.o): In function HAL_NET_notify_can_shutdown': firmware/system/src/system_network_internal.h:550: multiple definition ofHAL_NET_notify_can_shutdown’
firmware/hal/src/electron/cellular_hal.cpp:41: first defined here

…/build/target/system/platform-10//libsystem.a(system_network.o): In function HAL_NET_notify_connected': firmware/system/src/system_network.cpp:69: multiple definition ofHAL_NET_notify_connected’
…/build/target/hal/platform-10//libhal.a(cellular_hal.o):firmware/hal/src/electron/cellular_hal.cpp:20: first defined here

…/build/target/system/platform-10//libsystem.a(system_network.o): In function HAL_NET_notify_dhcp': firmware/system/src/system_network.cpp:84: multiple definition ofHAL_NET_notify_dhcp’
…/build/target/hal/platform-10//libhal.a(cellular_hal.o):firmware/hal/src/electron/cellular_hal.cpp:34: first defined here

…/build/target/system/platform-10//libsystem.a(system_network.o): In function HAL_NET_notify_disconnected': firmware/system/src/system_network.cpp:74: multiple definition ofHAL_NET_notify_disconnected’
…/build/target/hal/platform-10//libhal.a(cellular_hal.o):firmware/hal/src/electron/cellular_hal.cpp:27: first defined here

I tried deleting the target folder of firmware/modules, build/target and in my project folder as well. I am able to compile just fine with MODULAR=y and DEBUG_MODE=n for PLATFORM=electron. Alternatively, I am also able to enable those options for PLATFORM=photon.

This happens in both command line and Eclipse. I have version 4.9.3 20150529 of arm-none-eabi-gcc, and am running Ubuntu 16.04.

Anyone figured this out?

I am not sure but it is possible that the system part 3 changes are hurting you here.

Can you try passing MODULE_HAS_SYSTEM_PART3=0 as well?

Maybe @rickkas7 has a idea on this one, because I am just guessing!

What system firmware version tag are you building? I’ve done MODULAR=n DEBUG_BUILD=y for the Electron in the past, but I’ll try it with whatever version you’re building with.

1 Like

I am trying to build 0.6.2, but can confirm that this problems happens on 0.6.1 and 0.6.0 also.

@bko, I have tried passing MODULE_HAS_SYSTEM_PART3=0. No dice :confused:

1 Like