Skip to content
Open

Dev #12

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions .github/workflows/cmake-single-platform.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ build
mx.scratch
!.settings
.fake

SW/build
SW/.cache
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "Libs/sca"]
path = Libs/sca
url = https://github.com/Paran-oid/sca.git
[submodule "Libs/scal"]
path = Libs/scal
url = https://github.com/Paran-oid/scal.git
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"cmake.cmakePath": "cube-cmake",
"cmake.configureArgs": ["-DCMAKE_COMMAND=cube-cmake"],
"cmake.preferredGenerators": ["Ninja"]
"cmake.preferredGenerators": ["Ninja"],
"stm32cube-ide-clangd.path": "cube",
"stm32cube-ide-clangd.arguments": [
"starm-clangd",
"--query-driver=${env:CUBE_BUNDLE_PATH}/gnu-tools-for-stm32/13.3.1+st.9/bin/arm-none-eabi-gcc",
"--query-driver=${env:CUBE_BUNDLE_PATH}/gnu-tools-for-stm32/13.3.1+st.9/bin/arm-none-eabi-g++"
]
}
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ target_sources(
${CMAKE_SOURCE_DIR}/Core/Src/entry.cpp
${CMAKE_SOURCE_DIR}/Core/Src/utils.cpp
${CMAKE_SOURCE_DIR}/Core/Src/Modules/sd_file.cpp
${CMAKE_SOURCE_DIR}/Core/Src/Modules/filesystem.cpp
${CMAKE_SOURCE_DIR}/Core/Src/App/hal_init.cpp
${CMAKE_SOURCE_DIR}/Core/Src/Modules/sd_filesystem.cpp
${CMAKE_SOURCE_DIR}/Core/Src/App/command_handler.cpp
${CMAKE_SOURCE_DIR}/Core/Src/App/Commands/echo.cpp
${CMAKE_SOURCE_DIR}/Core/Src/App/Commands/rm.cpp
Expand All @@ -73,6 +72,7 @@ target_sources(
${CMAKE_SOURCE_DIR}/Core/Src/App/Commands/dir_cmds.cpp
${CMAKE_SOURCE_DIR}/Core/Src/App/Commands/touch.cpp
${CMAKE_SOURCE_DIR}/Core/Src/App/Commands/mv.cpp
${CMAKE_SOURCE_DIR}/Core/Src/Peripherals/uart_io.cpp
#
# Test-related
#
Expand All @@ -92,6 +92,7 @@ target_include_directories(
${CMAKE_SOURCE_DIR}/Core/Inc
${CMAKE_SOURCE_DIR}/Core/Inc/Modules
${CMAKE_SOURCE_DIR}/Core/Inc/App
${CMAKE_SOURCE_DIR}/Core/Inc/Peripherals
#
# Test-related
#
Expand All @@ -102,10 +103,6 @@ target_compile_definitions(
${CMAKE_PROJECT_NAME} PUBLIC # Add user defined symbols
)

target_compile_definitions(
sca PUBLIC # Add user defined symbols for cpp abstraction library
SCA_GPIO SCA_SPI SCA_PTIMER SCA_UART)

# Add flags
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -Wall -Wall -Wextra
-Werror -Wunused -Os)
Expand All @@ -131,4 +128,4 @@ list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_LIBRARIES ob)
# Add linked libraries
target_link_libraries(
${CMAKE_PROJECT_NAME} stm32cubemx etl::etl # Add user defined libraries
sca printf)
printf)
53 changes: 24 additions & 29 deletions Core/Inc/App/command_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ namespace stm_sd
/***************************************************************
* Forward Declarations
***************************************************************/
enum class status : uint8_t;
enum class Status : uint8_t;

/***************************************************************
* Public Typedefs / Structs
***************************************************************/
enum class command_type : uint8_t
enum class CommandType : uint8_t
{
/*
* HOW TO ADD A FUNCTIONALITY:
Expand All @@ -30,41 +30,36 @@ enum class command_type : uint8_t
* .cpp(implementation of this .hpp)
* - add extern declaration for functions (and define it somewhere)
* - add it to the cmd_table unordered_map
* - pass it in check_command_type function
* - map it in check_command static function with it's string representation
*
*/

cat = 0, // read to file
echo, // write to a file
ls, // list contents of a directory
rm, // delete a file/dir
cp, // move and/or rename file
cd, // enter a directory
clear, // clears terminal
pwd, // prints current working directory
mkdir, // creates a new directory(or more)
rmdir, // deletes a directory(or more)
touch, // create empty file(s)(have to make it update timestamp too at some point)
mv, // move (and/or rename) a file
free_space, // remaining free space of the sd card
total_space, // total space inside the sd card
none, // undefined
total_size // returns number of command types including none
CAT = 0, // read to file
ECHO, // write to a file
LS, // list contents of a directory
RM, // delete a file/dir
CP, // move and/or rename file
CD, // enter a directory
CLEAR, // clears terminal
PWD, // prints current working directory
MKDIR, // creates a new directory(or more)
RMDIR, // deletes a directory(or more)
TOUCH, // create empty file(s)(have to make it update timestamp too at some point)
MV, // move (and/or rename) a file
FREE_SPACE, // remaining free space of the sd card
TOTAL_SPACE, // total space inside the sd card
NONE, // undefined
COUNT // returns number of command types including none
};

using cmd_args = etl::vector<string, CMD_HANDLER_ARGS_CAPACITY>;
using cmd_exec = status (*)(const cmd_args&);
using cmd_exec_map =
etl::unordered_map<command_type, cmd_exec, static_cast<size_t>(command_type::total_size)>;

/***************************************************************
* Exported Objects
***************************************************************/
extern cmd_exec_map cmd_table; // defined in command_handler.cpp
using CmdArgs = etl::vector<string, CMD_HANDLER_ARGS_CAPACITY>;
using CmdExec = Status (*)(const CmdArgs&);
using CmdExecMap =
etl::unordered_map<CommandType, CmdExec, static_cast<size_t>(CommandType::COUNT)>;

/***************************************************************
* Function Declarations
***************************************************************/
void handle_command(const string&);
void handleCommand(const string&);

} // namespace stm_sd
52 changes: 0 additions & 52 deletions Core/Inc/App/hal_init.hpp

This file was deleted.

Loading