Skip to content

Commit

Permalink
Simplify templates for having everything on PATH on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
SKyletoft committed Feb 13, 2022
1 parent 4212fb4 commit 55a9a83
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 152 deletions.
5 changes: 1 addition & 4 deletions vsc_gui/templates/basic/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"linux": {
"gdbpath": "gdb-multiarch"
},
"windows": {
"gdbpath": "C:/Program Files (x86)/GMV/Eterm8/arm-none-eabi-gdb"
"gdbpath": "arm-none-eabi-gdb"
},
"name": "Debug - SimServer",
"type": "gdb",
Expand Down
32 changes: 2 additions & 30 deletions vsc_gui/templates/basic/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,7 @@
"kind": "build",
"isDefault": true
},
"linux": {
"command": "make build_linux"
},
"windows": {
"command": "C:/cseapp/CodeLite/mingw32-make build_windows"
}
},
{
"label": "run_hardware",
"type": "shell",
"linux": {
"command": "make run_linux"
},
"windows": {
"command": "C:/cseapp/CodeLite/mingw32-make run_windows"
},
"problemMatcher": [],
"group": "build"
},
{
"label": "query",
"type": "shell",
"linux": {
"command": "make query_linux"
},
"windows": {
"command": "C:/cseapp/CodeLite/mingw32-make query_windows"
},
"problemMatcher": []
},
"command": "make build"
}
]
}
50 changes: 8 additions & 42 deletions vsc_gui/templates/basic/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,25 @@ FILES := \
startup.c \
debug.c

# Copy the value from query_* to here. If there are several, you might have to try them all
WINDOWS_PORT := COM3
LINUX_PORT := /dev/ttyUSB0

# +---------------------------------------------------------------------------+
# | |
# | If you're just using the templates, there's nothing to look at below this |
# | |
# +---------------------------------------------------------------------------+

# Yes, these are hacky and don't allow anything to be cached. I'm not gonna do the research to figure that one out for programs of this scale.
# Yes, this is hacky and doesn't allow anything to be cached. I'm not gonna do the research to figure that one out for programs of this scale.
# Merge requests welcome though

GCCPATH := C:/cseapp/CodeLite/tools/gcc-arm/bin
RUN_W := "./.vscode/hardware-com-windows.exe"
RUN_L := "./.vscode/hardware-com-linux"

build_windows:
build:
-mkdir debug
-cls
$(GCCPATH)/arm-none-eabi-gcc -c $(FILES) -g -O0 -w -mthumb -march=armv6-m -mno-unaligned-access -mfloat-abi=soft -std=gnu17 -I. -I.
$(GCCPATH)/arm-none-eabi-g++ -o debug/MOP -L. *.o -lgcc -lc_nano -Tmd407-ram.x -LC:/cseapp/CodeLite/tools/gcc-arm/lib/gcc/arm-none-eabi/9.2.1/thumb/v6-m/nofp -nostartfiles
$(GCCPATH)/arm-none-eabi-objcopy -S -O srec debug/MOP debug/MOP.s19
$(GCCPATH)/arm-none-eabi-objdump -D -S debug/MOP > debug/MOP.dass
-rm *.o

build_linux:
-mkdir debug
-clear
arm-none-eabi-gcc -c $(FILES) -g -O0 -w -mthumb -march=armv6-m -mno-unaligned-access -mfloat-abi=soft -std=gnu17 -I. -I.
arm-none-eabi-g++ -o debug/MOP -L. *.o -lgcc -lc_nano -Tmd407-ram.x -L/usr/include/newlib/c++/9.2.1/arm-none-eabi/thumb/v6-m/nofp -L/usr/lib/arm-none-eabi/newlib/thumb/v6-m/nofp -L/usr/lib/gcc/arm-none-eabi/9.2.1/thumb/v6-m/nofp -nostartfiles
arm-none-eabi-gcc -c $(FILES) -g -O0 -w -mthumb -march=armv6-m -mno-unaligned-access -mfloat-abi=soft -std=gnu17 -I. -I ./inc
arm-none-eabi-g++ -o debug/MOP -L. *.o -lgcc -lc_nano -Tmd407-ram.x -nostartfiles\
-L'C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v6-m/nofp' \
-L/usr/include/newlib/c++/9.2.1/arm-none-eabi/thumb/v6-m/nofp -L/usr/lib/arm-none-eabi/newlib/thumb/v6-m/nofp \
-L/usr/lib/gcc/arm-none-eabi/9.2.1/thumb/v6-m/nofp
arm-none-eabi-objcopy -S -O srec debug/MOP debug/MOP.s19
arm-none-eabi-objdump -D -S debug/MOP > debug/MOP.dass
-rm *.o

run_windows:
C:/cseapp/CodeLite/mingw32-make build_windows
-cls
$(RUN_W) load -p $(WINDOWS_PORT) -f debug/MOP.s19
$(RUN_W) interactive -p $(WINDOWS_PORT)

run_linux:
make build_linux
-chmod +x $(RUN_L)
-clear
$(RUN_L) load -p $(LINUX_PORT) -f debug/MOP.s19
$(RUN_L) interactive -p $(LINUX_PORT)

query_windows:
-cls
$(RUN_W) query

