summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Livingston2019-07-23 12:15:52 -0500
committerFrank Livingston2019-07-23 12:15:52 -0500
commita88c7db9ed2df12a4971aad49215b05192bf8f4e (patch)
treec4c27fb0a00603ced2bf8fc8b31cfb884e784baf
parent659e800c657e4c33d6b3cada37b2bc784079f1e0 (diff)
downloadpruss-lld-a88c7db9ed2df12a4971aad49215b05192bf8f4e.tar.gz
pruss-lld-a88c7db9ed2df12a4971aad49215b05192bf8f4e.tar.xz
pruss-lld-a88c7db9ed2df12a4971aad49215b05192bf8f4e.zip
PRSDK-5738:Add makefile for PWM PRU FW
-rw-r--r--example/apps/icssg_pwm/firmware/src/Makefile131
1 files changed, 131 insertions, 0 deletions
diff --git a/example/apps/icssg_pwm/firmware/src/Makefile b/example/apps/icssg_pwm/firmware/src/Makefile
new file mode 100644
index 0000000..ccfb69f
--- /dev/null
+++ b/example/apps/icssg_pwm/firmware/src/Makefile
@@ -0,0 +1,131 @@
1# PRU_CGT environment variable must point to the TI PRU code gen tools directory. E.g.:
2#(Desktop Linux) export PRU_CGT=/path/to/pru/code/gen/tools/ti-cgt-pru_2.x.y
3#(Windows) set PRU_CGT=C:/path/to/pru/code/gen/tools/ti-cgt-pru_2.x.y
4#(ARM Linux*) export PRU_CGT=/usr/share/ti/cgt-pru
5#
6# *ARM Linux also needs to create a symbolic link to the /usr/bin/ directory in
7# order to use the same Makefile
8#(ARM Linux) ln -s /usr/bin/ /usr/share/ti/cgt-pru/bin
9
10ifndef PRU_CGT
11define ERROR_BODY
12
13*******************************************************************************
14PRU_CGT environment variable is not set. Examples given:
15(Desktop Linux) export PRU_CGT=/path/to/pru/code/gen/tools/ti-cgt-pru_2.1.2
16(Windows) set PRU_CGT=C:/path/to/pru/code/gen/tools/ti-cgt-pru_2.1.2
17(ARM Linux*) export PRU_CGT=/usr/share/ti/cgt-pru
18
19*ARM Linux also needs to create a symbolic link to the /usr/bin/ directory in
20order to use the same Makefile
21(ARM Linux) ln -s /usr/bin/ /usr/share/ti/cgt-pru/bin
22*******************************************************************************
23
24endef
25$(error $(ERROR_BODY))
26endif
27
28MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
29CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MKFILE_PATH))))
30PROJ_NAME=pwm
31
32LINKER_COMMAND_FILE=./AM654x_PRU.cmd
33
34LIBS=
35
36PDK_INSTALL_DIR ?= $(PRSDK_INSTALL_DIR)/pdk_am65xx_1_0_4/packages
37
38INCLUDE=--include_path=$(PDK_INSTALL_DIR)
39STACK_SIZE=0x100
40HEAP_SIZE=0x100
41GEN_DIR=gen
42
43CDEFINES = -DSOC_AM65XX
44
45#Common compiler and linker flags (Defined in 'PRU Optimizing C/C++ Compiler User's Guide)
46#CFLAGS=-v3 -o2 --display_error_number --endian=little --hardware_mac=on --asm_directory=$(GEN_DIR) --obj_directory=$(GEN_DIR) --pp_directory=$(GEN_DIR) -ppd -ppa
47CFLAGS= $(CDEFINES) -v3 -o2 --display_error_number --endian=little --hardware_mac=on --asm_directory=$(GEN_DIR) --obj_directory=$(GEN_DIR) --pp_directory=$(GEN_DIR) -ppd -ppa
48#CFLAGS= $(CDEFINES) -v3 -o2 --opt_for_speed=0 --display_error_number --endian=little --hardware_mac=on --asm_directory=$(GEN_DIR) --obj_directory=$(GEN_DIR) --pp_directory=$(GEN_DIR) -ppd -ppa
49#CFLAGS= $(CDEFINES) -v3 -g --display_error_number --endian=little --hardware_mac=on --asm_directory=$(GEN_DIR) --obj_directory=$(GEN_DIR) --pp_directory=$(GEN_DIR) -ppd -ppa
50
51#Linker flags (Defined in 'PRU Optimizing C/C++ Compiler User's Guide)
52#LFLAGS=--reread_libs --warn_sections --stack_size=$(STACK_SIZE) --heap_size=$(HEAP_SIZE) --entry_point=SDDF_ENTRY
53LFLAGS=--reread_libs --warn_sections --stack_size=$(STACK_SIZE) --heap_size=$(HEAP_SIZE)
54
55TARGET=$(GEN_DIR)/$(PROJ_NAME)_array.h
56PRU_IMAGE_PREFIX=pru_$(PROJ_NAME)_image
57
58EXE=$(GEN_DIR)/$(PROJ_NAME).out
59MAP=$(GEN_DIR)/$(PROJ_NAME).map
60OBJECTS=$(patsubst %.asm,$(GEN_DIR)/%.object,$(wildcard *.asm))
61OBJECTS+=$(patsubst %.c,$(GEN_DIR)/%.object,$(wildcard *.c))
62
63
64all: printStart $(TARGET) printEnd
65
66printStart:
67 @echo ''
68 @echo '************************************************************'
69 @echo 'Building project: $(PROJ_NAME)'
70
71printEnd:
72 @echo ''
73 @echo 'Output files can be found in the "$(GEN_DIR)" directory'
74 @echo ''
75 @echo 'Finished building project: $(PROJ_NAME)'
76 @echo '************************************************************'
77 @echo ''
78
79
80# Invoke the hex format converter to translate the .out file to a C header file
81$(TARGET): $(EXE)
82 @echo ''
83 @echo 'Building image header file: $@'
84 @echo 'Invoking: PRU Hex Format Converter'
85 $(PRU_CGT)/bin/hexpru --array --array:name_prefix=$(PRU_IMAGE_PREFIX) $(EXE)
86 mv $(subst .h,.c,$(PROJ_NAME)_array.h) $(TARGET)
87 @echo 'Finished image header file: $@'
88
89# Invokes the linker (-z flag) to make the .out file
90$(EXE): $(OBJECTS) $(LINKER_COMMAND_FILE)
91 @echo ''
92 @echo 'Building executable: $@'
93 @echo 'Invoking: PRU Linker'
94 $(PRU_CGT)/bin/clpru $(CFLAGS) -z -i$(PRU_CGT)/lib -i$(PRU_CGT)/include $(LFLAGS) -o $(EXE) $(OBJECTS) -m$(MAP) $(LINKER_COMMAND_FILE) --library=libc.a $(LIBS)
95 @echo 'Finished building executable: $@'
96
97# Invokes the compiler on all assembly files in the directory to create the object files
98$(GEN_DIR)/%.object: %.asm
99 @mkdir -p $(GEN_DIR)
100 @echo ''
101 @echo 'Building file: $<'
102 @echo 'Invoking: PRU Compiler'
103 $(PRU_CGT)/bin/clpru --include_path=$(PRU_CGT)/include $(INCLUDE) $(CFLAGS) -fe $@ $<
104
105# Invokes the compiler on all c files in the directory to create the object files
106$(GEN_DIR)/%.object: %.c
107 @mkdir -p $(GEN_DIR)
108 @echo ''
109 @echo 'Building file: $<'
110 @echo 'Invoking: PRU Compiler'
111 $(PRU_CGT)/bin/clpru -k --include_path=$(PRU_CGT)/include $(INCLUDE) $(CFLAGS) -fe $@ $<
112
113.PHONY: all clean
114
115# Remove the $(GEN_DIR) directory
116clean:
117 @echo ''
118 @echo '************************************************************'
119 @echo 'Cleaning project: $(PROJ_NAME)'
120 @echo ''
121 @echo 'Removing files in the "$(GEN_DIR)" directory'
122 @rm -rf $(GEN_DIR)
123 @rm -f $(subst .h,.c,$(PROJ_NAME)_array.h)
124 @echo ''
125 @echo 'Finished cleaning project: $(PROJ_NAME)'
126 @echo '************************************************************'
127 @echo ''
128
129# Includes the dependencies that the compiler creates (-ppd and -ppa flags)
130-include $(OBJECTS:%.object=%.pp)
131