Can't debug on meshnetics board

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi folks,

Would anybody here be able to tell me why I can't place breakpoints in this project. It's the ZBNDemo that came with the meshnetics kit. Micro is ATmega1281. Using a jtag mkii and it works fine except for debugging with breakpoints... I'm assuming it's something to do with optimization in the makefile (below) but I don't really know my way around these files... Thanks in advance.

Phil

PROJNAME = ZBNDemoApp
PROJECT  = $(PROJNAME).elf

#-------------------------------------------------------
# Select the stack type and the security mode
#-------------------------------------------------------
SECURITY_MODE = NO_SECURITY
#SECURITY_MODE = STD_SECURITY

STACK_TYPE = ZBN_ALL
#STACK_TYPE = ZBN_COORDINATOR
#STACK_TYPE = ZBN_ROUTER
#STACK_TYPE = ZBN_ENDDEVICE

# Automatic selection of Makerules and related parameters
ifeq ($(STACK_TYPE), ZBN_ALL)
ifeq ($(SECURITY_MODE), NO_SECURITY)
include ../../ZigBeeNet/lib/MakerulesZbnAll
endif
ifeq ($(SECURITY_MODE), STD_SECURITY)
include ../../ZigBeeNet/lib/MakerulesZbnAllStdSec
endif
endif

ifeq ($(STACK_TYPE), ZBN_COORDINATOR)
ifeq ($(SECURITY_MODE), NO_SECURITY)
include ../../ZigBeeNet/lib/MakerulesZbnCoordinator
endif
ifeq ($(SECURITY_MODE), STD_SECURITY)
include ../../ZigBeeNet/lib/MakerulesZbnCoordinatorStdSec
endif
endif

ifeq ($(STACK_TYPE), ZBN_ROUTER)
ifeq ($(SECURITY_MODE), NO_SECURITY)
include ../../ZigBeeNet/lib/MakerulesZbnRouter
endif
ifeq ($(SECURITY_MODE), STD_SECURITY)
include ../../ZigBeeNet/lib/MakerulesZbnRouterStdSec
endif
endif

ifeq ($(STACK_TYPE), ZBN_ENDDEVICE)
ifeq ($(SECURITY_MODE), NO_SECURITY)
include ../../ZigBeeNet/lib/MakerulesZbnEndDevice
endif
ifeq ($(SECURITY_MODE), STD_SECURITY)
include ../../ZigBeeNet/lib/MakerulesZbnEndDeviceStdSec
endif
endif

# COMPILER FLAGS --------------------------------------
#CFLAGS += -Os 
CFLAGS += -Wl,--gc-sections

#------------------------------------- 
# Application paramters
#---------------------------------------
CFLAGS += -DTIMER_SENDING_PERIOD=3000
#After this amount of failed transmission in a row the rejoin network procedure is done
CFLAGS += -DTHRESHOLD_FAILD_TRANSMISSION=10

#-------------------------------------------- 
# Stack paramters being set to Config Server
#--------------------------------------------
CFLAGS += -DCS_AUTONETWORK=1
# If CS_AUTONETWORK is 1 CS_CHANNEL_MASK should be declared 
CFLAGS += -DCS_CHANNEL_MASK=0x01000000
CFLAGS += -DCS_EXT_PANID=0xAAAAAAAAAAAAAAAALL
CFLAGS += -DCS_END_DEVICE_SLEEP_PERIOD=5000
CFLAGS += -DCS_NEIB_TABLE_SIZE=7
CFLAGS += -DCS_MAX_CHILDREN_AMOUNT=6
CFLAGS += -DCS_MAX_CHILDREN_ROUTER_AMOUNT=2
CFLAGS += -DCS_ROUTE_TABLE_SIZE=30
CFLAGS += -DCS_ADDRESS_MAP_TABLE_SIZE=10
CFLAGS += -DCS_ROUTE_DISCOVERY_TABLE_SIZE=10                
CFLAGS += -DCS_APS_DATA_REQ_BUFFER_SIZE=3
CFLAGS += -DCS_APS_ACK_FRAME_BUFFER_SIZE=2
CFLAGS += -DCS_DUPLICATE_REJECTION_TABLE_SIZE=5
# The value of polling should be less than CS_ACK_TIMEOUT 
# by default the value is a one half of CS_ACK_TIMEOUT
#CFLAGS += -DCS_INDIRECT_POLL_RATE=1000   

# Used only for static addressing
#CFLAGS += -DCS_NWK_ADDR=0x0001
#CFLAGS += -DCS_NWK_UNIQUE_ADDR=true
# Pre-configured key which is used by NWK
#CFLAGS += -DCS_NETWORK_KEY="{0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC}"
#0 - preconfigured network key
#1 - preconfigured trust centre link key
#2 - preconfigured trust centre master key
#3 - not preconfigured
CFLAGS += -DCS_ZDO_SECURITY_STATUS=3
#CFLAGS += -DCS_UID=0xAAAAAAAAAAAAAAAALL
CFLAGS += -DCS_APS_TRUST_CENTER_ADDRESS=0xAAAAAAAAAAAAAAAALL
#CFLAGS += -DCS_APS_SECURITY_TIMEOUT_PERIOD=10000

# COMPONENTS PATHS ---------------------------------------
STACK_PATH = ../../ZigBeeNet/Components
ifeq ($(HAL), ATMEGA1281)
  HAL_PATH = $(STACK_PATH)/HAL/atmega1281
endif
ifeq ($(HAL), ATMEGA2561)
  HAL_PATH = $(STACK_PATH)/HAL/atmega1281
endif
ifeq ($(HAL), AT91SAM7X256)
  HAL_PATH = $(STACK_PATH)/HAL/at91sam7x256