query_linux:
-chmod +x $(RUN_L)
-clear
$(RUN_L) query
-del *.o
5 changes: 1 addition & 4 deletions vsc_gui/templates/crt/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"linux": {
"gdbpath": "gdb-multiarch"
},
"windows": {
"gdbpath": "C:/Program Files (x86)/GMV/Eterm8/arm-none-eabi-gdb"
"gdbpath": "arm-none-eabi-gdb"
},
"name": "Debug - SimServer",
"type": "gdb",
Expand Down
32 changes: 2 additions & 30 deletions vsc_gui/templates/crt/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,7 @@
"kind": "build",
"isDefault": true
},
"linux": {
"command": "make build_linux"
},
"windows": {
"command": "C:/cseapp/CodeLite/mingw32-make build_windows"
}
},
{
"label": "run_hardware",
"type": "shell",
"linux": {
"command": "make run_linux"
},
"windows": {
"command": "C:/cseapp/CodeLite/mingw32-make run_windows"
},
"problemMatcher": [],
"group": "build"
},
{
"label": "query",
"type": "shell",
"linux": {
"command": "make query_linux"
},
"windows": {
"command": "C:/cseapp/CodeLite/mingw32-make query_windows"
},
"problemMatcher": []
},
"command": "make build"
}
]
}
50 changes: 8 additions & 42 deletions vsc_gui/templates/crt/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,25 @@ FILES := \
startup.c \
debug.c

# Copy the value from query_* to here. If there are several, you might have to try them all
WINDOWS_PORT := COM3
LINUX_PORT := /dev/ttyUSB0

# +---------------------------------------------------------------------------+
# | |
# | If you're just using the templates, there's nothing to look at below this |
# | |
# +---------------------------------------------------------------------------+

# Yes, these are hacky and don't allow anything to be cached. I'm not gonna do the research to figure that one out for programs of this scale.
# Yes, this is hacky and doesn't allow anything to be cached. I'm not gonna do the research to figure that one out for programs of this scale.
# Merge requests welcome though

GCCPATH := C:/cseapp/CodeLite/tools/gcc-arm/bin
RUN_W := "./.vscode/hardware-com-windows.exe"
RUN_L := "./.vscode/hardware-com-linux"

build_windows:
build:
-mkdir debug
-cls
$(GCCPATH)/arm-none-eabi-gcc -c $(FILES) -g -O0 -w -mthumb -march=armv6-m -mno-unaligned-access -mfloat-abi=soft -std=gnu17 -I. -I.
$(GCCPATH)/arm-none-eabi-g++ -o debug/MOP -L. *.o -lgcc -lc_nano -Tmd407-ram.x -LC:/cseapp/CodeLite/tools/gcc-arm/lib/gcc/arm-none-eabi/9.2.1/thumb/v6-m/nofp -nostartfiles
$(GCCPATH)/arm-none-eabi-objcopy -S -O srec debug/MOP debug/MOP.s19
$(GCCPATH)/arm-none-eabi-objdump -D -S debug/MOP > debug/MOP.dass
-rm *.o

build_linux:
-mkdir debug
-clear
arm-none-eabi-gcc -c $(FILES) -g -O0 -w -mthumb -march=armv6-m -mno-unaligned-access -mfloat-abi=soft -std=gnu17 -I. -I.
arm-none-eabi-g++ -o debug/MOP -L. *.o -lgcc -lc_nano -Tmd407-ram.x -L/usr/include/newlib/c++/9.2.1/arm-none-eabi/thumb/v6-m/nofp -L/usr/lib/arm-none-eabi/newlib/thumb/v6-m/nofp -L/usr/lib/gcc/arm-none-eabi/9.2.1/thumb/v6-m/nofp -nostartfiles
arm-none-eabi-gcc -c $(FILES) -g -O0 -w -mthumb -march=armv6-m -mno-unaligned-access -mfloat-abi=soft -std=gnu17 -I. -I ./inc
arm-none-eabi-g++ -o debug/MOP -L. *.o -lgcc -lc_nano -Tmd407-ram.x -nostartfiles\
-L'C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v6-m/nofp' \
-L/usr/include/newlib/c++/9.2.1/arm-none-eabi/thumb/v6-m/nofp -L/usr/lib/arm-none-eabi/newlib/thumb/v6-m/nofp \
-L/usr/lib/gcc/arm-none-eabi/9.2.1/thumb/v6-m/nofp
arm-none-eabi-objcopy -S -O srec debug/MOP debug/MOP.s19
arm-none-eabi-objdump -D -S debug/MOP > debug/MOP.dass
-rm *.o

run_windows:
C:/cseapp/CodeLite/mingw32-make build_windows
-cls
$(RUN_W) load -p $(WINDOWS_PORT) -f debug/MOP.s19
$(RUN_W) interactive -p $(WINDOWS_PORT)

run_linux:
make build_linux
-chmod +x $(RUN_L)
-clear
$(RUN_L) load -p $(LINUX_PORT) -f debug/MOP.s19
$(RUN_L) interactive -p $(LINUX_PORT)

query_windows:
-cls
$(RUN_W) query

query_linux:
-chmod +x $(RUN_L)
-clear
$(RUN_L) query
-del *.o

0 comments on commit 55a9a83

Please sign in to comment.