Initial commit
This commit is contained in:
commit
e57114ac35
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
bin/
|
||||
obj/
|
||||
|
26
.vscode/launch.json
vendored
Normal file
26
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "g++",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/bin/bootloader",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "all",
|
||||
"miDebuggerPath": "/usr/bin/gdb"
|
||||
}
|
||||
]
|
||||
}
|
16
.vscode/settings.json
vendored
Normal file
16
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"array": "cpp",
|
||||
"deque": "cpp",
|
||||
"string": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"vector": "cpp",
|
||||
"iterator": "cpp",
|
||||
"memory_resource": "cpp",
|
||||
"optional": "cpp",
|
||||
"string_view": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"utility": "cpp"
|
||||
}
|
||||
}
|
33
.vscode/tasks.json
vendored
Normal file
33
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"type": "shell",
|
||||
"command": "make",
|
||||
"echoCommand": true,
|
||||
"problemMatcher": {
|
||||
"base": "$gcc",
|
||||
},
|
||||
"presentation": {
|
||||
"focus": true,
|
||||
"reveal": "always",
|
||||
"panel": "shared",
|
||||
"clear": true,
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"label": "all",
|
||||
"args": ["all"],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "clean",
|
||||
"args": ["clean"],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
58
Makefile
Normal file
58
Makefile
Normal file
@ -0,0 +1,58 @@
|
||||
CROSS_COMPILE ?=
|
||||
|
||||
TARGET_FILE ?= bootloader
|
||||
|
||||
CXXFLAGS += -O0
|
||||
CXXFLAGS += -ggdb3
|
||||
CXXFLAGS += -std=c++17
|
||||
CXXFLAGS += -pedantic
|
||||
CXXFLAGS += -pedantic-errors
|
||||
CXXFLAGS += -ffunction-sections -fdata-sections
|
||||
CXXFLAGS += -fno-implicit-inline-templates
|
||||
CXXFLAGS += -Isrc
|
||||
CXXFLAGS += -std=c++20
|
||||
|
||||
|
||||
LD_LIBS := -lc -lgcc -lpthread
|
||||
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
|
||||
OBJ_DIR := obj
|
||||
BIN_DIR := bin
|
||||
SRC_DIR := src
|
||||
|
||||
CC_SRCS = $(wildcard $(SRC_DIR)/*.cc)
|
||||
|
||||
CC_OBJS = $(patsubst %.cc,$(OBJ_DIR)/%.o,$(notdir $(CC_SRCS)))
|
||||
|
||||
OBJS = $(CC_OBJS)
|
||||
TARGET = $(BIN_DIR)/$(TARGET_FILE)
|
||||
|
||||
|
||||
.PHONY: all
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS) Makefile
|
||||
@mkdir -p $(BIN_DIR)
|
||||
$(CXX) $(LD_FLAGS) $(OBJS) $(LD_LIBS) -o $@
|
||||
|
||||
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cc
|
||||
@mkdir -p $(dir $@)
|
||||
@$(call makedep,$<,$@,$(patsubst %.cc,%.d,$(OBJ_DIR)/$(notdir $<)),$(CXXFLAGS))
|
||||
$(CXX) -c $(CXXFLAGS) -o $@ $<
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf \
|
||||
$(OBJS) \
|
||||
$(patsubst %.o,%.d,$(OBJS)) \
|
||||
$(TARGET)
|
||||
|
||||
define makedep
|
||||
$(CXX) -MM -MF $3 -MP -MT $2 $4 $1
|
||||
endef
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
-include $(subst .o,.d,$(OBJS))
|
||||
endif
|
Loading…
Reference in New Issue
Block a user