-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
522030b
commit 2183beb
Showing
10 changed files
with
18,986 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
CC = arm-linux-gnueabihf-gcc | ||
CXX = arm-linux-gnueabihf-g++ | ||
|
||
CPPFLAGS = -I . | ||
CFLAGS =-g -std=gnu99 -O1 -Wall | ||
CXXFLAGS = -g -std=gnu++11 -O1 -Wall | ||
LDFLAGS = -lrt -lpthread | ||
#LDLIBS = -lm | ||
|
||
SOURCES = change_me.c mzapo_phys.c mzapo_parlcd.c | ||
#SOURCES += font_prop14x16.c font_rom8x16.c | ||
TARGET_EXE = change_me | ||
#TARGET_IP ?= 192.168.202.127 | ||
ifeq ($(TARGET_IP),) | ||
ifneq ($(filter debug run,$(MAKECMDGOALS)),) | ||
$(warning The target IP address is not set) | ||
$(warning Run as "TARGET_IP=192.168.202.xxx make run" or modify Makefile) | ||
TARGET_IP ?= 192.168.202.xxx | ||
endif | ||
endif | ||
TARGET_DIR ?= /tmp/$(shell whoami) | ||
TARGET_USER ?= root | ||
# for use from Eduroam network use TARGET_IP=localhost and enable next line | ||
#SSH_OPTIONS=-o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -o "Port=2222" | ||
#SSH_GDB_TUNNEL_REQUIRED=y | ||
#SSH_OPTIONS=-i /opt/zynq/ssh-connect/mzapo-root-key | ||
#SSH_OPTIONS=-o 'ProxyJump=ctu_login@postel.felk.cvut.cz' | ||
|
||
OBJECTS += $(filter %.o,$(SOURCES:%.c=%.o)) | ||
OBJECTS += $(filter %.o,$(SOURCES:%.cpp=%.o)) | ||
|
||
#$(warning OBJECTS=$(OBJECTS)) | ||
|
||
ifeq ($(filter %.cpp,$(SOURCES)),) | ||
LINKER = $(CC) | ||
LDFLAGS += $(CFLAGS) $(CPPFLAGS) | ||
else | ||
LINKER = $(CXX) | ||
LDFLAGS += $(CXXFLAGS) $(CPPFLAGS) | ||
endif | ||
|
||
%.o:%.c | ||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | ||
|
||
%.o:%.cpp | ||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $< | ||
|
||
all: $(TARGET_EXE) | ||
|
||
$(TARGET_EXE): $(OBJECTS) | ||
$(LINKER) $(LDFLAGS) -L. $^ -o $@ $(LDLIBS) | ||
|
||
.PHONY : dep all run copy-executable debug | ||
|
||
dep: depend | ||
|
||
depend: $(SOURCES) *.h | ||
echo '# autogenerated dependencies' > depend | ||
ifneq ($(filter %.c,$(SOURCES)),) | ||
$(CC) $(CFLAGS) $(CPPFLAGS) -w -E -M $(filter %.c,$(SOURCES)) \ | ||
>> depend | ||
endif | ||
ifneq ($(filter %.cpp,$(SOURCES)),) | ||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -w -E -M $(filter %.cpp,$(SOURCES)) \ | ||
>> depend | ||
endif | ||
|
||
clean: | ||
rm -f *.o *.a $(OBJECTS) $(TARGET_EXE) connect.gdb depend | ||
|
||
copy-executable: $(TARGET_EXE) | ||
ssh $(SSH_OPTIONS) -t $(TARGET_USER)@$(TARGET_IP) killall gdbserver 1>/dev/null 2>/dev/null || true | ||
ssh $(SSH_OPTIONS) $(TARGET_USER)@$(TARGET_IP) mkdir -p $(TARGET_DIR) | ||
scp $(SSH_OPTIONS) $(TARGET_EXE) $(TARGET_USER)@$(TARGET_IP):$(TARGET_DIR)/$(TARGET_EXE) | ||
|
||
run: copy-executable $(TARGET_EXE) | ||
ssh $(SSH_OPTIONS) -t $(TARGET_USER)@$(TARGET_IP) $(TARGET_DIR)/$(TARGET_EXE) | ||
|
||
ifneq ($(filter -o ProxyJump=,$(SSH_OPTIONS))$(SSH_GDB_TUNNEL_REQUIRED),) | ||
SSH_GDB_PORT_FORWARD=-L 12345:127.0.0.1:12345 | ||
TARGET_GDB_PORT=127.0.0.1:12345 | ||
else | ||
TARGET_GDB_PORT=$(TARGET_IP):12345 | ||
endif | ||
|
||
debug: copy-executable $(TARGET_EXE) | ||
xterm -e ssh $(SSH_OPTIONS) $(SSH_GDB_PORT_FORWARD) -t $(TARGET_USER)@$(TARGET_IP) gdbserver :12345 $(TARGET_DIR)/$(TARGET_EXE) & | ||
sleep 2 | ||
echo >connect.gdb "target extended-remote $(TARGET_GDB_PORT)" | ||
echo >>connect.gdb "b main" | ||
echo >>connect.gdb "c" | ||
ddd --debugger gdb-multiarch -x connect.gdb $(TARGET_EXE) | ||
|
||
-include depend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************* | ||
Project main function template for MicroZed based MZ_APO board | ||
designed by Petr Porazil at PiKRON | ||
change_me.c - main file | ||
include your name there and license for distribution. | ||
Remove next text: This line should not appear in submitted | ||
work and project name should be change to match real application. | ||
If this text is there I want 10 points subtracted from final | ||
evaluation. | ||
*******************************************************************/ | ||
|
||
#define _POSIX_C_SOURCE 200112L | ||
|
||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include <time.h> | ||
#include <unistd.h> | ||
|
||
#include "mzapo_parlcd.h" | ||
#include "mzapo_phys.h" | ||
#include "mzapo_regs.h" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
printf("Hello world\n"); | ||
|
||
sleep(4); | ||
|
||
printf("Goodbye world\n"); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.