Why is STM32CubeIDE not showing SFR registers when debugging?

Viewed 112

I imported a project in STM32CubeIDE with the option "Makefile Project with Existing Code". I created this project without using any IDE, so I had to write my own makefile.

CC = arm-none-eabi-gcc -c
LD = arm-none-eabi-gcc

LIBNAME_OPENCM3 = opencm3_stm32f1

OPT = -Os
DEFS += -DSTM32F1
DIR_OPENCM3 = ./libopencm3
DIR_INC = ./inc
DIR_OBJ = ./obj
DEBUG = -ggdb3
LDSCRIPT = stm32f1.ld

DIR_FLAGS = -I$(DIR_INC)

ARCH_FLAGS = -mthumb -mcpu=cortex-m3

LDFLAGS += --static -nostartfiles
LDFLAGS += -T$(LDSCRIPT)
LDFLAGS += $(ARCH_FLAGS) $(DEBUG)
LDFLAGS += -Wl,-Map=$(*).map -Wl,--cref
LDFLAGS += -Wl,--gc-sections
ifeq ($(V),99)
LDFLAGS     += -Wl,--print-gc-sections
endif
LDFLAGS += -u _printf_float
LDFLAGS += -L$(DIR_OPENCM3)/lib

LDLIBS += -l$(LIBNAME_OPENCM3)
LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group

CFLAGS += $(OPT) $(DEBUG) $(ARCH_FLAGS)
CFLAGS += -Wextra -Wshadow -Wimplicit-function-declaration
CFLAGS += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes
CFLAGS += -fno-common -ffunction-sections -fdata-sections
CFLAGS += -std=c11

DEFS += -I$(DIR_OPENCM3)/include

PREPFLAGS = -MD -Wall -Wundef $(DEFS)

OBJS = $(DIR_OBJ)/main.o \
        $(DIR_OBJ)/bmp180.o

main.elf : $(OBJS) $(LDSCRIPT)
    $(LD) $(LDFLAGS) $(OBJS) $(LDLIBS) -o main.elf
$(DIR_OBJ)/%.o : %.c
    mkdir -p $(DIR_OBJ)
    $(CC) $(CFLAGS) $(DIR_FLAGS) $(PREPFLAGS) $< -o $@
clean :
    rm -rf $(DIR_OBJ) *.elf *.map *.d
all :
    make

The project is compiled successfully and it's running, but when I started to debug, this IDE didn't show the SFR registers. That window is empty.enter image description here

I created a different project, this time with the IDE, and it shows me the registers. enter image description here

I suppose that it has something to do with my makefile. Is there an extra flag that I need to add or why is this happenning?

1 Answers

coming up on this after some time since i JUST faced the exact same problem (using STM32CubeIDE 1.9.0 on Win10)

It all generated when I imported an existing makefile project into the IDE... Was able to debug from within the IDE (using STLINK) but SFR view was oddly empty...

I resolved by playing with the "Project Nature" settings, despite the threatening messages from the IDE itself ( too bad :S )

  • after the import, the project got configured with 3 natures: ccnature, managedBuildNature, ScannerConfigNature
  • I added a 4th nature: MCUProjectNature (select STM32CubeIDE Project from the list in the dialog which shows up)

ta-da!!!

The project Properties (finally!) started to show the CMSIS-SVD settings tab which allows me to point to the .SVD device file describing the MCU used

I specified this string (copied from a project generate completely inside the IDE):

platform:/plugin/com.st.stm32cube.ide.mcu.productdb.debug/resources/cmsis/STMicroelectronics_CMSIS_SVD/STM32xxxx.svd

(replace xxxx with your MCU micro, search your STM32CubeIDE installation plugin folder for *.svd)

I hope this can relief the pain from banging one's head against the wall in search for a fix

Related