Here are minimalist makefiles for app&lib generation

Here’s an update to my Makefile so it will build the files needed by TMT.
Disclaimers:

  • It should work with Cygwin, but I only tested it with Linux.
  • I don’t really use TMT, so I’m not sure if all the features are work, etc.

Because of this, I’m not going to modify my original post with these changes until I’m more comfortable that it works. YMMV.

Here’s updates to existing rules:

all: $(APP_NAME).wpb.dwl $(APP_NAME).wks $(APP_NAME).zip

clean:
        echo "Cleaning..."
        $(RM) *.axf *.elf *.bin *.wpb *.o *.dwl symbols.txt mapfile opec_header.o genBin.trc backtraces.axf *.wks *.zip

backtraces.axf: $(APP_NAME).elf
       echo "Generating TMT trace file..."
       $(AXFSHRINKER) $< $@ > /dev/null

.PHONY: all clean tmt

And here’s the new rules:

SGT_PATH = $(OAT_ROOT)/IDE/IDE/$(IDE_VERSION)/sgt
NM = $(GCC_ROOT)/bin/arm-elf-nm

# Some tools that my not come with cygwin, so they're in SGT,
#  but for Linux you need to get them from your distribution.
ifeq ($(OS), cygwin)
UNIX2DOS = $(SGT_PATH)/tools/$(OS)/crlf -d
ZIP = $(SGT_PATH)/tools/$(OS)/zip
else
UNIX2DOS = unix2dos
ZIP = zip
endif

symbols.txt: $(APP_NAME).elf
       echo "Generating TMT symbol file..."
       $(NM) $(APP_NAME).elf | awk -f $(SGT_PATH)/cmd/convert_symbol.awk | awk -f $(SGT_PATH)/cmd/sort.awk > $@
       $(UNIX2DOS) $@ 2> /dev/null

$(APP_NAME).wks: $(SGT_PATH)/template/tmt/gprs/default.wks
       echo "Generating TMT workspace..."
       sed -e "s/TMT_PATH_WKSFILE/$(APP_NAME).zip/g; s/WKS_REMTRACE_FILE//g; s/=s$$/=symbols.txt/g" $< > $@

%.zip: backtraces.axf symbols.txt $(SGT_PATH)/template/tmt/gprs/DiagnoseTips.ini $(SGT_PATH)/template/tmt/gprs/MokaWatches.ini $(SGT_PATH)/template/tmt/gprs/RemoteDefs.ini
       $(ZIP) -jq $@ $^

This change will create two useful files: $(APP_NAME).wks and $(APP_NAME).zip. (And two intermediary files, backtraces.axf and symbols.txt, which end up in the zip file.) If you point TMT to these two useful files, it should be all that it needs (TMT knows how to read the zip file, so don’t unzip it).

I suppose I could have posted a patch, or the whole Makefile for that matter, but I’m guessing that anyone who used these Makefiles probably has customized them, so hopefully this will help you update your own Makefile. If you want more the full Makefile, or any other information, just post a reply and I’ll see it.