This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TM4C123GH6PM: Trouble compiling the vector table on linux

Part Number: TM4C123GH6PM


Tool/software: Linux

Hello,

I got some trouble compiling my project on linux. I'm working with Imperas Open Virtual Platform (ovpworld.org) and I'm compiling it with a makefile.

Makefile:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

IMPERAS_HOME := $(shell getpath.exe "$(IMPERAS_HOME)")
include $(IMPERAS_HOME)/bin/Makefile.include

ifndef IMPERAS_HOME
  IMPERAS_ERROR := $(error "IMPERAS_HOME not defined")
endif

CROSS=ARM_CORTEX_M4F

-include $(IMPERAS_HOME)/lib/$(IMPERAS_ARCH)/CrossCompiler/$(CROSS).makefile.include
ifeq ($($(CROSS)_CXX),)
    IMPERAS_ERROR := $(error "Please install the toolchain to support $(CROSS) ")
endif

OPTIMISATION?=-O2

SRC = $(sort $(wildcard main.cpp))  $(sort $(wildcard Configuration/Configuration.cpp)) $(sort $(wildcard Segway/Simulation.cpp)) $(sort $(wildcard Segway/Segway.cpp)) $(sort $(wildcard Sensor/ADC.cpp)) $(sort $(wildcard Sensor/ADCSensor.cpp)) $(sort $(wildcard Antrieb/Motor.cpp)) $(sort $(wildcard Sensor/GPIOSensor.cpp)) $(sort $(wildcard Timer/Timer.cpp))  $(sort $(wildcard Antrieb/PWM.cpp)) $(sort $(wildcard tm4c123gh6pm_startup_ccs.c))



EXE = application.ARM_CORTEX_M4F.elf


all: $(EXE)


%.elf: main.o Segway/Segway.o Timer/Timer.o Sensor/ADC.o Sensor/ADCSensor.o Sensor/GPIOSensor.o  Configuration/Configuration.o Antrieb/Motor.o Antrieb/PWM.o tm4c123gh6pm_startup_ccs.o
    $(V) $(IMPERAS_LINKXX)  -o $@ $^ $(IMPERAS_LDFLAGS)


# Compilation of standard benchmarch code
%.o: %.cpp
    $(V)  echo "# Compiling $<"
    $(V)  $(IMPERAS_CXX) -g -c -o $@ $< #$(OPTIMISATION)

%.o: %.c
    $(V)  echo "# Compiling $<"
    $(V)  $(IMPERAS_CC) -g -c -o $@ $< #$(OPTIMISATION)


clean:
    -rm -f *.elf *.o

realclean: clean
    -rm -f *.log

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

So my compiler and linker are from Imperas but I don't think that they are the problem.

I get errors with the assembler code when I compile the interrupt vector table (tm4c123gh6pm_startup_ccs.c).

Does anyone know how to compile it correctly?

Are there any example makefiles for compiling a project on linux?

  • You don't mention what errors you are getting. That's a rather important detail.

    However, there are some obvious issues. Startups are usually compiler specific. Inline assembler is also compiler specific. Using a startup for a TI compiler is unlikely to be successful with yours.

    Robert
  • I'm using this file now: tm4c123gh6pm_startup_ccs_gcc.c
    And I'm getting these errors:
    tm4c123gh6pm_startup_ccs_gcc.o: In function `ResetISR':
    /home/gensheimer/web/tivseg-sim/tivsegsim_template/Application_Segway/tm4c123gh6pm_startup_ccs_gcc.c:297: undefined reference to `__data_load__'
    /home/gensheimer/web/tivseg-sim/tivsegsim_template/Application_Segway/tm4c123gh6pm_startup_ccs_gcc.c:297: undefined reference to `__data_start__'
    /home/gensheimer/web/tivseg-sim/tivsegsim_template/Application_Segway/tm4c123gh6pm_startup_ccs_gcc.c:297: undefined reference to `__data_end__'
    collect2: error: ld returned 1 exit status

    So there should already be a startup file that my compiler is using?
  • Johannes Gensheimer said:
    And I'm getting these errors:
    tm4c123gh6pm_startup_ccs_gcc.o: In function `ResetISR':
    /home/gensheimer/web/tivseg-sim/tivsegsim_template/Application_Segway/tm4c123gh6pm_startup_ccs_gcc.c:297: undefined reference to `__data_load__'
    /home/gensheimer/web/tivseg-sim/tivsegsim_template/Application_Segway/tm4c123gh6pm_startup_ccs_gcc.c:297: undefined reference to `__data_start__'
    /home/gensheimer/web/tivseg-sim/tivsegsim_template/Application_Segway/tm4c123gh6pm_startup_ccs_gcc.c:297: undefined reference to `__data_end__'
    collect2: error: ld returned 1 exit status

    Those are link errors.

    Johannes Gensheimer said:
    So there should already be a startup file that my compiler is using?

    I don't know anything about your compiler. I don't know if it comes with appropriate startups. It looks like it might be GCC but I cannot be certain. There is certainly no TI support for it. Unless the compiler providers provide support you are probably going to have to figure it out yourself. If your compiler is, in fact, GCC then some here have some experience. I've worked with GCC but it's been too long ago for me to remember much.

    Robert

  • Johannes Gensheimer said:
    I got some trouble compiling my project on linux

    As poster Robert noted - you've, "Culled yourself FAR from the herd via that choice."       And - especially when embarking upon a new design - the comforts & guidance of  "herd members" - has great value.

    If you'd "relax your rules" - and employ a Windows Box (however briefly) - I suspect that "much could be learned - and then modeled" - should you desire to continue - "herd-free."