Hi,
for those of you who prefer old-fashioned, basic, easily customizable GNU makefiles, here are some minimalist versions to hack to your heart’s content. They will respectively generate an Open AT application, and an Open AT library. Notice that these versions:
- require some variable settings and filenames listing in the makefile
- use the ADS compiler, not GCC [Update: Matt Otto fixed this, see post below] nor RTE yet
- still require an installation of the SDK, as they run some executables provided by it
- are designed to run at the root of your project application/library
- are not recursive: if one project depends on another lib, and you change something in that lib, it’s up to you to recompile the lib before the project depending on it. Again, the goal is to K.I.S.S., so if you want somthing fancier, DIY!
If you feel like improving/completing these, here’s the dirty little secret: in $(OATROOT)/IDE/IDE/$(IDEVERSION)/make/gen.mak, comment the first uncommented line “.SILENT:”. This way you’ll have every single executed command printed on the output, together with the usual logs. Save these, and check what your specific configuration does. Your contributions are obviously welcome on this thread.
Now the application generation makefile:
# Name of the resulting application, without extension
APP_NAME = luasample
# Basic paths and version numbers;
# can be retrieved from the "Open AT IDE Settings" GUI application
OAT_ROOT = c:/OpenAT-oasis-201
OS_VERSION = 6.01.05
IDE_VERSION = 1.06.04
WIP_VERSION = 4.00.2050
OAT_API_VERSION = 602
# Paths to Open AT header files
INCLUDES = \
-I$(OAT_ROOT)/OS/$(OS_VERSION)/ADL/itf \
-I$(OAT_ROOT)/OS/$(OS_VERSION)/ADL/basic \
-I$(OAT_ROOT)/Plug-ins/WIP/$(WIP_VERSION)/WIP/itf \
# Paths to local header files
INCLUDES += \
-Iitf \
-Iinc \
# Paths to other user-defined library headers
INCLUDES += \
-Id:/fft/src/git/oatlua/itf \
# All source files of this project (excluding libraries)
SRC = appli.c
# Paths where source files might be found (relative or absolute, space-separated)
VPATH = src
# C compiler settings
CC = M:/ads/ADS_V12/Bin/tcc
CFLAGS = -D__OAT_API_VERSION__=$(OAT_API_VERSION) -D__DEBUG_APP__ -apcs /noswstackcheck/interwork -Ono_data_reorder -Wbnsu+adefgiklmopvx -Ecz -O2 -cpu ARM946E-S -g
# C linker settings for application generation
# LINK_RWBASE = 0x180C0000 # For 8Mb RAM modules
LINK_RWBASE = 0x18100000 # For 16Mb RAM modules
LINK_FLAGS = -ro 0x00220000 -rw-base $(LINK_RWBASE) -first mos_header.o\(OAT_HEADER_AREA\) -elf -info sizes -info unused -xref -verbose -noremove
# Various tools, either from Open AT or from ADS
FROMELF = M:/ads/ADS_V12/Bin/fromelf
ADDCHECK = $(OAT_ROOT)/IDE/IDE/$(IDE_VERSION)/sgt/tools/cygwin/addchk.exe
AXFSHRINKER = $(OAT_ROOT)/IDE/IDE/$(IDE_VERSION)/sgt/tools/cygwin/AXFshrinker.exe
WZPACKER = $(OAT_ROOT)/IDE/IDE/$(IDE_VERSION)/sgt/tools/cygwin/wzpacker.exe
GENDWL = $(OAT_ROOT)/IDE/IDE/$(IDE_VERSION)/sgt/tools/cygwin/python/python.exe -E $(OAT_ROOT)/IDE/IDE/$(IDE_VERSION)/sgt/tools/scripts/gendwl.py
# Library binaries to link to the project
LIBRARIES = $(OAT_ROOT)/OS/$(OS_VERSION)/ADL/ads_wmadl_$(OS_VERSION).0.0.lib
LIBRARIES += $(OAT_ROOT)/Plug-ins/WIP/$(WIP_VERSION)/WIP/ads_wmwip_$(WIP_VERSION).lib
LIBRARIES += d:/fft/src/git/oatlua/ads_oatlua.lib
# By default, build the compressed binary
all: $(APP_NAME).wpb.dwl
clean:
$(RM) *.axf *.bin *.wpb *.o *.dwl s m
# Generation of TMT traces file. Not functional yet.
backtraces.axf: $(APP_NAME).axf
$(AXFSHRINKER) $< $@
# Usual C compilation rule
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
# Link of object files and libraries
$(APP_NAME).axf: $(SRC:.c=.o)
$(LINK) $(LINK_FLAGS) $+ $(LIBRARIES) -o $@ -list m -symdefs s -errors $(APP_NAME).link.log
# Convert linked binary into a signed .bin file
%.bin: %.axf
$(FROMELF) $< -bin -output $@
$(ADDCHECK) $@
# Compressed version of the .bin file
%.wpb: %.bin
$(WZPACKER) -b 0x00220000 $<
# Non-compressed, X-MODEM downloadable of the .bin file
%.dwl: %.bin
$(GENDWL) --bin $< --dwl $@ --addr 0x00220000 --header BINARY
# X-MODEM downloadable version of the compressed binary file
%.wpb.dwl: %.wpb
$(GENDWL) --bin $< --dwl $@ --addr 0x00220000 --header COMPBIN
.PHONY: all clean
And the library generation Makefile:
# Name of the library, without extension
LIB_NAME = oatlua
# Basic paths and version numbers;
# can be retrieved from the "Open AT IDE Settings" GUI application
OAT_ROOT = c:/OpenAT-oasis-201
OS_VERSION = 6.01.05
IDE_VERSION = 1.06.04
WIP_VERSION = 4.00.2050
OAT_API_VERSION = 602
# All source files of this library
SRC = \
lapi.c \
lauxlib.c \
lbaselib.c \
lcode.c \
ldblib.c \
ldebug.c \
ldo.c \
ldump.c \
lfunc.c \
lgc.c \
linit.c \
llex.c \
lmem.c \
loadlib.c \
lobject.c \
lopcodes.c \
lparser.c \
lstate.c \
lstring.c \
lstrlib.c \
ltable.c \
ltablib.c \
ltm.c \
lundump.c \
lvm.c \
lzio.c \
luaw_at.c \
luaw_b64md5.c \
luaw_bearers.c \
luaw_channel.c \
luaw_core.c \
luaw_flash.c \
luaw_int.c \
luaw_main.c \
luaw_mem.c \
luaw_options.c \
luaw_sms.c \
luaw_sync.c \
luaw_tcp.c \
luaw_timer.c
# Paths where source files might be found (relative or absolute, space-separated)
VPATH = src_porting src_orig
# Paths to Open AT header files
INCLUDES = \
-I$(OAT_ROOT)/OS/$(OS_VERSION)/ADL/itf \
-I$(OAT_ROOT)/OS/$(OS_VERSION)/ADL/basic \
-I$(OAT_ROOT)/Plug-ins/WIP/$(WIP_VERSION)/WIP/itf \
# Paths to local header files
INCLUDES += \
-Iitf \
-Iinc \
# C compiler settings
CC = M:/ads/ADS_V12/Bin/tcc
CFLAGS = -D__OAT_API_VERSION__=$(OAT_API_VERSION) -D__DEBUG_APP__ -apcs /noswstackcheck/interwork -Ono_data_reorder -Wbnsu+adefgiklmopvx -Ecz -O2 -cpu ARM946E-S -g
# Linker settings for library generation
AR = M:/ads/ADS_V12/Bin/armar
all: ads_$(LIB_NAME).lib
clean:
$(RM) *.o *.lib
# Generation of the library
ads_$(LIB_NAME).lib: $(SRC:.c=.o)
$(AR) -create $@ $+
# Usual C compilation rule
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
.PHONY: all clean