Skip to content

Commit

Permalink
Merge pull request #31 from stevenewald/file-refactor
Browse files Browse the repository at this point in the history
Refactor file structure
  • Loading branch information
stevenewald authored Nov 15, 2024
2 parents 88fb3b4 + b0fdd27 commit ff10f0b
Show file tree
Hide file tree
Showing 23 changed files with 28 additions and 20 deletions.
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,21 @@ ETL_INCLUDES += ./external/etl/include/etl/unordered_map.h

# Source and header files
APP_HEADER_PATHS += ./include
APP_SOURCE_PATHS += ./src
APP_SOURCE_PATHS += ./src/user
APP_SOURCES = $(notdir $(wildcard src/*.cpp src/user/*.cpp))
APP_SOURCE_PATHS = ./src
APP_SOURCE_PATHS += ./src/user_programs
APP_SOURCE_PATHS += ./src/drivers
APP_SOURCE_PATHS += ./src/faults
APP_SOURCE_PATHS += ./src/hal
APP_SOURCE_PATHS += ./src/ipc
APP_SOURCE_PATHS += ./src/scheduler
APP_SOURCE_PATHS += ./src/userlib
APP_SOURCE_PATHS += ./src/svc

# I hate make
rwildcard = $(foreach d,$(wildcard $1*), \
$(call rwildcard,$d/,$2)) $(wildcard $1$2)

APP_SOURCES = $(foreach dir,$(APP_SOURCE_PATHS),$(call rwildcard,$(dir)/,*.cpp))

# Path to base of nRF52x-base repo
NRF_BASE_DIR = external/nrf52x-base/
Expand Down
File renamed without changes.
7 changes: 0 additions & 7 deletions include/register_utils.hpp

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion src/button_driver.cpp → src/drivers/button_driver.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "drivers/button_driver.hpp"

#include "drivers/driver_enums.hpp"
#include "pending_process_callbacks.hpp"
#include "scheduler/pending_process_callbacks.hpp"

namespace edge::drivers {

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main.cpp → src/entrypoint.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "drivers/driver_enums.hpp"
#include "fault_handler.hpp"
#include "faults/fault_handler.hpp"
#include "scheduler/scheduler.hpp"
#include "util.hpp"

Expand Down
4 changes: 2 additions & 2 deletions src/fault_handler.cpp → src/faults/fault_handler.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "fault_handler.hpp"
#include "faults/fault_handler.hpp"

#include "nrf52.h"
#include "pending_process_callbacks.hpp"
#include "scheduler/pending_process_callbacks.hpp"
#include "scheduler/scheduler.hpp"

#include <stdio.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "fault_handler.hpp"
#include "faults/fault_handler.hpp"
#include "nrf52833.h"

#include <stdio.h>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/ipc_manager.cpp → src/ipc/ipc_manager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "ipc/ipc_manager.hpp"

#include "pending_process_callbacks.hpp"
#include "scheduler/pending_process_callbacks.hpp"
#include "util.hpp"

#include <stdio.h>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "pending_process_callbacks.hpp"
#include "scheduler/pending_process_callbacks.hpp"

#include <stdio.h>

Expand Down
2 changes: 1 addition & 1 deletion src/scheduler.cpp → src/scheduler/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "drivers/driver_commands.hpp"
#include "nrf52833.h"
#include "pending_process_callbacks.hpp"
#include "scheduler/pending_process_callbacks.hpp"
#include "scheduler/mpu.hpp"
#include "util.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/svc.cpp → src/svc/svc.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "drivers/driver_commands.hpp"
#include "drivers/driver_enums.hpp"
#include "fault_handler.hpp"
#include "faults/fault_handler.hpp"
#include "ipc/ipc_command_types.hpp"
#include "ipc/ipc_manager.hpp"
#include "scheduler/scheduler.hpp"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion src/syscalls.cpp → src/userlib/syscalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

#include "drivers/driver_enums.hpp"
#include "ipc/ipc_command_types.hpp"
#include "register_utils.hpp"
#include "userlib/system_call_type.hpp"
#include "util.hpp"

#include <stdio.h>

#define TRIGGER_SVC(call_type) asm volatile("svc %0" ::"I"(call_type))
#define SET_REGISTER(reg, value) asm volatile("mov " #reg ", %0" ::"r"(value) : #reg)
#define READ_REGISTER(reg, var) asm volatile("mov %0, " #reg : "=r"(var))

#define RETURN_REGISTER(reg) \
int ret; \
READ_REGISTER(reg, ret); \
Expand Down

0 comments on commit ff10f0b

Please sign in to comment.