Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

MSP432P401R: I want to use c++ for my project, but am having troubles with my makefile. (GCC)

$
0
0

Part Number:MSP432P401R

I took the driverlib empty gcc project, and added some simple c++ code and created and destroyed an object in the main function.  I also put

#ifdef _cplusplus
extern "C"
{
#endif

//code

#ifdef _cplusplus
}
#endif

around the startup and system c files.

The code compiles, but does not link. It gives me this warning (repeatedly):

warning: /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libstdc++_nano.a(atexit_arm.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail

and this error:

/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-abort.o): In function `abort':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/stdlib/../../../../../../../newlib/libc/stdlib/abort.c:63: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-exit.o): In function `exit':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/stdlib/../../../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-openr.o): In function `_open_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/openr.c:59: undefined reference to `_open'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-sbrkr.o): In function `_sbrk_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/sbrkr.c:58: undefined reference to `_sbrk'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-signalr.o): In function `_kill_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/signalr.c:61: undefined reference to `_kill'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-signalr.o): In function `_getpid_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/signalr.c:97: undefined reference to `_getpid'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-writer.o): In function `_write_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/writer.c:58: undefined reference to `_write'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-closer.o): In function `_close_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/closer.c:53: undefined reference to `_close'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-fstatr.o): In function `_fstat_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-isattyr.o): In function `_isatty_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/isattyr.c:58: undefined reference to `_isatty'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-lseekr.o): In function `_lseek_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-readr.o): In function `_read_r':
/build/newlib-XAuz1P/newlib-2.4.0.20160527/build_nano/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/readr.c:58: undefined reference to `_read'
collect2: error: ld returned 1 exit status
makefile:45: recipe for target 'cppTest.out' failed
make: *** [cppTest.out] Error 1

This is my current makefile:

SIMPLELINK_MSP432_SDK_INSTALL_DIR ?= /opt/ti/simplelink_msp432p4_sdk_1_60_00_12

XDC_INSTALL_DIR ?= /home/username/ti/xdctools_3_50_04_43_core

FREERTOS_INSTALL_DIR ?= /home/username/FreeRTOSv9.0.0

GCC_ARMCOMPILER ?= /usr/bin/arm-none-eabi-g++
GXX_ARMCOMPILER ?= /usr/bin/arm-none-eabi-g++
GCC_ARMCOMPILER_LIBS ?= /usr/lib/gcc/arm-none-eabi/5.4.1

RM = rm -f
RMDIR = rm -rf
DEVNULL = /dev/null

CC = "$(GCC_ARMCOMPILER)"
LNK = "$(GCC_ARMCOMPILER)"

OBJECTSNAMES = system_msp432p401r.obj startup_msp432p401r_gcc.obj main.obj
OBJECTS = $(addprefix $(OUTPUTDIR), $(OBJECTSNAMES))
NAME = cppTest
OUTPUTDIR ?= ./debug/

CFLAGS = "-I$(SIMPLELINK_MSP432_SDK_INSTALL_DIR)/source" "-I$(SIMPLELINK_MSP432_SDK_INSTALL_DIR)/source/third_party/CMSIS/Include" -D__MSP432P401R__ -DDeviceFamily_MSP432P401x -mcpu=cortex-m4 -march=armv7e-m -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -g -gstrict-dwarf -Wall "-I$(GCC_ARMCOMPILER_LIBS)/include/newlib-nano" "-I$(GCC_ARMCOMPILER_LIBS)/include"

LFLAGS = -Wl,-T,./msp432p401r.lds "-Wl,-Map,$(OUTPUTDIR)/$(NAME).map" "-L$(SIMPLELINK_MSP432_SDK_INSTALL_DIR)/source/ti/display/lib" -l:display.am4fg "-L$(SIMPLELINK_MSP432_SDK_INSTALL_DIR)/source/ti/drivers/lib" -l:drivers_msp432p401x.am4fg "-L$(SIMPLELINK_MSP432_SDK_INSTALL_DIR)/source/third_party/fatfs/lib" -l:fatfs.am4fg "-L$(SIMPLELINK_MSP432_SDK_INSTALL_DIR)/source/ti/devices/msp432p4xx/driverlib/gcc" -l:msp432p4xx_driverlib.a -march=armv7e-m -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -static -Wl,--gc-sections "-L$(GCC_ARMCOMPILER_LIBS)/lib/thumb/v7e-m/fpv4-sp/hard" -lgcc -lc -lm -lnosys --specs=nano.specs

all: outdir $(NAME).out

outdir:
@ mkdir -p $(OUTPUTDIR)

system_msp432p401r.obj: ./system_msp432p401r.c
@ echo Building $@
@ $(CC) $(CFLAGS) $< -c -o $(OUTPUTDIR)/$@

startup_msp432p401r_gcc.obj: ./startup_msp432p401r_gcc.c
@ echo Building $@
@ $(CC) $(CFLAGS) $< -c -o $(OUTPUTDIR)/$@

main.obj: ./main.cc
@ echo Building $@
@ $(GXX_ARMCOMPILER) -std=gnu++14 $(CFLAGS) $< -c -o $(OUTPUTDIR)/$@

$(NAME).out: $(OBJECTSNAMES)
@ echo linking...
@ $(LNK) $(OBJECTS) $(LFLAGS) -o $(OUTPUTDIR)/$(NAME).out

clean:
@ echo Cleaning...
@ $(RM) $(OBJECTS) > $(DEVNULL) 2>&1
@ $(RM) $(OUTPUTDIR)/$(NAME).out > $(DEVNULL) 2>&1
@ $(RM) $(OUTPUTDIR)/$(NAME).map > $(DEVNULL) 2>&1
@ rm -rf $(OUTPUTDIR)

I think it is just a flag that is wrong but I am not sure. 


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>