mirror of
https://github.com/RobotechLille/cdf2018-principal
synced 2024-11-14 04:16:05 +01:00
GDB
This commit is contained in:
parent
0eb11d9fc6
commit
13d188e6f4
|
@ -7,7 +7,7 @@ LIBS=
|
|||
## Drapeaux pour le linker
|
||||
LDFLAGS_CUSTOM += -lpthread -lwiringPi
|
||||
## Drapeaux pour le compilateur
|
||||
CFLAGS=
|
||||
CFLAGS_CUSTOM += -g
|
||||
## Générateurs de drapeaux pour les bibliothèques
|
||||
PKG_CONFIG=pkg-config
|
||||
|
||||
|
@ -25,11 +25,9 @@ CFLAGS += -Wall -Wextra -pedantic -g -DDEBUG
|
|||
|
||||
# Génération des fichiers éxecutables
|
||||
bin/%: obj/%.o
|
||||
$(CXX) $(LDFLAGS_CUSTOM) $^ -o $@
|
||||
# On enlève les symboles inutiles pour gagner en temps de chargement de l'éxecutable
|
||||
ifeq ($(DEBUG),no)
|
||||
strip $@
|
||||
endif
|
||||
$(CC) $(LDFLAGS) $(LDFLAGS_CUSTOM) $^ -o $@
|
||||
$(OBJCOPY) --only-keep-debug $@ $@.debug
|
||||
$(STRIP) --strip-debug --strip-unneeded $@
|
||||
|
||||
# RÈGLES DE COMPILATION
|
||||
|
||||
|
@ -37,18 +35,21 @@ endif
|
|||
default: bin/testpin bin/premier bin/local bin/testI2c
|
||||
|
||||
# Binaires (dont il faut spécifier les objets explicitement)
|
||||
bin/premier: obj/CF.o obj/movement.o obj/debug.o obj/position.o
|
||||
OBJS=CF movement debug position ihm lcd i2c points parcours
|
||||
bin/premier: $(addprefix obj/,$(addsuffix .o,$(OBJS)))
|
||||
bin/testPin: obj/testPin.o
|
||||
# TODO ↑ Enlever (remplacé par IHM)
|
||||
bin/testI2c: obj/testI2c.o obj/i2c.o obj/srf08.o obj/lcd.o
|
||||
|
||||
# Programme de test sur PC, n'embarquant pas wiringPi
|
||||
bin/local: obj/local.o obj/debug.o
|
||||
$(CC) -lpthread $^ -o $@
|
||||
$(CC) $(CFLAGS) $(CFLAGS_CUSTOM) -lpthread $^ -o $@
|
||||
|
||||
# Génération des fichiers objets
|
||||
obj/%.o: src/%.c src/%.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(CFLAGS) $(CFLAGS_CUSTOM) -c $< -o $@
|
||||
obj/%.o: src/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(CFLAGS) $(CFLAGS_CUSTOM) -c $< -o $@
|
||||
|
||||
# OUTILS DE DÉVELOPPEMENT
|
||||
|
||||
|
|
1
raspberrypi/.gitignore
vendored
1
raspberrypi/.gitignore
vendored
|
@ -3,3 +3,4 @@ output
|
|||
principalconf.sh
|
||||
sshconf
|
||||
sshkey*
|
||||
gdbcommands
|
||||
|
|
|
@ -9,6 +9,12 @@ SDCARD=/dev/mmcblk0
|
|||
CON_MODE=wifi
|
||||
ETH_IFACE=enp3s0
|
||||
|
||||
# Debug
|
||||
TARGET_DIR=$(PWD)/buildroot/output/target/
|
||||
EXECDIR=/opt/chef/
|
||||
EXECPATH=bin/premier
|
||||
GDBPORT=2346
|
||||
|
||||
# SYSTÈME D'EXPLOITATION
|
||||
|
||||
# Configuration
|
||||
|
@ -109,3 +115,24 @@ upgrade-chef: chef
|
|||
ssh -F sshconf principal true
|
||||
rsync --rsh 'ssh -F sshconf' --archive --chown root:root buildroot/output/target/opt/chef principal:/opt/
|
||||
|
||||
run:
|
||||
ssh -F sshconf principal true
|
||||
ssh -F sshconf principal /etc/init.d/S50chef restart
|
||||
|
||||
gdbcommands:
|
||||
echo "set sysroot $(TARGET_DIR)" > "$@"
|
||||
echo "exec-file $(TARGET_DIR)$(EXECDIR)$(EXECPATH)" >> "$@"
|
||||
echo "symbol-file $(TARGET_DIR)$(EXECDIR)$(EXECPATH).debug" >> "$@"
|
||||
echo "target remote :$(GDBPORT)" >> "$@"
|
||||
echo "continue" >> "$@"
|
||||
|
||||
debug: gdbcommands
|
||||
ssh -F sshconf principal true
|
||||
ssh -F sshconf principal /etc/init.d/S50chef stop
|
||||
ssh -F sshconf principal killall gdbserver; true
|
||||
ssh -F sshconf principal -L $(GDBPORT):127.0.0.1:$(GDBPORT) 'cd $(EXECDIR); gdbserver 127.0.0.1:$(GDBPORT) $(EXECPATH)' & sleep 1
|
||||
buildroot/output/host/usr/bin/arm-linux-gnueabihf-gdb -x gdbcommands; \
|
||||
ssh -F sshconf principal /opt/chef/lcdOff.sh; \
|
||||
ssh -F sshconf principal killall gdbserver; true
|
||||
|
||||
.PHONY: gdbcommands
|
||||
|
|
|
@ -77,6 +77,9 @@ BR2_PACKAGE_PPPD=y
|
|||
# Pour faire plaisir à Geoffrey
|
||||
BR2_PACKAGE_HTOP=y
|
||||
|
||||
# Pour debugguer
|
||||
BR2_PACKAGE_GDB=y
|
||||
|
||||
# Pour uploader sur le Arduino
|
||||
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
|
||||
BR2_SHARED_LIBS=y
|
||||
|
|
Loading…
Reference in a new issue