endif
BSP_PATH = $(STACK_PATH)/BSP
MAC_PATH = $(STACK_PATH)/MAC_PHY
NWK_PATH = $(STACK_PATH)/NWK
APS_PATH = $(STACK_PATH)/APS
ZDO_PATH = $(STACK_PATH)/ZDO
PDS_PATH = $(STACK_PATH)/PersistDataServer
TC_PATH  = $(STACK_PATH)/Security/TrustCentre
SSP_PATH  = $(STACK_PATH)/Security/ServiceProvider
SE_PATH  = $(STACK_PATH)/SystemEnvironment
CS_PATH  = $(STACK_PATH)/ConfigServer
APP_PATH = .


# INCLUDES PATHS FLAGS ----------------------------------
INCLUDEDIRS =                          \
	-I./include                          \
	-I$(SE_PATH)/include                 \
	-I$(APS_PATH)/include                \
	-I$(NWK_PATH)/include                \
	-I$(ZDO_PATH)/include                \
	-I$(MAC_PATH)/include                \
	-I$(HAL_PATH)/HAL_HWD/include        \
	-I$(HAL_PATH)/HAL_HWI/include        \
	-I$(BSP_PATH)/include                \
	-I$(CS_PATH)/include                 \
	-I$(PDS_PATH)/include                \
	-I$(TC_PATH)/include                 \
	-I$(SSP_PATH)/include

# LIB PATHS FLAGS ----------------------------------------
LIBDIRS = -L$(APP_PATH)/../../ZigBeeNet/lib -L$(BSP_PATH)/lib

# LIBRARIES ----------------------------------------------
LIBS = -l$(STACK_LIB) -lBSP


# OBJECTS ------------------------------------------------
objects =                                     \
  $(APP_PATH)/objs/ZBNDemoApp.o               \
  $(APP_PATH)/objs/ZBNCoord.o                 \
  $(APP_PATH)/objs/ZBNRouter.o                \
  $(APP_PATH)/objs/ZBNEndDevice.o             \
  $(APP_PATH)/objs/ZBNUARTManager.o           \
  $(APP_PATH)/objs/ZBNSensorManager.o         \
  $(CS_PATH)/objs/ConfigServer.o              \
  $(PDS_PATH)/objs/pdsCrcService.o            \
  $(PDS_PATH)/objs/pdsDataServer.o            \
  $(PDS_PATH)/objs/pdsWriteData.o    

#  TARGETS ------------------------------------------------
all: $(objects) $(PROJECT) $(PROJNAME).srec $(PROJNAME).hex 

$(objects): 
	$(CC) $(CFLAGS) $(INCLUDEDIRS) -c $^ -o $@
$(APP_PATH)/objs/ZBNDemoApp.o:       $(APP_PATH)/ZBNDemoApp.c
$(APP_PATH)/objs/ZBNCoord.o:         $(APP_PATH)/ZBNCoord.c
$(APP_PATH)/objs/ZBNRouter.o:        $(APP_PATH)/ZBNRouter.c
$(APP_PATH)/objs/ZBNEndDevice.o:     $(APP_PATH)/ZBNEndDevice.c
$(APP_PATH)/objs/ZBNUARTManager.o:   $(APP_PATH)/ZBNUARTManager.c
$(APP_PATH)/objs/ZBNSensorManager.o: $(APP_PATH)/ZBNSensorManager.c
$(CS_PATH)/objs/ConfigServer.o:      $(CS_PATH)/src/configServer.c
$(PDS_PATH)/objs/pdsCrcService.o:    $(PDS_PATH)/src/pdsCrcService.c 
$(PDS_PATH)/objs/pdsDataServer.o:    $(PDS_PATH)/src/pdsDataServer.c 
$(PDS_PATH)/objs/pdsWriteData.o:     $(PDS_PATH)/src/pdsWriteData.c

$(PROJECT): $(objects) Makefile
	$(CC)  $(objects) $(HAL_PATH)/lib/WdtInit.o $(CFLAGS) $(INCLUDEDIRS) $(LIBDIRS) $(LIBS) -lm -o $(PROJECT)
	$(SIZE) -td $(PROJECT)

$(PROJNAME).srec:
	$(OBJCOPY) -O srec --srec-len 128 $(PROJECT) $(PROJNAME).srec

$(PROJNAME).hex:
	$(OBJCOPY) -O ihex $(PROJECT) $(PROJNAME).hex

#burn:
#	avarice -2epf ${TARGET} -j /dev/ttyS0

## Clean target
clean:
	-rm -rf $(TARGET) $(objects) $(PROJECT) $(PROJNAME).hex $(PROJNAME).eep $(PROJNAME).srec $(APP_PATH)/lib/*.*

Last Edited: Fri. Oct 16, 2015 - 02:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try adding a -g (or better -gdwarf-2) to the CFLAGS which embeds symbolic debug info into the ELF that you debug.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the tip, I'm certain that it'll come in handy :)
Should anyone else wish to know; the problem turned out to be with a space in a directory name...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup, unless you are willing to go through and "" quote all paths in Makefiles, you'll find GCC gets on much better with plain pathnames.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Phil.Barlow wrote:
It's the ZBNDemo that came with the meshnetics kit.
Are you sure you want to mess with some REALLY outdated code? Why not download new SDK from Atmel site?

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Alex,

Thanks for pointing that out. After the same other issues with the Atmel SDK (now fixed) I went back to the meshnetics stuff. This problem was evident in both and the makefile from meshnetics seemed more complete...

Still, I'm now using the Atmel WSNDemoApp as a starting point and slowly learning my way around this makefile business to boot. I'vee been putting it off for far too long...