Commit 72f8e020 authored by Martin Horauer's avatar Martin Horauer
Browse files

modified Makefiles

parent 0c03bd8e
...@@ -71,34 +71,40 @@ GDB_ARGS += -ex "monitor SWO EnableTarget 16000000 0 1 0" ...@@ -71,34 +71,40 @@ GDB_ARGS += -ex "monitor SWO EnableTarget 16000000 0 1 0"
################################################################################ ################################################################################
# BUILD RULES # BUILD RULES
all: $(SRC) all: $(SRC) build
$(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex: $(SRC) ################################################################################
# CREATE A DEBUG VESRION
build: $(SRC)
@echo "----------------------------------------------------------------------" @echo "----------------------------------------------------------------------"
@echo "Building" @echo "Building with DEBUG Symbols"
@echo ""
$(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main --profile mbed-os/tools/profiles/debug.json
@echo ""
################################################################################
# CREATE A RELEASE VESRION
release: $(SRC)
@echo "----------------------------------------------------------------------"
@echo "Build a RELEASE version"
@echo "" @echo ""
$(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main $(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main
@echo "" @echo ""
################################################################################ ################################################################################
# DEBUG RULES # DEBUG RULES
debug: $(SRC) debug: build $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).elf
ifdef SystemRoot ifdef SystemRoot
@call start JLinkGDBServer -Device XMC4500-1024 -if SWD @call start JLinkGDBServer -Device XMC4500-1024 -if SWD
else else
$(TERMINAL) -e "JLinkGDBServer -Device XMC4500-1024 -if SWD" & $(TERMINAL) -e "JLinkGDBServer -Device XMC4500-1024 -if SWD" &
sleep 1 && $(TERMINAL) -e "telnet 127.0.0.1 2333" & sleep 1 && $(TERMINAL) -e "telnet 127.0.0.1 2333" &
endif endif
@echo "----------------------------------------------------------------------"
@echo "Building with DEBUG Symbols"
@echo ""
$(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main --profile mbed-os/tools/profiles/debug.json
@echo ""
$(GDB) -q $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).elf $(GDB_ARGS) $(GDB) -q $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).elf $(GDB_ARGS)
################################################################################ ################################################################################
# FLASH RULES # FLASH RULES
flash: $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex flash: build $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex
echo -e 'speed 4000\nconnect\nh\nloadbin $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex,0xC000000\nr\ng\nq' | JLinkExe -Device XMC4500-1024 -if SWD echo -e 'speed 4000\nconnect\nh\nloadbin $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex,0xC000000\nr\ng\nq' | JLinkExe -Device XMC4500-1024 -if SWD
################################################################################ ################################################################################
......
...@@ -15,7 +15,8 @@ See the License for the specific language governing permissions and ...@@ -15,7 +15,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from os.path import join, abspath, dirname, subprocess import subprocess
from os.path import join, abspath, dirname
#ROOT = abspath(join(dirname(__file__), ".")) #ROOT = abspath(join(dirname(__file__), "."))
......
...@@ -71,34 +71,40 @@ GDB_ARGS += -ex "monitor SWO EnableTarget 16000000 0 1 0" ...@@ -71,34 +71,40 @@ GDB_ARGS += -ex "monitor SWO EnableTarget 16000000 0 1 0"
################################################################################ ################################################################################
# BUILD RULES # BUILD RULES
all: $(SRC) all: $(SRC) build
$(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex: $(SRC) ################################################################################
# CREATE A DEBUG VESRION
build: $(SRC)
@echo "----------------------------------------------------------------------" @echo "----------------------------------------------------------------------"
@echo "Building" @echo "Building with DEBUG Symbols"
@echo ""
$(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main --profile mbed-os/tools/profiles/debug.json
@echo ""
################################################################################
# CREATE A RELEASE VESRION
release: $(SRC)
@echo "----------------------------------------------------------------------"
@echo "Build a RELEASE version"
@echo "" @echo ""
$(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main $(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main
@echo "" @echo ""
################################################################################ ################################################################################
# DEBUG RULES # DEBUG RULES
debug: $(SRC) debug: build $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).elf
ifdef SystemRoot ifdef SystemRoot
@call start JLinkGDBServer -Device XMC4500-1024 -if SWD @call start JLinkGDBServer -Device XMC4500-1024 -if SWD
else else
$(TERMINAL) -e "JLinkGDBServer -Device XMC4500-1024 -if SWD" & $(TERMINAL) -e "JLinkGDBServer -Device XMC4500-1024 -if SWD" &
sleep 1 && $(TERMINAL) -e "telnet 127.0.0.1 2333" & sleep 1 && $(TERMINAL) -e "telnet 127.0.0.1 2333" &
endif endif
@echo "----------------------------------------------------------------------"
@echo "Building with DEBUG Symbols"
@echo ""
$(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main --profile mbed-os/tools/profiles/debug.json
@echo ""
$(GDB) -q $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).elf $(GDB_ARGS) $(GDB) -q $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).elf $(GDB_ARGS)
################################################################################ ################################################################################
# FLASH RULES # FLASH RULES
flash: $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex flash: build $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex
echo -e 'speed 4000\nconnect\nh\nloadbin $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex,0xC000000\nr\ng\nq' | JLinkExe -Device XMC4500-1024 -if SWD echo -e 'speed 4000\nconnect\nh\nloadbin $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex,0xC000000\nr\ng\nq' | JLinkExe -Device XMC4500-1024 -if SWD
################################################################################ ################################################################################
......
...@@ -15,7 +15,8 @@ See the License for the specific language governing permissions and ...@@ -15,7 +15,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from os.path import join, abspath, dirname, subprocess import subprocess
from os.path import join, abspath, dirname
#ROOT = abspath(join(dirname(__file__), ".")) #ROOT = abspath(join(dirname(__file__), "."))
......
...@@ -71,34 +71,40 @@ GDB_ARGS += -ex "monitor SWO EnableTarget 16000000 0 1 0" ...@@ -71,34 +71,40 @@ GDB_ARGS += -ex "monitor SWO EnableTarget 16000000 0 1 0"
################################################################################ ################################################################################
# BUILD RULES # BUILD RULES
all: $(SRC) all: $(SRC) build
$(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex: $(SRC) ################################################################################
# CREATE A DEBUG VESRION
build: $(SRC)
@echo "----------------------------------------------------------------------" @echo "----------------------------------------------------------------------"
@echo "Building" @echo "Building with DEBUG Symbols"
@echo ""
$(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main --profile mbed-os/tools/profiles/debug.json
@echo ""
################################################################################
# CREATE A RELEASE VESRION
release: $(SRC)
@echo "----------------------------------------------------------------------"
@echo "Build a RELEASE version"
@echo "" @echo ""
$(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main $(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main
@echo "" @echo ""
################################################################################ ################################################################################
# DEBUG RULES # DEBUG RULES
debug: $(SRC) debug: build $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).elf
ifdef SystemRoot ifdef SystemRoot
@call start JLinkGDBServer -Device XMC4500-1024 -if SWD @call start JLinkGDBServer -Device XMC4500-1024 -if SWD
else else
$(TERMINAL) -e "JLinkGDBServer -Device XMC4500-1024 -if SWD" & $(TERMINAL) -e "JLinkGDBServer -Device XMC4500-1024 -if SWD" &
sleep 1 && $(TERMINAL) -e "telnet 127.0.0.1 2333" & sleep 1 && $(TERMINAL) -e "telnet 127.0.0.1 2333" &
endif endif
@echo "----------------------------------------------------------------------"
@echo "Building with DEBUG Symbols"
@echo ""
$(MBED) compile -m $(BOARD) -t $(TOOLCHAIN) -N main --profile mbed-os/tools/profiles/debug.json
@echo ""
$(GDB) -q $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).elf $(GDB_ARGS) $(GDB) -q $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).elf $(GDB_ARGS)
################################################################################ ################################################################################
# FLASH RULES # FLASH RULES
flash: $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex flash: build $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex
echo -e 'speed 4000\nconnect\nh\nloadbin $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex,0xC000000\nr\ng\nq' | JLinkExe -Device XMC4500-1024 -if SWD echo -e 'speed 4000\nconnect\nh\nloadbin $(BUILDDIR)/$(BOARD)/$(TOOLCHAIN)/$(TARGET).hex,0xC000000\nr\ng\nq' | JLinkExe -Device XMC4500-1024 -if SWD
################################################################################ ################################################################################
......
...@@ -15,7 +15,8 @@ See the License for the specific language governing permissions and ...@@ -15,7 +15,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from os.path import join, abspath, dirname, subprocess import subprocess
from os.path import join, abspath, dirname
#ROOT = abspath(join(dirname(__file__), ".")) #ROOT = abspath(join(dirname(__file__), "."))
......
...@@ -47,22 +47,29 @@ J-Link> g ...@@ -47,22 +47,29 @@ J-Link> g
## Debugging ## Debugging
To the debug the application 3 steps in sequence are necessary: To the debug the application 4 steps in sequence are necessary.
(1) Start the `JLinkGDEBServer`, e.g.: (1) You will need to create the executable with DEBUg symbols. To that end add
`--profile mbed-os/tools/profiles/debug.json` to the build command.
```
mbed compile -m XMC_4500_RELAX_KIT -t GCC_ARM -N main --profile mbed-os/tools/profiles/debug.json
```
(2) Start the `JLinkGDEBServer`, e.g.:
``` ```
JLinkGDBServer -Device XMC4500-1024 -if SWD JLinkGDBServer -Device XMC4500-1024 -if SWD
``` ```
(2) In order to log messages printed to `stdout` we connect to port 2333 via (3) In order to log messages printed to `stdout` we connect to port 2333 via
telnet. telnet.
``` ```
telnet 127.0.0.1 2333 telnet 127.0.0.1 2333
``` ```
(3) We launch the debugger and control the debug session: (4) We launch the debugger and control the debug session:
``` ```
arm-none-eabi-gdb -q BUILD/XMC_4500_RELAX_KIT/GCC_ARM/main.elf arm-none-eabi-gdb -q BUILD/XMC_4500_RELAX_KIT/GCC_ARM/main.elf
...@@ -81,7 +88,9 @@ Using the prepared `Makefile` one can invoke trhe following actions in a more ...@@ -81,7 +88,9 @@ Using the prepared `Makefile` one can invoke trhe following actions in a more
convenient way: convenient way:
``` ```
make # build the application make # build the application with debug symbols
make debug # -"-
make release # debug a release version of the project
make flash # flash the application make flash # flash the application
make debug # debug the application make debug # debug the application
make erase # erase the program memory make erase # erase the program memory
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment