JTAG SAM-ICE Prize for help with makefile

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

 

 

Guys, I've attached a number of makefile used to compile the project that I trying to get working with c++.  If you can post suggests up, the first one to post the suggestion that works wins a JTAGE-SAM ICE debugger.

 

The lines I've included int Makefiles.RULES are listed below:

 

$(BUILDDIR)/%.d: %.cpp
	@mkdir -p $(dir $@)
	$(ECHO) DEP $<
	$(Q)$(CC) -ansi -lstdc -g -fno-rtti -std=c++14 $(CFLAGS_CPU) $() $(CFLAGS_DEFS) -MM $< -MT $(basename $@).o -o $(basename $@).d

$(BUILDDIR)/%.o: %.cpp
	@mkdir -p $(dir $@)
	$(ECHO) CC $<
	$(Q)$(CC) -ansi -lstdc -g -fno-rtti -std=c++14 $(CFLAGS_CPU) $() $(CFLAGS_DEFS) -c $< -o $@

I've attached the makefiles to this post.  There is only one file in question where I think the problem lies.  Namely in Makefile.RULES.

 

TIPS:  flag -fno-rtti got virtual functions working.

I'm now having problems with exceptions.  

 

The current error is:

 

LINK build/sama5d4-xplained/ddram/getting-started_with_blue.elf
./build/sama5d4-xplained/ddram/examples/getting_started_with_blue/test.o: In function `division(int, int)':
D:\atmel-software-package-2.15\examples\getting_started_with_blue/../../examples/getting_started_with_blue/test.cpp:15: undefined reference to `__cxa_allocate_exception'
D:\atmel-software-package-2.15\examples\getting_started_with_blue/../../examples/getting_started_with_blue/test.cpp:15: undefined reference to `typeinfo for char const*'
D:\atmel-software-package-2.15\examples\getting_started_with_blue/../../examples/getting_started_with_blue/test.cpp:15: undefined reference to `typeinfo for char const*'
D:\atmel-software-package-2.15\examples\getting_started_with_blue/../../examples/getting_started_with_blue/test.cpp:15: undefined reference to `__cxa_throw'
./build/sama5d4-xplained/ddram/examples/getting_started_with_blue/test.o: In function `temp_test':
D:\atmel-software-package-2.15\examples\getting_started_with_blue/../../examples/getting_started_with_blue/test.cpp:35: undefined reference to `__cxa_end_cleanup'
D:\atmel-software-package-2.15\examples\getting_started_with_blue/../../examples/getting_started_with_blue/test.cpp:30: undefined reference to `__cxa_begin_catch'
D:\atmel-software-package-2.15\examples\getting_started_with_blue/../../examples/getting_started_with_blue/test.cpp:30: undefined reference to `__cxa_end_catch'
./build/sama5d4-xplained/ddram/examples/getting_started_with_blue/test.o:(.ARM.extab+0xc): undefined reference to `__gxx_personality_v0'
./build/sama5d4-xplained/ddram/examples/getting_started_with_blue/test.o:(.ARM.extab+0x28): undefined reference to `typeinfo for char*'
collect2.exe: error: ld returned 1 exit status
make: *** [../../scripts/Makefile.rules:118: build/sama5d4-xplained/ddram/getting-started_with_blue.elf] Error 1

The project compiles and LINKS properly but fails when it tries to build the OBJECT *.bin

 

Thanks freaks.

 

 

 

Attachment(s): 

Last Edited: Mon. Feb 3, 2020 - 04:50 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So if the problem is with building the *.bin usingthe *.elf then I think the problem lies here:

$(BUILDDIR)/$(BINNAME).elf: $(OBJS) $(LIBS) $(gnu-debug-lib-y) $(gnu-linker-script-y)
	@cp $(gnu-debug-lib-y) $(BUILDDIR)/target/
	$(ECHO) LINK $@
	$(Q)$(CC) $(LDFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEFS) -T$(gnu-linker-script-y) -Wl,-Map,$(BUILDDIR)/$(BINNAME).map -o $@ $(OBJS) -Wl,--start-group $(LIBS) -Wl,--end-group -Wl,--no-undefined

$(BUILDDIR)/$(BINNAME).symbols: $(BUILDDIR)/$(BINNAME).elf
	$(Q)$(NM) $< >$@

$(BUILDDIR)/$(BINNAME).bin: $(BUILDDIR)/$(BINNAME).elf
	$(ECHO) OBJCOPY $@
	$(Q)$(OBJCOPY) -O binary $< $@

 

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

This looks interesting:

# linker flags
LDFLAGS = --specs=nano.specs -Wl,--cref -Wl,--check-sections -Wl,--gc-sections
LDFLAGS += -Wl,--unresolved-symbols=report-all -Wl,--warn-common
LDFLAGS += -Wl,--sort-section=alignment -lgcc -lc

 

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

I'm guessing there is some exception handling probably in the division(int,int) routine.  I had similar linker errors using virtual functions and the solution was to just create the routines the linker can't find:

 

extern "C" void __cxa_pure_virtual(void);
void __cxa_pure_virtual(void)
{
}
 

The exception handling may not work right, but at least the link errors would go away.

C: i = "told you so";

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

Got the software package, "atmel-software-package-2.15".

I'll post the solution tomorrow when I test it but its looking good guys.

 

Wm.