makefile libraries folder

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

Hello guys, I have a make file here from Atmel that when I build it can't find the header files hidden in a tree structure (foldere).  The make file is as follows.

 


# Chip & board used for compilation
# (can be overriden by adding CHIP=chip and BOARD=board to the command-line)
CHIP  = sama5d4x
BOARD = sama5d4x_XULT

# Defines which are the available memory targets for the sama5d4x-XULT board.
MEMORIES = sram ddram

# Trace level used for compilation
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
# TRACE_LEVEL_DEBUG      5
# TRACE_LEVEL_INFO       4
# TRACE_LEVEL_WARNING    3
# TRACE_LEVEL_ERROR      2
# TRACE_LEVEL_FATAL      1
# TRACE_LEVEL_NO_TRACE   0
TRACE_LEVEL = 4

# Optimization level, put in comment for debugging
ifeq ($(MEMORIES), sram)
OPTIMIZATION = -Os
else
OPTIMIZATION =
endif

# Output file basename
OUTPUT = usart_synchronous

# Output directories
BIN = bin
OBJ = obj

#-------------------------------------------------------------------------------
#		Tools
#-------------------------------------------------------------------------------

# Tool suffix when cross-compiling
CROSS_COMPILE = arm-none-eabi-

# Libraries
LIBRARIES = ../libraries
# Chip library directory
CHIP_LIB = $(LIBRARIES)/libchip_sama5d4x
# Board library directory
BOARD_LIB = $(LIBRARIES)/libboard_sama5d4x
# USB library directory
USB_LIB = $(LIBRARIES)/usb

LIBS = -Wl,--start-group -lgcc -lc -lchip_$(CHIP)_gcc_rel -lboard_$(BOARD)_gcc_rel -Wl,--end-group

LIB_PATH = -L$(CHIP_LIB)/lib
LIB_PATH += -L$(BOARD_LIB)/lib
LIB_PATH+=-L=/
LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.4.1

# Compilation tools
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
SIZE = $(CROSS_COMPILE)size
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
GDB = $(CROSS_COMPILE)gdb
NM = $(CROSS_COMPILE)nm

# Flags
INCLUDES  = -I$(CHIP_LIB)
INCLUDES += -I$(BOARD_LIB)
INCLUDES += -I$(USB_LIB)/include
INCLUDES += -I$(LIBRARIES)

CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
CFLAGS += -Waggregate-return -Wstrict-prototypes
CFLAGS += -Wmissing-prototypes -Wmissing-declarations
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
CFLAGS += -Wredundant-decls -Wnested-externs -Winline -Wlong-long
CFLAGS += -Wunreachable-code

# To reduce application size use only integer printf function.
CFLAGS += -Dprintf=iprintf

# -mlong-calls  -Wall
CFLAGS += -mcpu=cortex-a5 -ffunction-sections
CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D__SAMA5D44__ -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL)
ASFLAGS = -mcpu=cortex-a5 -Wall -g $(OPTIMIZATION) $(INCLUDES) -D__SAMA5D44__ -D$(CHIP) -D__ASSEMBLY__
LDFLAGS= -mcpu=cortex-a5 -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=entry -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
LD_OPTIONAL=-Wl,--print-gc-sections -Wl,--stats

#-------------------------------------------------------------------------------
#		Files
#-------------------------------------------------------------------------------

# Directories where source files can be found

VPATH += ../

# Objects built from C source files
C_OBJECTS += main.o

# Append OBJ and BIN directories to output filename
OUTPUT := $(BIN)/$(OUTPUT)

#-------------------------------------------------------------------------------
#		Rules
#-------------------------------------------------------------------------------

all: $(BIN) $(OBJ) $(MEMORIES)

$(BIN) $(OBJ):
	mkdir $@

define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))

$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
	$(CC) $(LIB_PATH) $(LDFLAGS) $(LD_OPTIONAL) -T"$(BOARD_LIB)/resources/gcc/$(CHIP)/$$@.ld" -Wl,-Map,$(OUTPUT)-$$@.map -o $(OUTPUT)-$$@.elf $$^ $(LIBS)
	$(NM) $(OUTPUT)-$$@.elf >$(OUTPUT)-$$@.elf.txt
	$(OBJCOPY) -O binary $(OUTPUT)-$$@.elf $(OUTPUT)-$$@.bin
	$(SIZE) $$^ $(OUTPUT)-$$@.elf

$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
	$(CC) $(CFLAGS) -D$(1) -c -o $$@ $$<

$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
	$(CC) $(ASFLAGS) -D$(1) -c -o $$@ $$<

debug_$(1): $(1)
	$(GDB) -x "$(BOARD_LIB)/resources/gcc/sama5d4x-XULT-$(1).gdb" -ex "reset" -readnow -se $(OUTPUT)-$(1).elf
endef

$(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY))))

clean:
	-cs-rm -fR $(OBJ) $(BIN)

 

 

Last Edited: Mon. Feb 12, 2018 - 05:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not Solved yet, I wasa unable to replicate what I previous done and am back to square one.  Any takers?

Last Edited: Mon. Feb 12, 2018 - 10:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Solved that problem, apparently you need to specify the MPU, lol.  Now I have another problem to solve.  Namely I get errors for declarations such as uint32_t and such.   I'm guessing it is a -flag setting but I have no idea how to fix it.  

 

 

Starting to think I'm all alone on this one lads.  ;)  Think I'll have to google it, lol, really forgot.

 

Last Edited: Tue. Feb 13, 2018 - 12:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Uint32_t etc are in stdint.h

Last Edited: Tue. Feb 13, 2018 - 12:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup, I know they are, I resolved the problem by only building for -gcc-arm-none-eabi